📄 ilbc_constants.java
字号:
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.media.codec.audio.ilbc;
/**
* @author Jean Lorchat
*/
class ilbc_constants {
/* general codec settings */
static float FS = (float)8000.0f;
static int BLOCKL_20MS = 160;
static int BLOCKL_30MS = 240;
static int BLOCKL_MAX = 240;
static int NSUB_20MS = 4;
static int NSUB_30MS = 6;
static int NSUB_MAX = 6;
static int NASUB_20MS = 2;
static int NASUB_30MS = 4;
static int NASUB_MAX = 4;
static int SUBL = 40;
static int STATE_LEN = 80;
static int STATE_SHORT_LEN_30MS = 58;
static int STATE_SHORT_LEN_20MS = 57;
/* LPC settings */
static int LPC_FILTERORDER = 10;
static float LPC_CHIRP_SYNTDENUM = (float)0.9025;
static float LPC_CHIRP_WEIGHTDENUM = (float)0.4222;
static int LPC_LOOKBACK = 60;
static int LPC_N_20MS = 1;
static int LPC_N_30MS = 2;
static int LPC_N_MAX = 2;
static int LPC_ASYMDIFF = 20;
static float LPC_BW = (float)60.0f;
static float LPC_WN = (float)1.0001f;
static int LSF_NSPLIT = 3;
static int LSF_NUMBER_OF_STEPS = 4;
static int LPC_HALFORDER = (LPC_FILTERORDER/2);
/* cb settings */
static int CB_NSTAGES = 3;
static int CB_EXPAND = 2;
static int CB_MEML = 147;
static int CB_HALFFILTERLEN = 4;
static int CB_FILTERLEN = 2*CB_HALFFILTERLEN;
static int CB_RESRANGE = 34;
static float CB_MAXGAIN = (float)1.3;
/* enhancer */
static int ENH_BLOCKL = 80; /* block length */
static int ENH_BLOCKL_HALF = (ENH_BLOCKL/2);
static int ENH_HL = 3; /* 2*ENH_HL+1 is number blocks
in said second sequence */
static int ENH_SLOP = 2; /* max difference estimated and
correct pitch period */
static int ENH_PLOCSL = 20; /* pitch-estimates and pitch-
locations buffer length */
static int ENH_OVERHANG = 2;
static int ENH_UPS0 = 4; /* upsampling rate */
static int ENH_FL0 = 3; /* 2*FLO+1 is the length of
each filter */
static int ENH_VECTL = (ENH_BLOCKL+2*ENH_FL0);
static int ENH_CORRDIM = (2*ENH_SLOP+1);
static int ENH_NBLOCKS = (BLOCKL_MAX/ENH_BLOCKL);
static int ENH_NBLOCKS_EXTRA = 5;
static int ENH_NBLOCKS_TOT = 8; /* ENH_NBLOCKS +
ENH_NBLOCKS_EXTRA */
static int ENH_BUFL = (ENH_NBLOCKS_TOT)*ENH_BLOCKL;
static float ENH_ALPHA0 = (float)0.05f;
/* Down sampling */
static int FILTERORDER_DS = 7;
static int DELAY_DS = 3;
static int FACTOR_DS = 2;
/* bit stream defs */
static int NO_OF_BYTES_20MS = 38;
static int NO_OF_BYTES_30MS = 50;
static int NO_OF_WORDS_20MS = 19;
static int NO_OF_WORDS_30MS = 25;
static int STATE_BITS = 3;
static int BYTE_LEN = 8;
static int ULP_CLASSES = 3;
/* help parameters */
static float DOUBLE_MAX = (float)1.0e37;
static float EPS = (float)2.220446049250313e-016;
static float PI = (float)3.14159265358979323846;
static int MIN_SAMPLE = -32768;
static int MAX_SAMPLE = 32767;
static float TWO_PI = (float)6.283185307;
static float PI2 = (float)0.159154943;
/* */
static int lsf_bits_20ms[][] = { {6,0,0,0,0}, {7,0,0,0,0}, {7,0,0,0,0},
{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}};
static int start_bits_20ms[] = {2,0,0,0,0};
static int startfirst_bits_20ms[] = {1,0,0,0,0};
static int scale_bits_20ms[] = {6,0,0,0,0};
static int state_bits_20ms[] = {0,1,2,0,0};
static int extra_cb_index_20ms[][] = {{6,0,1,0,0}, {0,0,7,0,0}, {0,0,7,0,0}};
static int extra_cb_gain_20ms[][] = {{2,0,3,0,0}, {1,1,2,0,0}, {0,0,3,0,0}};
static int cb_index_20ms[][][] = { {{7,0,1,0,0}, {0,0,7,0,0}, {0,0,7,0,0}},
{{0,0,8,0,0}, {0,0,8,0,0}, {0,0,8,0,0}},
{{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}},
{{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}};
static int cb_gain_20ms[][][] = { {{1,2,2,0,0}, {1,1,2,0,0}, {0,0,3,0,0}},
{{1,1,3,0,0}, {0,2,2,0,0}, {0,0,3,0,0}},
{{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}},
{{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}};
static int lsf_bits_30ms[][] = { {6,0,0,0,0}, {7,0,0,0,0}, {7,0,0,0,0},
{6,0,0,0,0}, {7,0,0,0,0}, {7,0,0,0,0}};
static int start_bits_30ms[] = {3,0,0,0,0};
static int startfirst_bits_30ms[] = {1,0,0,0,0};
static int scale_bits_30ms[] = {6,0,0,0,0};
static int state_bits_30ms[] = {0,1,2,0,0};
static int extra_cb_index_30ms[][] = {{4,2,1,0,0}, {0,0,7,0,0}, {0,0,7,0,0}};
static int extra_cb_gain_30ms[][] = {{1,1,3,0,0}, {1,1,2,0,0}, {0,0,3,0,0}};
static int cb_index_30ms[][][] = { {{6,1,1,0,0}, {0,0,7,0,0}, {0,0,7,0,0}},
{{0,7,1,0,0}, {0,0,8,0,0}, {0,0,8,0,0}},
{{0,7,1,0,0}, {0,0,8,0,0}, {0,0,8,0,0}},
{{0,7,1,0,0}, {0,0,8,0,0}, {0,0,8,0,0}},
{{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}},
{{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}};
static int cb_gain_30ms[][][] = { {{1,2,2,0,0}, {1,2,1,0,0}, {0,0,3,0,0}},
{{0,2,3,0,0}, {0,2,2,0,0}, {0,0,3,0,0}},
{{0,1,4,0,0}, {0,1,3,0,0}, {0,0,3,0,0}},
{{0,1,4,0,0}, {0,1,3,0,0}, {0,0,3,0,0}},
{{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}},
{{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}};
/* HP filters */
static float hpi_zero_coefsTbl[] = {(float)0.92727436f, (float)-1.8544941f, (float)0.92727436f};
static float hpi_pole_coefsTbl[] = {(float)1.0f, (float)-1.9059465f, (float)0.9114024f};
static float hpo_zero_coefsTbl[] = {(float)0.93980581f, (float)-1.8795834f, (float)0.93980581f};
static float hpo_pole_coefsTbl[] = {(float)1.0f, (float)-1.9330735f, (float)0.93589199f};
/* LP Filter */
static float lpFilt_coefsTbl[] = {(float)-0.066650, (float)0.125000,
(float)0.316650, (float)0.414063,
(float)0.316650, (float)0.125000,
(float)-0.066650};
/* State quantization tables */
static float state_sq3Tbl[] = {
(float)-3.719849, (float)-2.177490, (float)-1.130005,
(float)-0.309692, (float)0.444214, (float)1.329712,
(float)2.436279, (float)3.983887
};
static float state_frgqTbl[] = {
(float)1.000085, (float)1.071695, (float)1.140395,
(float)1.206868, (float)1.277188, (float)1.351503,
(float)1.429380, (float)1.500727, (float)1.569049,
(float)1.639599, (float)1.707071, (float)1.781531,
(float)1.840799, (float)1.901550, (float)1.956695,
(float)2.006750, (float)2.055474, (float)2.102787,
(float)2.142819, (float)2.183592, (float)2.217962,
(float)2.257177, (float)2.295739, (float)2.332967,
(float)2.369248, (float)2.402792, (float)2.435080,
(float)2.468598, (float)2.503394, (float)2.539284,
(float)2.572944, (float)2.605036, (float)2.636331,
(float)2.668939, (float)2.698780, (float)2.729101,
(float)2.759786, (float)2.789834, (float)2.818679,
(float)2.848074, (float)2.877470, (float)2.906899,
(float)2.936655, (float)2.967804, (float)3.000115,
(float)3.033367, (float)3.066355, (float)3.104231,
(float)3.141499, (float)3.183012, (float)3.222952,
(float)3.265433, (float)3.308441, (float)3.350823,
(float)3.395275, (float)3.442793, (float)3.490801,
(float)3.542514, (float)3.604064, (float)3.666050,
(float)3.740994, (float)3.830749, (float)3.938770,
(float)4.101764
};
/* CB tables */
static int search_rangeTbl[][]={{58,58,58}, {108,44,44},
{108,108,108}, {108,108,108}, {108,108,108}};
static int stMemLTbl=85;
static int memLfTbl[]={147,147,147,147};
/* expansion filter(s) */
static float cbfiltersTbl[]={
(float)-0.034180, (float)0.108887, (float)-0.184326,
(float)0.806152, (float)0.713379, (float)-0.144043,
(float)0.083740, (float)-0.033691
};
/* Gain Quantization */
static float gain_sq3Tbl[]={
(float)-1.000000, (float)-0.659973, (float)-0.330017,
(float)0.000000, (float)0.250000, (float)0.500000,
(float)0.750000, (float)1.00000};
static float gain_sq4Tbl[]={
(float)-1.049988, (float)-0.900024, (float)-0.750000,
(float)-0.599976, (float)-0.450012, (float)-0.299988,
(float)-0.150024, (float)0.000000, (float)0.150024,
(float)0.299988, (float)0.450012, (float)0.599976,
(float)0.750000, (float)0.900024, (float)1.049988,
(float)1.200012};
static float gain_sq5Tbl[]={
(float)0.037476, (float)0.075012, (float)0.112488,
(float)0.150024, (float)0.187500, (float)0.224976,
(float)0.262512, (float)0.299988, (float)0.337524,
(float)0.375000, (float)0.412476, (float)0.450012,
(float)0.487488, (float)0.525024, (float)0.562500,
(float)0.599976, (float)0.637512, (float)0.674988,
(float)0.712524, (float)0.750000, (float)0.787476,
(float)0.825012, (float)0.862488, (float)0.900024,
(float)0.937500, (float)0.974976, (float)1.012512,
(float)1.049988, (float)1.087524, (float)1.125000,
(float)1.162476, (float)1.200012};
/* Enhancer - Upsamling a factor 4 (ENH_UPS0 = 4) */
static float polyphaserTbl[]={
(float)0.000000, (float)0.000000, (float)0.000000,
(float)1.000000,
(float)0.000000, (float)0.000000, (float)0.000000,
(float)0.015625, (float)-0.076904, (float)0.288330,
(float)0.862061,
(float)-0.106445, (float)0.018799, (float)-0.015625,
(float)0.023682, (float)-0.124268, (float)0.601563,
(float)0.601563,
(float)-0.124268, (float)0.023682, (float)-0.023682,
(float)0.018799, (float)-0.106445, (float)0.862061,
(float)0.288330,
(float)-0.076904, (float)0.015625, (float)-0.018799};
static float enh_plocsTbl[] = {(float)40.0f, (float)120.0f,
(float)200.0f, (float)280.0f, (float)360.0f,
(float)440.0f, (float)520.0f, (float)600.0};
/* LPC analysis and quantization */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -