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 ...
随机推荐
- link(外部资源关系)
规定了外部资源与当前文档的关系 常于链接样式表<link href="/media/examples/link-element-example.css" rel=" ...
- Mysql注入汇总!!!!!!!!!
师傅tpl!!!!! https://xz.aliyun.com/t/7169[对MYSQL注入相关内容及部分Trick的归类小结] https://www.jianshu.com/p/f261125 ...
- SpringBoot整合WEB开发--(十)配置AOP
简介: SpringBoot框架中对AOP有很好的支持,简单AOP概念: JoinPoint(连接点):类里面可以被增强的方法即为连接点,例如,想修改哪个方法的功能,那么该方法就是一个连接点. Poi ...
- 在java中调用mockjs生成模拟数据
一.手写版 在前端有个模拟数据的神器 Mock.js 能生成随机数据,拦截 Ajax 请求,然后我觉得他的这个生成随机数据不错.然后我就到度娘一顿操作,没找到类似的java实现,于是就有了下面的代码: ...
- CSS:display:flex详解
水平居中很容易实现,但是一般垂直居中好像不是很好实现,一般我们都会用position.left等等进行定位:但是flex很好的解决了这个问题 Flex就是"弹性布局",现在应用很多 ...
- 多项式对数函数 - NTT
#include <bits/stdc++.h> using namespace std; #define int long long const int N=4000005; // 4 ...
- 左边div固定宽度,右边div自适应撑满剩下的宽度--实现方法汇总
神奇的事 其实有的方法(float.position.margin.flex)是有border像素的差 代码如下: <!DOCTYPE html><html><head ...
- (转)预估大数据量下UV的方法
在实际应用中,我们经常碰到这种情况,即要统计某个对象或者事件独立出现的次数.对于较小的数据量,这很容易解决,我们可以首先在内存中对序列进行排序,然后扫描有序序列统计独立元素数目.其中排序时间复杂度为O ...
- OpenCV中imread失败cvLoadImage成功
MYLAF 环境说明 编程环境:Windows 10(64bit), VS2013, OpenCV 2.4.12; 编程语言:C/C++: MYLAF 现象 在代码中,调用imread读取图片失败,但 ...
- 转载:Cubic interpolation
https://www.paulinternet.nl/?page=bicubic Cubic interpolation If the values of a function f(x) and i ...