From 896c11687ecc2915f41ac6f04be1d6293bd8f158 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Thu, 16 Sep 2021 00:36:30 +0200 Subject: 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 Signed-off-by: Andreas Rheinhardt --- libavcodec/cinepakenc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libavcodec/cinepakenc.c') 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); -- cgit v1.2.3