diff mbox series

[FFmpeg-devel,4/4] avcodec/libx265: do not arbitrarily limit color values

Message ID 20240329003343.1099137-4-jeebjp@gmail.com
State Accepted
Commit 16128f3c5595012719db7ae7851964d5a961c160
Headers show
Series [FFmpeg-devel,1/4] avutil/pix{desc, fmt}: add new matrix coefficients from H.273 v3 | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Jan Ekström March 29, 2024, 12:33 a.m. UTC
Newer specifications such as H.273 have, and probably will further
in the future add new values to these, so - instead of trying to update
these limits - we should simply check if the values are not set to the
value of "unspecified".

This should allow newer avutil values such as IPT-C2 or YCgCo-R
variants be passed to x265 itself, which apparently does its own
validation further down the line.
---
 libavcodec/libx265.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index d3e74eaacf..43ab14bfee 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -315,12 +315,9 @@  FF_ENABLE_DEPRECATION_WARNINGS
             avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
             avctx->pix_fmt == AV_PIX_FMT_YUVJ444P;
 
-    if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 &&
-         avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) ||
-        (avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 &&
-         avctx->color_trc != AVCOL_TRC_UNSPECIFIED) ||
-        (avctx->colorspace <= AVCOL_SPC_ICTCP &&
-         avctx->colorspace != AVCOL_SPC_UNSPECIFIED)) {
+    if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
+        avctx->color_trc       != AVCOL_TRC_UNSPECIFIED ||
+        avctx->colorspace      != AVCOL_SPC_UNSPECIFIED) {
 
         ctx->params->vui.bEnableColorDescriptionPresentFlag = 1;