comparison wmadec.c @ 3022:d4080a510724 libavcodec

get_vlc -> get_vlc2 transition.
author banan
date Sun, 08 Jan 2006 17:09:05 +0000
parents f74ae8aff2a9
children 0b546eab515d
comparison
equal deleted inserted replaced
3021:e3c391312d7c 3022:d4080a510724
53 #define MAX_CHANNELS 2 53 #define MAX_CHANNELS 2
54 54
55 #define NOISE_TAB_SIZE 8192 55 #define NOISE_TAB_SIZE 8192
56 56
57 #define LSP_POW_BITS 7 57 #define LSP_POW_BITS 7
58
59 #define VLCBITS 9
58 60
59 typedef struct WMADecodeContext { 61 typedef struct WMADecodeContext {
60 GetBitContext gb; 62 GetBitContext gb;
61 int sample_rate; 63 int sample_rate;
62 int nb_channels; 64 int nb_channels;
677 *q++ = v; 679 *q++ = v;
678 } while (--n); 680 } while (--n);
679 } 681 }
680 last_exp = 36; 682 last_exp = 36;
681 while (q < q_end) { 683 while (q < q_end) {
682 code = get_vlc(&s->gb, &s->exp_vlc); 684 code = get_vlc2(&s->gb, s->exp_vlc.table, VLCBITS, 2);
683 if (code < 0) 685 if (code < 0)
684 return -1; 686 return -1;
685 /* NOTE: this offset is the same as MPEG4 AAC ! */ 687 /* NOTE: this offset is the same as MPEG4 AAC ! */
686 last_exp += code - 60; 688 last_exp += code - 60;
687 /* XXX: use a table */ 689 /* XXX: use a table */
818 for(i=0;i<n;i++) { 820 for(i=0;i<n;i++) {
819 if (s->high_band_coded[ch][i]) { 821 if (s->high_band_coded[ch][i]) {
820 if (val == (int)0x80000000) { 822 if (val == (int)0x80000000) {
821 val = get_bits(&s->gb, 7) - 19; 823 val = get_bits(&s->gb, 7) - 19;
822 } else { 824 } else {
823 code = get_vlc(&s->gb, &s->hgain_vlc); 825 code = get_vlc2(&s->gb, s->hgain_vlc.table, VLCBITS, 2);
824 if (code < 0) 826 if (code < 0)
825 return -1; 827 return -1;
826 val += code - 18; 828 val += code - 18;
827 } 829 }
828 s->high_band_values[ch][i] = val; 830 s->high_band_values[ch][i] = val;
875 /* XXX: optimize */ 877 /* XXX: optimize */
876 ptr = &s->coefs1[ch][0]; 878 ptr = &s->coefs1[ch][0];
877 eptr = ptr + nb_coefs[ch]; 879 eptr = ptr + nb_coefs[ch];
878 memset(ptr, 0, s->block_len * sizeof(int16_t)); 880 memset(ptr, 0, s->block_len * sizeof(int16_t));
879 for(;;) { 881 for(;;) {
880 code = get_vlc(&s->gb, coef_vlc); 882 code = get_vlc2(&s->gb, coef_vlc->table, VLCBITS, 3);
881 if (code < 0) 883 if (code < 0)
882 return -1; 884 return -1;
883 if (code == 1) { 885 if (code == 1) {
884 /* EOB */ 886 /* EOB */
885 break; 887 break;