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

📄 lsp_az.cpp

📁 实现3GPP的GSM中AMR语音的CODECS。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
            lo = (Word16)((*(f - 1) >> 1) - ((Word32) hi << 15));            t0  = ((Word32)hi * *lsp);            t0 += ((Word32)lo * *lsp) >> 15;            *(f) +=  *(f - 2);          /*      *f += f[-2]      */            *(f--) -=  t0 << 2;         /*      *f -= t0         */        }        *f -= (Word32)(*lsp++) << 10;        f  += i;        lsp++;    }    return;}/****************************************************************************//*------------------------------------------------------------------------------ FUNCTION NAME: Get_lsp_pol_wrapper------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs:    lsp = pointer to the buffer containing the line spectral pairs (LSP)          of type Word16    f = pointer to the polynomial of type Word32 to be generated    pOverflow  = pointer set in case where one of the operations overflows.                 [data type Pointer to Flag] Outputs:    buffer pointed to by f contains the polynomial generated    pOverflow  = pointer set in case where one of the operations overflows.                 [data type Pointer to Flag] Returns:    None Global Variables Used:    None Local Variables Needed:    None------------------------------------------------------------------------------ FUNCTION DESCRIPTION This function provides external access to the static function Get_lsp_pol.------------------------------------------------------------------------------ REQUIREMENTS None------------------------------------------------------------------------------ REFERENCES None------------------------------------------------------------------------------ PSEUDO-CODE CALL Get_lsp_pol(lsp = lsp_ptr                  f = f_ptr )   MODIFYING(nothing)   RETURNING(nothing)------------------------------------------------------------------------------ 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 Get_lsp_pol_wrapper(    Word16 *lsp,    Word32 *f,    Flag   *pOverflow){    /*----------------------------------------------------------------------------     CALL Get_lsp_pol(lsp = lsp_ptr              f = f_ptr )    ----------------------------------------------------------------------------*/    Get_lsp_pol(lsp, f, pOverflow);    /*----------------------------------------------------------------------------       MODIFYING(nothing)       RETURNING(nothing)    ----------------------------------------------------------------------------*/    return;}/****************************************************************************//*------------------------------------------------------------------------------ FUNCTION NAME: Lsp_Az------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs:    lsp = pointer to the buffer containing the line spectral pairs (LSP)          of type Word16      a = pointer to the buffer containing Linear Predictive (LP)          coefficients of type Word16 to be generated    pOverflow  = pointer set in case where one of the operations overflows.                 [data type Pointer to Flag] Local Stores/Buffers/Pointers Needed:    None Global Stores/Buffers/Pointers Needed:    None Outputs:    pOverflow  = pointer set in case where one of the operations overflows.                 [data type Pointer to Flag] Pointers and Buffers Modified:    a buffer contains the generated Linear Predictive (LP) coefficients Local Stores Modified:    None Global Stores Modified:        None------------------------------------------------------------------------------ FUNCTION DESCRIPTION This function converts from the line spectral pairs (LSP) to LP coefficients for a 10th order filter. This is done by:    (1) Find the coefficients of F1(z) and F2(z) (see Get_lsp_pol)    (2) Multiply F1(z) by 1+z^{-1} and F2(z) by 1-z^{-1}    (3) A(z) = ( F1(z) + F2(z) ) / 2------------------------------------------------------------------------------ REQUIREMENTS None------------------------------------------------------------------------------ REFERENCES lsp_az.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001------------------------------------------------------------------------------ PSEUDO-CODEvoid Lsp_Az (    Word16 lsp[],        // (i)  : line spectral frequencies    Word16 a[]           // (o)  : predictor coefficients (order = 10)){    Word16 i, j;    Word32 f1[6], f2[6];    Word32 t0;    Get_lsp_pol (&lsp[0], f1);    Get_lsp_pol (&lsp[1], f2);    for (i = 5; i > 0; i--)    {        f1[i] = L_add (f1[i], f1[i - 1]); // f1[i] += f1[i-1];        f2[i] = L_sub (f2[i], f2[i - 1]); // f2[i] -= f2[i-1];    }    a[0] = 4096;    for (i = 1, j = 10; i <= 5; i++, j--)    {        t0 = L_add (f1[i], f2[i]);           // f1[i] + f2[i]        a[i] = extract_l (L_shr_r (t0, 13));        t0 = L_sub (f1[i], f2[i]);           // f1[i] - f2[i]        a[j] = extract_l (L_shr_r (t0, 13));    }    return;}------------------------------------------------------------------------------ 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 Lsp_Az(    Word16 lsp[],        /* (i)  : line spectral frequencies            */    Word16 a[],          /* (o)  : predictor coefficients (order = 10)  */    Flag  *pOverflow     /* (o)  : overflow flag                        */){    register Word16 i;    register Word16 j;    Word32 f1[6];    Word32 f2[6];    Word32 t0;    Word32 t1;    Word16 *p_a = &a[0];    Word32 *p_f1;    Word32 *p_f2;    Get_lsp_pol(&lsp[0], f1, pOverflow);    Get_lsp_pol(&lsp[1], f2, pOverflow);    p_f1 = &f1[5];    p_f2 = &f2[5];    for (i = 5; i > 0; i--)    {        *(p_f1--) += f1[i-1];        *(p_f2--) -= f2[i-1];    }    *(p_a++) = 4096;    p_f1 = &f1[1];    p_f2 = &f2[1];    for (i = 1, j = 10; i <= 5; i++, j--)    {        t0 = *(p_f1) + *(p_f2);               /* f1[i] + f2[i] */        t1 = *(p_f1++) - *(p_f2++);           /* f1[i] - f2[i] */        t0 = t0 + ((Word32) 1 << 12);        t1 = t1 + ((Word32) 1 << 12);        *(p_a++) = (Word16)(t0 >> 13);        a[j]     = (Word16)(t1 >> 13);    }    return;}

⌨️ 快捷键说明

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