Mercurial > mplayer.hg
comparison libfaad2/syntax.c @ 13453:6d50ef45a058
Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
patch by adland <adland123 at yahoo dot com>
author | diego |
---|---|
date | Fri, 24 Sep 2004 17:31:36 +0000 |
parents | d81145997036 |
children | 2ae5ab4331ca |
comparison
equal
deleted
inserted
replaced
13452:c364b7c13dd8 | 13453:6d50ef45a058 |
---|---|
21 ** | 21 ** |
22 ** Commercial non-GPL licensing of this software is possible. | 22 ** Commercial non-GPL licensing of this software is possible. |
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | 23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. |
24 ** | 24 ** |
25 ** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30 | 25 ** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30 |
26 ** $Id: syntax.c,v 1.3 2004/06/02 22:59:04 diego Exp $ | 26 ** $Id: syntax.c,v 1.4 2004/06/23 13:50:53 diego Exp $ |
27 ** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ | 27 ** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ |
28 **/ | 28 **/ |
29 | 29 |
30 /* | 30 /* |
31 Reads the AAC bitstream as defined in 14496-3 (MPEG-4 Audio) | 31 Reads the AAC bitstream as defined in 14496-3 (MPEG-4 Audio) |
52 #include "sbr_syntax.h" | 52 #include "sbr_syntax.h" |
53 #endif | 53 #endif |
54 | 54 |
55 | 55 |
56 /* static function declarations */ | 56 /* static function declarations */ |
57 static void decode_sce_lfe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, | 57 static void decode_sce_lfe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, |
58 uint8_t id_syn_ele); | 58 uint8_t id_syn_ele); |
59 static void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, | 59 static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, |
60 uint8_t id_syn_ele); | 60 uint8_t id_syn_ele); |
61 static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld, | 61 static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, |
62 uint8_t channel, uint8_t *tag); | 62 uint8_t channel, uint8_t *tag); |
63 static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld, | 63 static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, |
64 uint8_t channel, uint8_t *tag); | 64 uint8_t channel, uint8_t *tag); |
65 #ifdef COUPLING_DEC | 65 #ifdef COUPLING_DEC |
66 static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld); | 66 static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld); |
67 #endif | 67 #endif |
68 static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld); | 68 static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld); |
69 static uint8_t program_config_element(program_config *pce, bitfile *ld); | 69 static uint8_t program_config_element(program_config *pce, bitfile *ld); |
70 static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc | 70 static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc |
71 #ifdef SBR_DEC | 71 #ifdef SBR_DEC |
72 ,uint8_t sbr_ele | 72 ,uint8_t sbr_ele |
73 #endif | 73 #endif |
74 ); | 74 ); |
75 static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele, | 75 static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele, |
76 bitfile *ld, ic_stream *ics, uint8_t scal_flag, | 76 bitfile *ld, ic_stream *ics, uint8_t scal_flag, |
77 int16_t *spec_data); | 77 int16_t *spec_data); |
78 static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, | 78 static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, |
79 uint8_t common_window); | 79 uint8_t common_window); |
80 static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld); | 80 static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld); |
81 static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld); | 81 static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld); |
82 #ifdef SSR_DEC | 82 #ifdef SSR_DEC |
83 static void gain_control_data(bitfile *ld, ic_stream *ics); | 83 static void gain_control_data(bitfile *ld, ic_stream *ics); |
84 #endif | 84 #endif |
85 static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, | 85 static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, |
86 int16_t *spectral_data); | 86 int16_t *spectral_data); |
87 static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count); | 87 static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count); |
88 static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld); | 88 static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld); |
89 static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld); | 89 static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld); |
90 static uint8_t ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld); | 90 #ifdef LTP_DEC |
91 static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld); | |
92 #endif | |
91 static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld); | 93 static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld); |
92 static void adts_variable_header(adts_header *adts, bitfile *ld); | 94 static void adts_variable_header(adts_header *adts, bitfile *ld); |
93 static void adts_error_check(adts_header *adts, bitfile *ld); | 95 static void adts_error_check(adts_header *adts, bitfile *ld); |
94 static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc); | 96 static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc); |
95 static uint8_t excluded_channels(bitfile *ld, drc_info *drc); | 97 static uint8_t excluded_channels(bitfile *ld, drc_info *drc); |
96 #ifdef SCALABLE_DEC | 98 #ifdef SCALABLE_DEC |
97 static int8_t aac_scalable_main_header(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, | 99 static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, |
98 bitfile *ld, uint8_t this_layer_stereo); | 100 bitfile *ld, uint8_t this_layer_stereo); |
99 #endif | 101 #endif |
100 | 102 |
101 | 103 |
102 /* Table 4.4.1 */ | 104 /* Table 4.4.1 */ |
314 return 22; | 316 return 22; |
315 | 317 |
316 return 0; | 318 return 0; |
317 } | 319 } |
318 | 320 |
319 static void decode_sce_lfe(faacDecHandle hDecoder, | 321 static void decode_sce_lfe(NeAACDecHandle hDecoder, |
320 faacDecFrameInfo *hInfo, bitfile *ld, | 322 NeAACDecFrameInfo *hInfo, bitfile *ld, |
321 uint8_t id_syn_ele) | 323 uint8_t id_syn_ele) |
322 { | 324 { |
323 uint8_t channels = hDecoder->fr_channels; | 325 uint8_t channels = hDecoder->fr_channels; |
324 uint8_t tag = 0; | 326 uint8_t tag = 0; |
325 | 327 |
359 | 361 |
360 hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; | 362 hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; |
361 hDecoder->fr_ch_ele++; | 363 hDecoder->fr_ch_ele++; |
362 } | 364 } |
363 | 365 |
364 static void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, | 366 static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, |
365 uint8_t id_syn_ele) | 367 uint8_t id_syn_ele) |
366 { | 368 { |
367 uint8_t channels = hDecoder->fr_channels; | 369 uint8_t channels = hDecoder->fr_channels; |
368 uint8_t tag = 0; | 370 uint8_t tag = 0; |
369 | 371 |
407 | 409 |
408 hDecoder->fr_channels += 2; | 410 hDecoder->fr_channels += 2; |
409 hDecoder->fr_ch_ele++; | 411 hDecoder->fr_ch_ele++; |
410 } | 412 } |
411 | 413 |
412 void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, | 414 void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, |
413 bitfile *ld, program_config *pce, drc_info *drc) | 415 bitfile *ld, program_config *pce, drc_info *drc) |
414 { | 416 { |
415 uint8_t id_syn_ele; | 417 uint8_t id_syn_ele; |
416 | 418 |
417 hDecoder->fr_channels = 0; | 419 hDecoder->fr_channels = 0; |
423 if (hDecoder->object_type < ER_OBJECT_START) | 425 if (hDecoder->object_type < ER_OBJECT_START) |
424 { | 426 { |
425 #endif | 427 #endif |
426 /* Table 4.4.3: raw_data_block() */ | 428 /* Table 4.4.3: raw_data_block() */ |
427 while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID | 429 while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID |
428 DEBUGVAR(1,4,"faacDecDecode(): id_syn_ele"))) != ID_END) | 430 DEBUGVAR(1,4,"NeAACDecDecode(): id_syn_ele"))) != ID_END) |
429 { | 431 { |
430 switch (id_syn_ele) { | 432 switch (id_syn_ele) { |
431 case ID_SCE: | 433 case ID_SCE: |
432 if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; | 434 if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; |
433 decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); | 435 decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); |
556 return; | 558 return; |
557 } | 559 } |
558 | 560 |
559 /* Table 4.4.4 and */ | 561 /* Table 4.4.4 and */ |
560 /* Table 4.4.9 */ | 562 /* Table 4.4.9 */ |
561 static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld, | 563 static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, |
562 uint8_t channel, uint8_t *tag) | 564 uint8_t channel, uint8_t *tag) |
563 { | 565 { |
564 uint8_t retval = 0; | 566 uint8_t retval = 0; |
565 element sce = {0}; | 567 element sce = {0}; |
566 ic_stream *ics = &(sce.ics1); | 568 ic_stream *ics = &(sce.ics1); |
599 | 601 |
600 return 0; | 602 return 0; |
601 } | 603 } |
602 | 604 |
603 /* Table 4.4.5 */ | 605 /* Table 4.4.5 */ |
604 static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld, | 606 static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, |
605 uint8_t channels, uint8_t *tag) | 607 uint8_t channels, uint8_t *tag) |
606 { | 608 { |
607 ALIGN int16_t spec_data1[1024] = {0}; | 609 ALIGN int16_t spec_data1[1024] = {0}; |
608 ALIGN int16_t spec_data2[1024] = {0}; | 610 ALIGN int16_t spec_data2[1024] = {0}; |
609 element cpe = {0}; | 611 element cpe = {0}; |
641 } | 643 } |
642 | 644 |
643 #ifdef ERROR_RESILIENCE | 645 #ifdef ERROR_RESILIENCE |
644 if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present)) | 646 if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present)) |
645 { | 647 { |
646 if ((ics1->ltp.data_present = faad_get1bit(ld | 648 if (( |
647 DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) | 649 #ifdef LTP_DEC |
648 { | 650 ics1->ltp.data_present = |
651 #endif | |
652 faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) | |
653 { | |
654 #ifdef LTP_DEC | |
649 if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0) | 655 if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0) |
650 { | 656 { |
651 return result; | 657 return result; |
652 } | 658 } |
659 #else | |
660 return 26; | |
661 #endif | |
653 } | 662 } |
654 } | 663 } |
655 #endif | 664 #endif |
656 | 665 |
657 memcpy(ics2, ics1, sizeof(ic_stream)); | 666 memcpy(ics2, ics1, sizeof(ic_stream)); |
667 | 676 |
668 #ifdef ERROR_RESILIENCE | 677 #ifdef ERROR_RESILIENCE |
669 if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) && | 678 if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) && |
670 (ics1->predictor_data_present)) | 679 (ics1->predictor_data_present)) |
671 { | 680 { |
672 if ((ics1->ltp2.data_present = faad_get1bit(ld | 681 if (( |
673 DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) | 682 #ifdef LTP_DEC |
674 { | 683 ics1->ltp2.data_present = |
684 #endif | |
685 faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) | |
686 { | |
687 #ifdef LTP_DEC | |
675 if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0) | 688 if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0) |
676 { | 689 { |
677 return result; | 690 return result; |
678 } | 691 } |
692 #else | |
693 return 26; | |
694 #endif | |
679 } | 695 } |
680 } | 696 } |
681 #endif | 697 #endif |
682 | 698 |
683 if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics2, | 699 if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics2, |
710 | 726 |
711 return 0; | 727 return 0; |
712 } | 728 } |
713 | 729 |
714 /* Table 4.4.6 */ | 730 /* Table 4.4.6 */ |
715 static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, | 731 static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, |
716 uint8_t common_window) | 732 uint8_t common_window) |
717 { | 733 { |
718 uint8_t retval = 0; | 734 uint8_t retval = 0; |
719 | 735 |
720 /* ics->ics_reserved_bit = */ faad_get1bit(ld | 736 /* ics->ics_reserved_bit = */ faad_get1bit(ld |
751 { | 767 { |
752 if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */ | 768 if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */ |
753 { | 769 { |
754 uint8_t sfb; | 770 uint8_t sfb; |
755 | 771 |
756 ics->pred.limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index)); | 772 uint8_t limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index)); |
757 | 773 #ifdef MAIN_DEC |
758 if ((ics->pred.predictor_reset = faad_get1bit(ld | 774 ics->pred.limit = limit; |
759 DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1) | 775 #endif |
776 | |
777 if (( | |
778 #ifdef MAIN_DEC | |
779 ics->pred.predictor_reset = | |
780 #endif | |
781 faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1) | |
760 { | 782 { |
761 ics->pred.predictor_reset_group_number = (uint8_t)faad_getbits(ld, 5 | 783 #ifdef MAIN_DEC |
762 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number")); | 784 ics->pred.predictor_reset_group_number = |
785 #endif | |
786 (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number")); | |
763 } | 787 } |
764 | 788 |
765 for (sfb = 0; sfb < ics->pred.limit; sfb++) | 789 for (sfb = 0; sfb < limit; sfb++) |
766 { | 790 { |
767 ics->pred.prediction_used[sfb] = faad_get1bit(ld | 791 #ifdef MAIN_DEC |
768 DEBUGVAR(1,55,"ics_info(): pred.prediction_used")); | 792 ics->pred.prediction_used[sfb] = |
793 #endif | |
794 faad_get1bit(ld DEBUGVAR(1,55,"ics_info(): pred.prediction_used")); | |
769 } | 795 } |
770 } | 796 } |
771 #ifdef LTP_DEC | 797 #ifdef LTP_DEC |
772 else { /* Long Term Prediction */ | 798 else { /* Long Term Prediction */ |
773 if (hDecoder->object_type < ER_OBJECT_START) | 799 if (hDecoder->object_type < ER_OBJECT_START) |
826 | 852 |
827 for (i = 0; i < pul->number_pulse+1; i++) | 853 for (i = 0; i < pul->number_pulse+1; i++) |
828 { | 854 { |
829 pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5 | 855 pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5 |
830 DEBUGVAR(1,58,"pulse_data(): pulse_offset")); | 856 DEBUGVAR(1,58,"pulse_data(): pulse_offset")); |
857 #if 0 | |
858 printf("%d\n", pul->pulse_offset[i]); | |
859 #endif | |
831 pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4 | 860 pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4 |
832 DEBUGVAR(1,59,"pulse_data(): pulse_amp")); | 861 DEBUGVAR(1,59,"pulse_data(): pulse_amp")); |
862 #if 0 | |
863 printf("%d\n", pul->pulse_amp[i]); | |
864 #endif | |
833 } | 865 } |
834 | 866 |
835 return 0; | 867 return 0; |
836 } | 868 } |
837 | 869 |
838 #ifdef COUPLING_DEC | 870 #ifdef COUPLING_DEC |
839 /* Table 4.4.8: Currently just for skipping the bits... */ | 871 /* Table 4.4.8: Currently just for skipping the bits... */ |
840 static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld) | 872 static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld) |
841 { | 873 { |
842 uint8_t c, result = 0; | 874 uint8_t c, result = 0; |
843 uint8_t ind_sw_cce_flag = 0; | 875 uint8_t ind_sw_cce_flag = 0; |
844 uint8_t num_gain_element_lists = 0; | 876 uint8_t num_gain_element_lists = 0; |
845 uint8_t num_coupled_elements = 0; | 877 uint8_t num_coupled_elements = 0; |
924 return 0; | 956 return 0; |
925 } | 957 } |
926 #endif | 958 #endif |
927 | 959 |
928 /* Table 4.4.10 */ | 960 /* Table 4.4.10 */ |
929 static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld) | 961 static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld) |
930 { | 962 { |
931 uint8_t byte_aligned; | 963 uint8_t byte_aligned; |
932 uint16_t i, count; | 964 uint16_t i, count; |
933 | 965 |
934 /* element_instance_tag = */ faad_getbits(ld, LEN_TAG | 966 /* element_instance_tag = */ faad_getbits(ld, LEN_TAG |
953 | 985 |
954 return count; | 986 return count; |
955 } | 987 } |
956 | 988 |
957 /* Table 4.4.11 */ | 989 /* Table 4.4.11 */ |
958 static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc | 990 static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc |
959 #ifdef SBR_DEC | 991 #ifdef SBR_DEC |
960 ,uint8_t sbr_ele | 992 ,uint8_t sbr_ele |
961 #endif | 993 #endif |
962 ) | 994 ) |
963 { | 995 { |
986 return 24; | 1018 return 24; |
987 | 1019 |
988 if (!hDecoder->sbr[sbr_ele]) | 1020 if (!hDecoder->sbr[sbr_ele]) |
989 { | 1021 { |
990 hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength, | 1022 hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength, |
991 hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index) | 1023 hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index), |
1024 hDecoder->downSampledSBR | |
992 #ifdef DRM | 1025 #ifdef DRM |
993 , 0 | 1026 , 0 |
994 #endif | 1027 #endif |
995 ); | 1028 ); |
996 } | 1029 } |
997 | 1030 |
998 hDecoder->sbr_present_flag = 1; | 1031 hDecoder->sbr_present_flag = 1; |
999 | 1032 |
1000 /* parse the SBR data */ | 1033 /* parse the SBR data */ |
1001 hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count); | 1034 hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count); |
1035 | |
1036 #if 0 | |
1037 if (hDecoder->sbr[sbr_ele]->ret > 0) | |
1038 { | |
1039 printf("%s\n", NeAACDecGetErrorMessage(hDecoder->sbr[sbr_ele]->ret)); | |
1040 } | |
1041 #endif | |
1042 | |
1002 #if (defined(PS_DEC) || defined(DRM_PS)) | 1043 #if (defined(PS_DEC) || defined(DRM_PS)) |
1003 if (hDecoder->sbr[sbr_ele]->ps_used) | 1044 if (hDecoder->sbr[sbr_ele]->ps_used) |
1004 { | 1045 { |
1005 hDecoder->ps_used[sbr_ele] = 1; | 1046 hDecoder->ps_used[sbr_ele] = 1; |
1006 } | 1047 } |
1115 } | 1156 } |
1116 #endif | 1157 #endif |
1117 | 1158 |
1118 #ifdef SCALABLE_DEC | 1159 #ifdef SCALABLE_DEC |
1119 /* Table 4.4.13 ASME */ | 1160 /* Table 4.4.13 ASME */ |
1120 void aac_scalable_main_element(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, | 1161 void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, |
1121 bitfile *ld, program_config *pce, drc_info *drc) | 1162 bitfile *ld, program_config *pce, drc_info *drc) |
1122 { | 1163 { |
1123 uint8_t retval = 0; | 1164 uint8_t retval = 0; |
1124 uint8_t channels = hDecoder->fr_channels = 0; | 1165 uint8_t channels = hDecoder->fr_channels = 0; |
1125 uint8_t ch; | 1166 uint8_t ch; |
1137 if (hInfo->error > 0) | 1178 if (hInfo->error > 0) |
1138 return; | 1179 return; |
1139 | 1180 |
1140 cpe.common_window = 1; | 1181 cpe.common_window = 1; |
1141 if (this_layer_stereo) | 1182 if (this_layer_stereo) |
1142 cpe.ele_id = ID_CPE; | 1183 { |
1143 else | 1184 hDecoder->element_id[0] = ID_CPE; |
1144 cpe.ele_id = ID_SCE; | 1185 if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) |
1145 | 1186 hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2; |
1146 hDecoder->element_output_channels[hDecoder->fr_ch_ele] = (this_layer_stereo ? 2 : 0); | 1187 } else { |
1188 hDecoder->element_id[0] = ID_SCE; | |
1189 } | |
1147 | 1190 |
1148 for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++) | 1191 for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++) |
1149 { | 1192 { |
1150 ic_stream *ics; | 1193 ic_stream *ics; |
1151 if (ch == 0) | 1194 if (ch == 0) |
1185 return; | 1228 return; |
1186 } | 1229 } |
1187 | 1230 |
1188 if (!hDecoder->sbr[0]) | 1231 if (!hDecoder->sbr[0]) |
1189 { | 1232 { |
1190 hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, cpe.ele_id, | 1233 hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0], |
1191 2*get_sample_rate(hDecoder->sf_index), 1); | 1234 2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1); |
1192 } | 1235 } |
1193 | 1236 |
1194 /* Reverse bit reading of SBR data in DRM audio frame */ | 1237 /* Reverse bit reading of SBR data in DRM audio frame */ |
1195 revbuffer = (uint8_t*)faad_malloc(buffer_size*sizeof(uint8_t)); | 1238 revbuffer = (uint8_t*)faad_malloc(buffer_size*sizeof(uint8_t)); |
1196 prevbufstart = revbuffer; | 1239 prevbufstart = revbuffer; |
1201 /* Set SBR data */ | 1244 /* Set SBR data */ |
1202 /* consider 8 bits from AAC-CRC */ | 1245 /* consider 8 bits from AAC-CRC */ |
1203 count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed); | 1246 count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed); |
1204 faad_initbits(&ld_sbr, revbuffer, count); | 1247 faad_initbits(&ld_sbr, revbuffer, count); |
1205 | 1248 |
1206 hDecoder->sbr[0]->lcstereo_flag = hDecoder->lcstereo_flag; | |
1207 | |
1208 hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index); | 1249 hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index); |
1209 hDecoder->sbr[0]->sample_rate *= 2; | 1250 hDecoder->sbr[0]->sample_rate *= 2; |
1210 | 1251 |
1211 faad_getbits(&ld_sbr, 8); /* Skip 8-bit CRC */ | 1252 faad_getbits(&ld_sbr, 8); /* Skip 8-bit CRC */ |
1212 | 1253 |
1218 } | 1259 } |
1219 #endif | 1260 #endif |
1220 | 1261 |
1221 /* check CRC */ | 1262 /* check CRC */ |
1222 /* no need to check it if there was already an error */ | 1263 /* no need to check it if there was already an error */ |
1223 if (hDecoder->sbr[0]->ret == 0) | 1264 // if (hDecoder->sbr[0]->ret == 0) |
1224 hDecoder->sbr[0]->ret = faad_check_CRC(&ld_sbr, faad_get_processed_bits(&ld_sbr) - 8); | 1265 // hDecoder->sbr[0]->ret = (uint8_t)faad_check_CRC(&ld_sbr, (uint16_t)faad_get_processed_bits(&ld_sbr) - 8); |
1225 | 1266 |
1226 faad_endbits(&ld_sbr); | 1267 faad_endbits(&ld_sbr); |
1227 | 1268 |
1228 if (revbuffer) | 1269 if (revbuffer) |
1229 faad_free(revbuffer); | 1270 faad_free(revbuffer); |
1250 hDecoder->internal_channel[channels+1] = channels+1; | 1291 hDecoder->internal_channel[channels+1] = channels+1; |
1251 } else { | 1292 } else { |
1252 hDecoder->internal_channel[channels] = channels; | 1293 hDecoder->internal_channel[channels] = channels; |
1253 } | 1294 } |
1254 | 1295 |
1255 hDecoder->element_id[hDecoder->fr_ch_ele] = cpe.ele_id; | |
1256 | |
1257 hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; | 1296 hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; |
1258 hDecoder->fr_ch_ele++; | 1297 hDecoder->fr_ch_ele++; |
1259 | 1298 |
1260 return; | 1299 return; |
1261 } | 1300 } |
1262 | 1301 |
1263 /* Table 4.4.15 */ | 1302 /* Table 4.4.15 */ |
1264 static int8_t aac_scalable_main_header(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, | 1303 static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, |
1265 bitfile *ld, uint8_t this_layer_stereo) | 1304 bitfile *ld, uint8_t this_layer_stereo) |
1266 { | 1305 { |
1267 uint8_t retval = 0; | 1306 uint8_t retval = 0; |
1268 uint8_t ch; | 1307 uint8_t ch; |
1269 ic_stream *ics; | 1308 ic_stream *ics; |
1351 diff_control_data(); | 1390 diff_control_data(); |
1352 if (mono_stereo_flag) | 1391 if (mono_stereo_flag) |
1353 diff_control_data_lr(); | 1392 diff_control_data_lr(); |
1354 } else { | 1393 } else { |
1355 #endif | 1394 #endif |
1356 if ((ics->ltp.data_present = faad_get1bit(ld | 1395 if (( |
1357 DEBUGVAR(1,310,"aac_scalable_main_header(): ltp.data_present"))) & 1) | 1396 #ifdef LTP_DEC |
1358 { | 1397 ics->ltp.data_present = |
1398 #endif | |
1399 faad_get1bit(ld DEBUGVAR(1,310,"aac_scalable_main_header(): ltp.data_present"))) & 1) | |
1400 { | |
1401 #ifdef LTP_DEC | |
1359 if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0) | 1402 if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0) |
1360 { | 1403 { |
1361 return retval; | 1404 return retval; |
1362 } | 1405 } |
1406 #else | |
1407 return 26; | |
1408 #endif | |
1363 } | 1409 } |
1364 #if 0 | 1410 #if 0 |
1365 } | 1411 } |
1366 #endif | 1412 #endif |
1367 } | 1413 } |
1369 return 0; | 1415 return 0; |
1370 } | 1416 } |
1371 #endif | 1417 #endif |
1372 | 1418 |
1373 /* Table 4.4.24 */ | 1419 /* Table 4.4.24 */ |
1374 static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele, | 1420 static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele, |
1375 bitfile *ld, ic_stream *ics, uint8_t scal_flag, | 1421 bitfile *ld, ic_stream *ics, uint8_t scal_flag, |
1376 int16_t *spec_data) | 1422 int16_t *spec_data) |
1377 { | 1423 { |
1378 uint8_t result; | 1424 uint8_t result; |
1379 | 1425 |
1467 } | 1513 } |
1468 | 1514 |
1469 #ifdef DRM | 1515 #ifdef DRM |
1470 /* CRC check */ | 1516 /* CRC check */ |
1471 if (hDecoder->object_type == DRM_ER_LC) | 1517 if (hDecoder->object_type == DRM_ER_LC) |
1472 if ((result = faad_check_CRC(ld, faad_get_processed_bits(ld) - 8)) > 0) | 1518 if ((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0) |
1473 return result; | 1519 return result; |
1474 #endif | 1520 #endif |
1475 | 1521 |
1476 if (hDecoder->aacSpectralDataResilienceFlag) | 1522 if (hDecoder->aacSpectralDataResilienceFlag) |
1477 { | 1523 { |
1505 | 1551 |
1506 return 0; | 1552 return 0; |
1507 } | 1553 } |
1508 | 1554 |
1509 /* Table 4.4.25 */ | 1555 /* Table 4.4.25 */ |
1510 static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld) | 1556 static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld) |
1511 { | 1557 { |
1512 uint8_t g; | 1558 uint8_t g; |
1513 uint8_t sect_esc_val, sect_bits; | 1559 uint8_t sect_esc_val, sect_bits; |
1514 | 1560 |
1515 if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) | 1561 if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) |
1549 #endif | 1595 #endif |
1550 | 1596 |
1551 ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits | 1597 ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits |
1552 DEBUGVAR(1,71,"section_data(): sect_cb")); | 1598 DEBUGVAR(1,71,"section_data(): sect_cb")); |
1553 | 1599 |
1600 #if 0 | |
1601 printf("%d\n", ics->sect_cb[g][i]); | |
1602 #endif | |
1603 | |
1554 if (ics->sect_cb[g][i] == NOISE_HCB) | 1604 if (ics->sect_cb[g][i] == NOISE_HCB) |
1555 ics->noise_used = 1; | 1605 ics->noise_used = 1; |
1556 | 1606 |
1557 #ifdef ERROR_RESILIENCE | 1607 #ifdef ERROR_RESILIENCE |
1558 if (hDecoder->aacSectionDataResilienceFlag) | 1608 if (hDecoder->aacSectionDataResilienceFlag) |
1584 sect_len += sect_len_incr; | 1634 sect_len += sect_len_incr; |
1585 | 1635 |
1586 ics->sect_start[g][i] = k; | 1636 ics->sect_start[g][i] = k; |
1587 ics->sect_end[g][i] = k + sect_len; | 1637 ics->sect_end[g][i] = k + sect_len; |
1588 | 1638 |
1639 #if 0 | |
1640 printf("%d\n", ics->sect_start[g][i]); | |
1641 #endif | |
1642 #if 0 | |
1643 printf("%d\n", ics->sect_end[g][i]); | |
1644 #endif | |
1645 | |
1589 if (k + sect_len >= 8*15) | 1646 if (k + sect_len >= 8*15) |
1590 return 15; | 1647 return 15; |
1591 if (i >= 8*15) | 1648 if (i >= 8*15) |
1592 return 15; | 1649 return 15; |
1593 | 1650 |
1594 for (sfb = k; sfb < k + sect_len; sfb++) | 1651 for (sfb = k; sfb < k + sect_len; sfb++) |
1652 { | |
1595 ics->sfb_cb[g][sfb] = ics->sect_cb[g][i]; | 1653 ics->sfb_cb[g][sfb] = ics->sect_cb[g][i]; |
1654 #if 0 | |
1655 printf("%d\n", ics->sfb_cb[g][sfb]); | |
1656 #endif | |
1657 } | |
1596 | 1658 |
1597 #if 0 | 1659 #if 0 |
1598 printf(" %6d %6d %6d\n", | 1660 printf(" %6d %6d %6d\n", |
1599 i, | 1661 i, |
1600 ics->sect_end[g][i], | 1662 ics->sect_end[g][i], |
1603 | 1665 |
1604 k += sect_len; | 1666 k += sect_len; |
1605 i++; | 1667 i++; |
1606 } | 1668 } |
1607 ics->num_sec[g] = i; | 1669 ics->num_sec[g] = i; |
1670 #if 0 | |
1671 printf("%d\n", ics->num_sec[g]); | |
1672 #endif | |
1608 } | 1673 } |
1609 | 1674 |
1610 #if 0 | 1675 #if 0 |
1611 printf("\n"); | 1676 printf("\n"); |
1612 #endif | 1677 #endif |
1641 { | 1706 { |
1642 switch (ics->sfb_cb[g][sfb]) | 1707 switch (ics->sfb_cb[g][sfb]) |
1643 { | 1708 { |
1644 case ZERO_HCB: /* zero book */ | 1709 case ZERO_HCB: /* zero book */ |
1645 ics->scale_factors[g][sfb] = 0; | 1710 ics->scale_factors[g][sfb] = 0; |
1711 //#define SF_PRINT | |
1712 #ifdef SF_PRINT | |
1713 printf("%d\n", ics->scale_factors[g][sfb]); | |
1714 #endif | |
1646 break; | 1715 break; |
1647 case INTENSITY_HCB: /* intensity books */ | 1716 case INTENSITY_HCB: /* intensity books */ |
1648 case INTENSITY_HCB2: | 1717 case INTENSITY_HCB2: |
1649 | 1718 |
1650 /* decode intensity position */ | 1719 /* decode intensity position */ |
1651 t = huffman_scale_factor(ld); | 1720 t = huffman_scale_factor(ld); |
1652 is_position += (t - 60); | 1721 is_position += (t - 60); |
1653 ics->scale_factors[g][sfb] = is_position; | 1722 ics->scale_factors[g][sfb] = is_position; |
1723 #ifdef SF_PRINT | |
1724 printf("%d\n", ics->scale_factors[g][sfb]); | |
1725 #endif | |
1654 | 1726 |
1655 break; | 1727 break; |
1656 case NOISE_HCB: /* noise books */ | 1728 case NOISE_HCB: /* noise books */ |
1657 | 1729 |
1658 /* decode noise energy */ | 1730 /* decode noise energy */ |
1665 t = huffman_scale_factor(ld); | 1737 t = huffman_scale_factor(ld); |
1666 t -= 60; | 1738 t -= 60; |
1667 } | 1739 } |
1668 noise_energy += t; | 1740 noise_energy += t; |
1669 ics->scale_factors[g][sfb] = noise_energy; | 1741 ics->scale_factors[g][sfb] = noise_energy; |
1742 #ifdef SF_PRINT | |
1743 printf("%d\n", ics->scale_factors[g][sfb]); | |
1744 #endif | |
1670 | 1745 |
1671 break; | 1746 break; |
1672 default: /* spectral books */ | 1747 default: /* spectral books */ |
1673 | 1748 |
1674 /* ics->scale_factors[g][sfb] must be between 0 and 255 */ | 1749 /* ics->scale_factors[g][sfb] must be between 0 and 255 */ |
1679 t = huffman_scale_factor(ld); | 1754 t = huffman_scale_factor(ld); |
1680 scale_factor += (t - 60); | 1755 scale_factor += (t - 60); |
1681 if (scale_factor < 0 || scale_factor > 255) | 1756 if (scale_factor < 0 || scale_factor > 255) |
1682 return 4; | 1757 return 4; |
1683 ics->scale_factors[g][sfb] = scale_factor; | 1758 ics->scale_factors[g][sfb] = scale_factor; |
1759 #ifdef SF_PRINT | |
1760 printf("%d\n", ics->scale_factors[g][sfb]); | |
1761 #endif | |
1684 | 1762 |
1685 break; | 1763 break; |
1686 } | 1764 } |
1687 } | 1765 } |
1688 } | 1766 } |
1689 | 1767 |
1690 return 0; | 1768 return 0; |
1691 } | 1769 } |
1692 | 1770 |
1693 /* Table 4.4.26 */ | 1771 /* Table 4.4.26 */ |
1694 static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld) | 1772 static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld) |
1695 { | 1773 { |
1696 uint8_t ret = 0; | 1774 uint8_t ret = 0; |
1697 #ifdef PROFILE | 1775 #ifdef PROFILE |
1698 int64_t count = faad_get_ts(); | 1776 int64_t count = faad_get_ts(); |
1699 #endif | 1777 #endif |
1738 | 1816 |
1739 for (w = 0; w < ics->num_windows; w++) | 1817 for (w = 0; w < ics->num_windows; w++) |
1740 { | 1818 { |
1741 tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits | 1819 tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits |
1742 DEBUGVAR(1,74,"tns_data(): n_filt")); | 1820 DEBUGVAR(1,74,"tns_data(): n_filt")); |
1821 #if 0 | |
1822 printf("%d\n", tns->n_filt[w]); | |
1823 #endif | |
1743 | 1824 |
1744 if (tns->n_filt[w]) | 1825 if (tns->n_filt[w]) |
1745 { | 1826 { |
1746 if ((tns->coef_res[w] = faad_get1bit(ld | 1827 if ((tns->coef_res[w] = faad_get1bit(ld |
1747 DEBUGVAR(1,75,"tns_data(): coef_res"))) & 1) | 1828 DEBUGVAR(1,75,"tns_data(): coef_res"))) & 1) |
1748 { | 1829 { |
1749 start_coef_bits = 4; | 1830 start_coef_bits = 4; |
1750 } else { | 1831 } else { |
1751 start_coef_bits = 3; | 1832 start_coef_bits = 3; |
1752 } | 1833 } |
1834 #if 0 | |
1835 printf("%d\n", tns->coef_res[w]); | |
1836 #endif | |
1753 } | 1837 } |
1754 | 1838 |
1755 for (filt = 0; filt < tns->n_filt[w]; filt++) | 1839 for (filt = 0; filt < tns->n_filt[w]; filt++) |
1756 { | 1840 { |
1757 tns->length[w][filt] = (uint8_t)faad_getbits(ld, length_bits | 1841 tns->length[w][filt] = (uint8_t)faad_getbits(ld, length_bits |
1758 DEBUGVAR(1,76,"tns_data(): length")); | 1842 DEBUGVAR(1,76,"tns_data(): length")); |
1843 #if 0 | |
1844 printf("%d\n", tns->length[w][filt]); | |
1845 #endif | |
1759 tns->order[w][filt] = (uint8_t)faad_getbits(ld, order_bits | 1846 tns->order[w][filt] = (uint8_t)faad_getbits(ld, order_bits |
1760 DEBUGVAR(1,77,"tns_data(): order")); | 1847 DEBUGVAR(1,77,"tns_data(): order")); |
1848 #if 0 | |
1849 printf("%d\n", tns->order[w][filt]); | |
1850 #endif | |
1761 if (tns->order[w][filt]) | 1851 if (tns->order[w][filt]) |
1762 { | 1852 { |
1763 tns->direction[w][filt] = faad_get1bit(ld | 1853 tns->direction[w][filt] = faad_get1bit(ld |
1764 DEBUGVAR(1,78,"tns_data(): direction")); | 1854 DEBUGVAR(1,78,"tns_data(): direction")); |
1855 #if 0 | |
1856 printf("%d\n", tns->direction[w][filt]); | |
1857 #endif | |
1765 tns->coef_compress[w][filt] = faad_get1bit(ld | 1858 tns->coef_compress[w][filt] = faad_get1bit(ld |
1766 DEBUGVAR(1,79,"tns_data(): coef_compress")); | 1859 DEBUGVAR(1,79,"tns_data(): coef_compress")); |
1860 #if 0 | |
1861 printf("%d\n", tns->coef_compress[w][filt]); | |
1862 #endif | |
1767 | 1863 |
1768 coef_bits = start_coef_bits - tns->coef_compress[w][filt]; | 1864 coef_bits = start_coef_bits - tns->coef_compress[w][filt]; |
1769 for (i = 0; i < tns->order[w][filt]; i++) | 1865 for (i = 0; i < tns->order[w][filt]; i++) |
1770 { | 1866 { |
1771 tns->coef[w][filt][i] = (uint8_t)faad_getbits(ld, coef_bits | 1867 tns->coef[w][filt][i] = (uint8_t)faad_getbits(ld, coef_bits |
1772 DEBUGVAR(1,80,"tns_data(): coef")); | 1868 DEBUGVAR(1,80,"tns_data(): coef")); |
1869 #if 0 | |
1870 printf("%d\n", tns->coef[w][filt][i]); | |
1871 #endif | |
1773 } | 1872 } |
1774 } | 1873 } |
1775 } | 1874 } |
1776 } | 1875 } |
1777 } | 1876 } |
1778 | 1877 |
1779 #ifdef LTP_DEC | 1878 #ifdef LTP_DEC |
1780 /* Table 4.4.28 */ | 1879 /* Table 4.4.28 */ |
1781 static uint8_t ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld) | 1880 static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld) |
1782 { | 1881 { |
1783 uint8_t sfb, w; | 1882 uint8_t sfb, w; |
1784 | 1883 |
1785 ltp->lag = 0; | 1884 ltp->lag = 0; |
1786 | 1885 |
1839 return 0; | 1938 return 0; |
1840 } | 1939 } |
1841 #endif | 1940 #endif |
1842 | 1941 |
1843 /* Table 4.4.29 */ | 1942 /* Table 4.4.29 */ |
1844 static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, | 1943 static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, |
1845 int16_t *spectral_data) | 1944 int16_t *spectral_data) |
1846 { | 1945 { |
1847 int8_t i; | 1946 int8_t i; |
1848 uint8_t g; | 1947 uint8_t g; |
1849 uint16_t inc, k, p = 0; | 1948 uint16_t inc, k, p = 0; |
1870 { | 1969 { |
1871 case ZERO_HCB: | 1970 case ZERO_HCB: |
1872 case NOISE_HCB: | 1971 case NOISE_HCB: |
1873 case INTENSITY_HCB: | 1972 case INTENSITY_HCB: |
1874 case INTENSITY_HCB2: | 1973 case INTENSITY_HCB2: |
1974 //#define SD_PRINT | |
1975 #ifdef SD_PRINT | |
1976 { | |
1977 int j; | |
1978 for (j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++) | |
1979 { | |
1980 printf("%d\n", 0); | |
1981 } | |
1982 } | |
1983 #endif | |
1984 //#define SFBO_PRINT | |
1985 #ifdef SFBO_PRINT | |
1986 printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]); | |
1987 #endif | |
1875 p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] - | 1988 p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] - |
1876 ics->sect_sfb_offset[g][ics->sect_start[g][i]]); | 1989 ics->sect_sfb_offset[g][ics->sect_start[g][i]]); |
1877 break; | 1990 break; |
1878 default: | 1991 default: |
1992 #ifdef SFBO_PRINT | |
1993 printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]); | |
1994 #endif | |
1879 for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; | 1995 for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; |
1880 k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc) | 1996 k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc) |
1881 { | 1997 { |
1882 if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0) | 1998 if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0) |
1883 return result; | 1999 return result; |
2000 #ifdef SD_PRINT | |
2001 { | |
2002 int j; | |
2003 for (j = p; j < p+inc; j++) | |
2004 { | |
2005 printf("%d\n", spectral_data[j]); | |
2006 } | |
2007 } | |
2008 #endif | |
1884 p += inc; | 2009 p += inc; |
1885 } | 2010 } |
1886 break; | 2011 break; |
1887 } | 2012 } |
1888 } | 2013 } |