diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-16 01:36:30 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-20 05:38:45 +0300 |
commit | 896c11687ecc2915f41ac6f04be1d6293bd8f158 (patch) | |
tree | 228e0b79ca4bc1ffcc40a0d221b65d9ccfdfcc9e /libavfilter/vf_elbg.c | |
parent | 9e11debb5d5b1bd18f481e654f7515fc1eefde14 (diff) |
avcodec/elbg: Add persistent ELBGContext
It will be used in future commits to avoid having to allocate and free
all the buffers used.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/vf_elbg.c')
-rw-r--r-- | libavfilter/vf_elbg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavfilter/vf_elbg.c b/libavfilter/vf_elbg.c index 79797ee25f..2c9c861d02 100644 --- a/libavfilter/vf_elbg.c +++ b/libavfilter/vf_elbg.c @@ -35,6 +35,7 @@ typedef struct ELBGFilterContext { const AVClass *class; + struct ELBGContext *ctx; AVLFG lfg; int64_t lfg_seed; int max_steps_nb; @@ -163,7 +164,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) } /* compute the codebook */ - avpriv_do_elbg(elbg->codeword, NB_COMPONENTS, elbg->codeword_length, + avpriv_elbg_do(&elbg->ctx, elbg->codeword, NB_COMPONENTS, elbg->codeword_length, elbg->codebook, elbg->codebook_length, elbg->max_steps_nb, elbg->codeword_closest_codebook_idxs, &elbg->lfg); @@ -223,6 +224,8 @@ static av_cold void uninit(AVFilterContext *ctx) { ELBGFilterContext *const elbg = ctx->priv; + avpriv_elbg_free(&elbg->ctx); + av_freep(&elbg->codebook); av_freep(&elbg->codeword); av_freep(&elbg->codeword_closest_codebook_idxs); |