[FFmpeg-cvslog] Merge commit 'ffa190d0479d2370dd89c95692f822cbff2cc24c'
Clément Bœsch
git at videolan.org
Thu Jun 23 00:41:42 CEST 2016
ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Thu Jun 23 00:29:25 2016 +0200| [bcafc41a5aa838ff4a88cc020bd55aa6e0790723] | committer: Clément Bœsch
Merge commit 'ffa190d0479d2370dd89c95692f822cbff2cc24c'
* commit 'ffa190d0479d2370dd89c95692f822cbff2cc24c':
Move VLC and RL_VLC_ELEM structure definitions to a separate header
Merged-by: Clément Bœsch <u at pkh.me>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bcafc41a5aa838ff4a88cc020bd55aa6e0790723
---
libavcodec/bitstream.c | 2 +-
libavcodec/get_bits.h | 42 +------------------------------
libavcodec/huffman.c | 3 +++
libavcodec/huffman.h | 2 +-
libavcodec/rl.c | 1 +
libavcodec/rl.h | 3 ++-
libavcodec/vlc.h | 65 ++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 74 insertions(+), 44 deletions(-)
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 9785ef7..562ca1c 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -34,8 +34,8 @@
#include "avcodec.h"
#include "internal.h"
#include "mathops.h"
-#include "get_bits.h"
#include "put_bits.h"
+#include "vlc.h"
const uint8_t ff_log2_run[41]={
0, 0, 0, 0, 1, 1, 1, 1,
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 881dadd..d566b9c 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -33,6 +33,7 @@
#include "libavutil/log.h"
#include "libavutil/avassert.h"
#include "mathops.h"
+#include "vlc.h"
/*
* Safe bitstream reading:
@@ -58,20 +59,6 @@ typedef struct GetBitContext {
int size_in_bits_plus8;
} GetBitContext;
-#define VLC_TYPE int16_t
-
-typedef struct VLC {
- int bits;
- VLC_TYPE (*table)[2]; ///< code, bits
- int table_size, table_allocated;
-} VLC;
-
-typedef struct RL_VLC_ELEM {
- int16_t level;
- int8_t len;
- uint8_t run;
-} RL_VLC_ELEM;
-
/* Bitstream reader API docs:
* name
* arbitrary name which is used as prefix for the internal variables
@@ -463,33 +450,6 @@ static inline const uint8_t *align_get_bits(GetBitContext *s)
return s->buffer + (s->index >> 3);
}
-#define init_vlc(vlc, nb_bits, nb_codes, \
- bits, bits_wrap, bits_size, \
- codes, codes_wrap, codes_size, \
- flags) \
- ff_init_vlc_sparse(vlc, nb_bits, nb_codes, \
- bits, bits_wrap, bits_size, \
- codes, codes_wrap, codes_size, \
- NULL, 0, 0, flags)
-
-int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
- const void *bits, int bits_wrap, int bits_size,
- const void *codes, int codes_wrap, int codes_size,
- const void *symbols, int symbols_wrap, int symbols_size,
- int flags);
-void ff_free_vlc(VLC *vlc);
-
-#define INIT_VLC_LE 2
-#define INIT_VLC_USE_NEW_STATIC 4
-
-#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
- do { \
- static VLC_TYPE table[static_size][2]; \
- (vlc)->table = table; \
- (vlc)->table_allocated = static_size; \
- init_vlc(vlc, bits, a, b, c, d, e, f, g, INIT_VLC_USE_NEW_STATIC); \
- } while (0)
-
/**
* If the vlc code is invalid and max_depth=1, then no bits will be removed.
* If the vlc code is invalid and max_depth>1, then the number of bits removed
diff --git a/libavcodec/huffman.c b/libavcodec/huffman.c
index 1f5d8b9..a3d3920 100644
--- a/libavcodec/huffman.c
+++ b/libavcodec/huffman.c
@@ -27,8 +27,11 @@
#include <stdint.h>
#include "libavutil/qsort.h"
+#include"libavutil/common.h"
+
#include "avcodec.h"
#include "huffman.h"
+#include "vlc.h"
/* symbol for Huffman tree node */
#define HNODE -1
diff --git a/libavcodec/huffman.h b/libavcodec/huffman.h
index 6ab23ae..4f879e6 100644
--- a/libavcodec/huffman.h
+++ b/libavcodec/huffman.h
@@ -27,7 +27,7 @@
#define AVCODEC_HUFFMAN_H
#include "avcodec.h"
-#include "get_bits.h"
+#include "vlc.h"
typedef struct Node {
int16_t sym;
diff --git a/libavcodec/rl.c b/libavcodec/rl.c
index b206c6f..a925240 100644
--- a/libavcodec/rl.c
+++ b/libavcodec/rl.c
@@ -17,6 +17,7 @@
*/
#include <stdint.h>
+#include <string.h>
#include "libavutil/attributes.h"
#include "libavutil/mem.h"
diff --git a/libavcodec/rl.h b/libavcodec/rl.h
index af525ef..9a767bc 100644
--- a/libavcodec/rl.h
+++ b/libavcodec/rl.h
@@ -28,7 +28,8 @@
#define AVCODEC_RL_H
#include <stdint.h>
-#include "get_bits.h"
+
+#include "vlc.h"
/* run length table */
#define MAX_RUN 64
diff --git a/libavcodec/vlc.h b/libavcodec/vlc.h
new file mode 100644
index 0000000..4ade8243
--- /dev/null
+++ b/libavcodec/vlc.h
@@ -0,0 +1,65 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VLC_H
+#define AVCODEC_VLC_H
+
+#include <stdint.h>
+
+#define VLC_TYPE int16_t
+
+typedef struct VLC {
+ int bits;
+ VLC_TYPE (*table)[2]; ///< code, bits
+ int table_size, table_allocated;
+} VLC;
+
+typedef struct RL_VLC_ELEM {
+ int16_t level;
+ int8_t len;
+ uint8_t run;
+} RL_VLC_ELEM;
+
+#define init_vlc(vlc, nb_bits, nb_codes, \
+ bits, bits_wrap, bits_size, \
+ codes, codes_wrap, codes_size, \
+ flags) \
+ ff_init_vlc_sparse(vlc, nb_bits, nb_codes, \
+ bits, bits_wrap, bits_size, \
+ codes, codes_wrap, codes_size, \
+ NULL, 0, 0, flags)
+
+int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
+ const void *bits, int bits_wrap, int bits_size,
+ const void *codes, int codes_wrap, int codes_size,
+ const void *symbols, int symbols_wrap, int symbols_size,
+ int flags);
+void ff_free_vlc(VLC *vlc);
+
+#define INIT_VLC_LE 2
+#define INIT_VLC_USE_NEW_STATIC 4
+
+#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
+ do { \
+ static VLC_TYPE table[static_size][2]; \
+ (vlc)->table = table; \
+ (vlc)->table_allocated = static_size; \
+ init_vlc(vlc, bits, a, b, c, d, e, f, g, INIT_VLC_USE_NEW_STATIC); \
+ } while (0)
+
+#endif /* AVCODEC_VLC_H */
======================================================================
diff --cc libavcodec/get_bits.h
index 881dadd,66374f5..d566b9c
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@@ -31,8 -31,8 +31,9 @@@
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
+#include "libavutil/avassert.h"
#include "mathops.h"
+ #include "vlc.h"
/*
* Safe bitstream reading:
@@@ -55,23 -55,11 +56,9 @@@ typedef struct GetBitContext
const uint8_t *buffer, *buffer_end;
int index;
int size_in_bits;
-#if !UNCHECKED_BITSTREAM_READER
int size_in_bits_plus8;
-#endif
} GetBitContext;
- #define VLC_TYPE int16_t
-
- typedef struct VLC {
- int bits;
- VLC_TYPE (*table)[2]; ///< code, bits
- int table_size, table_allocated;
- } VLC;
-
- typedef struct RL_VLC_ELEM {
- int16_t level;
- int8_t len;
- uint8_t run;
- } RL_VLC_ELEM;
-
/* Bitstream reader API docs:
* name
* arbitrary name which is used as prefix for the internal variables
diff --cc libavcodec/huffman.c
index 1f5d8b9,3b15aa2..a3d3920
--- a/libavcodec/huffman.c
+++ b/libavcodec/huffman.c
@@@ -26,9 -26,11 +26,12 @@@
#include <stdint.h>
+#include "libavutil/qsort.h"
+ #include"libavutil/common.h"
+
#include "avcodec.h"
#include "huffman.h"
+ #include "vlc.h"
/* symbol for Huffman tree node */
#define HNODE -1
More information about the ffmpeg-cvslog
mailing list