AAC在对PCM数据进行编码时,使用window取出1024或128个数据进行MDCT转换到频域。

Window的相关信息记录在ics_info中:

关于ics_info中各个字段的含义如下

window sequence的类别如Table 44,long_sequence/start_sequence/stop_sequence包含1个window,short_sequence包含8个short window。

在一个window中包含的scalefactor band 依赖于fs.

对于48k来说long_window/long_start_window/long_stop_window中包含49个scalfactor band.window中的 频谱系数个数为1024.

而short window中包含14个scalefactor band,short window中的频谱系数个数为128.

Table 45为long_window的scalefactor band信息。

Scalefactor:Factor by which a set of values is scaled before quantization.
Scalefactor band:A set of spectral coefficients which are scaled by one scalefactor.

The basic method to adjust the quantization noise in the frequency domain is the noise shaping using scalefactors. For this purpose the spectrum is divided in several groups of spectral coefficients called scalefactor bands which share one scalefactor (see subclause 8.3.4). A scalefactor represents a gain value which is used to change the amplitude of all spectral coefficients in that scalefactor band. This mechanism is used to change the allocation of the quantization noise in the spectral domain generated by the non uniform
quantizer.

The width of the scalefactor bands is built in imitation of the critical bands of the human auditory system. For that reason the number of scalefactor bands in a spectrum and their width depend on the transform length and the sampling frequency.

The spectral coefficients are divided into scalefactor bands that contain a multiple of 4 quantized spectral coefficients. Each scalefactor band has a scalefactor.

num_swb_long_window:long window中scalefactor band的个数。

swb:window中scalefactor band的index.

swb_offset_long_window:long window中,scalefactor band中最小频谱系数的index。比如第0个scalefactor band包含4个频谱系数,最小频谱系数的index为0,那第一个scalefactor band的最小频谱系数的index为4.

window信息相关的字段含义如下:

对于long_sequence而言,window group为1,window group中只包含一个window.

对于short_sequence而言,可能包含多个window group,但所有window group中包含的window总数为8,window group信息和每个window group包含的window个数信息由scale factor_grouping算出。

下面是short window grouping的example.

包含4个window group, group划分由grouping_bits决定,当bit为1时,当前window在同一个window group中,window_group_length 加1,如果bit为0,当前window是在一个新的window group中,num_window_groups 加1,window_group_length等于1.

为进一步提高压缩率,AAC将一个window group中的所有的scalefactor band划分为几个section,每个section使用同一个huffman codebook.

Note that the length of a section is given in scalefactor bands rather than scalefactor window bands

section的划分使得原本码流的层次结构[g][win][sfb][coeff]变成[g][sect][sfb][coeff]

section划分信息包含在section_data()中:

sect_cb[g][i]: group g的第i个huffman table.

sect_len:section中包含的scalefactor个数。

sect_len_incr:用于计算sect_len的字段,short window为3 bit, long_window为5bit。当sect_len_incr==sect_esc_val时,sect_len加sect_esc_val.

sect_start/sect_end:表示当前section的起始和结束的scalfactor的index。sect_start和sect_end之间的scalefactor使用同一个huffman table.

num_sec[g]:group中section的个数。

scalefactor是在频域调节量化后带来的noise最基本的方法。为了这个目的,频谱被分为几个scalefactor band,每一个scalefactor band使用一个scalefactor.

scalefactor 是scalefactor band中频谱系数的gain value。

scalefactor的信息在scale_factor_data()中获取。

hcod_sf为scalefactor的codeword.

dpcm_sf为差分后的scalefactor.

scalefactor是采用差分方式进行编码的,即第一个scalefactor减去global_gain后编码,其后的scalefactor减去前一个scalefactor后编码。

scalefactor解码过程如下:

在码流信息中获取到scalfactor的codeword后,查找huffman codebook,获取到codeword的index,差分后的scalefactor为index-index_offset. index_offset固定为-60.

频谱系数信息包含在spectral_data()中:

hcod为编码4/2元组频谱系数的codeword。

在码流中读出频谱系数的codeword后,查huffman codebook,获取到codeword对应的index, 通过index可以计算出量化后的频谱系数(w,x,y,z),最大的量化频谱系数为8192

huffman解码出来的量化的频谱系数,需要进行反量化:

反量化的过程如下:

反量化的频谱系数为通过scalefactor进行scale后的频谱系数,在解码时,需要rescale还原真正的频谱系数x_rescale。

gain和scalefactor之间的关系为:

