rl: Add a function for freeing dynamically allocated tables.

Such tables are not used anywhere currently, but that should change.
This commit is contained in:
Anton Khirnov 2015-05-22 19:50:13 +01:00 committed by Vittorio Giovara
parent 6f57375d70
commit 324e50ee95
2 changed files with 17 additions and 0 deletions

View File

@ -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])
{

View File

@ -56,6 +56,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);
/**
* Free the contents of a dynamically allocated table.
*/
void ff_rl_free(RLTable *rl);
#define INIT_VLC_RL(rl, static_size)\
{\
int q;\