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

📄 d8_31pf.cpp

📁 实现3GPP的GSM中AMR语音的CODECS。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
                used to represent cycle count for each subroutine                called)     where: (cycle count variable) = cycle count for [subroutine                                     name]------------------------------------------------------------------------------ CAUTION [optional] [State any special notes, constraints or cautions for users of this function]------------------------------------------------------------------------------*/static void decompress_code(    Word16 indx[],      /* i : position and sign of 8 pulses (compressed) */    Word16 sign_indx[], /* o : signs of 4 pulses (signs only)             */    Word16 pos_indx[],  /* o : position index of 8 pulses (position only) */    Flag  *pOverflow    /* o : Flag set when overflow occurs              */){    Word16 i;    Word16 ia;    Word16 ib;    Word16 MSBs;    Word16 LSBs;    Word16 MSBs0_24;    Word32 tempWord32;    for (i = 0; i < NB_TRACK_MR102; i++)    {        sign_indx[i] = indx[i];    }    /*      First index: 10x10x10 -> 2x5x2x5x2x5-> 125x2x2x2 -> 7+1x3 bits      MSBs = indx[NB_TRACK]/8;      LSBs = indx[NB_TRACK]%8;      */    MSBs =        shr(            indx[NB_TRACK_MR102],            3,            pOverflow);    LSBs = indx[NB_TRACK_MR102] & 0x7;    decompress10(        MSBs,        LSBs,        0,        4,        1,        pos_indx,        pOverflow);    /*      Second index: 10x10x10 -> 2x5x2x5x2x5-> 125x2x2x2 -> 7+1x3 bits      MSBs = indx[NB_TRACK+1]/8;      LSBs = indx[NB_TRACK+1]%8;      */    MSBs =        shr(            indx[NB_TRACK_MR102+1],            3,            pOverflow);    LSBs = indx[NB_TRACK_MR102+1] & 0x7;    decompress10(        MSBs,        LSBs,        2,        6,        5,        pos_indx,        pOverflow);    /*      Third index: 10x10 -> 2x5x2x5-> 25x2x2 -> 5+1x2 bits      MSBs = indx[NB_TRACK+2]/4;      LSBs = indx[NB_TRACK+2]%4;      MSBs0_24 = (MSBs*25+12)/32;      if ((MSBs0_24/5)%2==1)         pos_indx[3] = (4-(MSBs0_24%5))*2 + LSBs%2;      else         pos_indx[3] = (MSBs0_24%5)*2 + LSBs%2;      pos_indx[7] = (MSBs0_24/5)*2 + LSBs/2;      */    MSBs =        shr(            indx[NB_TRACK_MR102+2],            2,            pOverflow);    LSBs = indx[NB_TRACK_MR102+2] & 0x3;    tempWord32 =        L_mult(            MSBs,            25,            pOverflow);    ia =        (Word16)        L_shr(            tempWord32,            1,            pOverflow);    ia =        add(            ia,            12,            pOverflow);    MSBs0_24 =        shr(            ia,            5,            pOverflow);    ia =        mult(            MSBs0_24,            6554,            pOverflow);    ia &= 1;    ib =        mult(            MSBs0_24,            6554,            pOverflow);    tempWord32 =        L_mult(            ib,            5,            pOverflow);    ib =        (Word16)        L_shr(            tempWord32,            1,            pOverflow);    ib =        sub(            MSBs0_24,            ib,            pOverflow);    if (ia == 1)    {        ib =            sub(                4,                ib,                pOverflow);    }    ib =        shl(            ib,            1,            pOverflow);    ia = LSBs & 0x1;    pos_indx[3] =        add(            ib,            ia,            pOverflow);    ia =        mult(            MSBs0_24,            6554,            pOverflow);    ia =        shl(            ia,            1,            pOverflow);    ib =        shr(            LSBs,            1,            pOverflow);    pos_indx[7] =        add(            ia,            ib,            pOverflow);}/*------------------------------------------------------------------------------ FUNCTION NAME: dec_8i40_31bits------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs:    index   array of type Word16 --  index of 8 pulses (sign+position) Outputs:    cod     array of type Word16 --  algebraic (fixed) codebook excitation    pOverflow pointer to type Flag -- Flag set when overflow occurs Returns:    None Global Variables Used:    None Local Variables Needed:    None------------------------------------------------------------------------------ FUNCTION DESCRIPTION PURPOSE:  Builds the innovative codevector from the received           index of algebraic codebook.------------------------------------------------------------------------------ REQUIREMENTS None------------------------------------------------------------------------------ REFERENCES d8_31pf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001------------------------------------------------------------------------------ PSEUDO-CODE------------------------------------------------------------------------------ RESOURCES USED [optional] When the code is written for a specific target processor the the resources used should be documented below. HEAP MEMORY USED: x bytes STACK MEMORY USED: x bytes CLOCK CYCLES: (cycle count equation for this function) + (variable                used to represent cycle count for each subroutine                called)     where: (cycle count variable) = cycle count for [subroutine                                     name]------------------------------------------------------------------------------ CAUTION [optional] [State any special notes, constraints or cautions for users of this function]------------------------------------------------------------------------------*/void dec_8i40_31bits(    Word16 index[],    /* i : index of 8 pulses (sign+position)         */    Word16 cod[],      /* o : algebraic (fixed) codebook excitation     */    Flag  *pOverflow   /* o : Flag set when overflow occurs             */){    Word16 i;    Word16 j;    Word16 pos1;    Word16 pos2;    Word16 sign;    Word32 tempWord32;    Word16 linear_signs[NB_TRACK_MR102];    Word16 linear_codewords[NB_PULSE];    for (i = 0; i < L_CODE; i++)    {        cod[i] = 0;    }    decompress_code(        index,        linear_signs,        linear_codewords,        pOverflow);    /* decode the positions and signs of pulses and build the codeword */    for (j = 0; j < NB_TRACK_MR102; j++)    {        /* compute index i */        i = linear_codewords[j];        tempWord32 =            L_mult(                i,                4,                pOverflow);        i =            (Word16)            L_shr(                tempWord32,                1,                pOverflow);        pos1 =            add(                i,                j,                pOverflow);   /* position of pulse "j" */        if (linear_signs[j] == 0)        {            sign = POS_CODE; /* +1.0 */        }        else        {            sign = -NEG_CODE; /* -1.0 */        }        cod[pos1] = sign;        /* compute index i */        i =            add(                j,                4,                pOverflow);        i = linear_codewords[i];        tempWord32 =            L_mult(                i,                4,                pOverflow);        i =            (Word16)            L_shr(                tempWord32,                1,                pOverflow);        pos2 =            add(                i,                j,                pOverflow);      /* position of pulse "j+4" */        if (pos2 < pos1)        {            sign = negate(sign);        }        cod[pos2] =            add(                cod[pos2],                sign,                pOverflow);    } /* for (j = 0; j < NB_TRACK_MR102; j++) */    return;}

⌨️ 快捷键说明

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