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 ...
随机推荐
- svn error: "Previous operation has not finished; run 'cleanup' if it was interrupted"
出现这种问题,有几个原因 1.本身文件确实是锁住了 2.之前clean up 过很多次,但是每次都可能以失败告终,造成work queue存在缓存队列 3.svn lock 有lock记录 以下是简单 ...
- H5-安卓和ios调用相机和相册
<input v-if="ipshow" type="file" accept="image/*" name="file1& ...
- php 字符串常用函数
数组.字符串和数据库是我们函数里面最.最.最常用的三类函数. 当然PHP的字符串函数也有很多.我们最常使用的两个系列的字符串: 1.单字节字符串处理函数 2.多字节字符串处理函数 3.字符串编码转换函 ...
- redis看这一篇就够了
redis的下载安装 准备相关依赖 yum install gcc 下载安装包 # 切换到存放安装包到目录 cd /usr/local # 下载安装包 wget http://download.red ...
- Spark Streaming数据限流简述
Spark Streaming对实时数据流进行分析处理,源源不断的从数据源接收数据切割成一个个时间间隔进行处理: 流处理与批处理有明显区别,批处理中的数据有明显的边界.数据规模已知:而流处理数 ...
- Vue中axios有关请求头的几点小结
在Vue前端中向后端发起http请求会有着两种写法:一种是在vue文件中直接导入axios模板,另外一种是使用Vue的属性$http. 1.在第一种方式中,在同一个工程中所添加的vue文件直接使用ax ...
- [CF91B] Queue - 权值线段树
有n个人在队列中等待.假如某个人前面有一个人年龄比他小,那他就会不高兴:定义他的"不高兴度"为他前面留他最远的年龄比他小的人与他的距离,求每个人的不高兴度. n<=10^5 ...
- Linux - mysql 异常: ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
问题描述 ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists 解决方案 删除:/var/lock/su ...
- SpringBoot学习- 7、问题Could not autowire. No beans of 'xxxx' type found处理
SpringBoot学习足迹 这个问题网上有好多同学都提到这个问题,代码可以运行,但是就是有红线,强迫症不能忍 自己试验下 1.增加一个final编译一下,再删掉就不会出红线了 public clas ...
- JUC-线程间通信
面试题: 两个线程,一个线程打印1-52,另一个打印字母A-Z打印顺序为12A34B...5152Z, 要求用线程间通信 线程间通信:1.生产者+消费者2.通知等待唤醒机制 多线程编程模版中 1.判断 ...