@@ -541,6 +541,203 @@ int mpeg4_aac_adts_pce_save(uint8_t* data, size_t bytes, const struct mpeg4_aac_
541541 return mpeg4_bits_error (& pce ) ? 0 : (int )((adts .bits + 7 ) / 8 );
542542}
543543
544+ /*
545+ single_channel_element()
546+ {
547+ element_instance_tag; 4 uimsbf
548+ individual_channel_stream(0,0);
549+ }
550+
551+ channel_pair_element()
552+ {
553+ element_instance_tag; 4 uimsbf
554+ common_window; 1 uimsbf
555+ if (common_window) {
556+ ics_info();
557+ ms_mask_present; 2 uimsbf
558+ if ( ms_mask_present == 1 ) {
559+ for (g = 0; g < num_window_groups; g++) {
560+ for (sfb = 0; sfb < max_sfb; sfb++) {
561+ ms_used[g][sfb]; 1 uimsbf
562+ }
563+ }
564+ }
565+ }
566+ individual_channel_stream(common_window,0);
567+ individual_channel_stream(common_window,0);
568+ }
569+
570+ coupling_channel_element()
571+ {
572+ element_instance_tag; 4 uimsbf
573+ ind_sw_cce_flag; 1 uimsbf
574+ num_coupled_elements; 3 uimsbf
575+ num_gain_element_lists = 0;
576+ for (c = 0; c < num_coupled_elements+1; c++) {
577+ num_gain_element_lists++;
578+ cc_target_is_cpe[c]; 1 uimsbf
579+ cc_target_tag_select[c]; 4 uimsbf
580+ if (cc_target_is_cpe[c]) {
581+ cc_l[c]; 1 uimsbf
582+ cc_r[c]; 1 uimsbf
583+ if (cc_l[c] && cc_r[c] )
584+ num_gain_element_lists++;
585+ }
586+ }
587+ cc_domain; 1 uimsbf
588+ gain_element_sign; 1 uimsbf
589+ gain_element_scale; 2 uimsbf
590+ individual_channel_stream(0,0);
591+ for (c=1; c<num_gain_element_lists; c++) {
592+ if (ind_sw_cce_flag) {
593+ cge = 1;
594+ } else {
595+ common_gain_element_present[c]; 1 uimsbf
596+ cge = common_gain_element_present[c];
597+ }
598+ if (cge)
599+ hcod_sf[common_gain_element[c]]; 1..19 vlclbf
600+ else {
601+ for (g = 0; g < num_window_groups; g++) {
602+ for (sfb=0; sfb<max_sfb; sfb++) {
603+ if (sfb_cb[g][sfb] != ZERO_HCB)
604+ hcod_sf[dpcm_gain_element[c][g][sfb]]; 1..19 vlclbf
605+ }
606+ }
607+ }
608+ }
609+ }
610+
611+ lfe_channel_element()
612+ {
613+ element_instance_tag; 4 uimsbf
614+ individual_channel_stream(0,0);
615+ }
616+
617+ data_stream_element()
618+ {
619+ element_instance_tag; 4 uimsbf
620+ data_byte_align_flag; 1 uimsbf
621+ cnt = count; 8 uimsbf
622+ if (cnt == 255)
623+ cnt += esc_count; 8 uimsbf
624+ if (data_byte_align_flag)
625+ byte_alignment();
626+ for (i = 0; i < cnt; i++)
627+ data_stream_byte[element_instance_tag][i]; 8 uimsbf
628+ }
629+
630+ Fill_element()
631+ {
632+ cnt = count; 4 uimsbf
633+ if (cnt == 15)
634+ cnt += esc_count - 1; 8 uimsbf
635+ while (cnt > 0) {
636+ cnt -= extension_payload(cnt);
637+ }
638+ }
639+
640+ individual_channel_stream(common_window, scale_flag)
641+ {
642+ global_gain; 8 uimsbf
643+ if (! common_window && ! scale_flag) {
644+ ics_info ();
645+ }
646+ section_data ();
647+ scale_factor_data ();
648+ if (! scale_flag) {
649+ pulse_data_present; 1 uimsbf
650+ if (pulse_data_present) {
651+ pulse_data ();
652+ }
653+ tns_data_present; 1 uimsbf
654+ if (tns_data_present) {
655+ tns_data ();
656+ }
657+ gain_control_data_present; 1 uimsbf
658+ if (gain_control_data_present) {
659+ gain_control_data ();
660+ }
661+ }
662+ if (! aacSpectralDataResilienceFlag) {
663+ spectral_data ();
664+ }
665+ else {
666+ length_of_reordered_spectral_data; 14 uimsbf
667+ length_of_longest_codeword; 6 uimsbf
668+ reordered_spectral_data ();
669+ }
670+ }
671+ */
672+ static int mpeg4_aac_individual_channel_stream_parse (struct mpeg4_bits_t * bits , struct mpeg4_aac_t * aac , uint8_t common_window , uint8_t scale_flag )
673+ {
674+ mpeg4_bits_read_uint8 (& bits , 8 ); // global_gain
675+ if (!common_window && !scale_flag )
676+ {
677+ // ics_info()
678+ }
679+
680+ // section_data ();
681+ // scale_factor_data ();
682+ return mpeg4_bits_error (& bits );
683+ }
684+
685+ static int mpeg4_aac_cpe_parse (struct mpeg4_bits_t * bits , struct mpeg4_aac_t * aac )
686+ {
687+ uint8_t element_instance_tag , common_window ;
688+ element_instance_tag = mpeg4_bits_read_uint8 (& bits , 4 );
689+ common_window = mpeg4_bits_read_uint8 (& bits , 1 );
690+ if (common_window )
691+ {
692+ // ics
693+ }
694+
695+ mpeg4_aac_individual_channel_stream_parse (bits , aac , common_window , 0 );
696+ mpeg4_aac_individual_channel_stream_parse (bits , aac , common_window , 0 );
697+ return mpeg4_bits_error (& bits );
698+ }
699+
700+ int mpeg4_aac_raw_data_block_parse (const uint8_t * data , size_t bytes , struct mpeg4_aac_t * aac )
701+ {
702+ int i ;
703+ uint8_t id ;
704+ size_t offset = 7 ;
705+ struct mpeg4_bits_t bits , pce ;
706+
707+ mpeg4_bits_init (& bits , (uint8_t * )data + offset , bytes - offset );
708+ id = mpeg4_bits_read_uint8 (& bits , 3 );
709+ while (0 == mpeg4_bits_error (& bits ) && id != ID_END )
710+ {
711+ switch (id )
712+ {
713+ case ID_SCE :
714+ return bytes ;
715+ case ID_CPE :
716+ return mpeg4_aac_cpe_parse (& bits , aac );
717+
718+ case ID_CCE :
719+ return bytes ;
720+ case ID_LFE :
721+ return bytes ;
722+ case ID_DSE :
723+ return bytes ;
724+
725+ case ID_PCE :
726+ mpeg4_bits_init (& pce , aac -> pce , sizeof (aac -> pce ));
727+ aac -> npce = mpeg4_aac_pce_load (& bits , aac , & pce );
728+ return mpeg4_bits_error (& bits ) ? -1 : (int )(7 + (pce .bits + 7 ) / 8 );
729+
730+ case ID_FIL :
731+ return bytes ;
732+
733+ default :
734+ return bytes ;
735+ }
736+ }
737+
738+ return 7 ;
739+ }
740+
544741static size_t mpeg4_aac_stream_mux_config_load3 (struct mpeg4_bits_t * bits , struct mpeg4_aac_t * aac )
545742{
546743 uint8_t audioMuxVersion = 0 ;
0 commit comments