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 (AMR) speech codec
23 Available from http://www.3gpp.org
25 (C) 2004, 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 ****************************************************************************************/
34 Filename: l_extract.cpp
36 ------------------------------------------------------------------------------
39 /*----------------------------------------------------------------------------
41 ----------------------------------------------------------------------------*/
44 /*----------------------------------------------------------------------------
46 ; [Define module specific macros here]
47 ----------------------------------------------------------------------------*/
49 /*----------------------------------------------------------------------------
51 ; [Include all pre-processor statements here. Include conditional
52 ; compile variables also.]
53 ----------------------------------------------------------------------------*/
55 /*----------------------------------------------------------------------------
56 ; LOCAL FUNCTION DEFINITIONS
57 ; [List function prototypes here]
58 ----------------------------------------------------------------------------*/
60 /*----------------------------------------------------------------------------
61 ; LOCAL VARIABLE DEFINITIONS
62 ; [Variable declaration - defined here and used outside this module]
63 ----------------------------------------------------------------------------*/
67 ------------------------------------------------------------------------------
68 FUNCTION NAME: L_extract
69 ------------------------------------------------------------------------------
70 INPUT AND OUTPUT DEFINITIONS
73 L_var = 32 bit signed integer (Word32) whose value falls
74 in the range : 0x8000 0000 <= L_32 <= 0x7fff ffff.
76 pL_var_hi = pointer to the most significant word of L_var (Word16).
78 pL_var_lo = pointer to the least significant word of L_var shifted
79 to the left by 1 (Word16).
81 pOverflow = pointer to overflow (Flag)
84 pOverflow -> 1 if the 32 bit add operation resulted in overflow
85 pL_var_hi -> MS word of L_32.
86 pL_var_lo -> LS word of L_32 shifted left by 1.
91 Global Variables Used:
94 Local Variables Needed:
97 ------------------------------------------------------------------------------
100 This function extracts two 16-bit double precision format (DPF) numbers
101 from a 32-bit integer. The MS word of L_var will be stored in the location
102 pointed to by pL_var_hi and the shifted LS word of L_var will be stored in
103 the location pointed to by pL_var_lo.
105 ------------------------------------------------------------------------------
110 ------------------------------------------------------------------------------
113 [1] L_extract() function in oper_32b.c, UMTS GSM AMR speech codec, R99 -
114 Version 3.2.0, March 2, 2001
116 ------------------------------------------------------------------------------
120 ------------------------------------------------------------------------------
122 [State any special notes, constraints or cautions for users of this function]
124 ------------------------------------------------------------------------------
127 /*----------------------------------------------------------------------------
129 ----------------------------------------------------------------------------*/
130 void L_Extract(Word32 L_var,
138 OSCL_UNUSED_ARG(pOverflow);
140 temp = (L_var >> 16);
142 *(pL_var_hi) = (Word16) temp;
143 *(pL_var_lo) = (Word16)((L_var >> 1) - (temp << 15));