[FFmpeg-cvslog] avcodec/mpeg4video: Don't use ac_val[1], ac_val[2] when cleaning buffers
Andreas Rheinhardt
git at videolan.org
Sat Jun 21 23:21:15 EEST 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at 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.rheinhardt at 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
More information about the ffmpeg-cvslog
mailing list