• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_Smooth_odata.c
16 
17 ******************************************************************/
18 
19 #include "defines.h"
20 #include "constants.h"
21 
WebRtcIlbcfix_Smooth_odata(int16_t * odata,int16_t * psseq,int16_t * surround,int16_t C)22 int32_t WebRtcIlbcfix_Smooth_odata(
23     int16_t *odata,
24     int16_t *psseq,
25     int16_t *surround,
26     int16_t C)
27 {
28   int i;
29 
30   int16_t err;
31   int32_t errs;
32 
33   for(i=0;i<80;i++) {
34     odata[i]= (int16_t)((C * surround[i] + 1024) >> 11);
35   }
36 
37   errs=0;
38   for(i=0;i<80;i++) {
39     err = (psseq[i] - odata[i]) >> 3;
40     errs += err * err;  /* errs in Q-6 */
41   }
42 
43   return errs;
44 }
45