Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1313281
  • 博文数量: 860
  • 博客积分: 425
  • 博客等级: 下士
  • 技术积分: 1464
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-20 19:57
个人简介

对技术执着

文章分类

全部博文(860)

文章存档

2019年(16)

2018年(12)

2015年(732)

2013年(85)

2012年(15)

我的朋友

分类:

2015-03-14 17:09:16

:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://kware.blogbus.com/logs/30705340.html

1. 关于MP3文件的数量计算
   文件名称:            C:\JYC2005SZ\Java\Jamp3\世纪春雨-彭丽媛.mp3
   最后修改(本地):      9/7/2005 18:07:17.281
   文件格式:            mp3PRO?(FhG), MPEG Layer-3, 128 Kbps, 44100Hz, 16bits, Stereo
   文件尺寸:            2.21 MB = 2,326,528 Byte
   每帧采样点(固定):    1152 = 576 * 2 = 18 * 32 * 2
   每帧时长:            26.122 ms = 1152 / 44.1
   帧数:                5566 = int(2326528 * 8.0 / 128 / 26.122)
   每帧样本字节数(固定):144 = 1152 / 8.0
   帧长:                418 Byte = 144.0 * 128000 / 44100 = 2326528 / 5566.0
   采样点:              6,412,032 = 5566 * 1152
   未压缩状态下大小:    24.45 MB = 25,648,128 = 6,412,032 * 2 * 2
   时间长度:            2:25.397 = 6412032 / 44100 = 145.397 s
   感知熵(PE):         2.903 bps = 2326528 * 8 / 6412032 = 128000 / 44100.0

2. Huffman 解码“声道颗粒”数据
   private void huffman_decode(int ch, int gr) {
     x[0] = 0;  y[0] = 0;  v[0] = 0;  w[0] = 0;

     int part2_3_end = part2_start + si.ch[ch].gr[gr].part2_3_length;
     int num_bits, region1Start, region2Start;
     int index, buf, buf1;
     huffcodetab h;                               // Huffman 码表
                                                  // 为短块寻找区域边界
     if (si.ch[ch].gr[gr].window_switching_flag!=0 && si.ch[ch].gr[gr].block_type==2) {
                                                  // Region2, MS: Extrahandling for 8KHZ
       region1Start = (sfreq==8) ? 72 : 36;       // sfb[9/3]*3=36 or in case 8KHZ = 72
       region2Start = 576;                        // 短块没有 Region2
     } else {                                     // 为长块寻找区域边界
       buf = si.ch[ch].gr[gr].region0_count + 1;
       buf1 = buf + si.ch[ch].gr[gr].region1_count + 1;

       if (buf1 > sfBandIndex[sfreq].l.length - 1) buf1 = sfBandIndex[sfreq].l.length - 1;
       region1Start = sfBandIndex[sfreq].l[buf];  // SBI.l(si.ch.gr.region0_count)
       region2Start = sfBandIndex[sfreq].l[buf1]; // MI
     }

     index = 0;                                   // 读 bigvalues 区
     for (int i=0; i<(si.ch[ch].gr[gr].big_values<<1); i+=2) {
       if (i         h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[0]];
       else if (i         h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[1]];
       else
         h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[2]];

       huffcodetab.huffman_decoder(h, x, y, v, w, br);

       is_1d[index++] = x[0];
       is_1d[index++] = y[0];
       CheckSumHuff = CheckSumHuff + x[0] + y[0];
     }
                                                  // 读 count1 区
     h = huffcodetab.ht[si.ch[ch].gr[gr].count1table_select+32];
     num_bits = br.hsstell();
     while ((num_bits < part2_3_end) && (index < 576)) {
       huffcodetab.huffman_decoder(h, x, y, v, w, br);
       is_1d[index++] = v[0];  is_1d[index++] = w[0];
       is_1d[index++] = x[0];  is_1d[index++] = y[0];
       CheckSumHuff = CheckSumHuff + v[0] + w[0] + x[0] + y[0];
       num_bits = br.hsstell();
     }

     if (num_bits > part2_3_end) {                // 读过头,绕回
       br.rewindNbits(num_bits - part2_3_end);
       index -= 4;
     }

     num_bits = br.hsstell();
     if (num_bits < part2_3_end)                  // 解散资料位
       br.hgetbits(part2_3_end - num_bits);
     nonzero[ch] = (index < 576) ? index : 576;   // 其余为零位
     if (index < 0) index = 0;
     for (; index<576; index++) is_1d[index] = 0; // 复位 is_1d,也许无必要
   }

