1/* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18/**************************************************************************************** 19Portions of this file are derived from the following 3GPP standard: 20 21 3GPP TS 26.173 22 ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec 23 Available from http://www.3gpp.org 24 25(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC) 26Permission to distribute, modify and use this file under the standard license 27terms listed above has been obtained from the copyright holder. 28****************************************************************************************/ 29/* 30------------------------------------------------------------------------------ 31 32 33 34 Filename: qisf_ns.cpp 35 36 Date: 05/08/2004 37 38------------------------------------------------------------------------------ 39 REVISION HISTORY 40 41 42 Description: 43 44------------------------------------------------------------------------------ 45 INPUT AND OUTPUT DEFINITIONS 46 47 int16 indice[] : indices of the selected codebook entries 48 int16 isf[] : quantized ISFs (in frequency domain) 49 50------------------------------------------------------------------------------ 51 FUNCTION DESCRIPTION 52 53 Coding/Decoding of ISF parameters for background noise. 54 55 The ISF vector is quantized using VQ with split-by-5 56 57------------------------------------------------------------------------------ 58 REQUIREMENTS 59 60 61------------------------------------------------------------------------------ 62 REFERENCES 63 64------------------------------------------------------------------------------ 65 PSEUDO-CODE 66 67------------------------------------------------------------------------------ 68*/ 69 70 71/*---------------------------------------------------------------------------- 72; INCLUDES 73----------------------------------------------------------------------------*/ 74 75#include "pv_amr_wb_type_defs.h" 76#include "pvamrwbdecoder_basic_op.h" 77#include "pvamrwbdecoder_acelp.h" 78#include "qisf_ns.h" 79 80/*---------------------------------------------------------------------------- 81; MACROS 82; Define module specific macros here 83----------------------------------------------------------------------------*/ 84 85 86/*---------------------------------------------------------------------------- 87; DEFINES 88; Include all pre-processor statements here. Include conditional 89; compile variables also. 90----------------------------------------------------------------------------*/ 91 92/*---------------------------------------------------------------------------- 93; LOCAL FUNCTION DEFINITIONS 94; Function Prototype declaration 95----------------------------------------------------------------------------*/ 96 97/*---------------------------------------------------------------------------- 98; LOCAL STORE/BUFFER/POINTER DEFINITIONS 99; Variable declaration - defined here and used outside this module 100----------------------------------------------------------------------------*/ 101 102/*---------------------------------------------------------------------------- 103; EXTERNAL FUNCTION REFERENCES 104; Declare functions defined elsewhere and referenced in this module 105----------------------------------------------------------------------------*/ 106 107/*---------------------------------------------------------------------------- 108; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES 109; Declare variables used in this module but defined elsewhere 110----------------------------------------------------------------------------*/ 111 112/*---------------------------------------------------------------------------- 113; FUNCTION CODE 114----------------------------------------------------------------------------*/ 115 116void Disf_ns( 117 int16 * indice, /* input: quantization indices */ 118 int16 * isf_q /* input: ISF in the frequency domain (0..0.5)*/ 119) 120{ 121 int16 i; 122 123 isf_q[0] = dico1_isf_noise[(indice[0] << 1)]; 124 isf_q[1] = dico1_isf_noise[(indice[0] << 1) + 1]; 125 126 for (i = 0; i < 3; i++) 127 { 128 isf_q[i + 2] = dico2_isf_noise[(indice[1] << 1) + indice[1] + i]; 129 isf_q[i + 5] = dico3_isf_noise[(indice[2] << 1) + indice[2] + i]; 130 } 131 132 for (i = 0; i < 4; i++) 133 { 134 isf_q[i + 8] = dico4_isf_noise[(indice[3] << 2) + i]; 135 isf_q[i + 12] = dico5_isf_noise[(indice[4] << 2) + i]; 136 } 137 138 for (i = 0; i < ORDER; i++) 139 { 140 isf_q[i] = add_int16(isf_q[i], mean_isf_noise[i]); 141 } 142 143 Reorder_isf(isf_q, ISF_GAP, ORDER); 144 145} 146