Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 2.2 KB
Line 
1/*
2 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11/******************************************************************
12
13 iLBC Speech Coder ANSI-C Source Code
14
15 WebRtcIlbcfix_GetLspPoly.c
16
17******************************************************************/
18
19#include "defines.h"
20
21/*----------------------------------------------------------------*
22 * Construct the polynomials F1(z) and F2(z) from the LSP
23 * (Computations are done in Q24)
24 *
25 * The expansion is performed using the following recursion:
26 *
27 * f[0] = 1;
28 * tmp = -2.0 * lsp[0];
29 * f[1] = tmp;
30 * for (i=2; i<=5; i++) {
31 *    b = -2.0 * lsp[2*i-2];
32 *    f[i] = tmp*f[i-1] + 2.0*f[i-2];
33 *    for (j=i; j>=2; j--) {
34 *       f[j] = f[j] + tmp*f[j-1] + f[j-2];
35 *    }
36 *    f[i] = f[i] + tmp;
37 * }
38 *---------------------------------------------------------------*/
39
40void WebRtcIlbcfix_GetLspPoly(
41    int16_t *lsp, /* (i) LSP in Q15 */
42    int32_t *f)  /* (o) polonymial in Q24 */
43{
44  int32_t tmpW32;
45  int i, j;
46  int16_t high, low;
47  int16_t *lspPtr;
48  int32_t *fPtr;
49
50  lspPtr = lsp;
51  fPtr = f;
52  /* f[0] = 1.0 (Q24) */
53  (*fPtr) = (int32_t)16777216;
54  fPtr++;
55
56  (*fPtr) = WEBRTC_SPL_MUL((*lspPtr), -1024);
57  fPtr++;
58  lspPtr+=2;
59
60  for(i=2; i<=5; i++)
61  {
62    (*fPtr) = fPtr[-2];
63
64    for(j=i; j>1; j--)
65    {
66      /* Compute f[j] = f[j] + tmp*f[j-1] + f[j-2]; */
67      high = (int16_t)WEBRTC_SPL_RSHIFT_W32(fPtr[-1], 16);
68      low = (int16_t)WEBRTC_SPL_RSHIFT_W32(fPtr[-1]-WEBRTC_SPL_LSHIFT_W32(((int32_t)high),16), 1);
69
70      tmpW32 = WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16(high, (*lspPtr)), 2) +
71          WEBRTC_SPL_LSHIFT_W32(WEBRTC_SPL_MUL_16_16_RSFT(low, (*lspPtr), 15), 2);
72
73      (*fPtr) += fPtr[-2];
74      (*fPtr) -= tmpW32;
75      fPtr--;
76    }
77    (*fPtr) -= (int32_t)WEBRTC_SPL_LSHIFT_W32((int32_t)(*lspPtr), 10);
78
79    fPtr+=i;
80    lspPtr+=2;
81  }
82  return;
83}
Note: See TracBrowser for help on using the repository browser.