diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-16 00:36:30 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-20 04:38:45 +0200 |
commit | 896c11687ecc2915f41ac6f04be1d6293bd8f158 (patch) | |
tree | 228e0b79ca4bc1ffcc40a0d221b65d9ccfdfcc9e /libavcodec/roqvideoenc.c | |
parent | 9e11debb5d5b1bd18f481e654f7515fc1eefde14 (diff) | |
download | ffmpeg-896c11687ecc2915f41ac6f04be1d6293bd8f158.tar.gz |
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/roqvideoenc.c')
-rw-r--r-- | libavcodec/roqvideoenc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index 7fa175c629..a9ec5950ff 100644 --- a/libavcodec/roqvideoenc.c +++ b/libavcodec/roqvideoenc.c @@ -133,6 +133,7 @@ typedef struct CelEvaluation { typedef struct RoqEncContext { RoqContext common; + struct ELBGContext *elbg; AVLFG randctx; uint64_t lambda; @@ -824,8 +825,8 @@ static int generate_codebook(RoqEncContext *enc, int *codebook = enc->tmp_codebook_buf; int *closest_cb = enc->closest_cb; - ret = avpriv_do_elbg(points, 6 * c_size, inputCount, codebook, - cbsize, 1, closest_cb, &enc->randctx); + ret = avpriv_elbg_do(&enc->elbg, points, 6 * c_size, inputCount, codebook, + cbsize, 1, closest_cb, &enc->randctx); if (ret < 0) return ret; @@ -961,6 +962,8 @@ static av_cold int roq_encode_end(AVCodecContext *avctx) av_freep(&enc->this_motion8); av_freep(&enc->last_motion8); + avpriv_elbg_free(&enc->elbg); + return 0; } |