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 ****************************************************************************************/
30 ------------------------------------------------------------------------------
36 ------------------------------------------------------------------------------
39 common part (reset) of LSF decoder
40 module (rest in d_plsf_3.c and d_plsf_5.c)
41 ------------------------------------------------------------------------------
44 /*----------------------------------------------------------------------------
46 ----------------------------------------------------------------------------*/
52 #include "q_plsf_5_tbl.h"
55 /*----------------------------------------------------------------------------
57 ; Define module specific macros here
58 ----------------------------------------------------------------------------*/
60 /*----------------------------------------------------------------------------
62 ; Include all pre-processor statements here. Include conditional
63 ; compile variables also.
64 ----------------------------------------------------------------------------*/
66 /*----------------------------------------------------------------------------
67 ; LOCAL FUNCTION DEFINITIONS
68 ; Function Prototype declaration
69 ----------------------------------------------------------------------------*/
71 /*----------------------------------------------------------------------------
72 ; LOCAL VARIABLE DEFINITIONS
73 ; Variable declaration - defined here and used outside this module
74 ----------------------------------------------------------------------------*/
76 /*----------------------------------------------------------------------------
77 ; EXTERNAL FUNCTION REFERENCES
78 ; Declare functions defined elsewhere and referenced in this module
79 ----------------------------------------------------------------------------*/
81 /*----------------------------------------------------------------------------
82 ; EXTERNAL VARIABLES REFERENCES
83 ; Declare variables used in this module but defined elsewhere
84 ----------------------------------------------------------------------------*/
87 ------------------------------------------------------------------------------
88 FUNCTION NAME: D_plsf_reset
89 ------------------------------------------------------------------------------
90 INPUT AND OUTPUT DEFINITIONS
93 state = pointer to structure of type D_plsf_reset
96 fields of the structure pointed to by state is initialized to zero
99 return_value = 0, if reset was successful; -1, otherwise (int)
101 Global Variables Used:
104 Local Variables Needed:
107 ------------------------------------------------------------------------------
112 ------------------------------------------------------------------------------
117 ------------------------------------------------------------------------------
120 d_plsf.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
122 ------------------------------------------------------------------------------
125 int D_plsf_reset (D_plsfState *state)
129 if (state == (D_plsfState *) NULL){
130 // fprintf(stderr, "D_plsf_reset: invalid parameter\n");
134 for (i = 0; i < M; i++){
135 state->past_r_q[i] = 0; // Past quantized prediction error
138 // Past dequantized lsfs
139 Copy(mean_lsf, &state->past_lsf_q[0], M);
143 ------------------------------------------------------------------------------
145 [State any special notes, constraints or cautions for users of this function]
147 ------------------------------------------------------------------------------
150 Word16 D_plsf_reset(D_plsfState *state, const Word16* mean_lsf_5_ptr)
154 if (state == (D_plsfState *) NULL)
156 /* fprintf(stderr, "D_plsf_reset: invalid parameter\n"); */
160 for (i = 0; i < M; i++)
162 state->past_r_q[i] = 0; /* Past quantized prediction error */
165 /* Past dequantized lsfs */
166 oscl_memmove((void *)&state->past_lsf_q[0], mean_lsf_5_ptr, M*sizeof(*mean_lsf_5_ptr));