swscale: treat XYZ formats as colorspace-less in color (de|en)coding

XYZ formats carry no YCbCr matrix, so decode and encode them like RGB
instead of falling into the unspecified colorspace path, which applied
a BT.470BG matrix and marked the graph as incomplete.

Note that the new code does not yet convert between XYZ and RGB.
This commit is contained in:
Lynne committed 2026-10-06 15:10:41 +09:00
1 parent 2983c23762
commit 2ed5830108
2 files changed
+7 -4

No files matched your search

+6 -3
View File
@@ -1522,8 +1522,10 @@ int ff_sws_decode_colors(SwsContext *ctx, SwsPixelType type,
.lin = fmt_decode_range(fmt, incomplete),
}));
/* Final step, decode colorspace */
switch (fmt->csp) {
/* Final step, decode colorspace. XYZ formats carry no colorspace
* matrix; their transfer/primaries are handled by the color mapping
* layer, so treat them like RGB here. */
switch (fmt->desc->flags & AV_PIX_FMT_FLAG_XYZ ? AVCOL_SPC_RGB : fmt->csp) {
case AVCOL_SPC_RGB:
return 0;
case AVCOL_SPC_UNSPECIFIED:
@@ -1595,7 +1597,8 @@ int ff_sws_encode_colors(SwsContext *ctx, SwsPixelType type,
if (!pixel_type)
return AVERROR(ENOTSUP);
switch (dst->csp) {
/* See ff_sws_decode_colors(): XYZ formats have no colorspace matrix */
switch (dst->desc->flags & AV_PIX_FMT_FLAG_XYZ ? AVCOL_SPC_RGB : dst->csp) {
case AVCOL_SPC_RGB:
break;
case AVCOL_SPC_UNSPECIFIED:
+1 -1
View File
@@ -1 +1 @@
b4ea23c724f642b3e43d329ed4981d38
1f03295f230be02367e812f3670230cc