PR #26294 opened by sjpotter URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26294 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26294.patch
The VC-1 parser's frame boundary check in vc1_parse() only kept field, slice and end-of-sequence start codes inside the current picture, so slice, field and frame level user data (0x1B/0x1C/0x1D) ended it. A field picture carrying field level user data before its second field was split in two, and the decoder rejected it with "first field slice count too large". Later pictures then referenced the broken ones, so output was also nondeterministic. Seen on a commercial 1080i VC-1 Blu-ray; details in #26293. This keeps those three user data start codes inside the current picture (entry point and sequence level user data still start a new one), and adds them to enum VC1Code. The new FATE test vc1_sa10143_userdata uses the attached SA10143_userdata.vc1, which is vc1/SA10143.vc1 with a field level user data BDU inserted before and after each second field. It must decode identically to SA10143, so it reuses the existing vc1_sa10143 reference. Without the fix all 30 frames decode blank. All existing VC-1 FATE tests are unchanged. Fixes #26293 ```fate-samples vc1/SA10143_userdata.vc1 ``` >From aa5e79961fb2b87c18483a313a53d56e81127f9c Mon Sep 17 00:00:00 2001 From: Shaya Potter <[email protected]> Date: Mon, 23 Nov 2026 11:51:19 +0200 Subject: [PATCH] avcodec/vc1_parser: don't end a picture at slice/field/frame user data Add the user data start codes (0x1B-0x1F) to enum VC1Code. The frame boundary check in vc1_parse() only kept field, slice and end-of-sequence start codes inside the current picture, so slice, field and frame level user data ended it. A field picture carrying field level user data before its second field was split in two, and the decoder rejected it with "first field slice count too large". Keep those three user data start codes inside the current picture; entry point and sequence level user data still start a new one. Add a FATE test with SA10143 carrying field level user data around each second field; it must decode identically to SA10143. Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/26293 Signed-off-by: Shaya Potter <[email protected]> --- libavcodec/vc1_common.h | 5 +++++ libavcodec/vc1_parser.c | 5 ++++- tests/fate/microsoft.mak | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libavcodec/vc1_common.h b/libavcodec/vc1_common.h index c0f0c8c2eb4..992e49595a4 100644 --- a/libavcodec/vc1_common.h +++ b/libavcodec/vc1_common.h @@ -38,6 +38,11 @@ enum VC1Code { VC1_CODE_FRAME, VC1_CODE_ENTRYPOINT, VC1_CODE_SEQHDR, + VC1_CODE_USER_SLICE = 0x0000011B, + VC1_CODE_USER_FIELD, + VC1_CODE_USER_FRAME, + VC1_CODE_USER_ENTRYPOINT, + VC1_CODE_USER_SEQHDR, }; //@} diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c index 224ff3ee587..8984014e4d4 100644 --- a/libavcodec/vc1_parser.c +++ b/libavcodec/vc1_parser.c @@ -250,7 +250,10 @@ static int vc1_parse(AVCodecParserContext *s, pic_found = 1; } else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF) - && b != (VC1_CODE_ENDOFSEQ & 0xFF)) { + && b != (VC1_CODE_ENDOFSEQ & 0xFF) + && b != (VC1_CODE_USER_SLICE & 0xFF) + && b != (VC1_CODE_USER_FIELD & 0xFF) + && b != (VC1_CODE_USER_FRAME & 0xFF)) { next = i - 4; pic_found = b == (VC1_CODE_FRAME & 0xFF); break; diff --git a/tests/fate/microsoft.mak b/tests/fate/microsoft.mak index 006ad34840d..cbbee4e502b 100644 --- a/tests/fate/microsoft.mak +++ b/tests/fate/microsoft.mak @@ -62,6 +62,10 @@ fate-vc1_sa10091: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA10091.vc1 FATE_VC1 += fate-vc1_sa10143 fate-vc1_sa10143: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA10143.vc1 +FATE_VC1 += fate-vc1_sa10143_userdata +fate-vc1_sa10143_userdata: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA10143_userdata.vc1 +fate-vc1_sa10143_userdata: REF = $(SRC_PATH)/tests/ref/fate/vc1_sa10143 + FATE_VC1 += fate-vc1_sa20021 fate-vc1_sa20021: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA20021.vc1 -- 2.54.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
