OSDN Git Service

RIO-8301: This record allows AAC multichannel contents to be partially decoded (outpu...
authorPacketVideo CM <engbuild@pv.com>
Sat, 20 Mar 2010 00:52:57 +0000 (17:52 -0700)
committerPacketVideo CM <engbuild@pv.com>
Sat, 20 Mar 2010 00:52:57 +0000 (17:52 -0700)
Change-Id: Idda75200dce317177bd273c8f9140a4a89e0f968

33 files changed:
build_config/opencore_dynamic/pv_config.h
build_config/opencore_dynamic/pv_config_derived.mk
build_config/opencore_dynamic/pv_config_selected.mk
codecs_v2/audio/aac/dec/Android.mk
codecs_v2/audio/aac/dec/build/make/local.mk
codecs_v2/audio/aac/dec/include/pv_audio_type_defs.h
codecs_v2/audio/aac/dec/include/pvmp4audiodecoder_api.h
codecs_v2/audio/aac/dec/src/e_progconfigconst.h
codecs_v2/audio/aac/dec/src/e_rawbitstreamconst.h
codecs_v2/audio/aac/dec/src/get_cce.cpp [new file with mode: 0644]
codecs_v2/audio/aac/dec/src/get_cce.h [new file with mode: 0644]
codecs_v2/audio/aac/dec/src/get_prog_config.cpp
codecs_v2/audio/aac/dec/src/getics.cpp
codecs_v2/audio/aac/dec/src/huffdecode.cpp
codecs_v2/audio/aac/dec/src/huffman.h
codecs_v2/audio/aac/dec/src/huffspec_fxp.cpp
codecs_v2/audio/aac/dec/src/infoinit.cpp
codecs_v2/audio/aac/dec/src/pvmp4audiodecoderframe.cpp
codecs_v2/audio/aac/dec/src/pvmp4audiodecodergetmemrequirements.cpp
codecs_v2/audio/aac/dec/src/pvmp4audiodecoderinitlibrary.cpp
codecs_v2/audio/aac/dec/src/pvmp4audiodecoderresetbuffer.cpp
codecs_v2/audio/aac/dec/src/s_tdec_int_file.h
codecs_v2/audio/aac/dec/src/sbr_applied.cpp
codecs_v2/audio/aac/dec/src/unpack_idx.cpp
codecs_v2/audio/aac/dec/src/unpack_idx.h
codecs_v2/audio/aac/dec/util/getactualaacconfig/src/get_prog_config.cpp
codecs_v2/audio/aac/dec/util/getactualaacconfig/src/getactualaacconfig.cpp
codecs_v2/audio/aac/dec/util/getactualaacconfig/src/infoinit.cpp
codecs_v2/audio/aac/dec/util/getactualaacconfig/src/pvmp4audiodecodergetmemrequirements.cpp
codecs_v2/audio/aac/dec/util/getactualaacconfig/src/pvmp4audiodecoderinitlibrary.cpp
engines/2way/src/pv_2way_sdkinfo.h
engines/author/src/pv_author_sdkinfo.h
engines/player/src/pv_player_sdkinfo.h

index a7fc1bc..d82d490 100644 (file)
 #define wmadecoder_lib 0
 #define useoldwmadecoder 0
 #define usepv_one_segment_broadcast 0
+#define usemultichannlefriendly 0
 #define wma_audio_support m
 
 //
 #define pvmp4ff_y_lib ""
 #define pvamrffparsernode_y_mk ""
 #define pvmshttpfsp_y_mk ""
-#define USE_OLD_WMA_DECODER 0
 #define LIBS_omxenc_static "   "
 #define pvstreamingmanagernode_y_mk ""
 #define smmshttpplugininterface_m_lib ""
 #define rtspbasedpluginselected 1
 #define pvwavffrecognizer_y_lib ""
 #define MODS_pvdb_recovery_utility "-lopencore_common -lpvdb"
+#define USE_OLD_WMA_DECODER 0
 #define pvomx_proxy_m_mk "/codecs_v2/omx/omx_proxy/build/make"
 #define pvra8decoder_imp_m_mk ""
 #define pvrtsptunicastfsp_y_mk ""
 #define LIBDIR_nodes_static "                                               "
 #define smrtspunicastplugininterface_m_mk "/modules/linux_rtsp/smplugins/unicast/core/build/make"
 #define pvmshttp_streaming_aggregate_libtype "static"
+#define PV_MULTICHANNEL_FRIENDLY 0
 #define asfrecognizer_utility_m_mk ""
 #define pvrmffparsernode_m_mk ""
 #define realaudio_deinterleaver_m_mk ""
index 9da523d..93e9836 100644 (file)
@@ -84,7 +84,6 @@ MODS_pvrtspbroadcastwithpvr_streaming="-lopencore_net_support -lopencore_player
 pvmp4ff_y_lib=""
 pvamrffparsernode_y_mk=""
 pvmshttpfsp_y_mk=""
-USE_OLD_WMA_DECODER=0
 LIBS_omxenc_static="   "
 pvstreamingmanagernode_y_mk=""
 smmshttpplugininterface_m_lib=""
@@ -501,6 +500,7 @@ pvasfff_y_lib=""
 rtspbasedpluginselected=y
 pvwavffrecognizer_y_lib=""
 MODS_pvdb_recovery_utility="-lopencore_common -lpvdb"
+USE_OLD_WMA_DECODER=0
 pvomx_proxy_m_mk="/codecs_v2/omx/omx_proxy/build/make"
 pvra8decoder_imp_m_mk=""
 pvrtsptunicastfsp_y_mk=""
@@ -1079,6 +1079,7 @@ pv_aac_enc_imp_m_lib=""
 LIBDIR_nodes_static="                                               "
 smrtspunicastplugininterface_m_mk="/modules/linux_rtsp/smplugins/unicast/core/build/make"
 pvmshttp_streaming_aggregate_libtype="static"
+PV_MULTICHANNEL_FRIENDLY=0
 asfrecognizer_utility_m_mk=""
 pvrmffparsernode_m_mk=""
 realaudio_deinterleaver_m_mk=""
index f3a7c8f..fb1526a 100644 (file)
@@ -130,6 +130,7 @@ pv_srs_wowhd_lib=n
 wmadecoder_lib=n
 useoldwmadecoder=n
 usepv_one_segment_broadcast=n
+usemultichannlefriendly=n
 wma_audio_support=m
 
 #
index 38f0a32..3588d7b 100644 (file)
@@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \
        src/get_adif_header.cpp \
        src/get_adts_header.cpp \
        src/get_audio_specific_config.cpp \
+       src/get_cce.cpp \
        src/get_dse.cpp \
        src/get_ele_list.cpp \
        src/get_ga_specific_config.cpp \
index f1db152..b20488f 100644 (file)
@@ -47,6 +47,7 @@ SRCS := analysis_sub_band.cpp \
        get_adif_header.cpp \
        get_adts_header.cpp \
        get_audio_specific_config.cpp \
+       get_cce.cpp \
        get_dse.cpp \
        get_ele_list.cpp \
        get_ga_specific_config.cpp \
index 3714288..e9b40d8 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -173,5 +173,13 @@ typedef Int     Bool;
 #define  NULL       0
 #endif
 
+#ifndef LEFT
+#define LEFT        0
+#endif
+
+#ifndef RIGHT
+#define RIGHT       1
+#endif
+
 
 #endif  /* PV_AUDIO_TYPE_DEFS_H */
index 9bde69b..20b0e46 100644 (file)
@@ -82,8 +82,11 @@ extern "C"
      * The constant value is 6144 * 2 channels / 8 bits per byte
      */
 
+#define  PV_MAX_AAC_FRAME_SIZE_2_CH  1536
+
+
+#define PVMP4AUDIODECODER_INBUFSIZE  PV_MAX_AAC_FRAME_SIZE_2_CH
 
-#define PVMP4AUDIODECODER_INBUFSIZE  1536
 
     /*----------------------------------------------------------------------------
     ; EXTERNAL VARIABLES REFERENCES
@@ -310,6 +313,19 @@ extern "C"
         */
         Int     extendedAudioObjectType;
 
+        /*
+        * This value indicates if the clip is multichannel, if true, it will only decode the
+        * front channel stereo or mono(if stereo not available)
+        */
+        bool     multichannel_detected;
+
+        /*
+        * This value indicates the total number of channels detected in a multichannel clip
+        * format (number of channel)<<1 + lfe
+        *  i.e.   5.1  ===  11  <>  (5 channels)<<1 + 1 lfe
+        */
+        Int     multichannel_numChannels;
+
 
     } tPVMP4AudioDecoderExternal;
 
