mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-08-29 20:56:12 +02:00
avcodec/roqvideoenc: use av_malloc(z)_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
591c0c26b5
commit
9b888fb159
@ -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; y<enc->height; 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user