3. 解码器 LayerIIIDecoder 类全局属性释义
   is_1d    = new int[SBLIMIT*SSLIMIT+4];
   out_1d   = new float[SBLIMIT*SSLIMIT];
   ro       = new float[2][SBLIMIT][SSLIMIT];     // ch=2
   lr       = new float[2][SBLIMIT][SSLIMIT];     // ch=2
   prevblck = new float[2][SBLIMIT*SSLIMIT];      // ch=2
   k        = new float[2][SBLIMIT*SSLIMIT];      // ch=2 sfb=SBLIMIT*SSLIMIT=32*18=576
   nonzero  = new int[2];                         // ch=2

   III_scalefac_t    = new temporaire2[2];        // ch=2
   III_scalefac_t[0] = new temporaire2();
   III_scalefac_t[1] = new temporaire2();
   scalefac          = III_scalefac_t;

   temporaire2[] scalefac;                        //
   int max_gr, sfreq;                             // 采样频率
   int frame_start, part2_start;                  //

   sfBandIndex = new SBI[9]; // SZD: MPEG2.5 +3 indices // 采样率比例系数子带索引?
   int[] l0 = {0,   6,   12,  18,  24,  30,  36,  44,   // 子带系数 l0:长度为 cb=23 ?
               54,  66,  80,  96,  116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576 };
   int[] s0 = {0,   4,   8,   12,  18,  24,  32,  42,   // 子带系数 s0:长度为 14
               56,  74,  100, 132, 174, 192 };
   int[] l1 = {0,   6,   12,  18,  24,  30,  36,  44,
               54,  66,  80,  96,  114, 136, 162, 194, 232, 278, 330, 394, 464, 540, 576 };
   int[] s1 = {0,   4,   8,   12,  18,  26,  36,  48,
               62,  80,  104, 136, 180, 192 };

   int[] x = {0};  int[] y = {0};                 //
   int[] v = {0};  int[] w = {0};

4. common.c in FHG decoder
   /* Double and SANE Floating Point Type Definitions */
   typedef struct  IEEE_DBL_struct {
     unsigned long   hi;
     unsigned long   lo;
   } IEEE_DBL;
   typedef struct  SANE_EXT_struct {
     unsigned long   l1;
     unsigned long   l2;
     unsigned short  s1;
   } SANE_EXT;

   int  eob;            /* end of buffer index */
   int  eobs;           /* end of bit stream flag */

5. AAC与AC-3的关系
   AAC 是 MPEG-2 音频编码的一部分;
   AC-3 是杜比公司所开发的Dolby AC-3是美国ATSC标准中所采用的音频编码方法;

   AAC和AC-3都是变换编码算法,但AAC使用了分辨率更高的滤波器组,因此它可以达到更高的压缩比。另外AAC
   还使用了临时噪声重整、后向自适应线性预测、联合立体声技术和量化哈夫曼编码等最新技术, 这些新技术
   的使用都使压缩比得到进一步的提高。而且,AAC 比AC-3更灵活,它支持更多种采样率和比特率、支持1个到
   48个音轨、支持多达15个低频音轨、具有多种语言的兼容能力、还有多达15个内嵌数据流。

6. New words,terms and commands
   AIFF - Audio Interchange File Format


收藏到:Del.icio.us
阅读(385) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~