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 * -------------------------------------------------------------------
20 Filename: decode_noise_floorlevels.c
22 ------------------------------------------------------------------------------
29 ------------------------------------------------------------------------------
30 INPUT AND OUTPUT DEFINITIONS
34 ------------------------------------------------------------------------------
38 ------------------------------------------------------------------------------
42 ------------------------------------------------------------------------------
45 SC 29 Software Copyright Licencing Disclaimer:
47 This software module was originally developed by
53 in the course of development of the ISO/IEC 13818-7 and ISO/IEC 14496-3
54 standards for reference purposes and its performance may not have been
55 optimized. This software module is an implementation of one or more tools as
56 specified by the ISO/IEC 13818-7 and ISO/IEC 14496-3 standards.
57 ISO/IEC gives users free license to this software module or modifications
58 thereof for use in products claiming conformance to audiovisual and
59 image-coding related ITU Recommendations and/or ISO/IEC International
60 Standards. ISO/IEC gives users the same free license to this software module or
61 modifications thereof for research purposes and further ISO/IEC standardisation.
62 Those intending to use this software module in products are advised that its
63 use may infringe existing patents. ISO/IEC have no liability for use of this
64 software module or modifications thereof. Copyright is not released for
65 products that do not conform to audiovisual and image-coding related ITU
66 Recommendations and/or ISO/IEC International Standards.
67 The original developer retains full right to modify and use the code for its
68 own purpose, assign or donate the code to a third party and to inhibit third
69 parties from using the code for products that do not conform to audiovisual and
70 image-coding related ITU Recommendations and/or ISO/IEC International Standards.
71 This copyright notice must be included in all copies or derivative works.
72 Copyright (c) ISO/IEC 2002.
74 ------------------------------------------------------------------------------
77 ------------------------------------------------------------------------------
82 /*----------------------------------------------------------------------------
84 ----------------------------------------------------------------------------*/
85 #include "decode_noise_floorlevels.h"
86 #include "sbr_constants.h"
88 /*----------------------------------------------------------------------------
90 ; Define module specific macros here
91 ----------------------------------------------------------------------------*/
94 /*----------------------------------------------------------------------------
96 ; Include all pre-processor statements here. Include conditional
97 ; compile variables also.
98 ----------------------------------------------------------------------------*/
100 /*----------------------------------------------------------------------------
101 ; LOCAL FUNCTION DEFINITIONS
102 ; Function Prototype declaration
103 ----------------------------------------------------------------------------*/
105 /*----------------------------------------------------------------------------
106 ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
107 ; Variable declaration - defined here and used outside this module
108 ----------------------------------------------------------------------------*/
110 /*----------------------------------------------------------------------------
111 ; EXTERNAL FUNCTION REFERENCES
112 ; Declare functions defined elsewhere and referenced in this module
113 ----------------------------------------------------------------------------*/
115 /*----------------------------------------------------------------------------
116 ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
117 ; Declare variables used in this module but defined elsewhere
118 ----------------------------------------------------------------------------*/
120 /*----------------------------------------------------------------------------
122 ----------------------------------------------------------------------------*/
124 void decode_noise_floorlevels(SBR_FRAME_DATA * hFrameData)
130 Int32 * frameInfo = hFrameData->frameInfo;
131 Int32 nNfb = hFrameData->nNfb;
132 Int32 * domain_vec = hFrameData->domain_vec2;
134 Int32 * sbrNoiseFloorLevel_man = hFrameData->sbrNoiseFloorLevel_man;
135 Int32 * prevNoiseLevel_man = hFrameData->prevNoiseLevel_man;
137 Int32 nEnv = frameInfo[(frameInfo[0] << 1) + 3];
139 for (env = 0; env < nEnv; env++)
141 if (domain_vec[env] == 0)
143 prevNoiseLevel_man[0] = *(sbrNoiseFloorLevel_man++);
145 for (i = 1; i < nNfb; i++)
147 *sbrNoiseFloorLevel_man += *(sbrNoiseFloorLevel_man - 1);
148 prevNoiseLevel_man[i] = *(sbrNoiseFloorLevel_man++);
153 for (i = 0; i < nNfb; i++)
155 *sbrNoiseFloorLevel_man += prevNoiseLevel_man[i];
156 prevNoiseLevel_man[i] = *(sbrNoiseFloorLevel_man++);