A skip run consumes no bits, so when it crosses a macroblock row boundary the bits ahead may already be the *next* slice's start code (this happens whenever a run reaches the end of a slice). The unconditional check_for_slice() at the row boundary then falsely swallowed the next slice header and skipped its MBs, leaving the covered rows unwritten and corrupting every later reference.
The reference decoders simply skip the whole run without probing for start codes; do the same by only scanning for a slice start when no skip run is pending (skip_count <= 0). Fixes 11 conformance streams of 标准集92(2009) whose B pictures have skip runs crossing row boundaries (01_Tsinghua_2.0, 03_longjing_*, 16_HiSilicon_*, 20_Tsinghua_4.0 and others). Co-Authored-By: kimi-k3 with kimi-code Signed-off-by: jianfeng.zheng <[email protected]> --- libavcodec/cavsdec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index 4ed3ac9a1d..dc28202958 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -2387,7 +2387,11 @@ static int decode_pic(AVSContext *h) h->aec.gb = NULL; /* started by the first slice header */ h->pic_data_end = 0; do { - ret = check_for_slice(h); + /* do not look for a new slice while a skip run is pending: the + * run consumes no bits, so the bits ahead may already be the + * next slice's start code although MBs of the current slice + * are still to be skipped */ + ret = skip_count > 0 ? 0 : check_for_slice(h); if (ret < 0) break; if (ret) -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
