1 /* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
18 /****************************************************************************************
19 Portions of this file are derived from the following 3GPP standard:
22 ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
23 Available from http://www.3gpp.org
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 ****************************************************************************************/
30 ------------------------------------------------------------------------------
36 ------------------------------------------------------------------------------
37 INPUT AND OUTPUT DEFINITIONS
40 X[-2:2] 16-bit integers.
43 The median of {X[-2], X[-1],..., X[2]}.
45 ------------------------------------------------------------------------------
48 Returns the median of the set {X[-2], X[-1],..., X[2]},
49 whose elements are 16-bit integers.
51 ------------------------------------------------------------------------------
55 ------------------------------------------------------------------------------
58 ------------------------------------------------------------------------------
61 ------------------------------------------------------------------------------
65 /*----------------------------------------------------------------------------
67 ----------------------------------------------------------------------------*/
69 #include "pv_amr_wb_type_defs.h"
70 #include "pvamrwbdecoder_basic_op.h"
71 #include "pvamrwbdecoder_acelp.h"
72 #include "pvamrwb_math_op.h"
74 /*----------------------------------------------------------------------------
76 ; Define module specific macros here
77 ----------------------------------------------------------------------------*/
80 /*----------------------------------------------------------------------------
82 ; Include all pre-processor statements here. Include conditional
83 ; compile variables also.
84 ----------------------------------------------------------------------------*/
86 /*----------------------------------------------------------------------------
87 ; LOCAL FUNCTION DEFINITIONS
88 ; Function Prototype declaration
89 ----------------------------------------------------------------------------*/
91 /*----------------------------------------------------------------------------
92 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
93 ; Variable declaration - defined here and used outside this module
94 ----------------------------------------------------------------------------*/
96 /*----------------------------------------------------------------------------
97 ; EXTERNAL FUNCTION REFERENCES
98 ; Declare functions defined elsewhere and referenced in this module
99 ----------------------------------------------------------------------------*/
101 /*----------------------------------------------------------------------------
102 ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
103 ; Declare variables used in this module but defined elsewhere
104 ----------------------------------------------------------------------------*/
106 /*----------------------------------------------------------------------------
108 ----------------------------------------------------------------------------*/
110 int16 median5(int16 x[])
112 int16 x1, x2, x3, x4, x5;