comparison decoders/mpglib/layer3.c @ 387:fb519e6028e3

Changed all the Sound_SetError() calls to __Sound_SetError (or BAIL*_MACRO)
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 05 Jul 2002 23:11:51 +0000
parents 7b1df7526915
children 9d0b5ec9cc26
comparison
equal deleted inserted replaced
386:8c8ecd1008c9 387:fb519e6028e3
345 gr_info->table_select[2] = 0; 345 gr_info->table_select[2] = 0;
346 for(i=0;i<3;i++) 346 for(i=0;i<3;i++)
347 gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(3)<<3); 347 gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(3)<<3);
348 348
349 if(gr_info->block_type == 0) { 349 if(gr_info->block_type == 0) {
350 Sound_SetError("MPGLIB: Blocktype == 0 and window-switching == 1 not allowed."); 350 BAIL_MACRO("MPGLIB: Blocktype == 0 and window-switching == 1 not allowed.", 0);
351 return 0;
352 } 351 }
353 /* region_count/start parameters are implicit in this case. */ 352 /* region_count/start parameters are implicit in this case. */
354 gr_info->region1start = 36>>1; 353 gr_info->region1start = 36>>1;
355 gr_info->region2start = 576>>1; 354 gr_info->region2start = 576>>1;
356 } 355 }
419 gr_info->table_select[2] = 0; 418 gr_info->table_select[2] = 0;
420 for(i=0;i<3;i++) 419 for(i=0;i<3;i++)
421 gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(3)<<3); 420 gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(3)<<3);
422 421
423 if(gr_info->block_type == 0) { 422 if(gr_info->block_type == 0) {
424 Sound_SetError("MPGLIB: Blocktype == 0 and window-switching == 1 not allowed."); 423 BAIL_MACRO("MPGLIB: Blocktype == 0 and window-switching == 1 not allowed.", 0);
425 return 0;
426 } 424 }
427 /* region_count/start parameters are implicit in this case. */ 425 /* region_count/start parameters are implicit in this case. */
428 /* check this again! */ 426 /* check this again! */
429 if(gr_info->block_type == 2) 427 if(gr_info->block_type == 2)
430 gr_info->region1start = 36>>1; 428 gr_info->region1start = 36>>1;
954 part2remain -= 16; 952 part2remain -= 16;
955 } 953 }
956 if(part2remain > 0) 954 if(part2remain > 0)
957 getbits(part2remain); 955 getbits(part2remain);
958 else if(part2remain < 0) { 956 else if(part2remain < 0) {
959 Sound_SetError("MPGLIB: Can't rewind stream!"); /* !!! FIXME: Need formatting: by %d bits!\n",-part2remain);*/ 957 /* !!! FIXME: Need formatting: by %d bits!\n",-part2remain);*/
960 return 1; /* -> error */ 958 BAIL_MACRO("MPGLIB: Can't rewind stream!", 1); /* -> error */
961 } 959 }
962 return 0; 960 return 0;
963 } 961 }
964 962
965 #if 0 963 #if 0
1365 part2remain -= 16; 1363 part2remain -= 16;
1366 } 1364 }
1367 if(part2remain > 0 ) 1365 if(part2remain > 0 )
1368 getbits(part2remain); 1366 getbits(part2remain);
1369 else if(part2remain < 0) { 1367 else if(part2remain < 0) {
1370 Sound_SetError("MPGLIB: Can't rewind stream!"); /* !!! FIXME: Need formatting: by %d bits!\n",-part2remain); */ 1368 /* !!! FIXME: Need formatting: by %d bits!\n",-part2remain);*/
1371 return 1; /* -> error */ 1369 BAIL_MACRO("MPGLIB: Can't rewind stream!", 1); /* -> error */
1372 } 1370 }
1373 return 0; 1371 return 0;
1374 } 1372 }
1375 #endif 1373 #endif
1376 1374
1904 granules = 2; 1902 granules = 2;
1905 #ifdef MPEG1 1903 #ifdef MPEG1
1906 if(!III_get_side_info_1(&sideinfo,stereo,ms_stereo,sfreq,single)) 1904 if(!III_get_side_info_1(&sideinfo,stereo,ms_stereo,sfreq,single))
1907 return -1; 1905 return -1;
1908 #else 1906 #else
1909 Sound_SetError("MPGLIB: Not supported!"); 1907 __Sound_SetError("MPGLIB: Not supported!");
1910 #endif 1908 #endif
1911 } 1909 }
1912 1910
1913 if(set_pointer(sideinfo.main_data_begin,mp) == MP3_ERR) 1911 if(set_pointer(sideinfo.main_data_begin,mp) == MP3_ERR)
1914 return -1; 1912 return -1;
1925 part2bits = III_get_scale_factors_2(scalefacs[0],gr_info,0); 1923 part2bits = III_get_scale_factors_2(scalefacs[0],gr_info,0);
1926 else { 1924 else {
1927 #ifdef MPEG1 1925 #ifdef MPEG1
1928 part2bits = III_get_scale_factors_1(scalefacs[0],gr_info); 1926 part2bits = III_get_scale_factors_1(scalefacs[0],gr_info);
1929 #else 1927 #else
1930 Sound_SetError("MPGLIB: Not supported!"); 1928 __Sound_SetError("MPGLIB: Not supported!");
1931 #endif 1929 #endif
1932 } 1930 }
1933 if(III_dequantize_sample(hybridIn[0], scalefacs[0],gr_info,sfreq,part2bits)) 1931 if(III_dequantize_sample(hybridIn[0], scalefacs[0],gr_info,sfreq,part2bits))
1934 return clip; 1932 return clip;
1935 } 1933 }
1940 part2bits = III_get_scale_factors_2(scalefacs[1],gr_info,i_stereo); 1938 part2bits = III_get_scale_factors_2(scalefacs[1],gr_info,i_stereo);
1941 else { 1939 else {
1942 #ifdef MPEG1 1940 #ifdef MPEG1
1943 part2bits = III_get_scale_factors_1(scalefacs[1],gr_info); 1941 part2bits = III_get_scale_factors_1(scalefacs[1],gr_info);
1944 #else 1942 #else
1945 Sound_SetError("MPGLIB: Not supported!"); 1943 __Sound_SetError("MPGLIB: Not supported!");
1946 #endif 1944 #endif
1947 } 1945 }
1948 1946
1949 if(III_dequantize_sample(hybridIn[1],scalefacs[1],gr_info,sfreq,part2bits)) 1947 if(III_dequantize_sample(hybridIn[1],scalefacs[1],gr_info,sfreq,part2bits))
1950 return clip; 1948 return clip;