* [FFmpeg-devel] [PATCH] lavc/vvc: Ensure seq_decode is always updated with SPS (PR #20717)
@ 2025-10-19 11:41 frankplow via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: frankplow via ffmpeg-devel @ 2025-10-19 11:41 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: frankplow
PR #20717 opened by frankplow
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20717
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20717.patch
seq_decode is used to ensure that a picture and all of its reference pictures use the same SPS. Any time the SPS changes, seq_decode should be incremented. Prior to this patch, seq_decode was incremented in frame_context_setup, which is called after the SPS is potentially changed in decode_sps. Should the decoder encounter an error between changing the SPS and incrementing seq_decode, the SPS could be modified while seq_decode was not incremented, which could lead to invalid reference pictures and various downstream issues. By instead updating seq_decode within the picture set manager, we ensure seq_decode and the SPS are always updated in tandem.
>From e611aeff64a15d12cede6da420e0173c665117a7 Mon Sep 17 00:00:00 2001
From: Frank Plowman <post@frankplowman.com>
Date: Sun, 19 Oct 2025 12:28:00 +0100
Subject: [PATCH] lavc/vvc: Ensure seq_decode is always updated with SPS
seq_decode is used to ensure that a picture and all of its reference
pictures use the same SPS. Any time the SPS changes, seq_decode should
be incremented. Prior to this patch, seq_decode was incremented in
frame_context_setup, which is called after the SPS is potentially
changed in decode_sps. Should the decoder encounter an error between
changing the SPS and incrementing seq_decode, the SPS could be modified
while seq_decode was not incremented, which could lead to invalid
reference pictures and various downstream issues. By instead updating
seq_decode within the picture set manager, we ensure seq_decode and the
SPS are always updated in tandem.
---
libavcodec/vvc/dec.c | 1 -
libavcodec/vvc/ps.c | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index bfe330e028..028f34b491 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -726,7 +726,6 @@ static int frame_context_setup(VVCFrameContext *fc, VVCContext *s)
}
if (IS_IDR(s)) {
- s->seq_decode = (s->seq_decode + 1) & 0xff;
ff_vvc_clear_refs(fc);
}
diff --git a/libavcodec/vvc/ps.c b/libavcodec/vvc/ps.c
index 8faee1d826..a591851238 100644
--- a/libavcodec/vvc/ps.c
+++ b/libavcodec/vvc/ps.c
@@ -279,12 +279,14 @@ fail:
static int decode_sps(VVCParamSets *ps, AVCodecContext *c, const H266RawSPS *rsps, int is_clvss)
{
+ VVCContext *s = c->priv_data;
const int sps_id = rsps->sps_seq_parameter_set_id;
const VVCSPS *old_sps = ps->sps_list[sps_id];
const VVCSPS *sps;
if (is_clvss) {
ps->sps_id_used = 0;
+ s->seq_decode = (s->seq_decode + 1) & 0xff;
}
if (old_sps) {
--
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-19 11:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-19 11:41 [FFmpeg-devel] [PATCH] lavc/vvc: Ensure seq_decode is always updated with SPS (PR #20717) frankplow 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