AAC 码流信息分析的更多相关文章

  1. 【雷神源码解析】无基础看懂AAC码流解析,看不懂你打我

    一 前言 最近在尝试学习一些视频相关的知识,随便一搜才知道原来国内有雷神这么一个真正神级的人物存在,尤其是在这里(传送门)看到他的感言更是对他膜拜不已,雷神这种无私奉献的精神应当被我辈发扬光大.那写这 ...

  2. H264码流打包分析(精华)

    H264码流打包分析 SODB 数据比特串-->最原始的编码数据 RBSP 原始字节序列载荷-->在SODB的后面填加了结尾比特(RBSP trailing bits 一个bit“1”)若 ...

  3. (转)MPEG4码流简单分析

    把MPEG4码流的分析和它的I,P,B Frame的判定方法在这里简要记录一下吧,供日后的翻看和大家的参考.   测试解码器测试了很久,由于需要将H264和MPEG4的码流进行分析和判断,并逐帧输入解 ...

  4. 【转】打包AAC码流到FLV文件

    AAC编码后数据打包到FLV很简单.1. FLV音频Tag格式                              字节位置    意义0x08,                         ...

  5. H264码流打包分析

    转自:http://www.360doc.com/content/13/0124/08/9008018_262076786.shtml   SODB 数据比特串-->最原始的编码数据 RBSP ...

  6. 将h264和aac码流合成flv文件

    在视频应用中,经常需要将接收到h264和aac数据保存成文件. 本来想用mp4格式,但是mp4在没有正常关闭的情况下会导致文件打不开,而在实际应用中经常会出现设备直接拔电,程序不是正常结束的情况.于是 ...

  7. 打包AAC码流到FLV文件

    AAC编码后数据打包到FLV很简单. 1. FLV音频Tag格式                              字节位置    意义0x08,                       ...

  8. aac adts & LATM封装码流分析

    本文继续上一篇文章的内容,介绍一个音频码流处理程序.音频码流在视频播放器中的位置如下所示. 本文中的程序是一个AAC码流解析程序.该程序可以从AAC码流中分析得到它的基本单元ADTS frame,并且 ...

  9. 视音频数据处理入门:AAC音频码流解析

    ===================================================== 视音频数据处理入门系列文章: 视音频数据处理入门:RGB.YUV像素数据处理 视音频数据处理 ...

随机推荐

  1. 使用Dockerfile构建镜像命令自己的理解

    1.FROM 基于那个基础命令开始构建镜像,我的理解就是选择一个操作系统 2.CMD 里面放的是指定一个容器启动时要运行的命令 3.ENTRYPOINT 类似于CDM命令,不过 docker run ...

  2. 题解 AT3717 【[ABC081A] Placing Marbles】

    题目传送门. 分析 我们可以把字符串中所有数加起来输出,那么到底怎么把一个字符变成一个数字呢.我们只需要减去字符\(0\)就可以了. 详细步骤 定义字符串\(s\)并将其输入. string s; c ...

  3. ACM-ICPC 2018 焦作赛区网络预赛 Give Candies 题解

    ACM-ICPC 2018 焦作赛区网络预赛 Give Candies n个糖果分给n个小朋友 从1到n个小朋友依次给,每次随机给个数,至少一个,知道没有糖果为止. 问糖果的分布情况方案数. 输出方案 ...

  4. Excel如何快速选定所需数据区域

    在使用Excel处理数据时,快速选定所需数据区域的一些小技巧. 第一种方法:(选定指定区域) Ctrl+G调出定位对话框,在[引用位置]处输入A1:E5000,点击[确定]即可.  第二种方法:(选定 ...

  5. 安装SQL Server2008出现Restart computer failed的解决办法

    1.打开注册表编辑器 2.找到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager双击文件夹 3.找到PendingF ...

  6. CSS一些特殊图形

    CSS一些特殊图形 CSS绘制三角形 通过控制元素的border属性可以实现三角形效果; 首先来设置4个边框, 为50px solid [color] color设置成不同的颜色值看一下效果 < ...

  7. The view or its master was not found or no view engine supports the searched locations

    Error like:The view 'LoginRegister' or its master was not found or no view engine supports the searc ...

  8. Linux DataGuard --

      概述 Oracle Data Guard 是针对企业数据库的最有效和最全面的数据可用性.数据保护和灾难恢复解决方案.它提供管理.监视和自动化软件基础架构来创建和维护一个或多个同步备用数据库,从而保 ...

  9. PP: Think globally, act locally: A deep neural network approach to high-dimensional time series forecasting

    Problem: high-dimensional time series forecasting ?? what is "high-dimensional" time serie ...

  10. 一步步教你如何在Ubuntu虚拟机中安装QEMU并模拟模拟arm 开发环境(一)uImage u-boot(转)

    初次接触qemu是因为工作的需要,有时候下了班,可能需要在家研究一些东西,因为博主用到arm环境,这时候博主比较小气,不愿花钱买开发板,当然博主在这里给大家的建议是,如果要真正学懂arm构架的相关知识 ...