niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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_InterpolateSamples.c |
| 16 | |
| 17 | ******************************************************************/ |
| 18 | |
Timothy Gu | 3111783 | 2020-12-18 22:25:57 -0800 | [diff] [blame] | 19 | #include "modules/audio_coding/codecs/ilbc/interpolate_samples.h" |
| 20 | |
Mirko Bonadei | 06c2aa9 | 2018-02-01 15:11:41 +0100 | [diff] [blame] | 21 | #include "modules/audio_coding/codecs/ilbc/constants.h" |
Timothy Gu | 3111783 | 2020-12-18 22:25:57 -0800 | [diff] [blame] | 22 | #include "modules/audio_coding/codecs/ilbc/defines.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 23 | |
| 24 | void WebRtcIlbcfix_InterpolateSamples( |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 25 | int16_t *interpSamples, /* (o) The interpolated samples */ |
| 26 | int16_t *CBmem, /* (i) The CB memory */ |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 27 | size_t lMem /* (i) Length of the CB memory */ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 28 | ) { |
pbos@webrtc.org | 0946a56 | 2013-04-09 00:28:06 +0000 | [diff] [blame] | 29 | int16_t *ppi, *ppo, i, j, temp1, temp2; |
| 30 | int16_t *tmpPtr; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 31 | |
| 32 | /* Calculate the 20 vectors of interpolated samples (4 samples each) |
| 33 | that are used in the codebooks for lag 20 to 39 */ |
| 34 | tmpPtr = interpSamples; |
| 35 | for (j=0; j<20; j++) { |
| 36 | temp1 = 0; |
| 37 | temp2 = 3; |
| 38 | ppo = CBmem+lMem-4; |
| 39 | ppi = CBmem+lMem-j-24; |
| 40 | for (i=0; i<4; i++) { |
| 41 | |
bjornv@webrtc.org | 2f6ae0d | 2015-03-01 19:50:41 +0000 | [diff] [blame] | 42 | *tmpPtr++ = (int16_t)((WebRtcIlbcfix_kAlpha[temp2] * *ppo) >> 15) + |
| 43 | (int16_t)((WebRtcIlbcfix_kAlpha[temp1] * *ppi) >> 15); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | |
| 45 | ppo++; |
| 46 | ppi++; |
| 47 | temp1++; |
| 48 | temp2--; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | return; |
| 53 | } |