diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2010-02-22 13:51:32 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2010-02-22 13:51:32 +0000 |
commit | 9068f36dccb15646480e8751385f086215287655 (patch) | |
tree | 426153ccde1d987d53cabd5afad64e60645527cd /libavcodec/ivi_common.c | |
parent | bb29fee3a6a289f6b191177098ddce3720d8c417 (diff) | |
download | ffmpeg-9068f36dccb15646480e8751385f086215287655.tar.gz |
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
Indeo 5, so make them global and move their initialization to the common place
as well. And fix static VLC initialization, as ff_ivi_create_huff_from_desc()
used old way to do so.
Originally committed as revision 21962 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ivi_common.c')
-rw-r--r-- | libavcodec/ivi_common.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c index 46266b15d4..86ca76ed15 100644 --- a/libavcodec/ivi_common.c +++ b/libavcodec/ivi_common.c @@ -33,6 +33,12 @@ #include "libavutil/common.h" #include "ivi_dsp.h" +extern const IVIHuffDesc ff_ivi_mb_huff_desc[8]; ///< static macroblock huffman tables +extern const IVIHuffDesc ff_ivi_blk_huff_desc[8]; ///< static block huffman tables + +VLC ff_ivi_mb_vlc_tabs [8]; +VLC ff_ivi_blk_vlc_tabs[8]; + /** * Reverses "nbits" bits of the value "val" and returns the result * in the least significant bits. @@ -80,7 +86,26 @@ int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag) /* number of codewords = pos */ return init_vlc(vlc, IVI_VLC_BITS, pos, bits, 1, 1, codewords, 2, 2, - (flag & 1) | INIT_VLC_LE); + (flag ? INIT_VLC_USE_NEW_STATIC : 0) | INIT_VLC_LE); +} + +void ff_ivi_init_static_vlc() +{ + int i; + static VLC table_data[8192 * 16][2]; + static int initialized_vlcs = 0; + + if (initialized_vlcs) + return; + for (i = 0; i < 8; i++) { + ff_ivi_mb_vlc_tabs[i].table = table_data + i * 2 * 8192; + ff_ivi_mb_vlc_tabs[i].table_allocated = 8192; + ff_ivi_create_huff_from_desc(&ff_ivi_mb_huff_desc[i], &ff_ivi_mb_vlc_tabs[i], 1); + ff_ivi_blk_vlc_tabs[i].table = table_data + (i * 2 + 1) * 8192; + ff_ivi_blk_vlc_tabs[i].table_allocated = 8192; + ff_ivi_create_huff_from_desc(&ff_ivi_blk_huff_desc[i], &ff_ivi_blk_vlc_tabs[i], 1); + } + initialized_vlcs = 1; } int ff_ivi_dec_huff_desc(GetBitContext *gb, IVIHuffDesc *desc) |