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

📄 coder.c

📁 C源程序---G.729a语音代码G.729a语音代码
💻 C
字号:
/*   ITU-T G.729A Speech Coder    ANSI-C Source Code   Version 1.1    Last modified: September 1996   Copyright (c) 1996,   AT&T, France Telecom, NTT, Universite de Sherbrooke   All rights reserved.*//*-------------------------------------------------------------------* * Main program of the ITU-T G.729A  8 kbit/s encoder.               * *                                                                   * *    Usage : coder speech_file  bitstream_file                      * *-------------------------------------------------------------------*/#include <stdio.h>#include <stdlib.h>#include "typedef.h"#include "basic_op.h"#include "ld8a.h"int main(int argc, char *argv[] ){  FILE *f_speech;               /* File of speech data                   */  FILE *f_serial;               /* File of serial bits for transmission  */  extern Word16 *new_speech;     /* Pointer to new speech data            */  Word16 prm[PRM_SIZE];          /* Analysis parameters.                  */  Word16 serial[SERIAL_SIZE];    /* Output bitstream buffer               */  Word16 frame;                  /* frame counter */  printf("\n");  printf("***********    ITU G.729A 8 KBIT/S SPEECH CODER    ***********\n");  printf("\n");  printf("------------------- Fixed point C simulation -----------------\n");  printf("\n");  printf("-------------------       Version 1.1        -----------------\n");  printf("\n");/*--------------------------------------------------------------------------* * Open speech file and result file (output serial bit stream)              * *--------------------------------------------------------------------------*/  if ( argc != 3 )    {       printf("Usage : coder speech_file  bitstream_file\n");       printf("\n");       printf("Format for speech_file:\n");       printf("  Speech is read from a binary file of 16 bits PCM data.\n");       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");       exit(1);    }  if ( (f_speech = fopen(argv[1], "rb")) == NULL) {     printf("%s - Error opening file  %s !!\n", argv[0], argv[1]);     exit(0);  }  printf(" Input speech file    :  %s\n", argv[1]);  if ( (f_serial = fopen(argv[2], "wb")) == NULL) {     printf("%s - Error opening file  %s !!\n", argv[0], argv[2]);     exit(0);  }  printf(" Output bitstream file:  %s\n", argv[2]);/*--------------------------------------------------------------------------* * Initialization of the coder.                                             * *--------------------------------------------------------------------------*/  Init_Pre_Process();  Init_Coder_ld8a();  Set_zero(prm, PRM_SIZE);  /* Loop for each "L_FRAME" speech data. */  frame =0;  while( fread(new_speech, sizeof(Word16), L_FRAME, f_speech) == L_FRAME)  {    printf("Frame =%d\r", frame++);    Pre_Process(new_speech, L_FRAME);    Coder_ld8a(prm);    prm2bits_ld8k( prm, serial);    fwrite(serial, sizeof(Word16), SERIAL_SIZE, f_serial);  }  return (0);}

⌨️ 快捷键说明

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