📄 nb_celp_dec.c
字号:
float bws_mp_exc[], /* out: decoded excitation */ long *acb_delay, /* out: adaptive code delay */ float *adaptive_gain, /* out: adaptive code gain */ long dec_enhstages, long postfilter, long SampleRateMode){ float *tmp_lpc_coefficients; long i; long num_lpc_indices; if(fs8kHz==SampleRateMode) { num_lpc_indices = PAN_NUM_LPC_INDICES; }else { num_lpc_indices = PAN_NUM_LPC_INDICES_W; } if((tmp_lpc_coefficients=(float *)calloc(lpc_order, sizeof(float)))==NULL) { printf("\n Memory allocation error in abs_exc_generation\n"); exit(1); } for(i=0;i<lpc_order;i++) tmp_lpc_coefficients[i] = -int_Qlpc_coefficients[i]; nec_abs_excitation_generation( tmp_lpc_coefficients, /* in: interpolated LPC */ shape_indices, /* in: shape code indices */ gain_indices, /* in: gain code indices */ rms_index, /* in: RMS code index */ signal_mode, /* in: signal mode */ excitation, /* out: decoded excitation */ adaptive_gain, /* out: adaptive code gain */ acb_delay, /* out: adaptive code delay */ lpc_order, /* in: order of LPC */ sbfrm_size, /* in: subframe size */ n_subframes, /* in: number of subframes */ org_frame_bit_allocation+num_lpc_indices, num_shape_cbks, /* in: number of shape codebooks */ num_gain_cbks, /* in: number of gain codebooks */ dec_enhstages, /* in: number of enhancement stages */ bws_mp_exc, postfilter, SampleRateMode ); free(tmp_lpc_coefficients);}void bws_excitation_generation( unsigned long shape_indices[], /* in: shape code indices */ unsigned long gain_indices[], /* in: gain code indices */ long num_shape_cbks, /* in: number of shape codebooks */ long num_gain_cbks, /* in: number of gain codebooks */ unsigned long rms_index, /* in: RMS code index */ float int_Qlpc_coefficients[], /* in: interpolated LPC */ long lpc_order, /* in: order of LPC */ long sbfrm_size, /* in: subframe size */ long n_subframes, /* in: number of subframes */ unsigned long signal_mode, /* in: signal mode */ long org_frame_bit_allocation[], /* in: bit number for each index */ float excitation[], /* out: decoded excitation */ float bws_mp_exc[], /* in: decoded mp excitation */ long acb_indx_8[], /* in: acb_delay */ long *acb_delay, /* out: adaptive code delay */ float *adaptive_gain, /* out: adaptive code gain */ long postfilter){ float *tmp_lpc_coefficients; long i; if((tmp_lpc_coefficients=(float *)calloc(lpc_order, sizeof(float)))==NULL) { printf("\n Memory allocation error in abs_exc_generation\n"); exit(1); } for(i=0;i<lpc_order;i++) tmp_lpc_coefficients[i] = -int_Qlpc_coefficients[i]; nec_bws_excitation_generation( tmp_lpc_coefficients, /* in: interpolated LPC */ shape_indices, /* in: shape code indices */ gain_indices, /* in: gain code indices */ rms_index, /* in: RMS code index */ signal_mode, /* in: signal_mode */ excitation, /* out: decoded excitation */ adaptive_gain, /* out: adaptive code gain */ acb_delay, /* out: adaptive code delay */ lpc_order, /* in: order of LPC */ sbfrm_size, /* in: subframe size */ n_subframes, /* in: number of subframes */ org_frame_bit_allocation, num_shape_cbks, /* in: number of shape codebooks */ num_gain_cbks, /* in: number of gain codebooks */ bws_mp_exc, acb_indx_8, postfilter ); free(tmp_lpc_coefficients);}void nb_abs_postprocessing( float synth_signal[], /* input */ float PP_synth_signal[], /* output */ float int_Qlpc_coefficients[], /* input */ long lpc_order, /* configuration input */ long sbfrm_sizes, /* configuration input */ long acb_delay, /* input */ float adaptive_gain /* input */){ float *tmp_lpc_coefficients; long i; if((tmp_lpc_coefficients=(float *)calloc(lpc_order, sizeof(float)))==NULL) { printf("\n Memory allocation error in abs_postprocessing\n"); exit(1); } for(i=0;i<lpc_order;i++) tmp_lpc_coefficients[i] = -int_Qlpc_coefficients[i]; att_abs_postprocessing( synth_signal, /* input */ PP_synth_signal, /* output */ tmp_lpc_coefficients, /* input */ lpc_order, /* configuration input */ sbfrm_sizes, /* configuration input */ acb_delay, /* input */ adaptive_gain /* input */ ); free(tmp_lpc_coefficients);}void wb_celp_lsp_decode( unsigned long lpc_indices[], /* in: LPC code indices */ float int_Qlpc_coefficients[], /* out: quantized & interpolated LPC*/ long lpc_order, /* in: order of LPC */ long n_subframes, /* in: number of subframes */ float *prev_Qlsp_coefficients){ #include "inc_lsp46w.tbl" float *Qlsp_coefficients; float *int_Qlsp_coefficients; float *tmp_lpc_coefficients; long i, j; float *lsp_tbl; float *d_tbl; float *pd_tbl; long *dim_1; long *dim_2; long *ncd_1; long *ncd_2; long offset; long orderLsp;/* Memory allocation */ if((Qlsp_coefficients=(float *)calloc(lpc_order, sizeof(float)))==NULL) { printf("\n Memory allocation error in abs_lpc_quantizer\n"); exit(1); } if((int_Qlsp_coefficients=(float *)calloc(lpc_order, sizeof(float)))==NULL) { printf("\n Memory allocation error in abs_lpc_quantizer\n"); exit(2); } if((tmp_lpc_coefficients=(float *)calloc(lpc_order+1, sizeof(float)))==NULL) { printf("\n Memory allocation error in abs_lpc_quantizer\n"); exit(3); }/* LSP decode - lower part */ orderLsp = dim46w_L1[0]+dim46w_L1[1]; lsp_tbl = lsp_tbl46w_L; d_tbl = d_tbl46w_L; pd_tbl = pd_tbl46w_L; dim_1 = dim46w_L1; dim_2 = dim46w_L2; ncd_1 = ncd46w_L1; ncd_2 = ncd46w_L2; pan_lspdec(prev_Qlsp_coefficients, Qlsp_coefficients, PAN_LSP_AR_R_CELP_W, PAN_MINGAP_CELP_W, orderLsp, lpc_indices, lsp_tbl, d_tbl, pd_tbl, dim_1, ncd_1, dim_2, ncd_2, 0, 1);/* LSP decode - upper part */ offset = dim46w_L1[0]+dim46w_L1[1]; orderLsp = dim46w_U1[0]+dim46w_U1[1]; lsp_tbl = lsp_tbl46w_U; d_tbl = d_tbl46w_U; pd_tbl = pd_tbl46w_U; dim_1 = dim46w_U1; dim_2 = dim46w_U2; ncd_1 = ncd46w_U1; ncd_2 = ncd46w_U2; pan_lspdec(prev_Qlsp_coefficients+offset, Qlsp_coefficients+offset, PAN_LSP_AR_R_CELP_W, PAN_MINGAP_CELP_W, orderLsp, lpc_indices+5, lsp_tbl, d_tbl, pd_tbl, dim_1, ncd_1, dim_2, ncd_2, 0, 1); pan_stab(Qlsp_coefficients, PAN_MINGAP_CELP_W, lpc_order);/* for Testing for(i=0;i<lpc_order;i++) printf("%7.5f ", Qlsp_coefficients[i]); printf("\n");*//* Interpolation & LSP -> LPC conversion */ for(i=0;i<n_subframes;i++) { pan_lsp_interpolation(prev_Qlsp_coefficients, Qlsp_coefficients, int_Qlsp_coefficients, lpc_order, n_subframes, i); for(j=0;j<lpc_order;j++) int_Qlsp_coefficients[j] *= PAN_PI; lsf2pc(tmp_lpc_coefficients, int_Qlsp_coefficients, lpc_order); for(j=0;j<lpc_order;j++) int_Qlpc_coefficients[lpc_order*i+j] = -tmp_lpc_coefficients[j+1]; } pan_mv_fdata(prev_Qlsp_coefficients, Qlsp_coefficients, lpc_order); free(Qlsp_coefficients); free(int_Qlsp_coefficients); free(tmp_lpc_coefficients);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -