PR #24841 opened by 9c5s URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24841 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24841.patch
# Summary of changes The NotchLC decoder tags its YCbCr output as `AVCOL_SPC_RGB`. Because of that, `zscale` fails with "YUV color family cannot have RGB matrix coefficients", `libplacebo` converts with BT.709, and players that follow the tag display the planes as GBR. The planes hold BT.601 full range YCbCr (see #24840 for the measurement and the sample), so this tags the output as `AVCOL_SPC_BT470BG`. The default swscale conversion gives the same output as before. There is no FATE test for NotchLC in master. The framemd5 tests proposed in #23791 hash the decoded `yuva444p12le` planes, so they don't depend on the tag; their five samples give the same output with and without this patch. If a test of the tag is wanted, a few frames of the sample in #24840 can be added to fate-suite. Tested on master (`9d3f0f2c58`, MSYS2 UCRT64) with and without this patch: ffprobe reports `bt470bg` instead of `gbr`, zscale no longer fails, libplacebo converts with BT.601 instead of BT.709, the default swscale output (`format=rgb24`) is bit-identical, and `make fate` gives the same results (the same 15 tests fail in this Windows environment either way). Fixes #24840 >From adc323187dda8cec5d9b778c83b1a4943c7afaf2 Mon Sep 17 00:00:00 2001 From: 9c5s <[email protected]> Date: Thu, 1 Oct 2026 20:38:25 +0900 Subject: [PATCH] avcodec/notchlc: set BT.601 colorspace instead of RGB The decoder outputs YCbCr in yuva444p12, but tags the frames as AVCOL_SPC_RGB, which means that the planes hold G, B and R. Users of the tag fail or pick a wrong matrix: zscale errors out with "YUV color family cannot have RGB matrix coefficients", libplacebo falls back to BT.709, and players that follow the tag display the planes as GBR. A least-squares fit of the NotchLC Big Buck Bunny sample against the same frames of the H.264 version matches the BT.601 coefficients for R and G (1.402, 0.344, 0.714) and not the BT.709 ones (1.575, 0.187, 0.468). Tag the output as BT.470BG. Fixes: #24840 --- libavcodec/notchlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c index 396089254e..8ee9f535a5 100644 --- a/libavcodec/notchlc.c +++ b/libavcodec/notchlc.c @@ -65,7 +65,7 @@ static av_cold int decode_init(AVCodecContext *avctx) { avctx->pix_fmt = AV_PIX_FMT_YUVA444P12; avctx->color_range = AVCOL_RANGE_JPEG; - avctx->colorspace = AVCOL_SPC_RGB; + avctx->colorspace = AVCOL_SPC_BT470BG; avctx->color_primaries = AVCOL_PRI_BT709; avctx->color_trc = AVCOL_TRC_IEC61966_2_1; -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
