コード例 #1
0
ファイル: LPCFUNC.C プロジェクト: SibghatullahSheikh/codecs
void Lsp_Az(
  Word16 lsp[],    /* (i) Q15 : line spectral frequencies            */
  Word16 a[]       /* (o) Q12 : 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) );        /* from Q24 to Q12 and * 0.5 */

    t0   = L_sub(f1[i], f2[i]);                 /* f1[i] - f2[i]             */
    a[j] = extract_l( L_shr_r(t0, 13) );        /* from Q24 to Q12 and * 0.5 */

  }

  return;
}
コード例 #2
0
ファイル: lpcfunc.c プロジェクト: sippet/g729
void WebRtcG729fix_Lsp_Az(
  int16_t lsp[],    /* (i) Q15 : line spectral frequencies            */
  int16_t a[]       /* (o) Q12 : predictor coefficients (order = 10)  */
)
{
  int16_t i;
  int32_t f1[6], f2[6];
  int32_t ff1, ff2, fff1, fff2;

  Get_lsp_pol(&lsp[0],f1);
  Get_lsp_pol(&lsp[1],f2);

  a[0] = 4096;
  for (i = 1; i <= 5; i++)
  {
    ff1  = WebRtcSpl_AddSatW32(f1[i], f1[i-1]);               /* f1[i] += f1[i-1];         */
    ff2  = WebRtcSpl_SubSatW32(f2[i], f2[i-1]);               /* f2[i] -= f2[i-1];         */

    fff1 = WebRtcSpl_AddSatW32(ff1, ff2);                     /* f1[i] + f2[i]             */
    fff2 = WebRtcSpl_SubSatW32(ff1, ff2);                     /* f1[i] - f2[i]             */

    a[i] = extract_l(L_shr_r(fff1, 13));        /* from Q24 to Q12 and * 0.5 */
    a[11-i] = extract_l(L_shr_r(fff2, 13));     /* from Q24 to Q12 and * 0.5 */
  }
}
コード例 #3
0
void Lsp_Az(
    Word16 lsp[],        /* (i)  : line spectral frequencies            */
    Word16 a[],          /* (o)  : predictor coefficients (order = 10)  */
    Flag  *pOverflow     /* (o)  : overflow flag                        */
)
{
    Word16 i;
    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;
}
コード例 #4
0
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;
}