mulaw.c

来自「dsp AD公司ADSP21的代码,里面有FFT FIR IIR EQULIZE」· C语言 代码 · 共 31 行

C
31
字号
#include <stdlib.h>
#include <stdio.h>
#include "rtdspc.h"
#include "mu.h"

/**************************************************************************

MULAW.C - PROGRAM TO DEMONSTRATE MU LAW SPEECH COMPRESSION

*************************************************************************/

    int bypass = 0;
    int i,j,k,out;

void main()
{
    for(;;) {
        i = (int) getinput();

/* encode 14 bit linear input to mu-law */
        j = abs(i);
        if(j > 0x1fff) j = 0x1fff;
        k = invmutab[j >> 1];
        if(i >= 0) k |= 0x80;
        out = mutab[k];

/* decode the 8 bit mu-law and send out */
        if(bypass) sendout((float)i); else sendout((float)out);
    }
}

⌨️ 快捷键说明

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