MloElementCce.h

00001 /*****************************************************************
00002 |
00003 |    Copyright 2004-2006 Axiomatic Systems LLC
00004 |
00005 |    This file is part of Melo (Melo AAC Decoder).
00006 |
00007 |    Unless you have obtained Melo under a difference license,
00008 |    this version of Melo is Melo|GPL.
00009 |    Melo|GPL is free software; you can redistribute it and/or modify
00010 |    it under the terms of the GNU General Public License as published by
00011 |    the Free Software Foundation; either version 2, or (at your option)
00012 |    any later version.
00013 |
00014 |    Melo|GPL is distributed in the hope that it will be useful,
00015 |    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 |    GNU General Public License for more details.
00018 |
00019 |    You should have received a copy of the GNU General Public License
00020 |    along with Melo|GPL; see the file COPYING.  If not, write to the
00021 |    Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
00022 |    02111-1307, USA.
00023 |
00024  ****************************************************************/
00025 
00026 /*
00027 Ref:
00028 4.4.2.1, Table 4.8 (p 17)
00029 4.6.8.3 (p 153)
00030 */
00031 
00032 #ifndef _MLO_ELEMENT_CCE_H_
00033 #define _MLO_ELEMENT_CCE_H_
00034 
00035 /*----------------------------------------------------------------------
00036 |       Includes
00037 +---------------------------------------------------------------------*/
00038 #include "MloSamplingFreq.h"
00039 #include "MloBitStream.h"
00040 #include "MloDefs.h"
00041 #include "MloIndivChnPool.h"
00042 #include "MloIndivChnStream.h"
00043 #include "MloTypes.h"
00044 
00045 /*----------------------------------------------------------------------
00046 |       Data
00047 +---------------------------------------------------------------------*/
00048 enum {   MLO_ELEMENT_CCE_MAX_NBR_TARGETS  = (1<<3) + 1   };
00049 enum {   MLO_ELEMENT_CCE_MAX_NBR_G_E_L    = MLO_ELEMENT_CCE_MAX_NBR_TARGETS * 2  };
00050 
00051 /* For implementation */
00052 enum {   MLO_ELEMENT_CCE_POW2_RES_L2   = 3   }; /* Bits */
00053 enum {   MLO_ELEMENT_CCE_POW2_RES      = 1 << MLO_ELEMENT_CCE_POW2_RES_L2   };
00054 
00055 /*----------------------------------------------------------------------
00056 |       Types
00057 +---------------------------------------------------------------------*/
00058 /* Forward declarations */
00059 struct MLO_SyntacticElements;
00060 
00061 
00062 
00063 typedef enum MLO_ElementCce_Stage
00064 {
00065    MLO_ELEMENT_CCE_STAGE_DEP_BEFORE_TNS = 0,
00066    MLO_ELEMENT_CCE_STAGE_DEP_AFTER_TNS,
00067    MLO_ELEMENT_CCE_STAGE_INDEP,
00068 
00069    MLO_ELEMENT_CCE_STAGE_NBR_ELT
00070 }  MLO_ElementCce_Stage;
00071 
00072 typedef struct MLO_ElementCce_CcTarget
00073 {
00074    MLO_UInt8      is_cpe;     /* Boolean */
00075    MLO_UInt8      tag_select;
00076    MLO_UInt8      cc_l;       /* Boolean */
00077    MLO_UInt8      cc_r;       /* Boolean */
00078 }  MLO_ElementCce_CcTarget;
00079 
00080 typedef struct MLO_ElementCce_GainElementList
00081 {
00082    MLO_UInt8      cge_flag;   /* Boolean, true = common, false = dpcm */
00083    MLO_UInt8      common_gain_element;
00084    MLO_UInt8      dpcm_gain_element [MLO_DEFS_MAX_NBR_WIN_GRP] [MLO_DEFS_MAX_NUM_SWB + 1];  /* [g] [sfb] */
00085 }  MLO_ElementCce_GainElementList;
00086 
00087 typedef struct MLO_ElementCce
00088 {
00089    int            element_instance_tag;
00090    MLO_Boolean    ind_sw_cce_flag;
00091    int            num_coupled_elements;
00092    MLO_ElementCce_CcTarget
00093                   cc_target_arr [MLO_ELEMENT_CCE_MAX_NBR_TARGETS];
00094    MLO_Boolean    cc_domain;  /* True = apply after TNS */
00095    MLO_Boolean    gain_element_sign;
00096    int            gain_element_scale;
00097    int            num_gain_element_lists;
00098    MLO_ElementCce_GainElementList
00099                   gel_arr [MLO_ELEMENT_CCE_MAX_NBR_G_E_L];  /* Index 0 is not used */
00100    MLO_IndivChnStream *
00101                   ics_ptr;    /* Allocated by the channel pool */
00102 }  MLO_ElementCce;
00103 
00104 
00105 
00106 /*----------------------------------------------------------------------
00107 |       Function prototypes
00108 +---------------------------------------------------------------------*/
00109 
00110 
00111 
00112 #ifdef __cplusplus
00113 extern "C" {
00114 #endif /* __cplusplus */
00115 
00116 
00117 
00118 MLO_Result  MLO_ElementCce_Decode (MLO_ElementCce *cce_ptr, MLO_BitStream *bit_ptr, MLO_IndivChnPool *chn_pool_ptr, MLO_SamplingFreq_Index fs_index);
00119 MLO_Result  MLO_ElementCce_Process (const MLO_ElementCce *cce_ptr, struct MLO_SyntacticElements *se_ptr, MLO_ElementCce_Stage stage);
00120 
00121 
00122 
00123 
00124 #ifdef __cplusplus
00125 }
00126 #endif /* __cplusplus */
00127 
00128 
00129 
00130 #endif /* _MLO_ELEMENT_CCE_H_ */