writ_dat.c
来自「关于AMR-WB+语音压缩编码的实现代码」· C语言 代码 · 共 34 行
C
34 行
/*----------------------------------------------------------------------
*
* FUNCTION: writ_data
*
* PURPOSE: round array of float data to 16-bit words and write to the
* file "fp"
*
*--------------------------------------------------------------------------*/
#include <stdio.h>
#include "../include/amr_plus.h"
void writ_data(
float data[], /* input : data */
int size, /* input : number of samples */
FILE *fp /* output: file pointer */
)
{
short data16[4*L_FRAME_FSMAX];
int i;
float temp;
for (i = 0; i < size; i++)
{
temp = data[i];
if (temp >= 0.0)
temp += 0.5;
else
temp -= 0.5;
if (temp > 32767.0 ) temp = 32767.0;
if (temp < -32767.0 ) temp = -32767.0;
data16[i] = (short) temp;
}
fwrite(data16, sizeof(short), size, fp);
return;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?