diff options
author | Frank Plowman <post@frankplowman.com> | 2024-02-15 11:54:24 +0000 |
---|---|---|
committer | Nuo Mi <nuomi2021@gmail.com> | 2024-02-16 12:05:03 +0800 |
commit | acacf8a313f74d0cc83ae790d39341f471ef47b8 (patch) | |
tree | 14d891ddc0a266466e9296d91ca9eac9a4cf93d2 /libavcodec/vvc/vvc_refs.c | |
parent | 86367be5ef313887a0d93390e668fe13dc675394 (diff) | |
download | ffmpeg-acacf8a313f74d0cc83ae790d39341f471ef47b8.tar.gz |
lavc/vvc: Use pps->{width, height} over sps->{width, height}
The PPS should be used instead of the SPS to get the current picture's
dimensions. Using the SPS can cause issues if the resolution changes
mid-sequence. In particular, it was leading to invalid memory accesses
if the resolution decreased.
Patch replaces sps->{width,height} with pps->{width,height}. It also
removes sps->{width,height}, as these are no longer used anywhere.
Fixes crash when decoding DVB V&V test sequence
VVC_HDR_UHDTV1_ClosedGOP_Max3840x2160_50fps_HLG10_res_change_without_RPR
Signed-off-by: Frank Plowman <post@frankplowman.com>
Diffstat (limited to 'libavcodec/vvc/vvc_refs.c')
-rw-r--r-- | libavcodec/vvc/vvc_refs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/vvc/vvc_refs.c b/libavcodec/vvc/vvc_refs.c index e1895d1cca..99f2dcf3ec 100644 --- a/libavcodec/vvc/vvc_refs.c +++ b/libavcodec/vvc/vvc_refs.c @@ -316,6 +316,7 @@ static void mark_ref(VVCFrame *frame, int flag) static VVCFrame *generate_missing_ref(VVCContext *s, VVCFrameContext *fc, int poc) { const VVCSPS *sps = fc->ps.sps; + const VVCPPS *pps = fc->ps.pps; VVCFrame *frame; frame = alloc_frame(s, fc); @@ -329,10 +330,10 @@ static VVCFrame *generate_missing_ref(VVCContext *s, VVCFrameContext *fc, int po frame->frame->buf[i]->size); } else { for (int i = 0; frame->frame->data[i]; i++) - for (int y = 0; y < (sps->height >> sps->vshift[i]); y++) { + for (int y = 0; y < (pps->height >> sps->vshift[i]); y++) { uint8_t *dst = frame->frame->data[i] + y * frame->frame->linesize[i]; AV_WN16(dst, 1 << (sps->bit_depth - 1)); - av_memcpy_backptr(dst + 2, 2, 2*(sps->width >> sps->hshift[i]) - 2); + av_memcpy_backptr(dst + 2, 2, 2*(pps->width >> sps->hshift[i]) - 2); } } } |