MloSyntacticElements.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 #ifndef _MLO_SYNTACTIC_ELEMENTS_H_
00027 #define _MLO_SYNTACTIC_ELEMENTS_H_
00028 
00029 
00030 
00031 /*----------------------------------------------------------------------
00032 |       Includes
00033 +---------------------------------------------------------------------*/
00034 
00035 
00036 
00037 #include "MloSamplingFreq.h"
00038 #include "MloBitStream.h"
00039 #include "MloElementCce.h"
00040 #include "MloElementCpe.h"
00041 #include "MloElementFil.h"
00042 #include "MloElementPce.h"
00043 #include "MloElementSceLfe.h"
00044 #include    "MloFilterBank.h"
00045 #include "MloIndivChnPool.h"
00046 #include "MloSampleBuffer.h"
00047 
00048 
00049 
00050 /*----------------------------------------------------------------------
00051 |       Constants
00052 +---------------------------------------------------------------------*/
00053 
00054 
00055 
00056 #define  MLO_ERROR_SCE_TAG_DUPLICATED  (MLO_ERROR_BASE_SYNTACTIC_ELEMENTS-0)
00057 #define  MLO_ERROR_CPE_TAG_DUPLICATED  (MLO_ERROR_BASE_SYNTACTIC_ELEMENTS-1)
00058 #define  MLO_ERROR_SCE_TAG_UNKNOWN     (MLO_ERROR_BASE_SYNTACTIC_ELEMENTS-2)
00059 #define  MLO_ERROR_CPE_TAG_UNKNOWN     (MLO_ERROR_BASE_SYNTACTIC_ELEMENTS-3)
00060 
00061 
00062 
00063 /*----------------------------------------------------------------------
00064 |       Types
00065 +---------------------------------------------------------------------*/
00066 
00067 
00068 
00069 typedef enum MLO_SyntacticElements_ContentType
00070 {
00071    MLO_SYNTACTIC_ELEMENTS_CONTENT_TYPE_SCE = 0,
00072    MLO_SYNTACTIC_ELEMENTS_CONTENT_TYPE_CPE,
00073    MLO_SYNTACTIC_ELEMENTS_CONTENT_TYPE_LFE,
00074 
00075    MLO_SYNTACTIC_ELEMENTS_CONTENT_TYPE_SCE_NBR_ELT
00076 }  MLO_SyntacticElements_ContentType;
00077 
00078 
00079 
00080 typedef struct MLO_SyntacticElements_ContentRef
00081 {
00082    MLO_SyntacticElements_ContentType
00083                   type;
00084    int            index;
00085 }  MLO_SyntacticElements_ContentRef;
00086 
00087 
00088 
00089 typedef  int   MLO_SyntacticElements_TagMap [16];  /* < 0: empty tag, >= 0: element index */
00090 
00091 
00092 
00093 typedef struct MLO_SyntacticElements
00094 {
00095    MLO_ElementPce pce;           /* program_config_element */
00096 
00097    MLO_IndivChnPool
00098                   chn_pool;
00099 
00100    int            nbr_fil;
00101    MLO_ElementFil fil_arr [16];  /* fill_element */
00102 
00103    int            nbr_sce;
00104    MLO_ElementSceLfe             /* single_channel_element */
00105                   sce_arr [16];
00106    MLO_SyntacticElements_TagMap
00107                   sce_tag_map;
00108 
00109    int            nbr_lfe;
00110    MLO_ElementSceLfe             /* lfe_channel_element */
00111                   lfe_arr [16];
00112 
00113    int            nbr_cpe;
00114    MLO_ElementCpe cpe_arr [16];  /* channel_pair_element */
00115    MLO_SyntacticElements_TagMap
00116                   cpe_tag_map;
00117 
00118    int            nbr_cce;
00119    MLO_ElementCce cce_arr [16];  /* coupling_channel_element */
00120 
00121    int            nbr_received_elements;
00122    MLO_SyntacticElements_ContentRef
00123                   order_arr [64];   /* Order of receipt */
00124 }  MLO_SyntacticElements;
00125 
00126 
00127 
00128 /*----------------------------------------------------------------------
00129 |       Function prototypes
00130 +---------------------------------------------------------------------*/
00131 
00132 
00133 
00134 #ifdef __cplusplus
00135 extern "C" {
00136 #endif /* __cplusplus */
00137 
00138 
00139 
00140 MLO_Result  MLO_SyntacticElements_Init (MLO_SyntacticElements *se_ptr);
00141 void  MLO_SyntacticElements_Restore (MLO_SyntacticElements *se_ptr);
00142 MLO_Result  MLO_SyntacticElements_SetNbrChn (MLO_SyntacticElements *se_ptr, int nbr_chn);
00143 
00144 void  MLO_SyntacticElements_StartNewFrame (MLO_SyntacticElements *se_ptr, MLO_SamplingFreq_Index fs_index);
00145 
00146 MLO_Result  MLO_SyntacticElements_Decode (MLO_SyntacticElements *se_ptr, MLO_BitStream *bit_ptr);
00147 MLO_Result  MLO_SyntacticElements_FinishSpectralProc (MLO_SyntacticElements *se_ptr);
00148 MLO_Result  MLO_SyntacticElements_ConvertSpectralToTime (MLO_SyntacticElements *se_ptr, MLO_FilterBank *fb_ptr);
00149 MLO_Result  MLO_SyntacticElements_SendToOutput (const MLO_SyntacticElements *se_ptr, MLO_SampleBuffer *outbuf_ptr);
00150 
00151 MLO_Result  MLO_SyntacticElements_UseSce (MLO_SyntacticElements *se_ptr, int tag, MLO_ElementSceLfe **sce_ptr_ptr);
00152 MLO_Result  MLO_SyntacticElements_UseCpe (MLO_SyntacticElements *se_ptr, int tag, MLO_ElementCpe **cpe_ptr_ptr);
00153 
00154 
00155 #ifdef __cplusplus
00156 }
00157 #endif /* __cplusplus */
00158 
00159 
00160 
00161 #endif /* _MLO_SYNTACTIC_ELEMENTS_H_ */