Home | History | Annotate | Download | only in ilbc
      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_SimpleLsfDeQ.c
     16 
     17 ******************************************************************/
     18 
     19 #include "defines.h"
     20 #include "constants.h"
     21 
     22 /*----------------------------------------------------------------*
     23  *  obtain dequantized lsf coefficients from quantization index
     24  *---------------------------------------------------------------*/
     25 
     26 void WebRtcIlbcfix_SimpleLsfDeQ(
     27     int16_t *lsfdeq,  /* (o) dequantized lsf coefficients */
     28     int16_t *index,  /* (i) quantization index */
     29     int16_t lpc_n  /* (i) number of LPCs */
     30                                 ){
     31   int i, j, pos, cb_pos;
     32 
     33   /* decode first LSF */
     34 
     35   pos = 0;
     36   cb_pos = 0;
     37   for (i = 0; i < LSF_NSPLIT; i++) {
     38     for (j = 0; j < WebRtcIlbcfix_kLsfDimCb[i]; j++) {
     39       lsfdeq[pos + j] = WebRtcIlbcfix_kLsfCb[cb_pos + j + index[i] *
     40                                              WebRtcIlbcfix_kLsfDimCb[i]];
     41     }
     42     pos += WebRtcIlbcfix_kLsfDimCb[i];
     43     cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i];
     44   }
     45 
     46   if (lpc_n>1) {
     47     /* decode last LSF */
     48     pos = 0;
     49     cb_pos = 0;
     50     for (i = 0; i < LSF_NSPLIT; i++) {
     51       for (j = 0; j < WebRtcIlbcfix_kLsfDimCb[i]; j++) {
     52         lsfdeq[LPC_FILTERORDER + pos + j] = WebRtcIlbcfix_kLsfCb[
     53             cb_pos + index[LSF_NSPLIT + i] * WebRtcIlbcfix_kLsfDimCb[i] + j];
     54       }
     55       pos += WebRtcIlbcfix_kLsfDimCb[i];
     56       cb_pos += WebRtcIlbcfix_kLsfSizeCb[i] * WebRtcIlbcfix_kLsfDimCb[i];
     57     }
     58   }
     59   return;
     60 }
     61