refactor: request limited range for connection

This commit is contained in:
Acaki
2025-12-02 15:04:15 +08:00
parent 46b5d9522d
commit 85611bcab5
2 changed files with 5 additions and 19 deletions
-1
View File
@@ -591,7 +591,6 @@ void ClSetControllerLED(uint16_t controllerNumber, uint8_t r, uint8_t g, uint8_t
_callbacks = callbacks;
LiInitializeStreamConfiguration(&_streamConfig);
_streamConfig.colorRange = 1; // Full range
_streamConfig.width = config.width;
_streamConfig.height = config.height;
_streamConfig.fps = config.frameRate;
+5 -18
View File
@@ -221,19 +221,10 @@ extern int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size,
} mutableCopy];
#else
NSNumber *pixelFormat = nil;
// Uses limited range for AV1 as full range doesn't work well on all devices
if (self->_videoFormat & VIDEO_FORMAT_MASK_AV1) {
if (self->_videoFormat & VIDEO_FORMAT_MASK_YUV444) {
pixelFormat = @(kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange);
} else {
pixelFormat = @(kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange);
}
Log(LOG_I, @"Using VideoRange pixel format for AV1 (workaround for M3 decoder bug)");
} else if (self->_videoFormat & VIDEO_FORMAT_MASK_YUV444) {
pixelFormat = @(kCVPixelFormatType_444YpCbCr10BiPlanarFullRange);
if (self->_videoFormat & VIDEO_FORMAT_MASK_YUV444) {
pixelFormat = @(kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange);
} else {
pixelFormat = @(kCVPixelFormatType_420YpCbCr10BiPlanarFullRange);
pixelFormat = @(kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange);
}
NSMutableDictionary *destinationPixelBufferAttributes = [@{
(id)kCVPixelBufferPixelFormatTypeKey : pixelFormat
@@ -636,12 +627,8 @@ int DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit);
break;
}
Log(LOG_I, @"AV1 video range reported by stream: %@", seqHeader->color_config.color_range == 1 ? @"full" : @"limited");
// Forces limited range for AV1 as full range doesn't work well on all devices
SET_EXTENSION(kCMFormatDescriptionExtension_FullRangeVideo, @NO);
Log(LOG_I, @"AV1 using limited range end-to-end");
Log(LOG_I, @"AV1 video range: %@", seqHeader->color_config.color_range == 1 ? @"full" : @"limited");
SET_EXTENSION(kCMFormatDescriptionExtension_FullRangeVideo, @(seqHeader->color_config.color_range == 1));
// Progressive content
SET_EXTENSION(kCMFormatDescriptionExtension_FieldCount, @(1));