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 /* encode.c - Encoding function for the iSAC coder */ 12 13 #include <math.h> 14 15 #include "modules/audio_coding/codecs/isac/main/source/structs.h" 16 #include "modules/audio_coding/codecs/isac/main/source/codec.h" 17 #include "modules/audio_coding/codecs/isac/main/source/pitch_estimator.h" 18 WebRtcIsac_InitMasking(MaskFiltstr * maskdata)19void WebRtcIsac_InitMasking(MaskFiltstr *maskdata) { 20 21 int k; 22 23 for (k = 0; k < WINLEN; k++) { 24 maskdata->DataBufferLo[k] = 0.0; 25 maskdata->DataBufferHi[k] = 0.0; 26 } 27 for (k = 0; k < ORDERLO+1; k++) { 28 maskdata->CorrBufLo[k] = 0.0; 29 maskdata->PreStateLoF[k] = 0.0; 30 maskdata->PreStateLoG[k] = 0.0; 31 maskdata->PostStateLoF[k] = 0.0; 32 maskdata->PostStateLoG[k] = 0.0; 33 } 34 for (k = 0; k < ORDERHI+1; k++) { 35 maskdata->CorrBufHi[k] = 0.0; 36 maskdata->PreStateHiF[k] = 0.0; 37 maskdata->PreStateHiG[k] = 0.0; 38 maskdata->PostStateHiF[k] = 0.0; 39 maskdata->PostStateHiG[k] = 0.0; 40 } 41 42 maskdata->OldEnergy = 10.0; 43 return; 44 } 45 WebRtcIsac_InitPostFilterbank(PostFiltBankstr * postfiltdata)46void WebRtcIsac_InitPostFilterbank(PostFiltBankstr *postfiltdata) 47 { 48 int k; 49 50 for (k = 0; k < 2*POSTQORDER; k++) { 51 postfiltdata->STATE_0_LOWER[k] = 0; 52 postfiltdata->STATE_0_UPPER[k] = 0; 53 54 postfiltdata->STATE_0_LOWER_float[k] = 0; 55 postfiltdata->STATE_0_UPPER_float[k] = 0; 56 } 57 58 /* High pass filter states */ 59 postfiltdata->HPstates1[0] = 0.0; 60 postfiltdata->HPstates1[1] = 0.0; 61 62 postfiltdata->HPstates2[0] = 0.0; 63 postfiltdata->HPstates2[1] = 0.0; 64 65 postfiltdata->HPstates1_float[0] = 0.0f; 66 postfiltdata->HPstates1_float[1] = 0.0f; 67 68 postfiltdata->HPstates2_float[0] = 0.0f; 69 postfiltdata->HPstates2_float[1] = 0.0f; 70 71 return; 72 } 73