summaryrefslogtreecommitdiff
path: root/libavcodec/cinepakenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-16 00:36:30 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-20 04:38:45 +0200
commit896c11687ecc2915f41ac6f04be1d6293bd8f158 (patch)
tree228e0b79ca4bc1ffcc40a0d221b65d9ccfdfcc9e /libavcodec/cinepakenc.c
parent9e11debb5d5b1bd18f481e654f7515fc1eefde14 (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 'libavcodec/cinepakenc.c')
-rw-r--r--libavcodec/cinepakenc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/cinepakenc.c b/libavcodec/cinepakenc.c
index 8e8b73ce1d..2984b93de3 100644
--- a/libavcodec/cinepakenc.c
+++ b/libavcodec/cinepakenc.c
@@ -127,6 +127,7 @@ typedef struct CinepakEncContext {
int min_min_strips;
int max_max_strips;
int strip_number_delta_range;
+ struct ELBGContext *elbg;
} CinepakEncContext;
#define OFFSET(x) offsetof(CinepakEncContext, x)
@@ -761,7 +762,8 @@ static int quantize(CinepakEncContext *s, int h, uint8_t *data[4],
if (i < size)
size = i;
- avpriv_do_elbg(s->codebook_input, entry_size, i, codebook, size, 1, s->codebook_closest, &s->randctx);
+ avpriv_elbg_do(&s->elbg, s->codebook_input, entry_size, i, codebook,
+ size, 1, s->codebook_closest, &s->randctx);
// set up vq_data, which contains a single MB
vq_data[0] = vq_pict_buf;
@@ -1161,6 +1163,7 @@ static av_cold int cinepak_encode_end(AVCodecContext *avctx)
CinepakEncContext *s = avctx->priv_data;
int x;
+ avpriv_elbg_free(&s->elbg);
av_frame_free(&s->last_frame);
av_frame_free(&s->best_frame);
av_frame_free(&s->scratch_frame);