⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baseunit.c

📁 语音编结码的基本算法
💻 C
📖 第 1 页 / 共 5 页
字号:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include"baseunit.h"
#include"encoder.h"
#include"decoder.h"
/*
* g7231.c
* 2006-5-11
*/


Flag Overflow =0;
Flag Carry =0;

CODCNGDEF   CodCng;
CODSTATDEF  CodStat;
DECCNGDEF DecCng;
DECSTATDEF  DecStat;
Flag  UsePf;
VADSTATDEF  VadStat;
Flag UseHp;
Flag  UseVx;
enum  Crate  WrkRate;
enum Wmode WrkMode;

/*
**
**文件:        tab_lbc.c
**
** 描述:  G.723 编码和解码中使用的数组
**  
** 数组:      HammingWindowTable[180]
**
**              线性预测编码计算和滤波
**
**                  BinomialWindowTable[10]
**                  BandExpTable[10]
**
**              行频谱对计算和量化
**
**                  CosineTable[512]
**                  LspDcTable[10]
**                  BandInfoTable[3][2]
**                  Band0Tb8[256*3]
**                  Band1Tb8[256*3]
**                  Band2Tb8[256*4]
**                  BandQntTable[3]
**
**             感观式滤波器和后级滤波器
**

  **                  PerFiltZeroTable[10]
  **                  PerFiltPoleTable[10]
  **                  PostFiltZeroTable[10]
  **                  PostFiltPoleTable[10]
  **                  LpfConstTable[2] (pitch postfilter)
  **
  **              代数编码激发或多脉冲最大拟真量化
  **
  **                  Nb_puls[4] (MP-MLQ)
  **                  FcbkGainTable[24] (ACELP and MP-MLQ)
  **                  MaxPosTable[4]  (MP-MLQ), Word32
  **                  CombinatorialTable[6][30](MP-MLQ),Word32
  **                  epsi170[170] (ACELP)
  **                  gain170[170] (ACELP)
  **
  **              基频预测
  **
  **                  AcbkGainTable085[85*20]
  **                  AcbkGainTable170[170*20]
  **                  AcbkGainTablePtr[2]
  **
  **              Taming程序
  **
  **                  tabgain170[170]
  **                  tabgain85[85]
  **
  **              减缓噪声的产生
  **
  **                  fact[4]
  **                  L_bseg[3], Word32
  **                  base[3]
  **
  **
  **              所有的数组均为16位的,除非特殊说明
*/

/*
**  HammingWindowTable:
**
**  Hamming Window coefficients scaled by 32768 (Q15).
**
*/

