AAC 数据格式

AAC 数据格式

AAC是常见的编码格式,编码后的数据封装格式分为两种:ADIF(Audio Data Interchange Format)ADTS(Audio Data Transport Stream), 常见的主要是ADTS封装。

1 ADIF格式

1.1 序列语法

adif

  • adif_header() header of the Audio Data Interchange Format located at the beginning of an adif_sequence。
  • adif_sequence() a sequence according to the Audio Data Interchange Format (Table 2).
  • raw_data_stream() 编码数据流
1.1.1 adif_header

在这里插入图片描述

2 ADTS格式

2.1 adts_sequence

在这里插入图片描述

2.1.1 adts_frame

an ADTS frame, consisting of a fixed header, a variable header, an optional error check and a specified number of raw_data_block()'s (Table 5).
在这里插入图片描述

  • adts_fixed_header()
    fixed header of ADTS. The information in this header does not change from frame to frame. It is repeated every frame to allow random access into a bitstream bitstream (Table 8).帧见不变,保证随机访问。
  • adts_variable_header()
    variable header of ADTS. This header is transmitted every frame as well as the fixed header, but contains data that changes from frame to frame (Table 9).
  • adts_header_error_check()
    The following bits are protected and fed into the CRC algorithm in order of their appearance:
    • all bits of adts_fixed_header()
    • all bits of adts_variable_header()
    • all bits of every raw_data_block_position[i]
      -raw_data_block()
2.1.1.1 adts_fixed_header

在这里插入图片描述

  • syncword The bit string ‘1111 1111 1111’.
  • ID MPEG identifier, 0-MPEG4/1-MPEG2
  • layer Indicates which layer is used. Set to ‘00’.
  • protection_absent Indicates whether error_check() data is present or not. Same as syntax element ‘protection_bit’ in ISO/IEC 11172-3, subclause 2.4.1 and 2.4.2 (Table 8).
  • profile profile used
  • sampling_frequency_index indicates the sampling frequency used according to the following table
  • private_bit
  • channel_configuration indicates the channel configuration used. If channel_configuration is greater than 0, the channel configuration is given by the ‘Default bitstream index number’ in Table 42, see subclause 8.5. If channel_configuration equals 0, the channel configuration is not specified in the
    header and must be given by a program_config_element() following as first syntactic element in the first raw_data_block() after the header, or by the implicit configuration (see subclause 8.5) or must be known in the application (Table 8).

伪代码