index ece09e0..2a52b55 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -81,7 +81,6 @@ typedef enum
     LEN_MMIX_IDX    = 2,
     LEN_PSUR_ENAB   = 1,
     LEN_ELE_IS_CPE  = 1,
-    LEN_IND_SW_CCE  = 1,
     LEN_COMMENT_BYTES   = 8
 
 } eProgConfigConst;
index 48bc159..cd24d13 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -96,6 +96,7 @@ typedef enum
     LEN_CC_SGN      = 1,
     LEN_CCH_GES     = 2,
     LEN_CCH_CGP     = 1,
+    LEN_IND_SW_CCE  = 1,
 
     LEN_D_ALIGN     = 1,
     LEN_D_CNT       = 8,
diff --git a/codecs_v2/audio/aac/dec/src/get_cce.cpp b/codecs_v2/audio/aac/dec/src/get_cce.cpp
new file mode 100644 (file)
index 0000000..7ef09e6
--- /dev/null
@@ -0,0 +1,160 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/*
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    pInputStream = pointer to a BITS structure that holds information
+                   regarding the input stream.
+
+    pVars       = pointer to structure that holds information for decoding,
+                  tDec_Int_File
+
+    pChVars[]   = pointer to structure that holds channel information,
+                  tDec_Int_Chan
+
+
+ Local Stores/Buffers/Pointers Needed:
+    None
+
+ Global Stores/Buffers/Pointers Needed:
+    None
+
+ Outputs:
+    None
+
+ Pointers and Buffers Modified:
+    pInputStream->usedBits is rounded up to a number that represents the next
+    byte boundary.
+
+ Local Stores Modified:
+    None
+
+ Global Stores Modified:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    Adquire Coupling Channel Element (CCE) from raw bitstream
+    At this time this function just drops the information.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+  This function shall not use global or static variables.
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ (1) MPEG-2 NBC Audio Decoder
+   "This software module was originally developed by AT&T, Dolby
+   Laboratories, Fraunhofer Gesellschaft IIS in the course of development
+   of the MPEG-2 NBC/MPEG-4 Audio standard ISO/IEC 13818-7, 14496-1,2 and
+   3. This software module is an implementation of a part of one or more
+   MPEG-2 NBC/MPEG-4 Audio tools as specified by the MPEG-2 NBC/MPEG-4
+   Audio standard. ISO/IEC gives users of the MPEG-2 NBC/MPEG-4 Audio
+   standards free license to this software module or modifications thereof
+   for use in hardware or software products claiming conformance to the
+   MPEG-2 NBC/MPEG-4 Audio  standards. Those intending to use this software
+   module in hardware or software products are advised that this use may
+   infringe existing patents. The original developer of this software
+   module and his/her company, the subsequent editors and their companies,
+   and ISO/IEC have no liability for use of this software module or
+   modifications thereof in an implementation. Copyright is not released
+   for non MPEG-2 NBC/MPEG-4 Audio conforming products.The original
+   developer retains full right to use the code for his/her own purpose,
+   assign or donate the code to a third party and to inhibit third party
+   from using the code for non MPEG-2 NBC/MPEG-4 Audio conforming products.
+   This copyright notice must be included in all copies or derivative
+   works."
+   Copyright(c)1996.
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ RESOURCES USED
+
+ STACK USAGE:
+
+     where:
+
+ DATA MEMORY USED: x words
+
+ PROGRAM MEMORY USED: x words
+
+ CLOCK CYCLES:
+
+------------------------------------------------------------------------------
+*/
+
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "pv_audio_type_defs.h"
+#include "get_cce.h"
+#include "ibstream.h"
+#include "getbits.h"
+#include "s_bits.h"
+#include "e_elementid.h"
+#include "huffman.h"
+#include "e_huffmanconst.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL FUNCTION REFERENCES
+; Declare functions defined elsewhere and referenced in this module
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+
+
diff --git a/codecs_v2/audio/aac/dec/src/get_cce.h b/codecs_v2/audio/aac/dec/src/get_cce.h
new file mode 100644 (file)
index 0000000..51fe26b
--- /dev/null
@@ -0,0 +1,92 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/*
+
+ Pathname: get_dse.h
+ Funtions:
+    get_dse
+
+
+------------------------------------------------------------------------------
+ REVISION HISTORY
+
+
+ Who:                                   Date: MM/DD/YYYY
+ Description:
+------------------------------------------------------------------------------
+
+*/
+
+/*----------------------------------------------------------------------------
+; CONTINUE ONLY IF NOT ALREADY DEFINED
+----------------------------------------------------------------------------*/
+#ifndef GET_CCE_H
+#define GET_CCE_H
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+#include    "s_tdec_int_file.h"
+#include    "s_tdec_int_chan.h"
+#include "pv_audio_type_defs.h"
+#include "s_elelist.h"
+#include "s_bits.h"
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; EXTERNAL VARIABLES REFERENCES
+; Declare variables used in this module but defined elsewhere
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; SIMPLE TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; ENUMERATED TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; STRUCTURES TYPEDEF'S
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; GLOBAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+Int get_cce(BITS          *pInputStream,
+            tDec_Int_File *pVars,
+            tDec_Int_Chan *pChVars[]);
+
+
+
+
+/*----------------------------------------------------------------------------
+; END
+----------------------------------------------------------------------------*/
+#endif
index e7970a5..bd958e6 100644 (file)
@@ -404,12 +404,12 @@ Int get_prog_config(
     ProgConfig    *pScratchPCE)
 {
     Int    i;
-    UInt    tag;
+    UInt   tag;
     Int    numChars;
-    UInt    temp;
+    UInt   temp;
     Bool   flag;
     Int    status          = SUCCESS;
-    BITS  *pInputStream   = &(pVars->inputStream);
+    BITS   *pInputStream   = &(pVars->inputStream);
 
 
     /*
@@ -428,20 +428,11 @@ Int get_prog_config(
      * getbits is saved into a temporary variable, then transfered to
      * the structure item.
      */
-    tag =
-        get9_n_lessbits(
-            LEN_TAG,
-            pInputStream);
+    tag = get9_n_lessbits(LEN_TAG, pInputStream);
 
-    pScratchPCE->profile =
-        get9_n_lessbits(
-            LEN_PROFILE,
-            pInputStream);
+    pScratchPCE->profile = get9_n_lessbits(LEN_PROFILE, pInputStream);
 
-    pScratchPCE->sampling_rate_idx =
-        get9_n_lessbits(
-            LEN_SAMP_IDX,
-            pInputStream);
+    pScratchPCE->sampling_rate_idx = get9_n_lessbits(LEN_SAMP_IDX, pInputStream);
 
     if (!pVars->adif_test && (pScratchPCE->sampling_rate_idx != pVars->prog_config.sampling_rate_idx))
     {
@@ -478,49 +469,31 @@ Int get_prog_config(
      * The next six function calls could be combined into one, then use
      * shifts and masks to retrieve the individual fields.
      */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_ELE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_ELE, pInputStream);
 
     pScratchPCE->front.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_ELE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_ELE, pInputStream);
 
     pScratchPCE->side.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_ELE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_ELE, pInputStream);
 
     pScratchPCE->back.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_LFE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_LFE, pInputStream);
 
     pScratchPCE->lfe.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_DAT,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_DAT, pInputStream);
     pScratchPCE->data.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_CCE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_CCE, pInputStream);
 
     pScratchPCE->coupling.num_ele = temp;
 
