Mercurial > libavcodec.hg
comparison rv10.c @ 547:31be0f0b0792 libavcodec
get_vlc -> get_vlc2
author | michaelni |
---|---|
date | Sat, 13 Jul 2002 16:23:02 +0000 |
parents | 0d990115524d |
children | 18ad513d92fe |
comparison
equal
deleted
inserted
replaced
546:8cefba09f2e8 | 547:31be0f0b0792 |
---|---|
19 #include "avcodec.h" | 19 #include "avcodec.h" |
20 #include "dsputil.h" | 20 #include "dsputil.h" |
21 #include "mpegvideo.h" | 21 #include "mpegvideo.h" |
22 | 22 |
23 //#define DEBUG | 23 //#define DEBUG |
24 | |
25 #define DC_VLC_BITS 9 | |
24 | 26 |
25 static const UINT16 rv_lum_code[256] = | 27 static const UINT16 rv_lum_code[256] = |
26 { | 28 { |
27 0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06, | 29 0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06, |
28 0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e, | 30 0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e, |
171 int rv_decode_dc(MpegEncContext *s, int n) | 173 int rv_decode_dc(MpegEncContext *s, int n) |
172 { | 174 { |
173 int code; | 175 int code; |
174 | 176 |
175 if (n < 4) { | 177 if (n < 4) { |
176 code = get_vlc(&s->gb, &rv_dc_lum); | 178 code = get_vlc2(&s->gb, rv_dc_lum.table, DC_VLC_BITS, 2); |
177 if (code < 0) { | 179 if (code < 0) { |
178 /* XXX: I don't understand why they use LONGER codes than | 180 /* XXX: I don't understand why they use LONGER codes than |
179 necessary. The following code would be completely useless | 181 necessary. The following code would be completely useless |
180 if they had thought about it !!! */ | 182 if they had thought about it !!! */ |
181 code = get_bits(&s->gb, 7); | 183 code = get_bits(&s->gb, 7); |
194 } | 196 } |
195 } else { | 197 } else { |
196 code -= 128; | 198 code -= 128; |
197 } | 199 } |
198 } else { | 200 } else { |
199 code = get_vlc(&s->gb, &rv_dc_chrom); | 201 code = get_vlc2(&s->gb, rv_dc_chrom.table, DC_VLC_BITS, 2); |
200 /* same remark */ | 202 /* same remark */ |
201 if (code < 0) { | 203 if (code < 0) { |
202 code = get_bits(&s->gb, 9); | 204 code = get_bits(&s->gb, 9); |
203 if (code == 0x1fc) { | 205 if (code == 0x1fc) { |
204 code = (INT8)(get_bits(&s->gb, 7) + 1); | 206 code = (INT8)(get_bits(&s->gb, 7) + 1); |
349 | 351 |
350 h263_decode_init_vlc(s); | 352 h263_decode_init_vlc(s); |
351 | 353 |
352 /* init rv vlc */ | 354 /* init rv vlc */ |
353 if (!done) { | 355 if (!done) { |
354 init_vlc(&rv_dc_lum, 9, 256, | 356 init_vlc(&rv_dc_lum, DC_VLC_BITS, 256, |
355 rv_lum_bits, 1, 1, | 357 rv_lum_bits, 1, 1, |
356 rv_lum_code, 2, 2); | 358 rv_lum_code, 2, 2); |
357 init_vlc(&rv_dc_chrom, 9, 256, | 359 init_vlc(&rv_dc_chrom, DC_VLC_BITS, 256, |
358 rv_chrom_bits, 1, 1, | 360 rv_chrom_bits, 1, 1, |
359 rv_chrom_code, 2, 2); | 361 rv_chrom_code, 2, 2); |
360 done = 1; | 362 done = 1; |
361 } | 363 } |
362 | 364 |