Word16   HammingWindowTable[LpcFrame] = {
    2621 ,
		2631 ,
		2659 ,
		2705 ,
		2770 ,
		2853 ,
		2955 ,
		3074 ,
		3212 ,
		3367 ,
		3541 ,
		3731 ,
		3939 ,
		4164 ,
		4405 ,
		4663 ,
		4937 ,
		5226 ,
		5531 ,
		5851 ,
		6186 ,
		6534 ,
		6897 ,
		7273 ,
		7661 ,
		8062 ,
		8475 ,
		8899 ,
		9334 ,
		9780 ,
		10235 ,
		10699 ,
		11172 ,
		11653 ,
		12141 ,
		12636 ,
		13138 ,
		13645 ,
		14157 ,
		14673 ,
		15193 ,
		15716 ,
		16242 ,
		16769 ,
		17298 ,
		17827 ,
		18356 ,
		18884 ,
		19411 ,
		19935 ,
		20457 ,
		20975 ,
		21489 ,
		21999 ,
		22503 ,
		23002 ,
		23494 ,
		23978 ,
		24455 ,
		24924 ,
		25384 ,
		25834 ,
		26274 ,
		26704 ,
		27122 ,
		27529 ,
		27924 ,
		28306 ,
		28675 ,
		29031 ,
		29373 ,
		29700 ,
		30012 ,
		30310 ,
		30592 ,
		30857 ,
		31107 ,
		31340 ,
		31557 ,
		31756 ,
		31938 ,
		32102 ,
		32249 ,
		32377 ,
		32488 ,
		32580 ,
		32654 ,
		32710 ,
		32747 ,
		32766 ,
		32766 ,
		32747 ,
		32710 ,
		32654 ,
		32580 ,
		32488 ,
		32377 ,
		32249 ,
		32102 ,
		31938 ,
		31756 ,
		31557 ,
		31340 ,
		31107 ,
		30857 ,
		30592 ,
		30310 ,
		30012 ,
		29700 ,
		29373 ,
		29031 ,
		28675 ,
		28306 ,
		27924 ,
		27529 ,
		27122 ,
		26704 ,
		26274 ,
		25834 ,
		25384 ,
		24924 ,
		24455 ,
		23978 ,
		23494 ,
		23002 ,
		22503 ,
		21999 ,
		21489 ,
		20975 ,
		20457 ,
		19935 ,
		19411 ,
		18884 ,
		18356 ,
		17827 ,
		17298 ,
		16769 ,
		16242 ,
		15716 ,
		15193 ,
		14673 ,
		14157 ,
		13645 ,
		13138 ,
		12636 ,
		12141 ,
		11653 ,
		11172 ,
		10699 ,
		10235 ,
		9780 ,
		9334 ,
		8899 ,
		8475 ,
		8062 ,
		7661 ,
		7273 ,
		6897 ,
		6534 ,
		6186 ,
		5851 ,
		5531 ,
		5226 ,
		4937 ,
		4663 ,
		4405 ,
		4164 ,
		3939 ,
		3731 ,
		3541 ,
		3367 ,
		3212 ,
		3074 ,
		2955 ,
		2853 ,
		2770 ,
		2705 ,
		2659 ,
		2631 ,
		2621 ,
   } ;
   
   /*
   **  BinomialWindowTable:
   **
   **  Purpose:
   **     Binomial Window coefficients used to weight the autocorrelation before
   **     Levinson-Durbin in the LPC coefficient calculation.  
   **
   **     Table Structure:
   **     Coefficients are scaled by 32768 (Q15).
   **
   */
   
   Word16   BinomialWindowTable[LpcOrder] = {
	   32749 ,
		   32695 ,
		   32604 ,
		   32477 ,
		   32315 ,
		   32118 ,
		   31887 ,
		   31622 ,
		   31324 ,
		   30995 ,
   } ;
   
   /*
   **  BandExpTable:
   **
   **  Purpose:
   **      Do bandwidth expansion on the LPC coefficients by scaling the
   **      poles of the LPC synthesis filter by a factor of 0.994
   
	 **
	 **  Table Structure:
	 **      Table values correspond to (0.994) to the power of x,
	 **      where x = [0,..,10].
	 **      These values are scaled by 32768 (Q15).
	 **
   */
   
   Word16   BandExpTable[LpcOrder] = {
	   32571 ,  
		   32376 ,
		   32182 ,
		   31989 ,
		   31797 ,
		   31606 ,
		   31416 ,
		   31228 ,
		   31040 ,
		   30854 ,
   } ;
   
   /*
   **  CosineTable:
   **
   **  Purpose:
   **      Used to evaluate polynomial for LSP-LPC conversion
   **
   **  Table Structure:
   **      Contains one period of a cosine wave.  Amplitude has been
   **      scaled to go between 0 and 16384 instead of 0 and 1.
   **
   */
   
   Word16   CosineTable[CosineTableSize] = {
	   16384 ,
		   16383 ,
		   16379 ,
		   16373 ,
		   16364 ,
		   16353 ,
		   16340 ,
		   16324 ,
		   16305 ,
		   16284 ,
		   16261 ,
		   16235 ,
		   16207 ,
		   16176 ,
		   16143 ,
		   16107 ,
		   16069 ,
		   16029 ,
		   15986 ,
		   15941 ,
		   15893 ,
		   15843 ,
		   15791 ,
		   15736 ,
		   15679 ,
		   15619 ,
		   15557 ,
		   15493 ,
		   15426 ,
		   15357 ,
		   15286 ,
		   15213 ,
		   15137 ,
		   15059 ,
		   14978 ,
		   14896 ,
		   14811 ,
		   14724 ,
		   14635 ,
		   14543 ,
		   14449 ,
		   14354 ,
		   14256 ,
		   14155 ,
		   14053 ,
		   13949 ,
		   13842 ,
		   13733 ,
		   13623 ,
		   13510 ,
		   13395 ,
		   13279 ,
		   13160 ,
		   13039 ,
		   12916 ,
		   12792 ,
		   12665 ,
		   12537 ,
		   12406 ,
		   12274 ,
		   12140 ,
		   12004 ,
		   11866 ,
		   11727 ,
		   11585 ,
		   11442 ,
		   11297 ,
		   11151 ,
		   11003 ,
		   10853 ,
		   10702 ,
		   10549 ,
		   10394 ,
		   10238 ,
		   10080 ,
		   9921  ,
		   9760  ,
		   9598  ,
		   9434  ,
		   9269  ,
		   9102  ,
		   8935  ,
		   8765  ,
		   8595  ,
		   8423  ,
		   8250  ,
		   8076  ,
		   7900  ,
		   7723  ,
		   7545  ,
		   7366  ,
		   7186  ,
		   7005  ,
		   6823  ,
		   6639  ,
		   6455  ,
		   6270  ,
		   6084  ,
		   5897  ,
		   5708  ,
		   5520  ,
		   5330  ,
		   5139  ,
		   4948  ,
		   4756  ,
		   4563  ,
		   4370  ,
		   4176  ,
		   3981  ,
		   3786  ,
		   3590  ,
		   3393  ,
		   3196  ,
		   2999  ,
		   2801  ,
		   2603  ,
		   2404  ,
		   2205  ,
		   2006  ,
		   1806  ,
		   1606  ,
		   1406  ,
		   1205  ,
		   1005  ,
		   804   ,
		   603   ,
		   402   ,
		   201   ,
		   0     ,
		   -201  ,
		   -402  ,
		   -603  ,
		   -804  ,
		   -1005 ,
		   -1205 ,
		   -1406 ,
		   -1606 ,
		   -1806 ,
		   -2006 ,
		   -2205 ,
		   -2404 ,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -