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 20 Filename: sbr_get_sce.c 21 22------------------------------------------------------------------------------ 23 REVISION HISTORY 24 25 26 Who: Date: MM/DD/YYYY 27 Description: 28 29------------------------------------------------------------------------------ 30 INPUT AND OUTPUT DEFINITIONS 31 32 Arguments: hFrameData - handle to struct SBR_FRAME_DATA 33 hBitBuf - handle to struct BIT_BUF 34 35 Return: SbrFrameOK 36 37 38------------------------------------------------------------------------------ 39 FUNCTION DESCRIPTION 40 41 42------------------------------------------------------------------------------ 43 REQUIREMENTS 44 45 46------------------------------------------------------------------------------ 47 REFERENCES 48 49SC 29 Software Copyright Licencing Disclaimer: 50 51This software module was originally developed by 52 Coding Technologies 53 54and edited by 55 - 56 57in the course of development of the ISO/IEC 13818-7 and ISO/IEC 14496-3 58standards for reference purposes and its performance may not have been 59optimized. This software module is an implementation of one or more tools as 60specified by the ISO/IEC 13818-7 and ISO/IEC 14496-3 standards. 61ISO/IEC gives users free license to this software module or modifications 62thereof for use in products claiming conformance to audiovisual and 63image-coding related ITU Recommendations and/or ISO/IEC International 64Standards. ISO/IEC gives users the same free license to this software module or 65modifications thereof for research purposes and further ISO/IEC standardisation. 66Those intending to use this software module in products are advised that its 67use may infringe existing patents. ISO/IEC have no liability for use of this 68software module or modifications thereof. Copyright is not released for 69products that do not conform to audiovisual and image-coding related ITU 70Recommendations and/or ISO/IEC International Standards. 71The original developer retains full right to modify and use the code for its 72own purpose, assign or donate the code to a third party and to inhibit third 73parties from using the code for products that do not conform to audiovisual and 74image-coding related ITU Recommendations and/or ISO/IEC International Standards. 75This copyright notice must be included in all copies or derivative works. 76Copyright (c) ISO/IEC 2002. 77 78------------------------------------------------------------------------------ 79 PSEUDO-CODE 80 81------------------------------------------------------------------------------ 82*/ 83 84 85/*---------------------------------------------------------------------------- 86; INCLUDES 87----------------------------------------------------------------------------*/ 88 89#ifdef AAC_PLUS 90 91 92 93#include "sbr_get_sce.h" 94#include "sbr_get_additional_data.h" 95#include "sbr_extract_extended_data.h" 96#include "buf_getbits.h" 97#include "sbr_get_envelope.h" 98#include "sbr_get_noise_floor_data.h" 99#include "extractframeinfo.h" 100#include "sbr_get_dir_control_data.h" 101#include "e_invf_mode.h" 102#include "aac_mem_funcs.h" 103 104/*---------------------------------------------------------------------------- 105; MACROS 106; Define module specific macros here 107----------------------------------------------------------------------------*/ 108 109 110/*---------------------------------------------------------------------------- 111; DEFINES 112; Include all pre-processor statements here. Include conditional 113; compile variables also. 114----------------------------------------------------------------------------*/ 115 116/*---------------------------------------------------------------------------- 117; LOCAL FUNCTION DEFINITIONS 118; Function Prototype declaration 119----------------------------------------------------------------------------*/ 120 121/*---------------------------------------------------------------------------- 122; LOCAL STORE/BUFFER/POINTER DEFINITIONS 123; Variable declaration - defined here and used outside this module 124----------------------------------------------------------------------------*/ 125 126/*---------------------------------------------------------------------------- 127; EXTERNAL FUNCTION REFERENCES 128; Declare functions defined elsewhere and referenced in this module 129----------------------------------------------------------------------------*/ 130 131/*---------------------------------------------------------------------------- 132; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES 133; Declare variables used in this module but defined elsewhere 134----------------------------------------------------------------------------*/ 135 136/*---------------------------------------------------------------------------- 137; FUNCTION CODE 138----------------------------------------------------------------------------*/ 139 140SBR_ERROR sbr_get_sce(SBR_FRAME_DATA * hFrameData, 141 BIT_BUFFER * hBitBuf 142#ifdef PARAMETRICSTEREO 143 , HANDLE_PS_DEC hParametricStereoDec 144#endif 145 ) 146{ 147 Int32 i; 148 Int32 bits; 149 SBR_ERROR err = SBRDEC_OK; 150 151 /* reserved bits */ 152 bits = buf_getbits(hBitBuf, SI_SBR_RESERVED_PRESENT); 153 154 if (bits) 155 { 156 buf_getbits(hBitBuf, SI_SBR_RESERVED_BITS_DATA); 157 } 158 159 /* side info */ 160 err = extractFrameInfo(hBitBuf, hFrameData); 161 162 if (err != SBRDEC_OK) 163 { 164 return err; 165 } 166 167 168 sbr_get_dir_control_data(hFrameData, hBitBuf); 169 170 for (i = 0; i < hFrameData->nNfb; i++) 171 { 172 hFrameData->sbr_invf_mode_prev[i] = hFrameData->sbr_invf_mode[i]; 173 hFrameData->sbr_invf_mode[i] = 174 (INVF_MODE) buf_getbits(hBitBuf, SI_SBR_INVF_MODE_BITS); 175 } 176 177 178 /* raw data */ 179 sbr_get_envelope(hFrameData, hBitBuf); 180 181 sbr_get_noise_floor_data(hFrameData, hBitBuf); 182 183 pv_memset((void *)hFrameData->addHarmonics, 184 0, 185 hFrameData->nSfb[HI]*sizeof(Int32)); 186 187 sbr_get_additional_data(hFrameData, hBitBuf); 188 189 sbr_extract_extended_data(hBitBuf 190#ifdef PARAMETRICSTEREO 191 , hParametricStereoDec 192#endif 193 ); 194 195 hFrameData->coupling = COUPLING_OFF; 196 197 return SBRDEC_OK; 198 199} 200 201 202#endif 203