On 10/24/2019 8:54 AM, Paul B Mahol wrote: > +static int allocate_3dlut(AVFilterContext *ctx, int lutsize) > +{ > + LUT3DContext *lut3d = ctx->priv; > + > + if (lutsize < 2 || lutsize > MAX_LEVEL) { > + av_log(ctx, AV_LOG_ERROR, "Too large or invalid 3D LUT size\n"); > + return AVERROR(EINVAL); > + } > + > + lut3d->lutsize = lutsize; > + lut3d->lutsize2 = lutsize * lutsize; > + lut3d->lut = av_malloc_array(lutsize * lutsize * lutsize, > sizeof(*lut3d->lut)); > + if (!lut3d->lut) > + return AVERROR(ENOMEM); > + return 0; > +}
If this is allocated several times per frame/stream and the size doesn't change (Or rarely does), then you could use a buffer pool instead. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".