diff options
-rw-r--r-- | libavcodec/rl.c | 12 | ||||
-rw-r--r-- | libavcodec/rl.h | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/rl.c b/libavcodec/rl.c index 68122b7381..8b1854c049 100644 --- a/libavcodec/rl.c +++ b/libavcodec/rl.c @@ -19,9 +19,21 @@ #include <stdint.h> #include "libavutil/attributes.h" +#include "libavutil/mem.h" #include "rl.h" +void ff_rl_free(RLTable *rl) +{ + int i; + + for (i = 0; i < 2; i++) { + av_freep(&rl->max_run[i]); + av_freep(&rl->max_level[i]); + av_freep(&rl->index_run[i]); + } +} + av_cold void ff_rl_init(RLTable *rl, uint8_t static_store[2][2 * MAX_RUN + MAX_LEVEL + 3]) { diff --git a/libavcodec/rl.h b/libavcodec/rl.h index 086266e7f8..e4a6faa22c 100644 --- a/libavcodec/rl.h +++ b/libavcodec/rl.h @@ -55,6 +55,11 @@ typedef struct RLTable { void ff_rl_init(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]); void ff_rl_init_vlc(RLTable *rl, unsigned static_size); +/** + * Free the contents of a dynamically allocated table. + */ +void ff_rl_free(RLTable *rl); + #define INIT_VLC_RL(rl, static_size)\ {\ int q;\ |