[FFmpeg-devel] [PATCH] avfilter/vf_lut3d: allocate 3d lut dynamically

Paul B Mahol onemda at gmail.com
Thu Oct 24 18:15:27 EEST 2019


On 10/24/19, James Almer <jamrial at gmail.com> wrote:
> 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.

It is  allocated  only in init.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list