[FFmpeg-cvslog] rl: Add a function for freeing dynamically allocated tables.
Anton Khirnov
git at videolan.org
Thu May 28 22:02:20 CEST 2015
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri May 22 19:50:13 2015 +0100| [324e50ee95929a9491b855c5e15451145bd5d1ec] | committer: Vittorio Giovara
rl: Add a function for freeing dynamically allocated tables.
Such tables are not used anywhere currently, but that should change.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=324e50ee95929a9491b855c5e15451145bd5d1ec
---
libavcodec/rl.c | 12 ++++++++++++
libavcodec/rl.h | 5 +++++
2 files changed, 17 insertions(+)
diff --git a/libavcodec/rl.c b/libavcodec/rl.c
index 942b7a6..c0ec8ec 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 d03d436..8244968 100644
--- a/libavcodec/rl.h
+++ b/libavcodec/rl.h
@@ -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;\
More information about the ffmpeg-cvslog
mailing list