AC3 exponent coding
1.overview
AC-3编码的audio信号中的频率系数由浮点型数据表示,并将其归一化到0~1之间。
transform coefficient由exponent和mantissa组成。
设transform coefficient为a, 0<a<1,则可使a=m*2^(-exp), 其中m为mantissa,0<m<1, exp为exponent(注意不是-exp)。可以理解为将a用二进制小数表示,小数点与小数点后第一个1之间的0的个数便为exponent.
例如transform coefficient为-10db(0.316),二进制表示为0.0101B,那exponent为1,mantissa为101B.
exponent是5 bit,范围为0~24.当exponent大于24时,将exponent固定为24,那么对应的mantissa可以包含leading zero.可表示的频谱系数为0~-144db(以6 db为一个step)。0~-6db exponent 为0,-6db~-12db exponent为1,-12db~-18db exponent为2.....
由于每个frame的audio information都是独立的,并不共享。所以每个frame的block 0都会是一组新的exponents,exponent信息可以在同一个frame中共享,所以block 1~5可能会共用前一个block的exponent。
一个audio block中的diffrential exponent利用exponent strategy组合成group,有3中exponent strategy:D15,D25,D45.
AC-3 audio block包含两种类型的exponent信息,一种是每个channel使用的exponent strategy,一种是需要新exponent的channel的编码exponent。
2.exponent strategy
exponent采用差分编码方式来提高压缩率,在fbw or lfe ch的第一个exponent用4bit表示,其范围是0~15,如果exponent大于15,也将exponent限制成15.接下来的differential exponent(差分值)表示,其真正的exponent为上一个exponent加上diffrential exponent。
如下图所示,横坐标为frequency bin, 纵坐标为transform coefficient的level(以DBFS为单位)
每一个diffrential exponent被限定为-2,-1,0,+1,+2这5个值,即允许相邻frequecy bin的两个exponent的差最大为+/-12db。
这5个值需要map到无符号数,每个值加2,map成0,1,2,3,4。由于采用diffrential coding,只需要3 bit来coding diffrential value,而不需要5bit来 coding每个 exponent.
mapped value以5进制组合成一个7bit的group value.使用group策略,用7 bit可以表示3个exponent,每个exponent占用7/3=2.33 bits.
exponent strategy包含3种:D15,D25,D45. 5表示group value使用5进制,1/2/4表示 使用同一个mapped value(M1/M2/M3)的diffrential exponets的个数。
coded 7 bit group value = 25 * M1 + 5 * M2 + M3.
以D45为例,group value 为44,第一个exponent为6. M1=1, M2=3, M3=4.
exp1 = exp2 = exp3 = exp4 = 6 + (1 -2) = 5
exp5 = exp6 = exp7 = exp8 = exp4+ (3-2) = 6;
exp9 = exp10 = exp11 = exp12 = exp8 + (4-2) = 8;
使用D25,每个exponent占用7/3/2=1.17 bits.
使用D45,每个exponent占用7/3/4=0.58 bits.
exponent使用D15/D25/D45 是frequecy sharing 方式来增加压缩率,除此之外,还可以使用exponent sharing cross time.许多audio signal在一个frame内(time period)是stationary的,紧邻的几个transform block具有similar spectral contents,即similar exponent value.因此可以只transmit第一个block的exponent,其他5个block reuse第一个block的exponent.如果使用D45,并且time sharing,每个exponent占用0.1bits.
3. exponent decoding
1)从bitstream中读出exponent strategy.
coupled channel和independent channel的exponent strategy由bitstream的占有2bit的字段chexpstr[ch]来标识,coupling channel由chexpstr标识, lfe ch由lfeexpstr标识。
2)确定exponent的起止频率.
在bitstream中,紧接着exponent strategy后面的是一组chbwcod[ch](channel bandwidth codes),只有在当前audio block中有new exponent的independent channel(channel not coupling) 有chbwcod[ch], channel bandwidth code定义了end mantissa bin(bin表示频率,比如256个频谱系数,对应256个频率bin)的个数。 end mantissa bin表示的是exponent的截止频率.
independent channel & coupped channel
截至频率:endmant[ch] = ((chbwcod[ch] + 12) * 3) + 37; (ch not coupled)
截至频率:endmant[ch] = cplstrtmant;(ch is coulped)
起始频率:strtmant[ch] = 0
lfe channel:
起始频率:lfestrtmant = 0
截至频率:lfeendmant = 7
coupling channel:
起始频率:cplstrtmant = (cplbegf * 12) + 37
截至频率:cplendmant = ((cplendf + 3) * 12) + 37
其中cplbegf,cplendf,cplstrtmant是coupling strategy infomation,在coupling中做介绍。
3)解码exponent.
coded exponent包含在exps[ch][grp](independent channel & coupped channel),clpexps[grp](coupling channel),lfeexps[grp]等字段中。
exps[ch][0]和lfeexps[0]是第一个频率系数(bin #0)的exponents(The first absolute exponent),是一个4bit的值,被限制为0~15。cplabsexp是coupling channel用来的decoding diffrential exponent的absolute exponent.
计算每个channel内有多少组(不包含第一个absolute exponent)7位的bit group value的算法是
independent channel & coupled channel:
nchgrps[ch] = truncate {(endmant[ch] – 1) / 3} ; /* for D15 mode */
= truncate {(endmant[ch] – 1 + 3) / 6} ; /* for D25 mode */
= truncate {(endmant[ch] - 1 + 9) / 12} ; /* for D45 mode */
lfe channel:
nlfegrps = 2
coupling channel:
ncplgrps = (cplendmant – cplstrtmant) / 3 ; /* for D15 mode */
= (cplendmant – cplstrtmant) / 6 ; /* for D25 mode */
= (cplendmant – cplstrtmant) / 12 ; /* for D45 mode */
接下来group value解码出exponent:
a)通过group value转换成Mapped value:
M1 = truncate (gexp / 25)
M2 = truncate {(gexp % 25} / 5)
M3 = (gexp % 25) % 5
其中gexp为 lfeexps, cplexps, exps
b)Mapped value转换成differentail exponents:
dexp = M - 2;
M为M1,M2,M3
c)absolute exponent 为前一个absolute exponent 加上differential exponent
exp[n] = exp[n-1] + dexp[n]
d)对于D25,D45,相邻的2/4个exp相同。
对于coupling channel
Clpexp[n]+cplstrmant=exp[n].
伪代码如下:
AC3 exponent coding的更多相关文章
- AC3 overview
1.AC3 encode overview AC3 encoder的框图如下: AC3在频域采用粗量化(coarsely quantizing)来获取较高的压缩率. 1).输入PCM 经过MDCT变换 ...
- [原创]桓泽学音频编解码(13):AC3 位分配模块算法分析
[原创]桓泽学音频编解码(1):MPEG1 MP3 系统算法分析 [原创]桓泽学音频编解码(2):AC3/Dolby Digital 系统算法分析 [原创]桓泽学音频编解码(3):AAC 系统算法分析 ...
- AC3 encoder flow
AC3 encoder flow 如下: 1.input PCM PCM在进入encoder前会使用high pass filter来移除信号的DC部分来达到更有效的编码. 2.Transient d ...
- .NET 对接JAVA 使用Modulus,Exponent RSA 加密
最近有一个工作是需要把数据用RSA发送给Java 虽然一开始标准公钥 net和Java RSA填充的一些算法不一样 但是后来这个坑也补的差不多了 具体可以参考 http://www.cnblogs. ...
- 如何优化coding
如何优化coding 前言 最近一直在做修改bug工作,修改bug花费时间最多的不是如何解决问题而是怎样快速读懂代码.如果代码写的好的,不用debug就可以一眼看出来哪里出了问题.实际上,我都要deb ...
- 使用 Code Snippet 简化 Coding
在开发的项目的时候,你是否经常遇到需要重复编写一些类似的代码,比如是否经常会使用 for.foreach ? 在编写这两个循环语句的时候,你是一个字符一个字符敲还是使用 Visual Studio 提 ...
- 如何将本地项目与coding.net/github上的项目绑定
得到coding.net/github项目的ssh协议地址 形如:·git@git.coding.net:wzw/leave-a-message.git· 在本地生成公钥 输入 ssh-keyge ...
- 将本地项目提交到coding上托管
1: 注册coding并新建项目test2:在终端 cd 到要提交的项目 使用git init创建.git文件夹3:使用git pull <项目地址>https的那个4:git a ...
- Block Markov Coding & Decoding
Block Markov coding在一系列block上进行.在除了第一个和最后一个block上,都发送一个新消息.但是,每个block上发送的码字不仅取决于新的信息,也跟之前的一个或多个block ...
随机推荐
- PAT (Advanced Level) Practice 1008 Elevator (20 分) (模拟)
The highest building in our city has only one elevator. A request list is made up with N positive nu ...
- u盘变成Read-only file system
先查看U盘的设备号,然后修改后重新挂载 fdisk -l sudo dosfsck -v -a /dev/sdb4
- 我的第一个原生Web Components——滑块(SingleSlider)
写着写着,就会跑偏,没错又走上了一个岔道……就是不知道这条岔道以后会不会越来越宽,有的说他是未来,有的说…… 这里不知道,也不做什么评断.减少一些重复性的工作,提高开发效率这是最根本的.说白了就是偷懒 ...
- c# 调用c++类库控制usb继电器
网上找不到调用此类库的文章,简单写一下,以备后用. 下面是封装后的调用c++类库的类 public class UsbRelayDeviceHelper { /// <summary> / ...
- pytest之assert断言
assert pytest允许您使用标准Python断言来验证Python测试中的期望和值.例如,你可以写下 # content of test_assert1.py def f(): return ...
- Laradock + tp5 + nginx 配置虚拟机域名始终跳转首页/502报错
laradock默认配置文件如下: 配置运用于本地windows+phpstudy 部署的laravel项目未出现问题,如下: server { listen ; listen [::]:; serv ...
- vuejs在解析时出现闪烁的原因及防止闪烁的方法
原因: 在使用vuejs.angularjs开发时,经常会遇见在如Chrome这类能够快速解析的浏览器上出现表达式({{ express }} ),或者是模块(div)的闪烁.对于这个问题由于Java ...
- [USACO12FEB] 附近的牛 Nearby Cows - 树形dp,容斥
给你一棵 \(n\) 个点的树,点带权,对于每个节点求出距离它不超过 \(k\) 的所有节点权值和 \(m_i\) 随便定一个根,设\(f[i][j]\)表示只考虑子树,距离为\(j\)的权值和,\( ...
- pdo一次插入多条数据的2种实现方式
pdo一次插入多条数据的2种实现方式: **** 1.一个sql插入多个值,防注入处理放在获取到值的时候使用htmlspecialchars(addslashes($params )); try{ f ...
- SpringBoot学习- 7、问题Could not autowire. No beans of 'xxxx' type found处理
SpringBoot学习足迹 这个问题网上有好多同学都提到这个问题,代码可以运行,但是就是有红线,强迫症不能忍 自己试验下 1.增加一个final编译一下,再删掉就不会出红线了 public clas ...