summaryrefslogtreecommitdiffstats
path: root/libavcodec/huffman.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-09-02 14:22:17 +0200
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-09-03 13:55:38 +0200
commit741d353ab9cb47fe864e60552bf7b9af7aaa735b (patch)
tree0660a0c72bf99c62f4f375d28f1fae7506eace88 /libavcodec/huffman.c
parent26960aa1cd865e5dc55c67fb2ff9f0629e4d1bda (diff)
downloadffmpeg-streaming-741d353ab9cb47fe864e60552bf7b9af7aaa735b.zip
ffmpeg-streaming-741d353ab9cb47fe864e60552bf7b9af7aaa735b.tar.gz
huffman: allow specifying nb_bits to ff_huff_build_tree()
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/huffman.c')
-rw-r--r--libavcodec/huffman.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/huffman.c b/libavcodec/huffman.c
index a55e536..f13ab296 100644
--- a/libavcodec/huffman.c
+++ b/libavcodec/huffman.c
@@ -114,7 +114,7 @@ static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat,
}
}
-static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags)
+static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags, int nb_bits)
{
int no_zero_count = !(flags & FF_HUFFMAN_FLAG_ZERO_COUNT);
uint32_t bits[256];
@@ -124,7 +124,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags)
get_tree_codes(bits, lens, xlat, nodes, head, 0, 0,
&pos, no_zero_count);
- return ff_init_vlc_sparse(vlc, FF_HUFFMAN_BITS, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
+ return ff_init_vlc_sparse(vlc, nb_bits, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
}
@@ -132,7 +132,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags)
* nodes size must be 2*nb_codes
* first nb_codes nodes.count must be set
*/
-int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
+int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bits,
Node *nodes, HuffCmp cmp, int flags)
{
int i, j;
@@ -169,7 +169,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
}
cur_node++;
}
- if (build_huff_tree(vlc, nodes, nb_codes * 2 - 2, flags) < 0) {
+ if (build_huff_tree(vlc, nodes, nb_codes * 2 - 2, flags, nb_bits) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error building tree\n");
return -1;
}
OpenPOWER on IntegriCloud