ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | Thu May 15 03:42:06 2025 +0200| [b8ec4f7b20ae9aab85299b676d6f04ffae610b33] | committer: Andreas Rheinhardt
avcodec/svq3: Allocate motion_val jointly Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8ec4f7b20ae9aab85299b676d6f04ffae610b33 --- libavcodec/svq3.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index e1e65c4766..cdb2bd323b 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -74,7 +74,7 @@ typedef struct SVQ3Frame { AVFrame *f; - int16_t (*motion_val_buf[2])[2]; + int16_t (*motion_val_buf)[2]; int16_t (*motion_val[2])[2]; uint32_t *mb_type_buf, *mb_type; @@ -1323,10 +1323,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx) static void free_picture(SVQ3Frame *pic) { - int i; - for (i = 0; i < 2; i++) { - av_freep(&pic->motion_val_buf[i]); - } + av_freep(&pic->motion_val_buf); av_freep(&pic->mb_type_buf); av_frame_unref(pic->f); @@ -1340,23 +1337,19 @@ static int get_buffer(AVCodecContext *avctx, SVQ3Frame *pic) const int b4_array_size = b4_stride * s->mb_height * 4; int ret; - if (!pic->motion_val_buf[0]) { - int i; - + if (!pic->motion_val_buf) { pic->mb_type_buf = av_calloc(big_mb_num + s->mb_stride, sizeof(uint32_t)); if (!pic->mb_type_buf) return AVERROR(ENOMEM); pic->mb_type = pic->mb_type_buf + 2 * s->mb_stride + 1; - for (i = 0; i < 2; i++) { - pic->motion_val_buf[i] = av_calloc(b4_array_size + 4, 2 * sizeof(int16_t)); - if (!pic->motion_val_buf[i]) { - ret = AVERROR(ENOMEM); - goto fail; - } - - pic->motion_val[i] = pic->motion_val_buf[i] + 4; + pic->motion_val_buf = av_calloc(b4_array_size + 4, 2 * sizeof(*pic->motion_val[0])); + if (!pic->motion_val_buf) { + ret = AVERROR(ENOMEM); + goto fail; } + pic->motion_val[0] = pic->motion_val_buf + 4; + pic->motion_val[1] = pic->motion_val[0] + b4_array_size + 4; } ret = ff_get_buffer(avctx, pic->f, _______________________________________________ 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".