Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/vc1_parser: stop splitting ENDOFSEQ markers into separate packets (PR #20787)
@ 2025-10-29 15:49 James Almer via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: James Almer via ffmpeg-devel @ 2025-10-29 15:49 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: James Almer

PR #20787 opened by James Almer (jamrial)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20787
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20787.patch

Supersedes #20781


>From fd3d41c721b50962cb29c9c409904981c82bd2cd Mon Sep 17 00:00:00 2001
From: James Almer <jamrial@gmail.com>
Date: Wed, 29 Oct 2025 12:17:56 -0300
Subject: [PATCH 1/2] avcodec/vc1dec: look for ENDOFSEQ markers at the end of a
 packet's payload

This is in preparation for the parser no longer splitting them into their own
packets.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/vc1dec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 55225baec9..536fdcb147 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -834,9 +834,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
 
     if(s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
         s->low_delay = 1;
+    if (buf_size >= 4 && AV_RB32(&buf[buf_size-4]) == VC1_CODE_ENDOFSEQ)
+        buf_size -= 4;
 
     /* no supplementary picture */
-    if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) {
+    if (buf_size == 0) {
         /* special case for last picture */
         if (s->low_delay == 0 && s->next_pic.ptr) {
             if ((ret = av_frame_ref(pict, s->next_pic.ptr->f)) < 0)
-- 
2.49.1


>From 7929ba5d1fd21ecdc9e3829c40f21b9d41b7c8d9 Mon Sep 17 00:00:00 2001
From: James Almer <jamrial@gmail.com>
Date: Wed, 29 Oct 2025 12:47:11 -0300
Subject: [PATCH 2/2] avcodec/vc1_parser: stop splitting ENDOFSEQ markers into
 separate packets

The decode API can handle outputting delayed frames without relying on the
parser splitting off the ENDOFSEQ marker.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/vc1_parser.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index 124a7a771f..05094d782f 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -216,7 +216,8 @@ static int vc1_parse(AVCodecParserContext *s,
                 if (!pic_found && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) {
                     pic_found = 1;
                 }
-                else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) {
+                else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)
+                                   && b != (VC1_CODE_ENDOFSEQ & 0xFF)) {
                     next = i - 4;
                     pic_found = b == (VC1_CODE_FRAME & 0xFF);
                     break;
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-29 15:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-29 15:49 [FFmpeg-devel] [PATCH] avcodec/vc1_parser: stop splitting ENDOFSEQ markers into separate packets (PR #20787) James Almer via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git