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的更多相关文章

  1. AC3 overview

    1.AC3 encode overview AC3 encoder的框图如下: AC3在频域采用粗量化(coarsely quantizing)来获取较高的压缩率. 1).输入PCM 经过MDCT变换 ...

  2. [原创]桓泽学音频编解码(13):AC3 位分配模块算法分析

    [原创]桓泽学音频编解码(1):MPEG1 MP3 系统算法分析 [原创]桓泽学音频编解码(2):AC3/Dolby Digital 系统算法分析 [原创]桓泽学音频编解码(3):AAC 系统算法分析 ...

  3. AC3 encoder flow

    AC3 encoder flow 如下: 1.input PCM PCM在进入encoder前会使用high pass filter来移除信号的DC部分来达到更有效的编码. 2.Transient d ...

  4. .NET 对接JAVA 使用Modulus,Exponent RSA 加密

    最近有一个工作是需要把数据用RSA发送给Java 虽然一开始标准公钥 net和Java  RSA填充的一些算法不一样 但是后来这个坑也补的差不多了 具体可以参考 http://www.cnblogs. ...

  5. 如何优化coding

    如何优化coding 前言 最近一直在做修改bug工作,修改bug花费时间最多的不是如何解决问题而是怎样快速读懂代码.如果代码写的好的,不用debug就可以一眼看出来哪里出了问题.实际上,我都要deb ...

  6. 使用 Code Snippet 简化 Coding

    在开发的项目的时候,你是否经常遇到需要重复编写一些类似的代码,比如是否经常会使用 for.foreach ? 在编写这两个循环语句的时候,你是一个字符一个字符敲还是使用 Visual Studio 提 ...

  7. 如何将本地项目与coding.net/github上的项目绑定

      得到coding.net/github项目的ssh协议地址 形如:·git@git.coding.net:wzw/leave-a-message.git· 在本地生成公钥 输入 ssh-keyge ...

  8. 将本地项目提交到coding上托管

    1:   注册coding并新建项目test2:在终端 cd 到要提交的项目  使用git init创建.git文件夹3:使用git pull  <项目地址>https的那个4:git a ...

  9. Block Markov Coding & Decoding

    Block Markov coding在一系列block上进行.在除了第一个和最后一个block上,都发送一个新消息.但是,每个block上发送的码字不仅取决于新的信息,也跟之前的一个或多个block ...

随机推荐

  1. bootstrap-table中时间戳转换为日期格式。

    { field: 'createdTime', title: '创建时间', formatter: function (value, row, index) { return changeDateFo ...

  2. 搜索 rerank : learn to rank 算法

    (1)LambdaMART 算法可参考如下两篇博客: http://www.cnblogs.com/wowarsenal/p/3900359.html http://www.cnblogs.com/w ...

  3. CSS 美化网页元素

    一.为什么使用CSS 1.有效的传递页面信息 2.使用CSS美化过的页面文本,使页面漂亮.美观,吸引用户 3.可以很好的突出页面的主题内容,使用户第一眼可以看到页面主要内容 4.具有良好的用户体验 二 ...

  4. 深入浅出Mybatis系列三-配置详解之properties与environments(mybatis源码篇)

    注:本文转载自南轲梦 注:博主 Chloneda:个人博客 | 博客园 | Github | Gitee | 知乎 上篇文章<深入浅出Mybatis系列(二)---配置简介(mybatis源码篇 ...

  5. vue的$nextTick

    https://segmentfault.com/a/1190000012861862 简单来说:如果你修改了某个dom中的数据,视图并不会立即更新.Vue 实现响应式并不是数据发生变化之后 DOM ...

  6. 报表平台需求文档(V0.0.0.1)

    功能实现和发布版本严格遵照文档上内容. 1    主框架搭建 前端 样式模仿“钉钉工作台“ 2   前端页面 A  数据库配置页面 (1) 本系统(必须)[存入配置文件] 数据库配置 (2) 其他数据 ...

  7. 实用沙盒工具 —— VMware Workstation15安装教程

    一:简介 VMware Workstation(中文名"威睿工作站")是一款功能强大的桌面虚拟计算机软件,提供用户可在单一的桌面上同时运行不同的操作系统,和进行开发.测试 .部署新 ...

  8. 2020牛客寒假算法基础集训营1 I-nico和niconiconi

    #include <bits/stdc++.h> #define dbg(x) cout << #x << "=" << x < ...

  9. Spring boot unable to determine jdbc url from datasouce

    1. 首先删除 @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class}) 2. 在配置文件里添加完整的dataso ...

  10. phpstorm对比代码

    方法一 首先在phpstorm中左侧的资源管理器中,按住键盘上的CTRL键选中两个文件,然后鼠标右键,点击菜单中的"Compare Tow Files",就可以了,如下图 方法二 ...