adts_sequence()
{
    while (nextbits() == syncword)
    {
        adts_frame()
        {
            adts_fixed_header()
            {
                syncword;                 //12 bslbf
                ID;                       //1 bslbf
                layer;                    //2 uimsbf
                protection_absent;        //1 bslbf
                profile;                  //2 uimsbf
                sampling_frequency_index; //4 uimsbf
                private_bit;              //1 bslbf
                channel_configuration;    //3 uimsbf
                original / copy;          //1 bslbf
                home;                     //1 bslbf
            }

            adts_variable_header()
            {
                copyright_identification_bit;       // 1 bslbf
                copyright_identification_start;     // 1 bslbf
                frame_length;                       // 13 bslbf
                adts_buffer_fullness;               // 11 bslbf
                number_of_raw_data_blocks_in_frame; // 2 uimsfb
            }

            if (number_of_raw_data_blocks_in_frame == 0)
            {
                adts_error_check()
                {
                    if (protection_absent == '0')
                        crc_check; // 16 rpchof
                }
                raw_data_block();
            }
            else
            {
                adts_header_error_check()
                {
                    if (protection_absent == '0')
                    {
                        for (i = 1; i <= number_of_raw_data_blocks_in_frame; i++)
                        {
                            raw_data_block_position[i]; //16 uimsfb
                        }
                        crc_check; //16 rpchof
                    }
                }

                for (i = 0; i <= number_of_raw_data_blocks_in_frame; i++)
                {
                    raw_data_block()
                    {
                        while ((id = id_syn_ele) != ID_END) // id_syn_ele  3 uimsbf
                        {
                            switch (id)
                            {
                            case ID_SCE:
                                single_channel_element();
                                break;
                            case ID_CPE:
                                channel_pair_element();
                                break;
                            case ID_CCE:
                                coupling_channel_element();
                                break;
                            case ID_LFE:
                                lfe_channel_element();
                                break;
                            case ID_DSE:
                                data_stream_element();
                                break;
                            case ID_PCE:
                                program_config_element()
                                {
                                    element_instance_tag;       // 4 uimsbf
                                    object_type;                // 2 uimsbf
                                    sampling_frequency_index;   // 4 uimsbf
                                    num_front_channel_elements; // 4 uimsbf
                                    num_side_channel_elements;  // 4 uimsbf
                                    num_back_channel_elements;  // 4 uimsbf
                                    num_lfe_channel_elements;   // 2 uimsbf
                                    num_assoc_data_elements;    // 3 uimsbf
                                    num_valid_cc_elements;      // 4 uimsbf

                                    mono_mixdown_present 1 uimsbf if (mono_mixdown_present == 1)
                                        mono_mixdown_element_number; // 4 uimsbf
                                    stereo_mixdown_present;          // 1 uimsbf
                                    if (stereo_mixdown_present == 1)
                                        stereo_mixdown_element_number; // 4 uimsbf
                                    matrix_mixdown_idx_present;        // 1 uimsbf
                                    if (matrix_mixdown_idx_present == 1)
                                    {
                                        matrix_mixdown_idx;     // 2 uimsbf
                                        pseudo_surround_enable; // 1 uimsbf
                                    }
                                    for (i = 0; i < num_front_channel_elements; i++)
                                    {
                                        front_element_is_cpe[i];     // 1 bslbf
                                        front_element_tag_select[i]; // 4 uimsbf
                                    }
                                    for (i = 0; i < num_side_channel_elements; i++)
                                    {
                                        side_element_is_cpe[i];     // 1 bslbf
                                        side_element_tag_select[i]; // 4 uimsbf
                                    }
                                    for (i = 0; i < num_back_channel_elements; i++)
                                    {
                                        back_element_is_cpe[i];     // 1 bslbf
                                        back_element_tag_select[i]; // 4 uimsbf
                                    }
                                    for (i = 0; i < num_lfe_channel_elements; i++)
                                        lfe_element_tag_select[i]; // 4 uimsbf
                                    for (i = 0; i < num_assoc_data_elements; i++)
                                        assoc_data_element_tag_select[i]; // 4 uimsbf
                                    for (i = 0; i < num_valid_cc_elements; i++)
                                    {
                                        cc_element_is_ind_sw[i];        // 1 uimsbf
                                        valid_cc_element_tag_select[i]; // 4 uimsbf
                                    }
                                    byte_alignment()
                                        comment_field_bytes; // 8 uimsbf
                                    for (i = 0; i < comment_field_bytes; i++)
                                        comment_field_data[i]; // 8 uimsbf
                                }
                                break;
                            case ID_FIL:
                                fill_element();
                            }
                        }
                        byte_alignment();
                    }

                    adts_raw_data_block_error_check()
                    {
                        if (protection_absent == '0')
                            crc_check; // 16 rpchof
                    }
                }
            }
        }
    }
}
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
AAC(Advanced Audio Coding)是一种音频数据压缩格式,它采用更高效的编码算法,在保留音质的同时减小文件大小。AAC格式广泛用于各种音频播放设备和平台上,如音乐播放器、手机、电视和流媒体服务等。 在测试AAC格式时,我们可以使用不同的音频文件进行试验。首先,我们可以选择一首音频文件,将其转换为AAC格式,并比较转换后的文件大小和音质与原始文件的差异。这可以通过使用各种音频转换工具来完成,例如iTunes。 其次,我们可以测试使用AAC格式的音频在不同设备和平台上的兼容性和播放效果。我们可以尝试在不同的音频播放器和手机上播放AAC格式的音频文件,并评估其播放质量和是否有任何问题。 另外,我们还可以测试AAC格式在网络流媒体传输中的表现。我们可以尝试通过使用不同的流媒体服务,如YouTube或Spotify,以AAC格式传输音频,并评估流畅性、延迟和音质等方面的性能。 最后,在测试AAC格式时,我们还可以比较它与其他音频格式(如MP3、WAV等)之间的差异。我们可以使用相同的音频文件转换为不同格式,并评估它们之间的文件大小、音质和兼容性等方面的差异。 总之,测试AAC格式涉及到对其文件大小、音质、兼容性和流媒体传输性能等方面的评估。这些测试可以帮助我们了解AAC格式的特点和适用性,以便在实际应用中作出合适的选择。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值