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 /**************************************************************************************** 19 Portions 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) 26 Permission to distribute, modify and use this file under the standard license 27 terms listed above has been obtained from the copyright holder. 28 ****************************************************************************************/ 29 /* 30 ------------------------------------------------------------------------------ 31 32 33 34 Pathname: ./src/pvamrwb_math_op.h 35 36 Date: 01/04/2007 37 38 ------------------------------------------------------------------------------ 39 REVISION HISTORY 40 41 Description: 42 ------------------------------------------------------------------------------ 43 INCLUDE DESCRIPTION 44 45 ------------------------------------------------------------------------------ 46 */ 47 48 #ifndef PVAMRWB_MATH_OP_H 49 #define PVAMRWB_MATH_OP_H 50 51 52 /*---------------------------------------------------------------------------- 53 ; INCLUDES 54 ----------------------------------------------------------------------------*/ 55 56 #include "pv_amr_wb_type_defs.h" 57 58 /*---------------------------------------------------------------------------- 59 ; DEFINES 60 ----------------------------------------------------------------------------*/ 61 62 /*---------------------------------------------------------------------------- 63 ; MACROS 64 ; Define module specific macros here 65 ----------------------------------------------------------------------------*/ 66 67 /*---------------------------------------------------------------------------- 68 ; EXTERNAL VARIABLES REFERENCES 69 ----------------------------------------------------------------------------*/ 70 #ifdef __cplusplus 71 extern "C" 72 { 73 #endif 74 75 76 int32 one_ov_sqrt( /* (o) Q31 : output value (range: 0<=val<1) */ 77 int32 L_x /* (i) Q0 : input value (range: 0<=val<=7fffffff) */ 78 ); 79 void one_ov_sqrt_norm( 80 int32 * frac, /* (i/o) Q31: normalized value (1.0 < frac <= 0.5) */ 81 int16 * exp /* (i/o) : exponent (value = frac x 2^exponent) */ 82 ); 83 int32 power_of_2( /* (o) Q0 : result (range: 0<=val<=0x7fffffff) */ 84 int16 exponant, /* (i) Q0 : Integer part. (range: 0<=val<=30) */ 85 int16 fraction /* (i) Q15 : Fractionnal part. (range: 0.0<=val<1.0) */ 86 ); 87 int32 Dot_product12( /* (o) Q31: normalized result (1 < val <= -1) */ 88 int16 x[], /* (i) 12bits: x vector */ 89 int16 y[], /* (i) 12bits: y vector */ 90 int16 lg, /* (i) : vector length */ 91 int16 * exp /* (o) : exponent of result (0..+30) */ 92 ); 93 94 95 void amrwb_log_2( 96 int32 L_x, /* (i) : input value */ 97 int16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */ 98 int16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1)*/ 99 ); 100 101 void Lg2_normalized( 102 int32 L_x, /* (i) : input value (normalized) */ 103 int16 exp, /* (i) : norm_l (L_x) */ 104 int16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */ 105 int16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1) */ 106 ); 107 108 109 int16 mult_int16_r(int16 var1, int16 var2); /* Mult with round, 2 */ 110 int16 shr_rnd(int16 var1, int16 var2); /* Shift right with round, 2 */ 111 112 int16 div_16by16(int16 var1, int16 var2); /* Short division, 18 */ 113 114 115 void int32_to_dpf(int32 L_32, int16 *hi, int16 *lo); 116 int32 mpy_dpf_32(int16 hi1, int16 lo1, int16 hi2, int16 lo2); 117 118 119 #define norm_s( x) (normalize_amr_wb( x) - 16) 120 121 122 #define extract_h( x) (int16)((x)>>16) 123 #define L_deposit_h( x) (int32)((x)<<16) 124 125 126 #ifdef __cplusplus 127 } 128 #endif 129 130 131 #endif /* PVAMRWB_MATH_OP_H */ 132 133