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

📄 decoder.c

📁 语音编码G.729 语音编码G.729
💻 C
字号:
/*   ITU-T G.729 Annex C - Reference C code for floating point                         implementation of G.729 Annex A                         Version 1.01 of 15.September.98*//*----------------------------------------------------------------------                    COPYRIGHT NOTICE----------------------------------------------------------------------   ITU-T G.729 Annex C ANSI C source code   Copyright (C) 1998, AT&T, France Telecom, NTT, University of   Sherbrooke.  All rights reserved.----------------------------------------------------------------------*//*-----------------------------------------------------------------* * Main program of the G.729a 8.0 kbit/s decoder.                  * *                                                                 * *    Usage : decoder  bitstream_file  synth_file                  * *                                                                 * *-----------------------------------------------------------------*/#include "typedef.h"#include "ld8a.h"#include "cst_ld8a.h"#include "octet.h"/*-----------------------------------------------------------------* *            Main decoder routine                                 * *-----------------------------------------------------------------*/int main( int argc, char *argv[]){	static FLOAT  synth_buf[L_FRAME+M];     /* Synthesis                  */	FLOAT  *synth;	static int parm[2+PRM_SIZE];            /* Synthesis parameters + BFI */	static INT16 serial[SERIAL_SIZE];      /* Serial stream              */	static FLOAT  Az_dec[MP1*2];            /* Decoded Az for post-filter */	static int T2[2];                       /* Decoded Pitch              */	int count_frame;	int i;	int Vad;	FILE   *f_syn, *f_serial;	/* New unstaticed states */	struct preproc_state_t postproc_s;	struct dec_state_t dec_s;	struct postfilt_state_t postfilt_s;	printf("\n");	printf("************  ITU G.729A 8.0 KBIT/S SPEECH DECODER  ************\n");	printf("                       (WITH ANNEX B)                           \n");	printf("\n");	printf("----------------- Floating point C simulation ----------------\n");	printf("\n");	printf("-----------------          Version 1.04       ----------------\n");	printf("\n");   /* Passed arguments */   if ( argc != 3)     {        printf("Usage :%s bitstream_file  outputspeech_file\n",argv[0]);        printf("\n");        printf("Format for bitstream_file:\n");        printf("  One (2-byte) synchronization word \n");        printf("  One (2-byte) size word,\n");        printf("  80 words (2-byte) containing 80 bits.\n");        printf("\n");        printf("Format for outputspeech_file:\n");        printf("  Synthesis is written to a binary file of 16 bits data.\n");        exit( 1 );     }   /* Open file for synthesis and packed serial stream */   if( (f_serial = fopen(argv[1],"rb") ) == NULL )     {        printf("%s - Error opening file  %s !!\n", argv[0], argv[1]);        exit(0);     }   if( (f_syn = fopen(argv[2], "wb") ) == NULL )     {        printf("%s - Error opening file  %s !!\n", argv[0], argv[2]);        exit(0);     }	printf("Input bitstream file  :   %s\n",argv[1]);	printf("Synthesis speech file :   %s\n",argv[2]);#ifndef OCTET_TX_MODE	printf("OCTET TRANSMISSION MODE is disabled\n");#endif/*-----------------------------------------------------------------* *           Initialization of decoder                             * *-----------------------------------------------------------------*/	for (i=0; i<M; i++) synth_buf[i] = (F)0.0;	synth = synth_buf + M;	init_decod_ld8a(&dec_s);	init_post_filter(&postfilt_s);	init_post_process(&postproc_s);	/* for G.729b */	init_dec_cng(&dec_s.cng_s);/*-----------------------------------------------------------------* *            Loop for each "L_FRAME" speech data                  * *-----------------------------------------------------------------*/	count_frame = 0;	while(read_frame(f_serial, parm) != 0)	{		printf("Frame = %d\r", count_frame++);		decod_ld8a(&dec_s, parm, synth, Az_dec, T2, &Vad);		post_filter(&postfilt_s, synth, Az_dec, T2, Vad);        /* Post-filter */		post_process(&postproc_s, synth, L_FRAME);		fwrite16(synth, L_FRAME, f_syn);	}   return(0);}

⌨️ 快捷键说明

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