@@ -532,9 +505,7 @@ Int get_prog_config(
      */
 
     /* Read presence of mono_mix */
-    flag =
-        get1bits(/*            LEN_MIX_PRES,*/
-            pInputStream);
+    flag = get1bits(pInputStream);/* LEN_MIX_PRES,*/
 
     pScratchPCE->mono_mix.present = flag;
 
@@ -547,42 +518,30 @@ Int get_prog_config(
     } /* end if (flag != FALSE) */
 
     /* Read presence of stereo mix */
-    flag =
-        get1bits(/*            LEN_MIX_PRES,*/
-            pInputStream);
+    flag = get1bits(pInputStream);   /* LEN_MIX_PRES,*/
 
     pScratchPCE->stereo_mix.present = flag;
 
     if (flag != FALSE)
     {
-        temp =
-            get9_n_lessbits(
-                LEN_TAG,
-                pInputStream);
+        temp = get9_n_lessbits(LEN_TAG, pInputStream);
 
         pScratchPCE->stereo_mix.ele_tag = temp;
 
     } /* end if (flag != FALSE) */
 
     /* Read presence of matrix mix */
-    flag =
-        get1bits(/*            LEN_MIX_PRES,*/
-            pInputStream);
+    flag = get1bits(pInputStream);  /* LEN_MIX_PRES,*/
 
     pScratchPCE->matrix_mix.present = flag;
 
     if (flag != FALSE)
     {
-        temp =
-            get9_n_lessbits(
-                LEN_MMIX_IDX,
-                pInputStream);
+        temp = get9_n_lessbits(LEN_MMIX_IDX, pInputStream);
 
         pScratchPCE->matrix_mix.ele_tag = temp;
 
-        temp =
-            get1bits(/*                LEN_PSUR_ENAB,*/
-                pInputStream);
+        temp = get1bits(pInputStream);  /* LEN_PSUR_ENAB,*/
 
         pScratchPCE->matrix_mix.pseudo_enab = temp;
 
@@ -596,35 +555,29 @@ Int get_prog_config(
      * This could be optimized by advancing the bit stream for the
      * elements that do not need to be read.
      */
-    get_ele_list(
-        &pScratchPCE->front,
-        pInputStream,
-        TRUE);
-
-    get_ele_list(
-        &pScratchPCE->side,
-        pInputStream,
-        TRUE);
-
-    get_ele_list(
-        &pScratchPCE->back,
-        pInputStream,
-        TRUE);
-
-    get_ele_list(
-        &pScratchPCE->lfe,
-        pInputStream,
-        FALSE);
-
-    get_ele_list(
-        &pScratchPCE->data,
-        pInputStream,
-        FALSE);
-
-    get_ele_list(
-        &pScratchPCE->coupling,
-        pInputStream,
-        TRUE);
+    get_ele_list(&pScratchPCE->front,
+                 pInputStream,
+                 TRUE);
+
+    get_ele_list(&pScratchPCE->side,
+                 pInputStream,
+                 TRUE);
+
+    get_ele_list(&pScratchPCE->back,
+                 pInputStream,
+                 TRUE);
+
+    get_ele_list(&pScratchPCE->lfe,
+                 pInputStream,
+                 FALSE);
+
+    get_ele_list(&pScratchPCE->data,
+                 pInputStream,
+                 FALSE);
+
+    get_ele_list(&pScratchPCE->coupling,
+                 pInputStream,
+                 TRUE);
 
     /*
      * The standard requests a byte alignment before reading in the
@@ -632,9 +585,7 @@ Int get_prog_config(
      */
     byte_align(pInputStream);
 
-    numChars =
-        get9_n_lessbits(
-            LEN_COMMENT_BYTES, pInputStream);
+    numChars = get9_n_lessbits(LEN_COMMENT_BYTES, pInputStream);
 
     /*
      * Ignore the comment - it requires 65 bytes to store (or worse on DSP).
@@ -681,7 +632,7 @@ Int get_prog_config(
              *  Keep adts setting in case of a redundant PCE (only applicable when
              *  using aac-lib own adts parser)
              */
-            pScratchPCE->file_is_adts = pVars->prog_config.file_is_adts;
+            pScratchPCE->file_is_adts      = pVars->prog_config.file_is_adts;
             pScratchPCE->headerless_frames = pVars->prog_config.headerless_frames;
         }
 
@@ -689,21 +640,13 @@ Int get_prog_config(
                   pScratchPCE,
                   sizeof(ProgConfig));
 
-        /* enter configuration into MC_Info structure */
-        status =
-            set_mc_info(
-                &pVars->mc_info,
-                (tMP4AudioObjectType)(pVars->prog_config.profile + 1),
-                pVars->prog_config.sampling_rate_idx,
-                pVars->prog_config.front.ele_tag[0],
-                pVars->prog_config.front.ele_is_cpe[0],
-                pVars->winmap,
-                pVars->SFBWidth128);
+
+        tag = 0;
 
         /*
          *  Check that dual-mono does not carry more than 2 tracks, otherwise flag an non-supported error
          */
-        if ((pVars->prog_config.front.num_ele > 2) && !(pVars->prog_config.front.ele_is_cpe[0]))
+        if ((pVars->prog_config.front.num_ele > 2) && !(pVars->prog_config.front.ele_is_cpe[tag]))
         {
             status = 1;
         }
@@ -711,12 +654,28 @@ Int get_prog_config(
         /*
          *  Check that stereo does not carry more than 1 track, otherwise flag an non-supported error
          */
-        if ((pVars->prog_config.front.num_ele > 1) && (pVars->prog_config.front.ele_is_cpe[0]))
+        if ((pVars->prog_config.front.num_ele > 1) && (pVars->prog_config.front.ele_is_cpe[tag]))
         {
             status = 1;
         }
 
 
+
+        if (!status)
+        {
+
+            /* enter configuration into MC_Info structure */
+            status = set_mc_info(&pVars->mc_info,
+                                 (tMP4AudioObjectType)(pVars->prog_config.profile + 1),
+                                 pVars->prog_config.sampling_rate_idx,
+                                 pVars->prog_config.front.ele_tag[tag],
+                                 pVars->prog_config.front.ele_is_cpe[tag],
+                                 pVars->winmap,
+                                 pVars->SFBWidth128);
+        }
+
+
+
     } /* end if (tag == pVars->current_program) */
 
 
index 39781b0..b7371e0 100644 (file)
 #include    "huffman.h"
 #include    "aac_mem_funcs.h"
 #include    "get_tns.h"
+#include    "e_elementid.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
 Int getics(
+    Int             id_syn_ele,
     BITS            *pInputStream,
     Int             common_window,
     tDec_Int_File   *pVars,
@@ -408,24 +410,20 @@ Int getics(
     pGroup = group;
 
     /* read global gain from Input bitstream */
-    global_gain =
-        get9_n_lessbits(
-            LEN_SCL_PCM,
-            pInputStream);
+    global_gain = get9_n_lessbits(LEN_SCL_PCM, pInputStream);
 
     if (common_window == FALSE)
     {
-        status = get_ics_info(
-                     pVars->mc_info.audioObjectType,
-                     pInputStream,
-                     common_window,
-                     &pChVars->wnd,
-                     &pChVars->wnd_shape_this_bk,
-                     group,
-                     pMax_sfb,
-                     pWinMap,
-                     &pChVars->pShareWfxpCoef->lt_status,
-                     NULL);
+        status = get_ics_info(pVars->mc_info.audioObjectType,
+                              pInputStream,
+                              common_window,
+                              &pChVars->wnd,
+                              &pChVars->wnd_shape_this_bk,
+                              group,
+                              pMax_sfb,
+                              pWinMap,
+                              &pChVars->pShareWfxpCoef->lt_status,
+                              NULL);
     }
 
     pFrameInfo = pWinMap[pChVars->wnd];
@@ -456,14 +454,12 @@ Int getics(
         totSfb  *=  pFrameInfo->sfb_per_win[0];
 
         /* decode section data */
-        nsect =
-            huffcb(
-                sect,
-                pInputStream,
-                pFrameInfo->sectbits,
-                totSfb,
-                pFrameInfo->sfb_per_win[0],
-                *pMax_sfb);
+        nsect = huffcb(sect,
+                       pInputStream,
+                       pFrameInfo->sectbits,
+                       totSfb,
+                       pFrameInfo->sfb_per_win[0],
+                       *pMax_sfb);
 
         if (nsect == 0)
         {
@@ -494,10 +490,9 @@ Int getics(
     else
     {
         /* set all sections with ZERO_HCB */
-        pv_memset(
-            pCodebookMap,
-            ZERO_HCB,
-            MAXBANDS*sizeof(*pCodebookMap));
+        pv_memset(pCodebookMap,
+                  ZERO_HCB,
+                  MAXBANDS*sizeof(*pCodebookMap));
         /*
                 for (i=MAXBANDS; i>0; i--)
                 {
@@ -513,32 +508,27 @@ Int getics(
      */
     if (pFrameInfo->islong == FALSE)
     {
-        calc_gsfb_table(
-            pFrameInfo,
-            group);
+        calc_gsfb_table(pFrameInfo, group);
     }
 
     /* decode scale factor data */
     if (status == SUCCESS)
     {
-        status =
-            hufffac(
-                pFrameInfo,
-                pInputStream,
-                group,
-                nsect,
-                sect,
-                global_gain,
-                pChVars->pShareWfxpCoef->factors,
-                pVars->scratch.huffbook_used);
+        status = hufffac(pFrameInfo,
+                         pInputStream,
+                         group,
+                         nsect,
+                         sect,
+                         global_gain,
+                         pChVars->pShareWfxpCoef->factors,
+                         pVars->scratch.a.huffbook_used);
 
     } /* if (status) */
 
     /* noiseless coding */
     if (status == SUCCESS)
     {
-        present =
-            get1bits(pInputStream);
+        present = get1bits(pInputStream);
 
         pPulseInfo->pulse_data_present = present;
 
@@ -546,9 +536,8 @@ Int getics(
         {
             if (pFrameInfo->islong == 1)
             {
-                status = get_pulse_data(
-                             pPulseInfo,
-                             pInputStream);
+                status = get_pulse_data(pPulseInfo,
+                                        pInputStream);
             }
             else
             {
@@ -564,21 +553,19 @@ Int getics(
     /* decode tns data */
     if (status == SUCCESS)
     {
-        present =
-            get1bits(pInputStream);
+        present = get1bits(pInputStream);
 
         pTnsFrameInfo->tns_data_present = present;
 
         if (present != FALSE)
         {
-            get_tns(
-                pChVars->pShareWfxpCoef->max_sfb,
-                pInputStream,
-                pChVars->wnd,
-                pFrameInfo,
-                &pVars->mc_info,
-                pTnsFrameInfo,
-                pVars->scratch.tns_decode_coef);
+            get_tns(pChVars->pShareWfxpCoef->max_sfb,
+                    pInputStream,
+                    pChVars->wnd,
+                    pFrameInfo,
+                    &pVars->mc_info,
+                    pTnsFrameInfo,
+                    pVars->scratch.a.tns_decode_coef);
         }
         else
         {
@@ -606,19 +593,21 @@ Int getics(
 
     if (status == SUCCESS)
     {
-        status =
-            huffspec_fxp(
-                pFrameInfo,
-                pInputStream,
-                nsect,
-                sect,
-                pChVars->pShareWfxpCoef->factors,
-                pChVars->fxpCoef,
-                pVars->share.a.quantSpec,
-                pVars->scratch.tmp_spec,
-                pWinMap[ONLY_LONG_WINDOW],
-                pPulseInfo,
-                pChVars->pShareWfxpCoef->qFormat);
+        /* Support Mono, Dual-Mono, or Stereo */
+        if ((id_syn_ele == ID_SCE) || (id_syn_ele == ID_CPE))
+        {
+            status = huffspec_fxp(pFrameInfo,
+                                  pInputStream,
+                                  nsect,
+                                  sect,
+                                  pChVars->pShareWfxpCoef->factors,
+                                  pChVars->fxpCoef,
+                                  pVars->share.a.quantSpec,
+                                  pVars->scratch.tmp_spec,
+                                  pWinMap[ONLY_LONG_WINDOW],
+                                  pPulseInfo,
+                                  pChVars->pShareWfxpCoef->qFormat);
+        }
     }
 
     /*----------------------------------------------------------------------------
index 6b1bee8..eda8d25 100644 (file)
 ; Include all pre-processor statements here. Include conditional
 ; compile variables also.
 ----------------------------------------------------------------------------*/
-#define LEFT  (0)
-#define RIGHT (1)
+
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
 ; Function Prototype declaration
 Int huffdecode(
     Int           id_syn_ele,
     BITS          *pInputStream,
-    tDec_Int_File *pVars,
-    tDec_Int_Chan *pChVars[])
+    tDec_Int_File *pVars_0,
+    tDec_Int_Chan *pChVars_0[]
+)
 
 {
     /*----------------------------------------------------------------------------
@@ -298,18 +298,23 @@ Int huffdecode(
     Int      hasmask;
     Int      status   = SUCCESS;
     Int      num_channels = 0;
-    Int      tag;
+    Int      tag = 0;
     MC_Info  *pMcInfo;
 
+    tDec_Int_File *pVars   = (tDec_Int_File *)pVars_0;
+    tDec_Int_Chan *pChVars[2];
+
+    pChVars[0] = pChVars_0[0];
+    pChVars[1] = pChVars_0[1];
     per_chan_share_w_fxpCoef *pChLeftShare;  /* Helper pointer */
     per_chan_share_w_fxpCoef *pChRightShare; /* Helper pointer */
     /*----------------------------------------------------------------------------
     ; Function body here
     ----------------------------------------------------------------------------*/
 
-    tag = get9_n_lessbits(LEN_TAG, pInputStream);
-
-    /* suppose an un-supported id_syn_ele will never be passed */
+    {
+        tag = get9_n_lessbits(LEN_TAG, pInputStream);
+    }
 
 
     if (id_syn_ele == ID_CPE)
@@ -320,6 +325,7 @@ Int huffdecode(
 
     pMcInfo = &pVars->mc_info;
 
+
     /*
      *  check if provided info (num of channels) on audio config,
      *  matches read bitstream data, if not, allow update only once.
@@ -344,6 +350,9 @@ Int huffdecode(
         }
     }
 
+
+
+
     if (status == SUCCESS)
     {
         if (id_syn_ele == ID_SCE)
@@ -383,12 +392,14 @@ Int huffdecode(
                 else
                 {
 
-
                     status = 1; /* ERROR == incorrect tag identifying dual-mono channel  */
 
+
                 }
 
-                pMcInfo->nch = pVars->prog_config.front.num_ele;
+                {
+                    pMcInfo->nch = pVars->prog_config.front.num_ele;  // dual mono
+                }
             }
 
             if ((pMcInfo->nch > 1) && (pMcInfo->psPresentFlag))
@@ -426,17 +437,16 @@ Int huffdecode(
                     pChVars[RIGHT]->wnd_shape_this_bk =
                         pChVars[LEFT]->wnd_shape_this_bk;
                     pChRightShare->max_sfb = pChLeftShare->max_sfb;
-                    pv_memcpy(
-                        pChRightShare->group,
-                        pChLeftShare->group,
-                        NSHORT*sizeof(pChLeftShare->group[0]));
 
-                    hasmask = getmask(
-                                  pVars->winmap[pChVars[LEFT]->wnd],
-                                  pInputStream,
-                                  pChLeftShare->group,
-                                  pChLeftShare->max_sfb,
-                                  pVars->mask);
+                    pv_memcpy(pChRightShare->group,
+                              pChLeftShare->group,
+                              NSHORT*sizeof(pChLeftShare->group[0]));
+
+                    hasmask = getmask(pVars->winmap[pChVars[LEFT]->wnd],
+                                      pInputStream,
+                                      pChLeftShare->group,
+                                      pChLeftShare->max_sfb,
+                                      pVars->mask);
 
                     if (hasmask == MASK_ERROR)
                     {
@@ -460,18 +470,18 @@ Int huffdecode(
     {
         pChLeftShare = pChVars[ch]->pShareWfxpCoef;
 
-        status = getics(
-                     pInputStream,
-                     common_window,
-                     pVars,
-                     pChVars[ch],
-                     pChLeftShare->group,
-                     &pChLeftShare->max_sfb,
-                     pChLeftShare->cb_map,
-                     &pChLeftShare->tns,
-                     pVars->winmap,
-                     &pVars->share.a.pulseInfo,
-                     pVars->share.a.sect);
+        status = getics(id_syn_ele,
+                        pInputStream,
+                        common_window,
+                        pVars,
+                        pChVars[ch],
+                        pChLeftShare->group,
+                        &pChLeftShare->max_sfb,
+                        pChLeftShare->cb_map,
+                        &pChLeftShare->tns,
+                        pVars->winmap,
+                        &pVars->share.a.pulseInfo,
+                        pVars->share.a.sect);
 
         ch++;
 
index 23484e9..1e27338 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -129,6 +129,12 @@ extern "C"
         FrameInfo   **ppWin_seq_info,
         Int    *pSfbwidth128);
 
+    void initScratchChannel(
+        tDec_Int_File *pt_Scratch,
+        tDec_Int_File *pVars,
+        tDec_Int_Chan *pt_ChScratch[]);
+
+
     Int huffcb(
         SectInfo *pSect,
         BITS     *pInputStream,
@@ -160,11 +166,20 @@ extern "C"
         PulseInfo  *pPulseInfo,
         Int         qFormat[]);
 
+
+    Int huffspec_fxp_parse_bits(
+        FrameInfo *pFrameInfo,
+        BITS      *pInputStream,
+        Int       nsect,
+        SectInfo  *pSectInfo);
+
     Int huffdecode(
         Int           id_syn_ele,
         BITS          *pInputStream,
-        tDec_Int_File *pVars,
-        tDec_Int_Chan *pChVars[]);
+        tDec_Int_File *pVars_0,
+        tDec_Int_Chan *pChVars_0[]
+    );
+
 
     void deinterleave(
         Int16          interleaved[],
@@ -172,7 +187,7 @@ extern "C"
         FrameInfo   *pFrameInfo);
 
     Int getics(
-
+        Int             id_syn_ele,
         BITS            *pInputStream,
         Int             common_window,
         tDec_Int_File   *pVars,
@@ -185,6 +200,7 @@ extern "C"
         PulseInfo       *pPulseInfo,
         SectInfo        sect[]);
 
+
     void  calc_gsfb_table(
         FrameInfo   *pFrameInfo,
         Int         group[]);
index 5b70f42..ee58948 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -497,14 +497,14 @@ Int huffspec_fxp(
     though each one of them for re-quant and scaling, and pick the right qFormat to apply to
     all spectral coeffs.*/
 
-    if ((max < 0) || (max > 8192))    /* (8192>>ORDER) == 1024 is the inverseQuantTable size */
+    if ((max >= 0) && (max <= 8192))    /* (8192>>ORDER) == 1024 is the inverseQuantTable size */
     {
-        return (-1);   /*  error condition */
+        /* Get  (max/SPACING) ^ (1/3), in Q Format  */
+        temp = inverseQuantTable[(max >> ORDER) + 1];
     }
     else
     {
-        /* Get  (max/SPACING) ^ (1/3), in Q Format  */
-        temp = inverseQuantTable[(max >> ORDER) + 1];
+        return (-1);   /*  error condition */
     }
 
 
@@ -566,10 +566,10 @@ Int huffspec_fxp(
                                max);
 
             pQuantSpec += sfbWidth;
-            qFormat[tot_sfb] -= power_scale_div_4;
             pCoef += sfbWidth;
 
-            tot_sfb++;
+            qFormat[tot_sfb++] -= power_scale_div_4;
+
 
         } /* for (sfb) */
     } /* for (i) */
@@ -581,3 +581,6 @@ Int huffspec_fxp(
     return SUCCESS;
 
 } /* huffspec_fxp */
+
+
+
index 1a5544f..724c923 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include    "e_huffmanconst.h"
 #include    "sfb.h"
 #include    "huffman.h"
+#include    "aac_mem_funcs.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -306,3 +307,6 @@ Int infoinit(
     return SUCCESS;
 
 } /* infoinit */
+
+
+
index e0e0cf7..3fc763b 100644 (file)
 #include "get_sbr_bitstream.h"
 #include "e_sbr_element_id.h"
 
+#include "get_cce.h"
 
 
 /*----------------------------------------------------------------------------
 ; compile variables also.
 ----------------------------------------------------------------------------*/
 
-#define LEFT (0)
-#define RIGHT (1)
-
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
 ; Declare variables used in this module but defined elsewhere
 ----------------------------------------------------------------------------*/
 
+
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
@@ -346,6 +345,8 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
     per_chan_share_w_fxpCoef *pChLeftShare;  /* Helper pointer */
     per_chan_share_w_fxpCoef *pChRightShare; /* Helper pointer */
 
+
+
     Int            status = MP4AUDEC_SUCCESS;
 
 
@@ -363,6 +364,8 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
      */
     pVars = (tDec_Int_File *)pMem;
 
+
+
     pMC_Info = &pVars->mc_info;
 
     pChVars[LEFT]  = &pVars->perChan[LEFT];
@@ -504,6 +507,9 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
     leaveGetLoop = FALSE;
     empty_frame  = TRUE;
 
+
+
+
     while ((leaveGetLoop == FALSE) && (status == SUCCESS))
     {
         /* get audio syntactic element */
@@ -531,17 +537,17 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
                 status = huffdecode(id_syn_ele,
                                     &(pVars->inputStream),
                                     pVars,
-                                    pChVars);
+                                    pChVars
+                                   );
 
 #ifdef AAC_PLUS
                 sbrBitStream->sbrElement[sbrBitStream->NrElements].ElementID = id_syn_ele;
                 sbrBitStream->NrElementsCore++;
-
-
 #endif
-
                 break;
 
+
+
             case ID_PCE:        /* program config element */
                 /*
                  * PCE are not accepted in the middle of a
@@ -584,6 +590,8 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
                         &pVars->inputStream);
                 break;
 
+
+
             default: /* Unsupported element, including ID_LFE */
                 status = -1;  /* ERROR CODE needs to be updated */
                 break;
@@ -688,16 +696,15 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
 
         pFrameInfo = pVars->winmap[pChVars[LEFT]->wnd];
 
-        pns_left(
-            pFrameInfo,
-            pChLeftShare->group,
-            pChLeftShare->cb_map,
-            pChLeftShare->factors,
-            pChLeftShare->lt_status.sfb_prediction_used,
-            pChLeftShare->lt_status.ltp_data_present,
-            pChVars[LEFT]->fxpCoef,
-            pChLeftShare->qFormat,
-            &(pVars->pns_cur_noise_state));
+        pns_left(pFrameInfo,
+                 pChLeftShare->group,
+                 pChLeftShare->cb_map,
+                 pChLeftShare->factors,
+                 pChLeftShare->lt_status.sfb_prediction_used,
+                 pChLeftShare->lt_status.ltp_data_present,
+                 pChVars[LEFT]->fxpCoef,
+                 pChLeftShare->qFormat,
+                 &(pVars->pns_cur_noise_state));
 
         /*
          *  For dual-mono clips, process second channel as well
@@ -707,16 +714,15 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
         {
             pFrameInfo = pVars->winmap[pChVars[RIGHT]->wnd];
 
-            pns_left(
-                pFrameInfo,
-                pChRightShare->group,
-                pChRightShare->cb_map,
-                pChRightShare->factors,
-                pChRightShare->lt_status.sfb_prediction_used,
-                pChRightShare->lt_status.ltp_data_present,
-                pChVars[RIGHT]->fxpCoef,
-                pChRightShare->qFormat,
-                &(pVars->pns_cur_noise_state));
+            pns_left(pFrameInfo,
+                     pChRightShare->group,
+                     pChRightShare->cb_map,
+                     pChRightShare->factors,
+                     pChRightShare->lt_status.sfb_prediction_used,
+                     pChRightShare->lt_status.ltp_data_present,
+                     pChVars[RIGHT]->fxpCoef,
+                     pChRightShare->qFormat,
+                     &(pVars->pns_cur_noise_state));
         }
 
 
@@ -731,15 +737,14 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
 
         if (pVars->hasmask > 0)
         {
-            apply_ms_synt(
-                pFrameInfo,
-                pChLeftShare->group,
-                pVars->mask,
-                pChLeftShare->cb_map,
-                pChVars[LEFT]->fxpCoef,
-                pChVars[RIGHT]->fxpCoef,
-                pChLeftShare->qFormat,
-                pChRightShare->qFormat);
+            apply_ms_synt(pFrameInfo,
+                          pChLeftShare->group,
+                          pVars->mask,
+                          pChLeftShare->cb_map,
+                          pChVars[LEFT]->fxpCoef,
+                          pChVars[RIGHT]->fxpCoef,
+                          pChLeftShare->qFormat,
+                          pChRightShare->qFormat);
         }
 
         for (ch = 0; (ch < pMC_Info->nch); ch++)
@@ -870,24 +875,21 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
              * the forward filter, but is passed in to maintain
              * common interface for inverse and forward filter
              */
-            apply_tns(
-                pChVars[ch]->fxpCoef,
-                pChVars[ch]->pShareWfxpCoef->qFormat,
-                pFrameInfo,
-                &(pChVars[ch]->pShareWfxpCoef->tns),
-                FALSE,                   /* FALSE is IIR */
-                pVars->scratch.tns_inv_filter);
+            apply_tns(pChVars[ch]->fxpCoef,
+                      pChVars[ch]->pShareWfxpCoef->qFormat,
+                      pFrameInfo,
+                      &(pChVars[ch]->pShareWfxpCoef->tns),
+                      FALSE,                   /* FALSE is IIR */
+                      pVars->scratch.tns_inv_filter);
 
             /*
              * Normalize the q format across all scale factor bands
              * to one value.
              */
-            qFormatNorm =
-                q_normalize(
-                    pChVars[ch]->pShareWfxpCoef->qFormat,
-                    pFrameInfo,
-                    pChVars[ch]->abs_max_per_window,
-                    pChVars[ch]->fxpCoef);
+            qFormatNorm = q_normalize(pChVars[ch]->pShareWfxpCoef->qFormat,
+                                      pFrameInfo,
+                                      pChVars[ch]->abs_max_per_window,
+                                      pChVars[ch]->fxpCoef);
 
             /*
              *  filterbank - converts frequency coeficients to time domain.
@@ -973,16 +975,12 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
 
             }
 
-
 #endif
-
-
             /* Update the window shape */
             pChVars[ch]->wnd_shape_prev_bk = pChVars[ch]->wnd_shape_this_bk;
 
         } /* end for() */
 
-
         /*
          * Copy to the final output buffer, taking into account the desired
          * channels from the calling environment, the actual channels, and
@@ -1002,7 +1000,6 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
          *
          */
 
-
 #ifdef AAC_PLUS
 
         if (sbrBitStream->NrElements || pMC_Info->upsamplingFactor == 2)
@@ -1017,12 +1014,10 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
                              sbrDecoderData,
                              pVars->mc_info.bDownSampledSbr);
                 }
-
             }
             pMC_Info->upsamplingFactor =
                 sbrDecoderData->SbrChannel[0].frameData.sbr_header.sampleRateMode;
 
-
             /* reuse right aac spectrum channel  */
             {
                 Int16 *pt_left  =  &(pChVars[LEFT ]->ltp_buffer[pVars->ltp_buffer_state]);
@@ -1182,9 +1177,6 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
 
         }
 
-
-
-
         /* pVars->ltp_buffer_state cycles between 0 and 1024.  The value
          * indicates the location of the data corresponding to t == -2.
          *
@@ -1207,7 +1199,6 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
         pVars->ltp_buffer_state ^= frameLength;
 #endif
 
-
         if (pVars->bno <= 1)
         {
             /*
@@ -1221,7 +1212,6 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
                                                       * only the first time
                                                       */
 
-
 #ifdef AAC_PLUS
 
             if (pMC_Info->upsamplingFactor == 2)
@@ -1229,7 +1219,6 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
                 pExt->samplingRate *= pMC_Info->upsamplingFactor;
                 pExt->aacPlusUpsamplingFactor = pMC_Info->upsamplingFactor;
             }
-
 #endif
 
             pExt->extendedAudioObjectType = pMC_Info->ExtendedAudioObjectType;
@@ -1237,6 +1226,13 @@ OSCL_EXPORT_REF Int PVMP4AudioDecodeFrame(
 
             pExt->encodedChannels = pMC_Info->nch;
             pExt->frameLength = pVars->frameLength;
+
+
+            pExt->multichannel_detected = pVars->multichannel_detected;
+            if (pVars->multichannel_detected)
+            {
+                pExt->multichannel_numChannels = pVars->multichannel_numChannels ;
+            }
         }
 
         pVars->bno++;
index 620c310..fed8828 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -112,6 +112,7 @@ OSCL_EXPORT_REF UInt32 PVMP4AudioDecoderGetMemRequirements(void)
 
     size = (UInt32) sizeof(tDec_Int_File);
 
+
     return (size);
 
 } /* PVMP4AudioDecoderGetMemRequirements() */
index 5f5ca25..d97e9ab 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -264,6 +264,8 @@ OSCL_EXPORT_REF Int PVMP4AudioDecoderInitLibrary(
     pVars->aacPlusEnabled = pExt->aacPlusEnabled;
 
 
+    pVars->multichannel_detected = false;
+
 #if defined(AAC_PLUS)
     pVars->sbrDecoderData.setStreamType = 1;        /* Enable Lock for AAC stream type setting  */
 #endif
index 9d8702b..a5ff84f 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -97,8 +97,6 @@
 ; Include all pre-processor statements here. Include conditional
 ; compile variables also.
 ----------------------------------------------------------------------------*/
-#define LEFT  (0)
-#define RIGHT (1)
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
index 6550cbe..fad44b0 100644 (file)
@@ -102,6 +102,9 @@ extern "C"
         bool           aacPlusEnabled;
         bool           aacConfigUtilityEnabled;
 
+        bool           multichannel_detected;
+        Int            multichannel_numChannels;
+
         Int            current_program;
         Int            frameLength;
         Int            adif_test;
@@ -131,15 +134,6 @@ extern "C"
 
         Int            ltp_buffer_state;
 
-        /*
-         *  For eaac+, a scratch matrix is created with the rigth element ( perChan[1] is not used)
-         *  and the fxpCoef matrix. These  2 matrices are [2][38][64] == 4864 Int32
-         *    2349 coming from the perChan[1] plus 4096 coming from fxpCoef
-         */
-        tDec_Int_Chan  perChan[Chans];
-
-        Int32          fxpCoef[2][LN];         /* LN  = 2048     */
-
 
 
 #ifdef AAC_PLUS
@@ -162,6 +156,17 @@ extern "C"
         Int         hasmask;
 
 
+        /*
+         *  For eaac+, a scratch matrix is created with the rigth element ( perChan[1] is not used)
+         *  and the fxpCoef matrix. These  2 matrices are [2][38][64] == 4864 Int32
+         *    2349 coming from the perChan[1] plus 4096 coming from fxpCoef
+         */
+        tDec_Int_Chan  perChan[Chans];
+
+        Int32          fxpCoef[2][LN];         /* LN  = 2048     */
+
+
+
         /*  SBR usage
          *  These two unions are used for the SBR tool and used
          *  as a single 2560 int32 continuous memory for circular
@@ -177,8 +182,11 @@ extern "C"
         {
             Int32  fft[LONG_WINDOW];    /* 1024, as needed by the FFT */
             Int32  tns_inv_filter[TNS_MAX_ORDER];
-            Int32  tns_decode_coef[2*TNS_MAX_ORDER];
-            Int    huffbook_used[248];
+            struct
+            {
+                Int32  tns_decode_coef[2*TNS_MAX_ORDER];
+                Int    huffbook_used[248];
+            } a;
             Int16  tmp_spec[LN2];  /* Used in conjunction with quant_spec */
 
             ADIF_Header    adif_header;
index f9d0b2d..634250d 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -119,8 +119,6 @@ Copyright (c) ISO/IEC 2002.
 ; Include all pre-processor statements here. Include conditional
 ; compile variables also.
 ----------------------------------------------------------------------------*/
-#define LEFT  (0)
-#define RIGHT (1)
 
 
 /*----------------------------------------------------------------------------
index 41ca7e2..0c83384 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -598,3 +598,9 @@ void unpack_idx_esc(
 
     return ;
 } /* unpack_idx_esc */
+
+
+/*############################################################################################*/
+
+
+
index c0a3260..0b4bb24 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -96,6 +96,16 @@ extern "C"
         BITS  *pInputStream,
         Int *max);
 
+
+    void unpack_idx_sgn_parse_bits(
+        Int  codeword_indx,
+        const Hcb *pHuffCodebook,
+        BITS  *pInputStream);
+    void unpack_idx_esc_parse_bits(
+        Int  codeword_indx,
+        const Hcb *pHuffCodebook,
+        BITS  *pInputStream);
+
 #ifdef __cplusplus
 }
 #endif
index c465a5a..fef50e3 100644 (file)
@@ -404,12 +404,12 @@ Int get_prog_config(
     ProgConfig    *pScratchPCE)
 {
     Int    i;
-    UInt    tag;
+    UInt   tag;
     Int    numChars;
-    UInt    temp;
+    UInt   temp;
     Bool   flag;
     Int    status          = SUCCESS;
-    BITS  *pInputStream   = &(pVars->inputStream);
+    BITS   *pInputStream   = &(pVars->inputStream);
 
 
     /*
@@ -428,20 +428,11 @@ Int get_prog_config(
      * getbits is saved into a temporary variable, then transfered to
      * the structure item.
      */
-    tag =
-        get9_n_lessbits(
-            LEN_TAG,
-            pInputStream);
+    tag = get9_n_lessbits(LEN_TAG, pInputStream);
 
-    pScratchPCE->profile =
-        get9_n_lessbits(
-            LEN_PROFILE,
-            pInputStream);
+    pScratchPCE->profile = get9_n_lessbits(LEN_PROFILE, pInputStream);
 
-    pScratchPCE->sampling_rate_idx =
-        get9_n_lessbits(
-            LEN_SAMP_IDX,
-            pInputStream);
+    pScratchPCE->sampling_rate_idx = get9_n_lessbits(LEN_SAMP_IDX, pInputStream);
 
     if (!pVars->adif_test && (pScratchPCE->sampling_rate_idx != pVars->prog_config.sampling_rate_idx))
     {
@@ -478,49 +469,31 @@ Int get_prog_config(
      * The next six function calls could be combined into one, then use
      * shifts and masks to retrieve the individual fields.
      */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_ELE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_ELE, pInputStream);
 
     pScratchPCE->front.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_ELE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_ELE, pInputStream);
 
     pScratchPCE->side.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_ELE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_ELE, pInputStream);
 
     pScratchPCE->back.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_LFE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_LFE, pInputStream);
 
     pScratchPCE->lfe.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_DAT,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_DAT, pInputStream);
     pScratchPCE->data.num_ele = temp;
 
     /* Needed only to read in the element list. */
-    temp =
-        get9_n_lessbits(
-            LEN_NUM_CCE,
-            pInputStream);
+    temp = get9_n_lessbits(LEN_NUM_CCE, pInputStream);
 
     pScratchPCE->coupling.num_ele = temp;
 
@@ -532,9 +505,7 @@ Int get_prog_config(
      */
 
     /* Read presence of mono_mix */
-    flag =
-        get1bits(/*            LEN_MIX_PRES,*/
-            pInputStream);
+    flag = get1bits(pInputStream);/* LEN_MIX_PRES,*/
 
     pScratchPCE->mono_mix.present = flag;
 
@@ -547,42 +518,30 @@ Int get_prog_config(
     } /* end if (flag != FALSE) */
 
     /* Read presence of stereo mix */
-    flag =
-        get1bits(/*            LEN_MIX_PRES,*/
-            pInputStream);
+    flag = get1bits(pInputStream);   /* LEN_MIX_PRES,*/
 
     pScratchPCE->stereo_mix.present = flag;
 
     if (flag != FALSE)
     {
-        temp =
-            get9_n_lessbits(
-                LEN_TAG,
-                pInputStream);
+        temp = get9_n_lessbits(LEN_TAG, pInputStream);
 
         pScratchPCE->stereo_mix.ele_tag = temp;
 
     } /* end if (flag != FALSE) */
 
     /* Read presence of matrix mix */
-    flag =
-        get1bits(/*            LEN_MIX_PRES,*/
-            pInputStream);
+    flag = get1bits(pInputStream);  /* LEN_MIX_PRES,*/
 
     pScratchPCE->matrix_mix.present = flag;
 
     if (flag != FALSE)
     {
-        temp =
-            get9_n_lessbits(
-                LEN_MMIX_IDX,
-                pInputStream);
+        temp = get9_n_lessbits(LEN_MMIX_IDX, pInputStream);
 
         pScratchPCE->matrix_mix.ele_tag = temp;
 
-        temp =
-            get1bits(/*                LEN_PSUR_ENAB,*/
-                pInputStream);
+        temp = get1bits(pInputStream);  /* LEN_PSUR_ENAB,*/
 
         pScratchPCE->matrix_mix.pseudo_enab = temp;
 
@@ -596,35 +555,29 @@ Int get_prog_config(
      * This could be optimized by advancing the bit stream for the
      * elements that do not need to be read.
      */
-    get_ele_list(
-        &pScratchPCE->front,
-        pInputStream,
-        TRUE);
-
-    get_ele_list(
-        &pScratchPCE->side,
-        pInputStream,
-        TRUE);
-
-    get_ele_list(
-        &pScratchPCE->back,
-        pInputStream,
-        TRUE);
-
-    get_ele_list(
-        &pScratchPCE->lfe,
-        pInputStream,
-        FALSE);
-
-    get_ele_list(
-        &pScratchPCE->data,
-        pInputStream,
-        FALSE);
-
-    get_ele_list(
-        &pScratchPCE->coupling,
-        pInputStream,
-        TRUE);
+    get_ele_list(&pScratchPCE->front,
+                 pInputStream,
+                 TRUE);
+
+    get_ele_list(&pScratchPCE->side,
+                 pInputStream,
+                 TRUE);
+
+    get_ele_list(&pScratchPCE->back,
+                 pInputStream,
+                 TRUE);
+
+    get_ele_list(&pScratchPCE->lfe,
+                 pInputStream,
+                 FALSE);
+
+    get_ele_list(&pScratchPCE->data,
+                 pInputStream,
+                 FALSE);
+
+    get_ele_list(&pScratchPCE->coupling,
+                 pInputStream,
+                 TRUE);
 
     /*
      * The standard requests a byte alignment before reading in the
@@ -632,9 +585,7 @@ Int get_prog_config(
      */
     byte_align(pInputStream);
 
-    numChars =
-        get9_n_lessbits(
-            LEN_COMMENT_BYTES, pInputStream);
+    numChars = get9_n_lessbits(LEN_COMMENT_BYTES, pInputStream);
 
     /*
      * Ignore the comment - it requires 65 bytes to store (or worse on DSP).
@@ -681,7 +632,7 @@ Int get_prog_config(
              *  Keep adts setting in case of a redundant PCE (only applicable when
              *  using aac-lib own adts parser)
              */
-            pScratchPCE->file_is_adts = pVars->prog_config.file_is_adts;
+            pScratchPCE->file_is_adts      = pVars->prog_config.file_is_adts;
             pScratchPCE->headerless_frames = pVars->prog_config.headerless_frames;
         }
 
@@ -689,21 +640,13 @@ Int get_prog_config(
                   pScratchPCE,
                   sizeof(ProgConfig));
 
-        /* enter configuration into MC_Info structure */
-        status =
-            set_mc_info(
-                &pVars->mc_info,
-                (tMP4AudioObjectType)(pVars->prog_config.profile + 1),
-                pVars->prog_config.sampling_rate_idx,
-                pVars->prog_config.front.ele_tag[0],
-                pVars->prog_config.front.ele_is_cpe[0],
-                pVars->winmap,
-                pVars->SFBWidth128);
+
+        tag = 0;
 
         /*
          *  Check that dual-mono does not carry more than 2 tracks, otherwise flag an non-supported error
          */
-        if ((pVars->prog_config.front.num_ele > 2) && !(pVars->prog_config.front.ele_is_cpe[0]))
+        if ((pVars->prog_config.front.num_ele > 2) && !(pVars->prog_config.front.ele_is_cpe[tag]))
         {
             status = 1;
         }
@@ -711,12 +654,28 @@ Int get_prog_config(
         /*
          *  Check that stereo does not carry more than 1 track, otherwise flag an non-supported error
          */
-        if ((pVars->prog_config.front.num_ele > 1) && (pVars->prog_config.front.ele_is_cpe[0]))
+        if ((pVars->prog_config.front.num_ele > 1) && (pVars->prog_config.front.ele_is_cpe[tag]))
         {
             status = 1;
         }
 
 
+
+        if (!status)
+        {
+
+            /* enter configuration into MC_Info structure */
+            status = set_mc_info(&pVars->mc_info,
+                                 (tMP4AudioObjectType)(pVars->prog_config.profile + 1),
+                                 pVars->prog_config.sampling_rate_idx,
+                                 pVars->prog_config.front.ele_tag[tag],
+                                 pVars->prog_config.front.ele_is_cpe[tag],
+                                 pVars->winmap,
+                                 pVars->SFBWidth128);
+        }
+
+
+
     } /* end if (tag == pVars->current_program) */
 
 
index 14c1e47..9ff56cd 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #define ERROR_BUFFER_OVERRUN (-2)
 #define KCODEC_INIT_FAILURE (-1)
-#define LEFT (0)
-#define RIGHT (1)
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
index 1a5544f..d578a32 100644 (file)
 #include    "e_huffmanconst.h"
 #include    "sfb.h"
 #include    "huffman.h"
+#include    "aac_mem_funcs.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -306,3 +307,6 @@ Int infoinit(
     return SUCCESS;
 
 } /* infoinit */
+
+
+
index 620c310..340aca7 100644 (file)
@@ -112,6 +112,7 @@ OSCL_EXPORT_REF UInt32 PVMP4AudioDecoderGetMemRequirements(void)
 
     size = (UInt32) sizeof(tDec_Int_File);
 
+
     return (size);
 
 } /* PVMP4AudioDecoderGetMemRequirements() */
index 5f5ca25..f2a78a1 100644 (file)
@@ -264,6 +264,8 @@ OSCL_EXPORT_REF Int PVMP4AudioDecoderInitLibrary(
     pVars->aacPlusEnabled = pExt->aacPlusEnabled;
 
 
+    pVars->multichannel_detected = false;
+
 #if defined(AAC_PLUS)
     pVars->sbrDecoderData.setStreamType = 1;        /* Enable Lock for AAC stream type setting  */
 #endif
index 882e46a..17876d6 100644 (file)
@@ -21,7 +21,7 @@
 // This header file is automatically generated at build-time
 // *** OFFICIAL RELEASE INFO -- Will not auto update
 
-#define PV2WAY_ENGINE_SDKINFO_LABEL "1313199"
+#define PV2WAY_ENGINE_SDKINFO_LABEL "1313263"
 #define PV2WAY_ENGINE_SDKINFO_DATE 0x20100310
 
 #endif //PV_2WAY_SDKINFO_H_INCLUDED
index e1d88aa..90510a6 100644 (file)
@@ -21,7 +21,7 @@
 // This header file is automatically generated at build-time
 // *** OFFICIAL RELEASE INFO -- Will not auto update
 
-#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1313199"
+#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1313263"
 #define PVAUTHOR_ENGINE_SDKINFO_DATE 0x20100310
 
 #endif //PV_AUTHOR_SDKINFO_H_INCLUDED
index da04516..f71bc7e 100644 (file)
@@ -21,7 +21,7 @@
 // This header file is automatically generated at build-time
 // *** OFFICIAL RELEASE INFO -- Will not auto update
 
-#define PVPLAYER_ENGINE_SDKINFO_LABEL "1313199"
+#define PVPLAYER_ENGINE_SDKINFO_LABEL "1313263"
 #define PVPLAYER_ENGINE_SDKINFO_DATE 0x20100310
 
 #endif //PV_PLAYER_SDKINFO_H_INCLUDED