[FFmpeg-cvslog] avcodec/mpegvideo: Don't reset AC values of upper-left luma block

Andreas Rheinhardt git at videolan.org
Sat Jun 21 23:21:11 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Jun 13 03:04:45 2025 +0200| [70ce68d0212f7c1fd9b453fa203371dba05fb3af] | committer: Andreas Rheinhardt

avcodec/mpegvideo: Don't reset AC values of upper-left luma block

Said block will only be referenced by blocks from the same macroblock,
which will read the new AC values instead of the reset values
from this function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=70ce68d0212f7c1fd9b453fa203371dba05fb3af
---

 libavcodec/mpegvideo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index a27efa8b89..b481d1eef4 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -506,7 +506,9 @@ void ff_clean_intra_table_entries(MpegEncContext *s)
     /* ac pred */
     int16_t (*ac_val)[16] = s->ac_val[0];
     av_assume(!((uintptr_t)ac_val & 0xF));
-    memset(ac_val[xy       ], 0, 2 * sizeof(*ac_val));
+    // Don't reset the upper-left luma block, as it will only ever be
+    // referenced by blocks from the same macroblock.
+    memset(ac_val[xy +    1], 0,     sizeof(*ac_val));
     memset(ac_val[xy + wrap], 0, 2 * sizeof(*ac_val));
     /* ac pred */
     memset(ac_val[uxy], 0, sizeof(*ac_val));



More information about the ffmpeg-cvslog mailing list