diff mbox series

[FFmpeg-devel,v2,3/4] avcodec/mpegvideo_enc: use FF_ALLOCZ_TYPED_ARRAY_OR_GOTO instead

Message ID 1589212343-8334-3-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v2,1/4] avutil/internal: add FF_ALLOC_TYPED_ARRAY_OR_GOTO & FF_ALLOCZ_TYPED_ARRAY_OR_GOTO
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Limin Wang May 11, 2020, 3:52 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/mpegvideo_enc.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 50ae57e..81542b8 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -928,23 +928,20 @@  FF_ENABLE_DEPRECATION_WARNINGS
                           2 * 2 * (MAX_LEVEL + 1) *
                           (MAX_RUN + 1) * 2 * sizeof(int), fail);
     }
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);
+    FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);
 
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix,   64 * 32 * sizeof(int), fail);
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->q_chroma_intra_matrix, 64 * 32 * sizeof(int), fail);
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix,   64 * 32 * sizeof(int), fail);
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64 * 32 * 2 * sizeof(uint16_t), fail);
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->q_chroma_intra_matrix16, 64 * 32 * 2 * sizeof(uint16_t), fail);
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64 * 32 * 2 * sizeof(uint16_t), fail);
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture,
-                      MAX_PICTURE_COUNT * sizeof(Picture *), fail);
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture,
-                      MAX_PICTURE_COUNT * sizeof(Picture *), fail);
+    FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->q_intra_matrix,   64 * 32, fail);
+    FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->q_chroma_intra_matrix, 64 * 32, fail);
+    FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->q_inter_matrix,   64 * 32, fail);
+    FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->q_intra_matrix16, 64 * 32 * 2, fail);
+    FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->q_chroma_intra_matrix16, 64 * 32 * 2, fail);
+    FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->q_inter_matrix16, 64 * 32 * 2, fail);
+    FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->input_picture, MAX_PICTURE_COUNT, fail);
+    FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT, fail);
 
 
     if (s->noise_reduction) {
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset,
-                          2 * 64 * sizeof(uint16_t), fail);
+        FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(s->avctx, s->dct_offset, 2 * 64, fail);
     }
 
     ff_dct_encode_init(s);