基于ADSP的G.729语音编解码程序

源代码在线查看: decoder.dsp

软件大小: 3349 K
上传用户: tianlin4431
关键词: ADSP 729 语音编解码 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				#define        stream_port   0x201
				#define        speech_port   0x200
				/**********************************************************************
				* Main program of the ITU-T G.729  8 kbit/s decoder.                  *
				*    Usage : decoder  bitstream_file  synth_file                      *
				* $$01/10/2000 checked Decoder module data variables and function     *
				***********************************************************************/
				.MODULE/SEG=App_PM        Decoder;
				
				/**********************************************************************/
				#include       "ld8a.inc"
				#include       "dtx.inc"
				#include       "octet.inc"
				
				/***********************************************************************/
				.VAR/DM/RAM/SEG=App_DMmem    DecodeParm[PRM_SIZE+2];  /* Synthesis parameters        */
				.VAR/DM/RAM/SEG=App_DMmem    InputSerial[SERIAL_SIZE];/* Output bitstream buffer     */
				.VAR/DM/RAM/SEG=App_DMbuf    synth_buf[L_FRAME+M];    /* Synthesis buffer            */
				.VAR/DM/RAM/SEG=App_DMbuf    Az_dec[MP1*2];           /* Decoded Az for post-filter  */
				.VAR/DM/RAM/SEG=App_DMbuf    Dec_T2[2],VadDecode;     /* Pitch lag for 2 subframes   */
				.VAR/DM/RAM/SEG=App_DMbuf    bad_lsf,SynthDecode,Decode_FrameID;
				.VAR/DM/RAM/SEG=App_DMbuf    Fetch_pointer,segmeant_no;
				
				/***********************************************************************/
				.GLOBAL        bad_lsf,SynthDecode,Decode_FrameID;
				.GLOBAL        Az_dec,Dec_T2,VadDecode;
				.GLOBAL        DecodeParm,InputSerial;
				
				.EXTERNAL      Init_LPCFilt;
				.EXTERNAL      Init_Dec_cng;
				.EXTERNAL      Init_Decod_ld8a;
				.EXTERNAL      Init_DecodeGain;
				.EXTERNAL      Init_Decod_ld8a;
				.EXTERNAL      Init_Post_Filter;
				.EXTERNAL      Init_Post_Process;
				.EXTERNAL      decode_seag;   
				.EXTERNAL      Decod_ld8a;
				.EXTERNAL      Post_Filter;
				.EXTERNAL	   Post_Process;
				.EXTERNAL      bits2prm_ld8a;
				
				/*********************************************************************
				*  Initialization of decoder										 *
				* $$01/10/2000 main decoder function							     *
				**********************************************************************/
				.ENTRY         Init_decoder;
				
				Init_decoder:  CNTR=M;
							   I1=^synth_buf;
							   DO zero_synth UNTIL CE;
				zero_synth:	   DM(I1,M1)=0;
							   AR=PASS 0;
				               DM(SynthDecode)=I1;
							   DM(bad_lsf)=AR;
							   CALL Init_LPCFilt;
							   CALL Init_DecodeGain;
							   CALL Init_Decod_ld8a;
							   CALL Init_Post_Filter;
							   CALL Init_Post_Process;
							   CALL Init_Dec_cng;
							   RTS;
				/*******************************************************************
				*            Main decoder routine                                  *
				********************************************************************/
				.ENTRY         decode_seag; 
				
				decode_seag:   AR=PASS 0;
							   DM(segmeant_no)=AR;
				               I1=^InputSerial;
							   DM(Fetch_pointer)=I1;
				decode_frame:  I0=^DecodeParm;
							   CALL bits2prm_ld8a;
				   			   DM(Fetch_pointer)=I1;
							   CALL Decod_ld8a;
				    {----------Postfilter filtering--------------------------}
							   I1=^Dec_T2;
							   I2=^Az_dec;
							   CALL Post_Filter;
				               CNTR=L_FRAME;
							   I1=DM(SynthDecode);
							   CALL Post_Process;			  
							   I1=DM(SynthDecode);
							   CNTR=L_FRAME;		// 80 samples
							   DO put_speech UNTIL CE;
							   SI=DM(I1,M1);
				put_speech:	   IO(speech_port)=SI;
				               AR=DM(segmeant_no);
							   AR=AR+1;
							   DM(segmeant_no)=AR;
							   AR=AR-8;
							   I1=DM(Fetch_pointer);
							   IF LT JUMP decode_frame;
				               RTS;
				/*********************************************************************/
				.ENDMOD;
				
				
				
				
				
							

相关资源