[PR] avcodec/cbs_lcevc: don't abort if a Process Block is missing padding bits (PR #23983)

James Almer via ffmpeg-devel <[email protected]> Sun, 02 Aug 2026 16:34:46 -0000
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178568848661.59.8380084301231330719@29965ddac10e>
PR #23983 opened by James Almer (jamrial)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23983
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23983.patch

Samples made following the current (for now) faulty specification may not include alignment bits at the end of VUI parameters, so instead of aborting, warn about it and keep going.
In a writing scenario, like the lcevc_metadata bsf, the output bitstream will be written with them.


>From fd13f30e41137ba32187900940d01e7f483d9f66 Mon Sep 17 00:00:00 2001
From: James Almer <[email protected]>
Date: Sun, 2 Aug 2026 13:33:32 -0300
Subject: [PATCH] avcodec/cbs_lcevc: don't abort if a Process Block is missing
 padding bits

Samples made following the current (for now) faulty specification may not include
alignment bits at the end of VUI parameters, so instead of aborting, warn about it
and keep going.
In a writing scenario, like the lcevc_metadata bsf, the output bitstream will
be written with them.

Signed-off-by: James Almer <[email protected]>
---
 libavcodec/cbs_lcevc_syntax_template.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_lcevc_syntax_template.c b/libavcodec/cbs_lcevc_syntax_template.c
index b24c1bf365..0655b6ac97 100644
--- a/libavcodec/cbs_lcevc_syntax_template.c
+++ b/libavcodec/cbs_lcevc_syntax_template.c
@@ -515,7 +515,10 @@ static int FUNC(process_block)(CodedBitstreamContext *ctx, RWContext *rw,
             if (trailing_bits == 0) {
                 // The trailing bits must contain a payload_bit_equal_to_one, so
                 // they can't all be zero.
-                return AVERROR_INVALIDDATA;
+                // Don't abort as older encoders following a faulty specification
+                // syntax trigger this.
+                av_log(ctx->log_ctx, AV_LOG_WARNING, "Missing alignment bits\n");
+                return 0;
             }
             trailing_zero_bits = ff_ctz(trailing_bits);
             current->extension_bit_length =
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]