This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit fb07d7c6f1d8376484056cdfe16e1428b9cf082c
Author:     Romain Beauxis <[email protected]>
AuthorDate: Fri Oct 16 19:01:08 2026 +0200
Commit:     Romain Beauxis <[email protected]>
CommitDate: Sat Nov 7 15:16:11 2026 +0000

    avcodec/mpeg4videodec: report reserved colour tags as unspecified
    
    The Visual Object colour description is copied into the codec context as it
    is, so a reserved value reaches the decoded frames.
    
    The swscale frame checks reject reserved values, so scaling such a stream 
fails
    with ENOTSUP. h2645_vui.c reports them as unspecified since c80002aa81
    ("avcodec/h2645_vui: Ensure color primaries/trc/space isn't reserved 
value"),
    do the same here. Valid values are untouched.
---
 libavcodec/mpeg4videodec.c               | 14 ++++++++++++++
 tests/ref/fate/mpeg4-reserved-color-tags |  6 +++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index e080c83f9d..03b145379d 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -26,6 +26,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/internal.h"
+#include "libavutil/pixdesc.h"
 #include "libavutil/opt.h"
 #include "libavutil/thread.h"
 #include "codec_internal.h"
@@ -2462,6 +2463,19 @@ static int mpeg4_decode_visual_object(MpegEncContext *s, 
GetBitContext *gb)
                 s->avctx->color_primaries = get_bits(gb, 8);
                 s->avctx->color_trc       = get_bits(gb, 8);
                 s->avctx->colorspace      = get_bits(gb, 8);
+
+                // Reserved and unassigned values carry no colour information
+                if (s->avctx->color_primaries == AVCOL_PRI_RESERVED0 ||
+                    s->avctx->color_primaries == AVCOL_PRI_RESERVED  ||
+                    !av_color_primaries_name(s->avctx->color_primaries))
+                    s->avctx->color_primaries = AVCOL_PRI_UNSPECIFIED;
+                if (s->avctx->color_trc == AVCOL_TRC_RESERVED0 ||
+                    s->avctx->color_trc == AVCOL_TRC_RESERVED  ||
+                    !av_color_transfer_name(s->avctx->color_trc))
+                    s->avctx->color_trc = AVCOL_TRC_UNSPECIFIED;
+                if (s->avctx->colorspace == AVCOL_SPC_RESERVED ||
+                    !av_color_space_name(s->avctx->colorspace))
+                    s->avctx->colorspace = AVCOL_SPC_UNSPECIFIED;
             }
         }
     }
diff --git a/tests/ref/fate/mpeg4-reserved-color-tags 
b/tests/ref/fate/mpeg4-reserved-color-tags
index 55c9df3bad..b86330d693 100644
--- a/tests/ref/fate/mpeg4-reserved-color-tags
+++ b/tests/ref/fate/mpeg4-reserved-color-tags
@@ -1,3 +1,3 @@
-color_space=reserved
-color_primaries=reserved
-color_transfer=reserved
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to