打印

有谁知道u律压缩中的偏移量0x84是做什么用的?

[复制链接]
1439|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
youcanh|  楼主 | 2007-10-12 10:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
se, PCM, pc, AN, ge
网上关于A律压缩的资料很多,但u律的就很少了,最近遇到一个问题就是u律的段落码、电平码该怎么计算阿?每个段落的量化间隔又怎么计算?为什么在进行u律压缩时要价0x84偏移量 比如下面这段程序
#define    BIAS        (0x84)        /* Bias for linear code. */
unsigned char
linear2ulaw(
    int        pcm_val)    /* 2's complement (16-bit range) */
{
    int        mask;
    int        seg;
    unsigned char    uval;

    /* Get the sign and the magnitude of the value. */
    if (pcm_val < 0) {
        pcm_val = BIAS - pcm_val;
        mask = 0x7F;
    } else {
        pcm_val += BIAS;
        mask = 0xFF;
    }

    /* Convert the scaled magnitude to segment number. */
    seg = search(pcm_val, seg_end, 8);

    /*
     * Combine the sign, segment, quantization bits;
     * and complement the code word.
     */
    if (seg >= 8)        /* out of range, return maximum value. */
        return (0x7F ^ mask);
    else {
        uval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0xF);
        return (uval ^ mask);
    }

}
有知道的告诉一声啊 谢谢了

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

17

主题

57

帖子

0

粉丝