comparison vorbis.c @ 3762:f1e4ea591eb6 libavcodec

Get rid of get_bits_long_le, get_bits_long was fixed and now behaves the same way.
author reimar
date Mon, 25 Sep 2006 22:54:19 +0000
parents 271eca88821b
children 6e7b9a44800c
comparison
equal deleted inserted replaced
3761:c559d45f66e8 3762:f1e4ea591eb6
43 #undef NDEBUG 43 #undef NDEBUG
44 #include <assert.h> 44 #include <assert.h>
45 45
46 /* Helper functions */ 46 /* Helper functions */
47 47
48 /**
49 * reads 0-32 bits when using the ALT_BITSTREAM_READER_LE bitstream reader
50 */
51 static unsigned int get_bits_long_le(GetBitContext *s, int n){
52 if(n<=17) return get_bits(s, n);
53 else{
54 int ret= get_bits(s, 16);
55 return ret | (get_bits(s, n-16) << 16);
56 }
57 }
58
59 #define ilog(i) av_log2(2*(i)) 48 #define ilog(i) av_log2(2*(i))
60 49
61 #define BARK(x) \ 50 #define BARK(x) \
62 (13.1f*atan(0.00074f*(x))+2.24f*atan(1.85e-8f*(x)*(x))+1e-4f*(x)) 51 (13.1f*atan(0.00074f*(x))+2.24f*atan(1.85e-8f*(x)*(x))+1e-4f*(x))
63 52
309 if (codebook_setup->lookup_type==1) { 298 if (codebook_setup->lookup_type==1) {
310 uint_fast16_t i, j, k; 299 uint_fast16_t i, j, k;
311 uint_fast16_t codebook_lookup_values=nth_root(entries, codebook_setup->dimensions); 300 uint_fast16_t codebook_lookup_values=nth_root(entries, codebook_setup->dimensions);
312 uint_fast16_t codebook_multiplicands[codebook_lookup_values]; 301 uint_fast16_t codebook_multiplicands[codebook_lookup_values];
313 302
314 float codebook_minimum_value=vorbisfloat2float(get_bits_long_le(gb, 32)); 303 float codebook_minimum_value=vorbisfloat2float(get_bits_long(gb, 32));
315 float codebook_delta_value=vorbisfloat2float(get_bits_long_le(gb, 32)); 304 float codebook_delta_value=vorbisfloat2float(get_bits_long(gb, 32));
316 uint_fast8_t codebook_value_bits=get_bits(gb, 4)+1; 305 uint_fast8_t codebook_value_bits=get_bits(gb, 4)+1;
317 uint_fast8_t codebook_sequence_p=get_bits1(gb); 306 uint_fast8_t codebook_sequence_p=get_bits1(gb);
318 307
319 AV_DEBUG(" We expect %d numbers for building the codevectors. \n", codebook_lookup_values); 308 AV_DEBUG(" We expect %d numbers for building the codevectors. \n", codebook_lookup_values);
320 AV_DEBUG(" delta %f minmum %f \n", codebook_delta_value, codebook_minimum_value); 309 AV_DEBUG(" delta %f minmum %f \n", codebook_delta_value, codebook_minimum_value);
867 (get_bits(gb, 8)!='i') || (get_bits(gb, 8)!='s')) { 856 (get_bits(gb, 8)!='i') || (get_bits(gb, 8)!='s')) {
868 av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (no vorbis signature). \n"); 857 av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (no vorbis signature). \n");
869 return 1; 858 return 1;
870 } 859 }
871 860
872 vc->version=get_bits_long_le(gb, 32); //FIXME check 0 861 vc->version=get_bits_long(gb, 32); //FIXME check 0
873 vc->audio_channels=get_bits(gb, 8); //FIXME check >0 862 vc->audio_channels=get_bits(gb, 8); //FIXME check >0
874 vc->audio_samplerate=get_bits_long_le(gb, 32); //FIXME check >0 863 vc->audio_samplerate=get_bits_long(gb, 32); //FIXME check >0
875 vc->bitrate_maximum=get_bits_long_le(gb, 32); 864 vc->bitrate_maximum=get_bits_long(gb, 32);
876 vc->bitrate_nominal=get_bits_long_le(gb, 32); 865 vc->bitrate_nominal=get_bits_long(gb, 32);
877 vc->bitrate_minimum=get_bits_long_le(gb, 32); 866 vc->bitrate_minimum=get_bits_long(gb, 32);
878 bl0=get_bits(gb, 4); 867 bl0=get_bits(gb, 4);
879 bl1=get_bits(gb, 4); 868 bl1=get_bits(gb, 4);
880 vc->blocksize[0]=(1<<bl0); 869 vc->blocksize[0]=(1<<bl0);
881 vc->blocksize[1]=(1<<bl1); 870 vc->blocksize[1]=(1<<bl1);
882 if (bl0>13 || bl0<6 || bl1>13 || bl1<6 || bl1<bl0) { 871 if (bl0>13 || bl0<6 || bl1>13 || bl1<6 || bl1<bl0) {