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

lance.lmwang at gmail.com lance.lmwang at gmail.com
Mon May 11 18:52:22 EEST 2020


From: Limin Wang <lance.lmwang at gmail.com>

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

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);
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list