📄 lspdece.c
字号:
/* ITU-T G.729 Annex C+ - Reference C code for floating point implementation of G.729 Annex C+ (integration of Annexes B, D and E) Version 2.1 of October 1999*//* File : LSPDECE.C */#include <math.h>#include "typedef.h"#include "ld8k.h"#include "ld8cp.h"#include "tab_ld8k.h"#include "tabld8cp.h"/* Prototype definitions of static functions */static void lsp_iqua_cse(struct lsp_dec_state_t *, int prm[], FLOAT lsp_q[], int erase);/*---------------------------------------------------------------------------- * Lsp_decw_reset - set the previous LSP vectors *---------------------------------------------------------------------------- */void lsp_decw_reset(struct lsp_dec_state_t *state){ int i; for(i=0; i<MA_NP; i++) copy (freq_prev_reset, &state->freq_prev[i][0], M ); state->prev_ma = 0; copy (freq_prev_reset, state->prev_lsp, M );}/*----------------------------------------------------------------------------* lsp_iqua_cs - LSP main quantization routine*----------------------------------------------------------------------------*/static void lsp_iqua_cse(struct lsp_dec_state_t *state, int prm[], /* input : codes of the selected LSP */ FLOAT lsp_q[], /* output: Quantized LSP parameters */ int erase /* input : frame erase information */){ int mode_index; int code0; int code1; int code2; FLOAT buf[M]; if(erase==0) /* Not frame erasure */ { mode_index = (prm[0] >> NC0_B) & 1; code0 = prm[0] & (INT16)(NC0 - 1); code1 = (prm[1] >> NC1_B) & (INT16)(NC1 - 1); code2 = prm[1] & (INT16)(NC1 - 1); lsp_get_quante(lspcb1, lspcb2, code0, code1, code2, fg[mode_index], state->freq_prev, lsp_q, fg_sum[mode_index], buf); copy(lsp_q, state->prev_lsp, M ); state->prev_ma = mode_index; } else /* Frame erased */ { copy(state->prev_lsp, lsp_q, M ); /* update freq_prev */ lsp_prev_extract(state->prev_lsp, buf, fg[state->prev_ma], state->freq_prev, fg_sum_inv[state->prev_ma]); } lsp_prev_update(buf, state->freq_prev);}/*----------------------------------------------------------------------------* d_lsp - decode lsp parameters*----------------------------------------------------------------------------*/void d_lspe(struct lsp_dec_state_t *state, int prm[], /* (i) : indexes of the selected LSP */ FLOAT lsp_q[], /* (o) : Quantized LSP parameters */ int erase /* (i) : frame erase information */){ lsp_iqua_cse(state, prm, lsp_q, erase); /* Convert LSFs to LSPs */ lsf_lsp(lsp_q, lsp_q, M);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -