diff options
Diffstat (limited to 'libavfilter')
29 files changed, 74 insertions, 73 deletions
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index 41212d922a..92557713c4 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -257,7 +257,7 @@ static int config_output(AVFilterLink *outlink) if (!s->frame_list) return AVERROR(ENOMEM); - s->fifos = av_mallocz_array(s->nb_inputs, sizeof(*s->fifos)); + s->fifos = av_calloc(s->nb_inputs, sizeof(*s->fifos)); if (!s->fifos) return AVERROR(ENOMEM); @@ -274,8 +274,8 @@ static int config_output(AVFilterLink *outlink) memset(s->input_state, INPUT_ON, s->nb_inputs); s->active_inputs = s->nb_inputs; - s->input_scale = av_mallocz_array(s->nb_inputs, sizeof(*s->input_scale)); - s->scale_norm = av_mallocz_array(s->nb_inputs, sizeof(*s->scale_norm)); + s->input_scale = av_calloc(s->nb_inputs, sizeof(*s->input_scale)); + s->scale_norm = av_calloc(s->nb_inputs, sizeof(*s->scale_norm)); if (!s->input_scale || !s->scale_norm) return AVERROR(ENOMEM); for (i = 0; i < s->nb_inputs; i++) @@ -561,7 +561,7 @@ static av_cold int init(AVFilterContext *ctx) if (!s->fdsp) return AVERROR(ENOMEM); - s->weights = av_mallocz_array(s->nb_inputs, sizeof(*s->weights)); + s->weights = av_calloc(s->nb_inputs, sizeof(*s->weights)); if (!s->weights) return AVERROR(ENOMEM); diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index c1eac79c98..f5a57539fe 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -310,7 +310,7 @@ static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf) if (nch_out > nch_in) { if (nch_out > FF_ARRAY_ELEMS(buf->data)) { uint8_t **new_extended_data = - av_mallocz_array(nch_out, sizeof(*buf->extended_data)); + av_calloc(nch_out, sizeof(*buf->extended_data)); if (!new_extended_data) { av_frame_free(&buf); return AVERROR(ENOMEM); diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c index 1df28d5590..0172b5f876 100644 --- a/libavfilter/af_compand.c +++ b/libavfilter/af_compand.c @@ -344,9 +344,9 @@ static int config_output(AVFilterLink *outlink) uninit(ctx); - s->channels = av_mallocz_array(channels, sizeof(*s->channels)); + s->channels = av_calloc(channels, sizeof(*s->channels)); s->nb_segments = (nb_points + 4) * 2; - s->segments = av_mallocz_array(s->nb_segments, sizeof(*s->segments)); + s->segments = av_calloc(s->nb_segments, sizeof(*s->segments)); if (!s->channels || !s->segments) { uninit(ctx); diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c index c8e58260da..2fe1fc9429 100644 --- a/libavfilter/af_join.c +++ b/libavfilter/af_join.c @@ -172,9 +172,9 @@ static av_cold int join_init(AVFilterContext *ctx) } s->nb_channels = av_get_channel_layout_nb_channels(s->channel_layout); - s->channels = av_mallocz_array(s->nb_channels, sizeof(*s->channels)); - s->buffers = av_mallocz_array(s->nb_channels, sizeof(*s->buffers)); - s->input_frames = av_mallocz_array(s->inputs, sizeof(*s->input_frames)); + s->channels = av_calloc(s->nb_channels, sizeof(*s->channels)); + s->buffers = av_calloc(s->nb_channels, sizeof(*s->buffers)); + s->input_frames = av_calloc(s->inputs, sizeof(*s->input_frames)); if (!s->channels || !s->buffers|| !s->input_frames) return AVERROR(ENOMEM); @@ -283,7 +283,7 @@ static int join_config_output(AVFilterLink *outlink) int i, ret = 0; /* initialize inputs to user-specified mappings */ - if (!(inputs = av_mallocz_array(ctx->nb_inputs, sizeof(*inputs)))) + if (!(inputs = av_calloc(ctx->nb_inputs, sizeof(*inputs)))) return AVERROR(ENOMEM); for (i = 0; i < s->nb_channels; i++) { ChannelMap *ch = &s->channels[i]; @@ -383,7 +383,7 @@ static int try_push_frame(AVFilterContext *ctx) if (!frame) return AVERROR(ENOMEM); if (s->nb_channels > FF_ARRAY_ELEMS(frame->data)) { - frame->extended_data = av_mallocz_array(s->nb_channels, + frame->extended_data = av_calloc(s->nb_channels, sizeof(*frame->extended_data)); if (!frame->extended_data) { ret = AVERROR(ENOMEM); @@ -417,8 +417,8 @@ static int try_push_frame(AVFilterContext *ctx) /* create references to the buffers we copied to output */ if (nb_buffers > FF_ARRAY_ELEMS(frame->buf)) { frame->nb_extended_buf = nb_buffers - FF_ARRAY_ELEMS(frame->buf); - frame->extended_buf = av_mallocz_array(frame->nb_extended_buf, - sizeof(*frame->extended_buf)); + frame->extended_buf = av_calloc(frame->nb_extended_buf, + sizeof(*frame->extended_buf)); if (!frame->extended_buf) { frame->nb_extended_buf = 0; ret = AVERROR(ENOMEM); diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 93ec5f7171..eb38d2811c 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -169,7 +169,8 @@ static int config_input(AVFilterLink *inlink) s->channels = inlink->channels; s->duration = av_rescale(s->duration, inlink->sample_rate, AV_TIME_BASE); s->independent_channels = s->mono ? s->channels : 1; - s->nb_null_samples = av_mallocz_array(sizeof(*s->nb_null_samples), s->independent_channels); + s->nb_null_samples = av_calloc(s->independent_channels, + sizeof(*s->nb_null_samples)); if (!s->nb_null_samples) return AVERROR(ENOMEM); s->start = av_malloc_array(sizeof(*s->start), s->independent_channels); diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c index e75ed88729..90180309dd 100644 --- a/libavfilter/avf_showwaves.c +++ b/libavfilter/avf_showwaves.c @@ -427,7 +427,7 @@ static int config_output(AVFilterLink *outlink) showwaves->n = FFMAX(1, av_rescale_q(inlink->sample_rate, av_make_q(1, showwaves->w), showwaves->rate)); showwaves->buf_idx = 0; - if (!(showwaves->buf_idy = av_mallocz_array(nb_channels, sizeof(*showwaves->buf_idy)))) { + if (!FF_ALLOCZ_TYPED_ARRAY(showwaves->buf_idy, nb_channels)) { av_log(ctx, AV_LOG_ERROR, "Could not allocate showwaves buffer\n"); return AVERROR(ENOMEM); } @@ -820,7 +820,7 @@ static int showwavespic_config_input(AVFilterLink *inlink) ShowWavesContext *showwaves = ctx->priv; if (showwaves->single_pic) { - showwaves->sum = av_mallocz_array(inlink->channels, sizeof(*showwaves->sum)); + showwaves->sum = av_calloc(inlink->channels, sizeof(*showwaves->sum)); if (!showwaves->sum) return AVERROR(ENOMEM); } diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index ce63b9762f..f325918021 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -702,7 +702,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) ret->input_pads = av_memdup(filter->inputs, ret->nb_inputs * sizeof(*filter->inputs)); if (!ret->input_pads) goto err; - ret->inputs = av_mallocz_array(ret->nb_inputs, sizeof(AVFilterLink*)); + ret->inputs = av_calloc(ret->nb_inputs, sizeof(*ret->inputs)); if (!ret->inputs) goto err; } @@ -712,7 +712,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) ret->output_pads = av_memdup(filter->outputs, ret->nb_outputs * sizeof(*filter->outputs)); if (!ret->output_pads) goto err; - ret->outputs = av_mallocz_array(ret->nb_outputs, sizeof(AVFilterLink*)); + ret->outputs = av_calloc(ret->nb_outputs, sizeof(*ret->outputs)); if (!ret->outputs) goto err; } diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index c95cad7944..7dd48fb612 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -1006,7 +1006,7 @@ static DNNReturnType fill_model_input_tf(TFModel *tf_model, TFRequestItem *reque goto err; } - infer_request->output_tensors = av_mallocz_array(task->nb_output, sizeof(*infer_request->output_tensors)); + infer_request->output_tensors = av_calloc(task->nb_output, sizeof(*infer_request->output_tensors)); if (!infer_request->output_tensors) { av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for output tensor\n"); goto err; diff --git a/libavfilter/dnn_filter_common.c b/libavfilter/dnn_filter_common.c index 3045ce0131..3c7a962b3a 100644 --- a/libavfilter/dnn_filter_common.c +++ b/libavfilter/dnn_filter_common.c @@ -29,7 +29,7 @@ static char **separate_output_names(const char *expr, const char *val_sep, int * return NULL; } - parsed_vals = av_mallocz_array(MAX_SUPPORTED_OUTPUTS_NB, sizeof(*parsed_vals)); + parsed_vals = av_calloc(MAX_SUPPORTED_OUTPUTS_NB, sizeof(*parsed_vals)); if (!parsed_vals) { return NULL; } diff --git a/libavfilter/ebur128.c b/libavfilter/ebur128.c index d93500ef3e..1a85a90360 100644 --- a/libavfilter/ebur128.c +++ b/libavfilter/ebur128.c @@ -232,7 +232,7 @@ FFEBUR128State *ff_ebur128_init(unsigned int channels, CHECK_ERROR(errcode, 0, free_internal) st->d->sample_peak = - (double *) av_mallocz_array(channels, sizeof(*st->d->sample_peak)); + (double *) av_calloc(channels, sizeof(*st->d->sample_peak)); CHECK_ERROR(!st->d->sample_peak, 0, free_channel_map) st->samplerate = samplerate; @@ -253,8 +253,8 @@ FFEBUR128State *ff_ebur128_init(unsigned int channels, - (st->d->audio_data_frames % st->d->samples_in_100ms); } st->d->audio_data = - (double *) av_mallocz_array(st->d->audio_data_frames, - st->channels * sizeof(*st->d->audio_data)); + (double *) av_calloc(st->d->audio_data_frames, + st->channels * sizeof(*st->d->audio_data)); CHECK_ERROR(!st->d->audio_data, 0, free_sample_peak) ebur128_init_filter(st); diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c index 9123403c40..7c63807df3 100644 --- a/libavfilter/framepool.c +++ b/libavfilter/framepool.c @@ -243,11 +243,11 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool) frame->linesize[0] = pool->linesize[0]; if (pool->planes > AV_NUM_DATA_POINTERS) { - frame->extended_data = av_mallocz_array(pool->planes, - sizeof(*frame->extended_data)); + frame->extended_data = av_calloc(pool->planes, + sizeof(*frame->extended_data)); frame->nb_extended_buf = pool->planes - AV_NUM_DATA_POINTERS; - frame->extended_buf = av_mallocz_array(frame->nb_extended_buf, - sizeof(*frame->extended_buf)); + frame->extended_buf = av_calloc(frame->nb_extended_buf, + sizeof(*frame->extended_buf)); if (!frame->extended_data || !frame->extended_buf) goto fail; } else { diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 135d4c4e36..d1218355c7 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -499,8 +499,8 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) s->in_mem_mode = in_frames_hwctx->frame_type; - s->surface_ptrs_in = av_mallocz_array(in_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs_in)); + s->surface_ptrs_in = av_calloc(in_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs_in)); if (!s->surface_ptrs_in) return AVERROR(ENOMEM); @@ -548,8 +548,8 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) return ret; } - s->surface_ptrs_out = av_mallocz_array(out_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs_out)); + s->surface_ptrs_out = av_calloc(out_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs_out)); if (!s->surface_ptrs_out) { av_buffer_unref(&out_frames_ref); return AVERROR(ENOMEM); @@ -672,7 +672,7 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p if (ret < 0) goto failed; - s->frame_infos = av_mallocz_array(avctx->nb_inputs, sizeof(*s->frame_infos)); + s->frame_infos = av_calloc(avctx->nb_inputs, sizeof(*s->frame_infos)); if (!s->frame_infos) { ret = AVERROR(ENOMEM); goto failed; @@ -708,7 +708,7 @@ int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *p if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) { s->nb_ext_buffers = param->num_ext_buf + 1; - s->ext_buffers = av_mallocz_array(s->nb_ext_buffers, sizeof(*s->ext_buffers)); + s->ext_buffers = av_calloc(s->nb_ext_buffers, sizeof(*s->ext_buffers)); if (!s->ext_buffers) { ret = AVERROR(ENOMEM); goto failed; diff --git a/libavfilter/tests/integral.c b/libavfilter/tests/integral.c index 03b1e77367..6bdf0fd7fa 100644 --- a/libavfilter/tests/integral.c +++ b/libavfilter/tests/integral.c @@ -54,8 +54,8 @@ int main(void) const int ii_lz_32 = ((ii_w + 1) + 3) & ~3; // "+1" is for the space of the top 0-line - uint32_t *ii = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii)); - uint32_t *ii2 = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii2)); + uint32_t *ii = av_calloc(ii_h + 1, ii_lz_32 * sizeof(*ii)); + uint32_t *ii2 = av_calloc(ii_h + 1, ii_lz_32 * sizeof(*ii2)); if (!ii || !ii2) return -1; diff --git a/libavfilter/vf_colorconstancy.c b/libavfilter/vf_colorconstancy.c index 25a17788c3..8c54f7c238 100644 --- a/libavfilter/vf_colorconstancy.c +++ b/libavfilter/vf_colorconstancy.c @@ -116,7 +116,7 @@ static int set_gauss(AVFilterContext *ctx) int i; for (i = 0; i <= difford; ++i) { - s->gauss[i] = av_mallocz_array(filtersize, sizeof(*s->gauss[i])); + s->gauss[i] = av_calloc(filtersize, sizeof(*s->gauss[i])); if (!s->gauss[i]) { for (; i >= 0; --i) { av_freep(&s->gauss[i]); @@ -219,7 +219,8 @@ static int setup_derivative_buffers(AVFilterContext* ctx, ThreadData *td) av_log(ctx, AV_LOG_TRACE, "Allocating %d buffer(s) for grey edge.\n", nb_buff); for (b = 0; b <= nb_buff; ++b) { // We need difford + 1 buffers for (p = 0; p < NUM_PLANES; ++p) { - td->data[b][p] = av_mallocz_array(s->planeheight[p] * s->planewidth[p], sizeof(*td->data[b][p])); + td->data[b][p] = av_calloc(s->planeheight[p] * s->planewidth[p], + sizeof(*td->data[b][p])); if (!td->data[b][p]) { cleanup_derivative_buffers(td, b + 1, p); return AVERROR(ENOMEM); diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m index 5732903609..5c7d272616 100644 --- a/libavfilter/vf_coreimage.m +++ b/libavfilter/vf_coreimage.m @@ -461,7 +461,7 @@ static av_cold int init(AVFilterContext *fctx) av_log(ctx, AV_LOG_DEBUG, "Filter count: %i\n", ctx->num_filters); // allocate CIFilter array - ctx->filters = av_mallocz_array(ctx->num_filters, sizeof(CIFilter*)); + ctx->filters = av_calloc(ctx->num_filters, sizeof(CIFilter*)); if (!ctx->filters) { av_log(ctx, AV_LOG_ERROR, "Could not allocate filter array.\n"); return AVERROR(ENOMEM); diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c index 570e8bded2..7d7773419e 100644 --- a/libavfilter/vf_curves.c +++ b/libavfilter/vf_curves.c @@ -666,7 +666,7 @@ static int config_input(AVFilterLink *inlink) for (i = 0; i < NB_COMP + 1; i++) { if (!curves->graph[i]) - curves->graph[i] = av_mallocz_array(curves->lut_size, sizeof(*curves->graph[0])); + curves->graph[i] = av_calloc(curves->lut_size, sizeof(*curves->graph[0])); if (!curves->graph[i]) return AVERROR(ENOMEM); ret = parse_points_str(ctx, comp_points + i, curves->comp_points_str[i], curves->lut_size); diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index 18b9a17760..173c314bb8 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -233,8 +233,8 @@ static int init_out_session(AVFilterContext *ctx) s->ext_buffers[s->num_ext_buffers++] = (mfxExtBuffer *)&s->deint_conf; if (opaque) { - s->surface_ptrs = av_mallocz_array(hw_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs)); + s->surface_ptrs = av_calloc(hw_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs)); if (!s->surface_ptrs) return AVERROR(ENOMEM); for (i = 0; i < hw_frames_hwctx->nb_surfaces; i++) @@ -263,8 +263,8 @@ static int init_out_session(AVFilterContext *ctx) .Free = frame_free, }; - s->mem_ids = av_mallocz_array(hw_frames_hwctx->nb_surfaces, - sizeof(*s->mem_ids)); + s->mem_ids = av_calloc(hw_frames_hwctx->nb_surfaces, + sizeof(*s->mem_ids)); if (!s->mem_ids) return AVERROR(ENOMEM); for (i = 0; i < hw_frames_hwctx->nb_surfaces; i++) diff --git a/libavfilter/vf_dejudder.c b/libavfilter/vf_dejudder.c index 0aa8ab7a1e..d74cd7b159 100644 --- a/libavfilter/vf_dejudder.c +++ b/libavfilter/vf_dejudder.c @@ -95,7 +95,7 @@ static av_cold int dejudder_init(AVFilterContext *ctx) { DejudderContext *s = ctx->priv; - s->ringbuff = av_mallocz_array(s->cycle+2, sizeof(*s->ringbuff)); + s->ringbuff = av_calloc(s->cycle + 2, sizeof(*s->ringbuff)); if (!s->ringbuff) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c index 4a5bc06871..f886395ab7 100644 --- a/libavfilter/vf_libopencv.c +++ b/libavfilter/vf_libopencv.c @@ -172,7 +172,7 @@ static int read_shape_from_file(int *cols, int *rows, int **values, const char * ret = AVERROR_INVALIDDATA; goto end; } - if (!(*values = av_mallocz_array(sizeof(int) * *rows, *cols))) { + if (!(*values = av_calloc(sizeof(int) * *rows, *cols))) { ret = AVERROR(ENOMEM); goto end; } diff --git a/libavfilter/vf_mestimate.c b/libavfilter/vf_mestimate.c index 582da48568..578c3be812 100644 --- a/libavfilter/vf_mestimate.c +++ b/libavfilter/vf_mestimate.c @@ -100,7 +100,7 @@ static int config_input(AVFilterLink *inlink) return AVERROR(EINVAL); for (i = 0; i < 3; i++) { - s->mv_table[i] = av_mallocz_array(s->b_count, sizeof(*s->mv_table[0])); + s->mv_table[i] = av_calloc(s->b_count, sizeof(*s->mv_table[0])); if (!s->mv_table[i]) return AVERROR(ENOMEM); } diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c index 33a4059042..f4e791a19e 100644 --- a/libavfilter/vf_minterpolate.c +++ b/libavfilter/vf_minterpolate.c @@ -353,7 +353,7 @@ static int config_input(AVFilterLink *inlink) for (i = 0; i < NB_FRAMES; i++) { Frame *frame = &mi_ctx->frames[i]; - frame->blocks = av_mallocz_array(mi_ctx->b_count, sizeof(Block)); + frame->blocks = av_calloc(mi_ctx->b_count, sizeof(*frame->blocks)); if (!frame->blocks) return AVERROR(ENOMEM); } @@ -373,19 +373,19 @@ static int config_input(AVFilterLink *inlink) else if (mi_ctx->me_mode == ME_MODE_BILAT) me_ctx->get_cost = &get_sbad_ob; - mi_ctx->pixel_mvs = av_mallocz_array(width * height, sizeof(PixelMVS)); - mi_ctx->pixel_weights = av_mallocz_array(width * height, sizeof(PixelWeights)); - mi_ctx->pixel_refs = av_mallocz_array(width * height, sizeof(PixelRefs)); + mi_ctx->pixel_mvs = av_calloc(width * height, sizeof(*mi_ctx->pixel_mvs)); + mi_ctx->pixel_weights = av_calloc(width * height, sizeof(*mi_ctx->pixel_weights)); + mi_ctx->pixel_refs = av_calloc(width * height, sizeof(*mi_ctx->pixel_refs)); if (!mi_ctx->pixel_mvs || !mi_ctx->pixel_weights || !mi_ctx->pixel_refs) return AVERROR(ENOMEM); if (mi_ctx->me_mode == ME_MODE_BILAT) - if (!(mi_ctx->int_blocks = av_mallocz_array(mi_ctx->b_count, sizeof(Block)))) + if (!FF_ALLOCZ_TYPED_ARRAY(mi_ctx->int_blocks, mi_ctx->b_count)) return AVERROR(ENOMEM); if (mi_ctx->me_method == AV_ME_METHOD_EPZS) { for (i = 0; i < 3; i++) { - mi_ctx->mv_table[i] = av_mallocz_array(mi_ctx->b_count, sizeof(*mi_ctx->mv_table[0])); + mi_ctx->mv_table[i] = av_calloc(mi_ctx->b_count, sizeof(*mi_ctx->mv_table[0])); if (!mi_ctx->mv_table[i]) return AVERROR(ENOMEM); } @@ -601,7 +601,7 @@ static int var_size_bme(MIContext *mi_ctx, Block *block, int x_mb, int y_mb, int } if (!block->subs) { - block->subs = av_mallocz_array(4, sizeof(Block)); + block->subs = av_mallocz(4 * sizeof(*block->subs)); if (!block->subs) return AVERROR(ENOMEM); } diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c index 39ed37368a..20107022c4 100644 --- a/libavfilter/vf_nlmeans.c +++ b/libavfilter/vf_nlmeans.c @@ -312,7 +312,7 @@ static int config_input(AVFilterLink *inlink) s->ii_lz_32 = FFALIGN(s->ii_w + 1, 4); // "+1" is for the space of the top 0-line - s->ii_orig = av_mallocz_array(s->ii_h + 1, s->ii_lz_32 * sizeof(*s->ii_orig)); + s->ii_orig = av_calloc(s->ii_h + 1, s->ii_lz_32 * sizeof(*s->ii_orig)); if (!s->ii_orig) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c index 578ef47e88..76bad4a984 100644 --- a/libavfilter/vf_overlay_qsv.c +++ b/libavfilter/vf_overlay_qsv.c @@ -325,8 +325,8 @@ static int overlay_qsv_init(AVFilterContext *ctx) vpp->comp_conf.Header.BufferId = MFX_EXTBUFF_VPP_COMPOSITE; vpp->comp_conf.Header.BufferSz = sizeof(vpp->comp_conf); vpp->comp_conf.NumInputStream = ctx->nb_inputs; - vpp->comp_conf.InputStream = av_mallocz_array(ctx->nb_inputs, - sizeof(*vpp->comp_conf.InputStream)); + vpp->comp_conf.InputStream = av_calloc(ctx->nb_inputs, + sizeof(*vpp->comp_conf.InputStream)); if (!vpp->comp_conf.InputStream) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_program_opencl.c b/libavfilter/vf_program_opencl.c index fdc6b4dcd1..1ffb18bde1 100644 --- a/libavfilter/vf_program_opencl.c +++ b/libavfilter/vf_program_opencl.c @@ -271,8 +271,7 @@ static av_cold int program_opencl_init(AVFilterContext *avctx) } else { int i; - ctx->frames = av_mallocz_array(ctx->nb_inputs, - sizeof(*ctx->frames)); + ctx->frames = av_calloc(ctx->nb_inputs, sizeof(*ctx->frames)); if (!ctx->frames) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 2ab04457a9..5a37cef63d 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -343,16 +343,16 @@ static int init_out_session(AVFilterContext *ctx) memset(&par, 0, sizeof(par)); if (opaque) { - s->surface_ptrs_in = av_mallocz_array(in_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs_in)); + s->surface_ptrs_in = av_calloc(in_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs_in)); if (!s->surface_ptrs_in) return AVERROR(ENOMEM); for (i = 0; i < in_frames_hwctx->nb_surfaces; i++) s->surface_ptrs_in[i] = in_frames_hwctx->surfaces + i; s->nb_surface_ptrs_in = in_frames_hwctx->nb_surfaces; - s->surface_ptrs_out = av_mallocz_array(out_frames_hwctx->nb_surfaces, - sizeof(*s->surface_ptrs_out)); + s->surface_ptrs_out = av_calloc(out_frames_hwctx->nb_surfaces, + sizeof(*s->surface_ptrs_out)); if (!s->surface_ptrs_out) return AVERROR(ENOMEM); for (i = 0; i < out_frames_hwctx->nb_surfaces; i++) @@ -383,16 +383,16 @@ static int init_out_session(AVFilterContext *ctx) .Free = frame_free, }; - s->mem_ids_in = av_mallocz_array(in_frames_hwctx->nb_surfaces, - sizeof(*s->mem_ids_in)); + s->mem_ids_in = av_calloc(in_frames_hwctx->nb_surfaces, + sizeof(*s->mem_ids_in)); if (!s->mem_ids_in) return AVERROR(ENOMEM); for (i = 0; i < in_frames_hwctx->nb_surfaces; i++) s->mem_ids_in[i] = in_frames_hwctx->surfaces[i].Data.MemId; s->nb_mem_ids_in = in_frames_hwctx->nb_surfaces; - s->mem_ids_out = av_mallocz_array(out_frames_hwctx->nb_surfaces, - sizeof(*s->mem_ids_out)); + s->mem_ids_out = av_calloc(out_frames_hwctx->nb_surfaces, + sizeof(*s->mem_ids_out)); if (!s->mem_ids_out) return AVERROR(ENOMEM); for (i = 0; i < out_frames_hwctx->nb_surfaces; i++) diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c index 41e35ac6ee..61a84ff990 100644 --- a/libavfilter/vf_ssim.c +++ b/libavfilter/vf_ssim.c @@ -478,7 +478,7 @@ static int config_input_ref(AVFilterLink *inlink) return AVERROR(ENOMEM); for (int t = 0; t < s->nb_threads; t++) { - s->temp[t] = av_mallocz_array(2 * SUM_LEN(inlink->w), (desc->comp[0].depth > 8) ? sizeof(int64_t[4]) : sizeof(int[4])); + s->temp[t] = av_calloc(2 * SUM_LEN(inlink->w), (desc->comp[0].depth > 8) ? sizeof(int64_t[4]) : sizeof(int[4])); if (!s->temp[t]) return AVERROR(ENOMEM); } diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 98399b804a..b413133e41 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -229,7 +229,7 @@ static int init_filter_param(AVFilterContext *ctx, UnsharpFilterParam *fp, const effect, effect_type, fp->msize_x, fp->msize_y, fp->amount / 65535.0); fp->sr = av_malloc_array((MAX_MATRIX_SIZE - 1) * s->nb_threads, sizeof(uint32_t)); - fp->sc = av_mallocz_array(2 * fp->steps_y * s->nb_threads, sizeof(uint32_t *)); + fp->sc = av_calloc(fp->steps_y * s->nb_threads, 2 * sizeof(*fp->sc)); if (!fp->sr || !fp->sc) return AVERROR(ENOMEM); diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c index 983a2fec4f..c4e4a1f82d 100644 --- a/libavfilter/vf_yaepblur.c +++ b/libavfilter/vf_yaepblur.c @@ -294,11 +294,11 @@ static int config_input(AVFilterLink *inlink) // padding one row on the top, and padding one col on the left, that is why + 1 below s->sat_linesize = inlink->w + 1; - s->sat = av_mallocz_array(inlink->h + 1, s->sat_linesize*sizeof(*s->sat)); + s->sat = av_calloc(inlink->h + 1, s->sat_linesize * sizeof(*s->sat)); if (!s->sat) return AVERROR(ENOMEM); - s->square_sat = av_mallocz_array(inlink->h + 1, s->sat_linesize*sizeof(*s->square_sat)); + s->square_sat = av_calloc(inlink->h + 1, s->sat_linesize * sizeof(*s->square_sat)); if (!s->square_sat) return AVERROR(ENOMEM); diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c index 9a62cfedc3..b22e8be836 100644 --- a/libavfilter/vsrc_cellauto.c +++ b/libavfilter/vsrc_cellauto.c @@ -123,7 +123,7 @@ static int init_pattern_from_string(AVFilterContext *ctx) s->h = (double)s->w * M_PHI; } - s->buf = av_mallocz_array(sizeof(uint8_t) * s->w, s->h); + s->buf = av_calloc(s->w, s->h * sizeof(*s->buf)); if (!s->buf) return AVERROR(ENOMEM); @@ -183,7 +183,7 @@ static av_cold int init(AVFilterContext *ctx) /* fill the first row randomly */ int i; - s->buf = av_mallocz_array(sizeof(uint8_t) * s->w, s->h); + s->buf = av_calloc(s->w, s->h * sizeof(*s->buf)); if (!s->buf) return AVERROR(ENOMEM); if (s->random_seed == -1) |