ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Fri Jun 13 04:25:13 2025 +0200| [4aca6b19ac8430605272f9742392de217326b8fb] | 
committer: Andreas Rheinhardt

avcodec/mpeg4video: Don't use ac_val[1], ac_val[2] when cleaning buffers

This is in preparation for removing removing ac_val[1]
and ac_val[2]. ff_mpeg4_clean_buffers() was the last user of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

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

 libavcodec/mpeg4video.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg4video.c b/libavcodec/mpeg4video.c
index 3980a39305..a690077c58 100644
--- a/libavcodec/mpeg4video.c
+++ b/libavcodec/mpeg4video.c
@@ -43,17 +43,18 @@ int ff_mpeg4_get_video_packet_prefix_length(enum 
AVPictureType pict_type,
 
 void ff_mpeg4_clean_buffers(MpegEncContext *s)
 {
-    int c_wrap, c_xy, l_wrap, l_xy;
+    const int mb_height = s->mb_height;
+    int c_wrap, l_wrap, l_xy;
 
     l_wrap = s->b8_stride;
     l_xy   = (2 * s->mb_y - 1) * l_wrap + s->mb_x * 2 - 1;
     c_wrap = s->mb_stride;
-    c_xy   = (s->mb_y - 1) * c_wrap + s->mb_x - 1;
+    int u_xy = 2 * mb_height * l_wrap + s->mb_y * c_wrap + s->mb_x - 1;
 
     /* clean AC */
     memset(s->ac_val[0] + l_xy, 0, (l_wrap * 2 + 1) * 16 * sizeof(int16_t));
-    memset(s->ac_val[1] + c_xy, 0, (c_wrap     + 1) * 16 * sizeof(int16_t));
-    memset(s->ac_val[2] + c_xy, 0, (c_wrap     + 1) * 16 * sizeof(int16_t));
+    memset(s->ac_val[0] + u_xy, 0, (c_wrap     + 1) * 16 * sizeof(int16_t));
+    memset(s->ac_val[0] + u_xy + c_wrap * (mb_height + 1), 0, (c_wrap     + 1) 
* 16 * sizeof(int16_t));
 
     /* clean MV */
     // we can't clear the MVs as they might be needed by a B-frame

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to