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/elbg.h | |
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 'libavcodec/elbg.h')
-rw-r--r-- | libavcodec/elbg.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libavcodec/elbg.h b/libavcodec/elbg.h index a9a19aa5e4..abeeb4ff44 100644 --- a/libavcodec/elbg.h +++ b/libavcodec/elbg.h @@ -23,11 +23,16 @@ #include "libavutil/lfg.h" +struct ELBGContext; + /** * Implementation of the Enhanced LBG Algorithm * Based on the paper "Neural Networks 14:1219-1237" that can be found in * http://citeseer.ist.psu.edu/patan01enhanced.html . * + * @param ctx A pointer to a pointer to an already allocated ELBGContext + * or a pointer to NULL. In the latter case, this function + * will allocate an ELBGContext and put a pointer to it in `*ctx`. * @param points Input points. * @param dim Dimension of the points. * @param numpoints Num of points in **points. @@ -38,8 +43,13 @@ * @param rand_state A random number generator state. Should be already initialized by av_lfg_init(). * @return < 0 in case of error, 0 otherwise */ -int avpriv_do_elbg(int *points, int dim, int numpoints, int *codebook, - int num_cb, int num_steps, int *closest_cb, - AVLFG *rand_state); +int avpriv_elbg_do(struct ELBGContext **ctx, int *points, int dim, + int numpoints, int *codebook, int num_cb, int num_steps, + int *closest_cb, AVLFG *rand_state); + +/** + * Free an ELBGContext and reset the pointer to it. + */ +void avpriv_elbg_free(struct ELBGContext **ctx); #endif /* AVCODEC_ELBG_H */ |