www.pudn.com > p_voice.rar > QSIDLSF.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 : QSIDLSF.C
*/
#include
#include
#include
#include "typedef.h"
#include "ld8k.h"
#include "tab_ld8k.h"
#include "ld8cp.h"
#include "sid.h"
#include "vad.h"
#include "dtx.h"
#include "tab_dtx.h"
/* local functions */
static void Qnt_e(
FLOAT *errlsf, /* (i) : error lsf vector */
FLOAT *weight, /* (i) : weighting vector */
int DIn, /* (i) : number of input candidates */
FLOAT *qlsf, /* (o) : quantized error lsf vector */
int *Pptr, /* (o) : predictor index */
int DOut, /* (i) : number of quantized vectors */
int *cluster, /* (o) : quantizer indices */
int *MS /* (i) : size of the quantizers */
);
static void New_ML_search_1(
FLOAT *d_data, /* (i) : error vector */
int J, /* (i) : number of input vectors */
FLOAT *new_d_data,/* (o) : output vector */
int K, /* (i) : number of candidates */
int *best_indx, /* (o) : best indices */
int *ptr_back, /* (o) : pointer for backtracking */
int *PtrTab, /* (i) : quantizer table */
int MQ /* (i) : size of quantizer */
);
static void New_ML_search_2(
FLOAT *d_data, /* (i) : error vector */
FLOAT *weight, /* (i) : weighting vector */
int J, /* (i) : number of input vectors */
FLOAT *new_d_data,/* (o) : output vector */
int K, /* (i) : number of candidates */
int *best_indx, /* (o) : best indices */
int *ptr_prd, /* (i) : pointer for backtracking */
int *ptr_back, /* (o) : pointer for backtracking */
int PtrTab[2][16],/* (i) : quantizer table */
int MQ /* (i) : size of quantizer */
);
/*-----------------------------------------------------------------*
* Functions lsfq_noise *
* ~~~~~~~~~~ *
* Input: *
* lsp[] : unquantized lsp vector *
* freq_prev[][] : memory of the lsf predictor *
* *
* Output: *
* *
* lspq[] : quantized lsp vector *
* ana[] : indices *
* *
*-----------------------------------------------------------------*/
void lsfq_noise( FLOAT *lsp, FLOAT *lspq, FLOAT freq_prev[MA_NP][M], int *ana)
{
int i, MS[MODE]={32, 16}, Clust[MODE], mode;
FLOAT lsf[M], lsfq[M], weight[M], tmpbuf[M], errlsf[M*MODE];
/* convert lsp to lsf */
for (i=0; i M_LIMIT)
lsf[M-1] = M_LIMIT;
if (lsf[M-1] < lsf[M-2])
lsf[M-2] = lsf[M-1]- GAP3;
/* get the lsf weighting */
get_wegt(lsf, weight);
/**********************/
/* quantize the lsf's */
/**********************/
/* get the prediction error vector */
for (mode=0; mode