1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

Simplify build_vlc() by using init_vlc_sparse() in mjpeg.

Originally committed as revision 25540 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2010-10-21 22:44:18 +00:00
parent 85f56757b4
commit 1932182498

View File

@ -44,23 +44,20 @@
static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table, static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table,
int nb_codes, int use_static, int is_ac) int nb_codes, int use_static, int is_ac)
{ {
uint8_t huff_size[256+16]; uint8_t huff_size[256];
uint16_t huff_code[256+16]; uint16_t huff_code[256];
uint16_t huff_sym[256];
int i;
assert(nb_codes <= 256); assert(nb_codes <= 256);
memset(huff_size, 0, sizeof(huff_size)); memset(huff_size, 0, sizeof(huff_size));
ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table); ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table);
if(is_ac){ for(i=0; i<256; i++)
memmove(huff_size+16, huff_size, sizeof(uint8_t)*nb_codes); huff_sym[i]= i + 16*is_ac;
memmove(huff_code+16, huff_code, sizeof(uint16_t)*nb_codes);
memset(huff_size, 0, sizeof(uint8_t)*16);
memset(huff_code, 0, sizeof(uint16_t)*16);
nb_codes += 16;
}
return init_vlc(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2, use_static); return init_vlc_sparse(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2, huff_sym, 2, 2, use_static);
} }
static void build_basic_mjpeg_vlc(MJpegDecodeContext * s) { static void build_basic_mjpeg_vlc(MJpegDecodeContext * s) {