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

📄 g729a_decoder.c

📁 DSP上优化的G.729A代码
💻 C
字号:
#include "../Common/typedef.h"
#include "../Include/G729A_basic_op.h"
#include "../Include/G729A_ld8a.h"
#include "../Include/G729A_decoder.h"

Word16 G729A_bad_lsf;          

static Word16  G729A_synth_buf[G729A_L_FRAME+G729A_M], *G729A_synth;  
static Word16  G729A_parm[G729A_PRM_SIZE+1];             
static Word16  G729A_Az_dec[G729A_MP1*2];                
static Word16  G729A_T2[2];                       
static Word16  G729A_serial[G729A_SERIAL_SIZE];                     

void G729AInitDecoder()
{
    int i;
    for (i=0; i<G729A_M; i++) 
        G729A_synth_buf[i] = 0;
    G729A_synth = G729A_synth_buf + G729A_M;
	
    G729A_bad_lsf = 0;          
    G729AInit_Decod_ld8a();
    G729AInit_Post_Filter();
    G729AInit_Post_Process();
}

int G729ADeCoder(Word16 *sample, char *buf, int *samplelen, int buflen)
{      
    int  i, j=0;   
    
    
    char tmp;
	for(i = 0; i < 30;)
	{
		tmp = buf[i];
		buf[i] = buf[i+1];
		buf[i+1] = tmp;
		i += 2;
	}	
    *samplelen = 0;
	for( j = 0; j < 3; j++)
	{   	    
	    memset(G729A_serial, 0, G729A_SERIAL_SIZE*sizeof(Word16));                       
	
		memcpy((char*)G729A_serial, buf + G729A_SERIAL_SIZE*2*j, G729A_SERIAL_SIZE*sizeof(short));
		
		G729Abits2prm_ld8k(&G729A_serial[0], G729A_parm);
		
		G729A_parm[0] = 0;           
		for (i=0; i < G729A_SERIAL_SIZE; i++)
		{
		  if (G729A_serial[i] == 0 ) 
			  G729A_parm[0] = 1; 
		}
		
		
        G729A_parm[4] = G729ACheck_Parity_Pitch(G729A_parm[3], G729A_parm[4]);
	
        G729ADecod_ld8a(G729A_parm, G729A_synth, G729A_Az_dec, G729A_T2);
    
        G729APost_Filter(G729A_synth, G729A_Az_dec, G729A_T2);        
    
        G729APost_Process(G729A_synth, G729A_L_FRAME);
	
	    memcpy((char *)(sample + j*G729A_L_FRAME), (char *)G729A_synth, G729A_L_FRAME*sizeof(Word16));
	
	    
	}
	*samplelen += 240;
    return(0);
}

⌨️ 快捷键说明

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