aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-10-21 22:44:18 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-10-21 22:44:18 +0000
commit19321824985aa5a5fc510d73bb087dffee77fccf (patch)
tree4e61d730b13fbc5a932e888866fa7a708f9a7624 /libavcodec
parent85f56757b44ff5505ed1053d760167c978345088 (diff)
downloadffmpeg-19321824985aa5a5fc510d73bb087dffee77fccf.tar.gz
Simplify build_vlc() by using init_vlc_sparse() in mjpeg.
Originally committed as revision 25540 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mjpegdec.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 5686380e0a..4dcbfdbc47 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -44,23 +44,20 @@
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)
{
- uint8_t huff_size[256+16];
- uint16_t huff_code[256+16];
+ uint8_t huff_size[256];
+ uint16_t huff_code[256];
+ uint16_t huff_sym[256];
+ int i;
assert(nb_codes <= 256);
memset(huff_size, 0, sizeof(huff_size));
ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table);
- if(is_ac){
- memmove(huff_size+16, huff_size, sizeof(uint8_t)*nb_codes);
- 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;
- }
+ for(i=0; i<256; i++)
+ huff_sym[i]= i + 16*is_ac;
- 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) {