[FFmpeg-devel] [PATCH 34/47] avcodec/mpegvideo: Don't reset AC values of upper-left luma block

Andreas Rheinhardt ffmpegagent at gmail.com
Sun Jun 15 19:54:25 EEST 2025


From: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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>
---
 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));
-- 
ffmpeg-codebot



More information about the ffmpeg-devel mailing list