From 9b888fb159ebbeb4d10e618d765fd42b60a1cbc6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 18 Apr 2014 18:53:13 +0200 Subject: avcodec/roqvideoenc: use av_malloc(z)_array() Signed-off-by: Michael Niedermayer --- libavcodec/roqvideoenc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'libavcodec/roqvideoenc.c') diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index 4b96934a65..cae157b768 100644 --- a/libavcodec/roqvideoenc.c +++ b/libavcodec/roqvideoenc.c @@ -249,7 +249,7 @@ static void create_cel_evals(RoqContext *enc, RoqTempdata *tempData) { int n=0, x, y, i; - tempData->cel_evals = av_malloc(enc->width*enc->height/64 * sizeof(CelEvaluation)); + tempData->cel_evals = av_malloc_array(enc->width*enc->height/64, sizeof(CelEvaluation)); /* Map to the ROQ quadtree order */ for (y=0; yheight; y+=16) @@ -799,11 +799,11 @@ static void generate_codebook(RoqContext *enc, RoqTempdata *tempdata, int i, j, k; int c_size = size*size/4; int *buf; - int *codebook = av_malloc(6*c_size*cbsize*sizeof(int)); + int *codebook = av_malloc_array(6*c_size, cbsize*sizeof(int)); int *closest_cb; if (size == 4) - closest_cb = av_malloc(6*c_size*inputCount*sizeof(int)); + closest_cb = av_malloc_array(6*c_size, inputCount*sizeof(int)); else closest_cb = tempdata->closest_cb2; @@ -834,8 +834,8 @@ static void generate_new_codebooks(RoqContext *enc, RoqTempdata *tempData) int max = enc->width*enc->height/16; uint8_t mb2[3*4]; roq_cell *results4 = av_malloc(sizeof(roq_cell)*MAX_CBS_4x4*4); - uint8_t *yuvClusters=av_malloc(sizeof(int)*max*6*4); - int *points = av_malloc(max*6*4*sizeof(int)); + uint8_t *yuvClusters=av_malloc_array(max, sizeof(int)*6*4); + int *points = av_malloc_array(max, 6*4*sizeof(int)); int bias; /* Subsample YUV data */ @@ -852,7 +852,7 @@ static void generate_new_codebooks(RoqContext *enc, RoqTempdata *tempData) codebooks->numCB4 = (enc->quake3_compat ? MAX_CBS_4x4-1 : MAX_CBS_4x4); - tempData->closest_cb2 = av_malloc(max*4*sizeof(int)); + tempData->closest_cb2 = av_malloc_array(max, 4*sizeof(int)); /* Create 2x2 codebooks */ generate_codebook(enc, tempData, points, max*4, enc->cb2x2, 2, MAX_CBS_2x2); @@ -985,16 +985,16 @@ static av_cold int roq_encode_init(AVCodecContext *avctx) enc->tmpData = av_malloc(sizeof(RoqTempdata)); enc->this_motion4 = - av_mallocz((enc->width*enc->height/16)*sizeof(motion_vect)); + av_mallocz_array((enc->width*enc->height/16), sizeof(motion_vect)); enc->last_motion4 = - av_malloc ((enc->width*enc->height/16)*sizeof(motion_vect)); + av_malloc_array ((enc->width*enc->height/16), sizeof(motion_vect)); enc->this_motion8 = - av_mallocz((enc->width*enc->height/64)*sizeof(motion_vect)); + av_mallocz_array((enc->width*enc->height/64), sizeof(motion_vect)); enc->last_motion8 = - av_malloc ((enc->width*enc->height/64)*sizeof(motion_vect)); + av_malloc_array ((enc->width*enc->height/64), sizeof(motion_vect)); return 0; } -- cgit v1.2.3