merging from dev_pasdk_frank
authorGovind Jeyaram <govind.j@ti.com>
Wed, 16 Nov 2016 23:03:28 +0000 (18:03 -0500)
committerGovind Jeyaram <govind.j@ti.com>
Wed, 16 Nov 2016 23:03:28 +0000 (18:03 -0500)
25 files changed:
dolby_ip/car
dolby_ip/mat-thd
dolby_ip/oar
pasdk/common/aspDecOpCircBuf_common.c
pasdk/common/aspDecOpCircBuf_common.h
pasdk/common/dbgDib.h
pasdk/paf
pasdk/test_arm/.cproject
pasdk/test_arm/application/app.cfg
pasdk/test_arm/application/app.cmd
pasdk/test_arm/framework/aspDecOpCircBuf_slave.c
pasdk/test_arm/framework/audioStreamDecodeProc.c
pasdk/test_arm/framework/itopo/params.c
pasdk/test_arm/framework/itopo/patchs.c
pasdk/test_dsp/.cproject
pasdk/test_dsp/application/app.cfg
pasdk/test_dsp/application/itopo/evmk2g/alpha/i13_a.h
pasdk/test_dsp/application/itopo/evmk2g/atboot.c
pasdk/test_dsp/application/itopo/evmk2g/dcs7_params.c
pasdk/test_dsp/framework/aspDecOpCircBuf_master.c
pasdk/test_dsp/framework/audioStreamInpProc.c
pasdk/test_dsp/framework/audioStreamOutProc.c
pasdk/test_dsp/framework/itopo/patchs.c
pasdk/test_dsp/sap/audio_dc_cfg.c
pasdk/test_dsp/sap/sap.c

index 9c5178ccb79f02e23cc0d3efcbf91652f3baae68..5198726f4ac19eafd5ffb6596ac1fb9233219d74 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 9c5178ccb79f02e23cc0d3efcbf91652f3baae68
+Subproject commit 5198726f4ac19eafd5ffb6596ac1fb9233219d74
index 0025a13d61d3b6053c7b4a46cfe2c21fcba30f94..5dd166c59bacc517a8fe6ceb81dbbf77ce583071 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0025a13d61d3b6053c7b4a46cfe2c21fcba30f94
+Subproject commit 5dd166c59bacc517a8fe6ceb81dbbf77ce583071
index 0f2335749e0cd3bc243c894d1681e7ad50ba842c..910714cb87e81a199ddc024b3f6046d45fdfbf3b 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0f2335749e0cd3bc243c894d1681e7ad50ba842c
+Subproject commit 910714cb87e81a199ddc024b3f6046d45fdfbf3b
index b127faff89125cedcbbe5ea65c2e7b5c699c6cd2..5bca2c467081c53a8b2673e1885927c590504857 100644 (file)
@@ -80,6 +80,13 @@ Int cbReset(
         pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_DDP;
         pCb->pcmRdIdx = pCb->decOpFrameLen - ASP_DECOP_CB_INIT_LAG_DDP*pCb->strFrameLen;
     }
+    else if (pCb->sourceSel == PAF_SOURCE_THD)
+    {
+        // 0 in behind
+        pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_THD;
+        pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_THD;
+        pCb->pcmRdIdx = 0;
+    }
 
     // initialize circular buffer current number of frames
     pCb->numAfCb = pCb->afWrtIdx - pCb->afRdIdx;
@@ -89,9 +96,9 @@ Int cbReset(
         pAfCb = &pCb->afCb[n];
         
         // clear PCM data
-        for (i=0; i<ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        for (i=0; i<pCb->maxAFChanNum; i++)
         {
-            memset(pAfCb->data.sample[i], pCb->decOpFrameLen, 0);
+            memset(pAfCb->data.sample[i], pCb->maxAFSampCount, 0);
         }
         
         // clear metadata
@@ -110,9 +117,9 @@ Int cbReset(
     for (n=0; n<pCb->maxNumAfCb; n++)
     {
         pAfCb = &pCb->afCb[n];
-        for (i=0; i<ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        for (i=0; i<pCb->maxAFChanNum; i++)
         {
-            Cache_wb(pAfCb->data.sample[i], pCb->decOpFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+            Cache_wb(pAfCb->data.sample[i], pCb->maxAFSampCount*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
         }
     }
     Cache_wait();
index 7d3decca8034ec7d611209414f4fd5d92e023c26..338acfaa9055ed04c50e0cd7d0e6ef38cbe20921 100644 (file)
@@ -40,16 +40,22 @@ All rights reserved.
 #include <ti/ipc/GateMP.h>
 #include "paftyp.h"
 #include "pafdec.h"
-
 #define ASP_DECOP_CB_SOK                    ( 0 )       // ok
 #define ASP_DECOP_CB_CTL_INIT_INV_GATE      ( ASP_DECOP_CB_SOK-1 )  // error: invalid gate handle
 #define ASP_DECOP_CB_ERR_START              ( ASP_DECOP_CB_CTL_INIT_INV_GATE )
-
-#define ASP_DECOP_CB_MAX_NUM_AF             ( 4 )       // decoder output circular buffer maximum number audio frames
+#define ASP_DECOP_CB_MAX_NUM_AF             ( 10 )       // decoder output circular buffer maximum number audio frames
 #define ASP_DECOP_CB_MAX_NUM_PCM_CH         ( 16 )      // decoder output circular buffer maximum number audio PCM channels
-#define ASP_DECOP_CB_MAX_NUM_PCM_FRAMES     ( 2 )       // decoder output circular buffer maximum number PCM frames //Qin - Increased to prevent cb overflow for ddp.
+#define ASP_DECOP_CB_MAX_NUM_PCM_FRAMES     ( 10 ) // decoder output circular buffer maximum number PCM frames //Qin - Increased to prevent cb overflow for ddp.
 #define ASP_DECOP_CB_MAX_PCM_FRAME_LEN      ( 6*256 )   // decoder output circular buffer maximum PCM frame length
+
+#define ASP_DECOP_CB_MAX_NUM_PCM_CH_DDP        ( 16 )     // decoder output circular buffer maximum number audio PCM channels for DDP
+#define ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kDDP  ( 6*256 )  // decoder output circular buffer maximum PCM frame length at 48kHz sampling rate
+
+#define ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT        ( 32 )     // decoder output circular buffer maximum number audio PCM channels for MAT
+#define ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kMAT  ( 4*256 )  // decoder output circular buffer maximum PCM frame length at 48kHz sampling rate
+
 #define ASP_DECOP_CB_PCM_BUF_SZ             ( ASP_DECOP_CB_MAX_NUM_PCM_CH * ASP_DECOP_CB_MAX_NUM_PCM_FRAMES * ASP_DECOP_CB_MAX_PCM_FRAME_LEN )
+#define ASP_DECOP_CB_PCM_BUF_SZ_32CH48kMAT  ( ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT * ASP_DECOP_CB_MAX_NUM_PCM_FRAMES * ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kMAT )
 
 #define ASP_DECOP_CB_MAX_NUM_AF_PCM         ( 4 )
 #define ASP_DECOP_CB_INIT_LAG_PCM           ( 2 ) // 1...3
@@ -61,6 +67,10 @@ All rights reserved.
 #define ASP_DECOP_CB_INIT_WRTIDX_DDP        ( 1 )
 #define ASP_DECOP_CB_INIT_RDIDX_DDP         ( 0 )
 
+#define ASP_DECOP_CB_MAX_NUM_AF_THD         ( 10 )
+#define ASP_DECOP_CB_INIT_LAG_THD           ( 3 )  
+#define ASP_DECOP_CB_INIT_WRTIDX_THD        ( 1 )
+#define ASP_DECOP_CB_INIT_RDIDX_THD         ( 0 )
 #define ASP_DECODE_CB_GATE_NAME             ( "AspDecOpCbGate" )
 #define ASP_DECODE_CB_GATE_REGION_ID        ( 0 )
 
@@ -84,6 +94,11 @@ typedef struct PAF_AST_DecOpCircBuf
     Int8 emptyFlag;         // flag indicates whether reader should empty (drain) remaining frames in CB
     Int8 errUndCnt;         // underflow count
     Int8 errOvrCnt;         // overflow count
+    PAF_AudioData *pcmBufEnd;  // PCM buffer, contains PCM data associated with audio frames end
+    UInt8 *metaBufEnd;         // metadata buffer, contains metadata associated with audio frames end
+    Int8 maxAFChanNum;      // maximum number of audio data channels in audio frame
+    Int16 maxAFSampCount;   // maximum number of sample counts in audio frame
+    PAF_AudioFrame lastAf;  // used to store the last valid read out audio frame info to generate mute frame
 } PAF_AST_DecOpCircBuf;
 
 // Decoder output circular buffer control
index d54f7da5553294ca2a85bbe7ad83d27a10ae3f9b..6589f9adff8f4249c51ad7b04031653f5e45a83c 100644 (file)
@@ -56,7 +56,8 @@ extern Int32 gCapIbPcmBufWrapCnt;
 #ifdef CAP_IP
 // IB capture buffer parameters
 #define CAP_IB_MAX_NUM_FRAME        ( 938 )
-#define CAP_IB_MAX_BYTES_PER_FRAME  ( 24576 )
+//#define CAP_IB_MAX_BYTES_PER_FRAME  ( 24576 ) // for DDP
+#define CAP_IB_MAX_BYTES_PER_FRAME  ( 30720 ) // for MAT-THD
 #define CAP_IB_BUF_SZ               ( CAP_IB_MAX_NUM_FRAME * CAP_IB_MAX_BYTES_PER_FRAME )
 
 // IB capture buffer
index d0c38f7fef4e5aea4d052325305060fa24a8f600..98345e46b141b4f257d77afaaf420c389b7f1d64 160000 (submodule)
--- a/pasdk/paf
+++ b/pasdk/paf
@@ -1 +1 @@
-Subproject commit d0c38f7fef4e5aea4d052325305060fa24a8f600
+Subproject commit 98345e46b141b4f257d77afaaf420c389b7f1d64
index 5f4de546524c10519474e94703750a68f6b3927d..f923fb7c5d6de61fb51f7a752a16b9d3a1d7a997 100644 (file)
@@ -11,8 +11,8 @@
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_00/psdk_cust/pdk_k2g_1_0_1_0_eng/packages"/>
+                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sio_dev2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/dolby_ip/ddp/Dolby_Digital_Plus_Decoder_Imp/Source_Code/alg&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/dolby_ip/ddp/Dolby_Digital_Plus_Decoder_Imp/Source_Code/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/dolby_ip/mat-thd/Dolby_MAT_Decoder_Imp/Source_Code/alg&quot;"/>
                                                                </option>
                                                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MFLOAT_ABI.576208136" name="Specify if floating point hardware should be used (-mfloat-abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MFLOAT_ABI" value="hard" valueType="string"/>
                                                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.OTHER_PREPROC_FLAGS.1983639225" name="Other preprocessor flags (-Xpreprocessor)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.OTHER_PREPROC_FLAGS"/>
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_00/psdk_cust/pdk_k2g_1_0_1_0_eng/packages"/>
+                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
index 9ac159597358b6573a4bf44262fd452bf6795048..964c4c7f018a92064eb51283d0b80a29b1b3a313 100644 (file)
@@ -272,7 +272,7 @@ Program.sectMap[".msmcSramHeap"] = "HOST_MSMC";
 /* Add DDR3 heap */ // formerly SDRAM
 var heapMem2Params = new HeapMem.Params();
 heapMem2Params.instance.name = "heapMemDdr3";
-heapMem2Params.size = 3350528;
+heapMem2Params.size = 4350528;
 heapMem2Params.sectionName = ".ddr3Heap";
 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
 Program.sectMap[".ddr3Heap"] = "HOST_DDR3";
index f5fe68203ac54718544ba262e140bfae450c1d71..9e57befc5db1dd9fb515870c6e3aa6cd83353441 100644 (file)
@@ -36,11 +36,15 @@ SEARCH_DIR ( C:\ti\processor_audio_sdk_1_00_00_00\pasdk\paf\pa\build\a15\release
 SEARCH_DIR ( C:\ti\processor_audio_sdk_1_00_00_00\dolby_ip\intrinsics\Dolby_Intrinsics_Imp\lib_float_A15 )
 SEARCH_DIR ( C:\ti\processor_audio_sdk_1_00_00_00\dolby_ip\ddp\Dolby_Digital_Plus_Decoder_Imp\Source_Code\make\ddp_udc_lib\a15 )
 SEARCH_DIR ( C:\ti\processor_audio_sdk_1_00_00_00\dolby_ip\ddp\Dolby_Digital_Plus_Decoder_Imp\Source_Code\make\ddp_udc_wrapper\a15 )
+SEARCH_DIR ( C:\ti\processor_audio_sdk_1_00_00_00\dolby_ip\mat-thd\Dolby_MAT_Decoder_Imp\Source_Code\mat_dec\make\dthd_dec_lib\a15 )
+SEARCH_DIR ( C:\ti\processor_audio_sdk_1_00_00_00\dolby_ip\mat-thd\Dolby_MAT_Decoder_Imp\Source_Code\mat_dec\make\mat_dec_lib\a15 )
+SEARCH_DIR ( C:\ti\processor_audio_sdk_1_00_00_00\dolby_ip\mat-thd\Dolby_MAT_Decoder_Imp\Source_Code\mat_dec\make\thd_alg_lib\a15 )
 
 INPUT ( c67x_cintrins_elf.lib simulate_dma_elf.lib )
 INPUT ( acp_elf.lib asp_std_elf.lib com_asp_elf.lib com_dec_elf.lib pcm1_elf.lib  )
 INPUT ( dlb_intrinsics_generic_float32_release.a )
 INPUT ( ddp_dec_lib_generic_wrapper_release.a ddp_dec_lib_generic_float32_release.a )
+INPUT ( mat_dec_lib_generic_float32_release.lib thd_alg_lib_generic_float32_release.lib dthd_dec_lib_generic_float32_release.lib )
 
 SECTIONS
 {
index 3af87fc8a1183d0d2cf51033f0dab69919cf298a..97a85f7b94e4ac579f2fff60754d076d70d1d259 100644 (file)
@@ -107,12 +107,7 @@ Int cbWriteStart(
     for (n=0; n<pCb->maxNumAfCb; n++)
     {
         pAfCb = &pCb->afCb[n];
-        Cache_inv(pAfCb->data.sample, ASP_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
-        // FL: unnecessary since part of AF
-        //for (i=0; i<PAF_MAX_NUM_PRIVATE_MD; i++) //QIN
-        //{
-        //     Cache_inv(&pAfCb->pafPrivateMetadata[i], sizeof(PAF_PrivateMetadata), Cache_Type_ALLD, 0);
-        //}
+        Cache_inv(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
     }
     Cache_wait();
             
@@ -184,6 +179,7 @@ Int cbWriteAf(
     PAF_ChannelMask_HD streamMask;
     Int8 i;
     Int16 j;
+    PAF_AudioData *pPcmBuf;UInt8 *pMetaBuf; int nextWrtIdx;PAF_AudioFrame *pAfCbNextAf; 
 
     // Get gate handle
     gateHandle = pCbCtl->gateHandle;
@@ -191,7 +187,7 @@ Int cbWriteAf(
     key = GateMP_enter(gateHandle);
 
     //Log_info2("cbWriteAf:gate enter, gateHandle=0x%04x, key=%d", (IArg)gateHandle, (IArg)key); // FL: debug
-    
+
     // Get circular buffer base pointer
     pCb = &((*pCbCtl->pXDecOpCb)[cbIdx]);
     //Log_info1("cbWriteAf:pCb=0x%04x", (IArg)pCb); // FL: debug
@@ -201,11 +197,11 @@ Int cbWriteAf(
     // NOTE: Probably only a subset of this information nexeds to be updated.
     Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
-    
+
     //Log_info1("cbWriteAf:afCb=0x%04x", (IArg)pCb->afCb); // FL: debug
     //Log_info2("cbWriteAf:pCb->readerActiveFlag=%d, pCb->writerActiveFlag=%d", (IArg)pCb->readerActiveFlag, (IArg)pCb->writerActiveFlag); // FL: debug
 
-    if (pCb->readerActiveFlag == 1)
+    if ((pCb->readerActiveFlag == 1) && (pAfWrt->sampleCount)) //QIN ?
     {
         //
         // Normal case, reader active.
@@ -219,7 +215,7 @@ Int cbWriteAf(
             for (n=0; n<pCb->maxNumAfCb; n++)
             {
                 pAfCb = &pCb->afCb[n];
-                Cache_inv(pAfCb->data.sample, ASP_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
+                Cache_inv(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
             }
             Cache_wait();
 
@@ -228,7 +224,7 @@ Int cbWriteAf(
 #endif        
 
         //Log_info2("cbWriteAf:pCb->numAfCb=%d, pCb->maxNumAfCb=%d", (IArg)pCb->readerActiveFlag, (IArg)pCb->maxNumAfCb); // FL: debug
-    
+
         // check overflow
         //while (pCb->numAfCb >= pCb->maxNumAfCb); // FL: debug
         if (pCb->numAfCb >= pCb->maxNumAfCb)
@@ -245,15 +241,50 @@ Int cbWriteAf(
             GateMP_leave(gateHandle, key);
 
             //Log_info2("cbWriteAf:gate leave, gateHandle=0x%04x, key=%d", (IArg)gateHandle, (IArg)key); // FL: debug
-            
+
             return ASP_DECOP_CB_WRITE_OVERFLOW;
         }
-        
-        // get pointer to current audio frame in circular buffer
-        //Log_info2("cbWriteAf:afCb=0x%04x, pCb->afWrtIdx=%d", (IArg)pCb->afCb, (IArg)pCb->afWrtIdx); // FL: debug
+
         pAfCb = &pCb->afCb[pCb->afWrtIdx];
-        //Log_info1("cbWriteAf:pAfCb=0x%04x", (IArg)pAfCb); // FL: debug
-           
+        pPcmBuf = pAfCb->data.sample[0];
+        pMetaBuf = pAfCb->pafPrivateMetadata[0].pMdBuf;
+        if((pPcmBuf + (pAfWrt->sampleCount * pCb->maxAFChanNum )) > (pCb->pcmBufEnd))
+        {
+            pPcmBuf = pCb->pcmBuf;
+        }
+
+        for (i=0; i<pCb->maxAFChanNum; i++)
+        {
+
+            pAfCb->data.sample[i] = pPcmBuf;
+            pPcmBuf += pAfWrt->sampleCount;
+            pAfCb->data.samsiz[i] = 0;
+        }
+        Cache_inv(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
+        Cache_wait();
+
+        for (i=0; i<pCb->maxAFChanNum; i++){
+        }
+        for (i=0; i<PAF_MAX_NUM_PRIVATE_MD; i++)
+        {
+            pAfCb->pafPrivateMetadata[i].offset = 0;
+            pAfCb->pafPrivateMetadata[i].size   = 0;
+            pAfCb->pafPrivateMetadata[i].pMdBuf = pMetaBuf;
+            pMetaBuf += PAF_MAX_PRIVATE_MD_SZ;
+        }
+
+        nextWrtIdx = 0;
+        if ((pCb->afWrtIdx +1) >= pCb->maxNumAfCb)
+        {
+            //Log_info0("cbWriteAf: AF Wrap around **** ");
+            nextWrtIdx = 0;
+        }else{
+            nextWrtIdx = pCb->afWrtIdx + 1;
+        }
+
+        pAfCbNextAf = &pCb->afCb[nextWrtIdx]; // +1 or last AF if overflow
+        pAfCbNextAf->data.sample[0] = &pAfCb->data.sample[PAF_MAX_NUM_PRIVATE_MD - 1][pAfWrt->sampleCount];// pAfCb->data.sample[15] + (pAfCb->sampleCount * sizeof(PAF_AudioData));
+
         // write audio frame information updated by decoder
         pAfCb->sampleDecode = pAfWrt->sampleDecode;
         PAF_PROCESS_COPY(pAfCb->sampleProcess, pAfWrt->sampleProcess);
@@ -268,75 +299,101 @@ Int cbWriteAf(
         pAfCb->bsMetadata_offset   = pAfWrt->bsMetadata_offset;      /* offset into audio frame for change in bsMetadata_type field */
         // write PCM samples
         streamMask = pAfWrt->fxns->channelMask(pAfWrt, pAfCb->channelConfigurationStream);
-        //Log_info1("cbWriteAf:streamMask=0x%04x", (IArg)streamMask); // FL: debug
-        //Log_info1("cbWriteAf:pCb->decOpFrameLen=%d", (IArg)pCb->decOpFrameLen); // FL: debug
-        //Log_info2("cbWriteAf:pAfCb->data.sample=0x%04x, pAfWrt->data.sample=0x%04x", (IArg)pAfCb->data.sample, (IArg)pAfWrt->data.sample); // FL: debug
-        //Log_info2("cbWriteAf:pAfCb->data.samsiz=0x%04x, pAfWrt->data.samsiz=0x%04x", (IArg)pAfCb->data.samsiz, (IArg)pAfWrt->data.samsiz); // FL: debug
-        for (i = 0; i < ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
+
+        for (i = 0; i < pCb->maxAFChanNum; i++)
         {
             if ((streamMask >> i) & 0x1)
             {
-                for (j = 0; j < pCb->decOpFrameLen; j++)
+                for (j = 0; j < pAfWrt->sampleCount; j++)
                 {
                     pAfCb->data.sample[i][j] = pAfWrt->data.sample[i][j];
-                }            
-                
+                }
+
                 pAfCb->data.samsiz[i] = pAfWrt->data.samsiz[i];
             }
         }
-        
-        //Log_info1("cbWriteAf:pAfCb->numPrivateMetadata=%d", (IArg)pAfCb->numPrivateMetadata); // FL: debug
+
+
+        // prepare metadata buffer pointers according to the metadata and buffer sizes
+        for (i=1; i < pAfWrt->numPrivateMetadata; i++)
+        {
+            UInt8 *nextMdBuf = (pAfCb->pafPrivateMetadata[i-1].pMdBuf + pAfWrt->pafPrivateMetadata[i-1].size);
+            if(nextMdBuf >= pCb->metaBufEnd) // metadata buffer overflow
+            {
+                pAfCb->pafPrivateMetadata[i].pMdBuf = pCb->metaBuf;
+            }
+            else
+            {
+                pAfCb->pafPrivateMetadata[i].pMdBuf = nextMdBuf;
+            }
+            Cache_inv(pAfCb->pafPrivateMetadata[i].pMdBuf, sizeof(UInt8 *), Cache_Type_ALLD, 0);
+        }
+
         // Write metadata to circular buffer
-        for (i = 0; i < pAfCb->numPrivateMetadata; i++) // FL: only copy numPrivateMetadata
+        for (i = 0; i < pAfWrt->numPrivateMetadata; i++) // FL: only copy numPrivateMetadata
         {
-            pAfCb->pafPrivateMetadata[i].offset = pAfWrt->pafPrivateMetadata[i].offset; 
-            pAfCb->pafPrivateMetadata[i].size   = pAfWrt->pafPrivateMetadata[i].size; 
-            memcpy(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfWrt->pafPrivateMetadata[i].pMdBuf, pAfWrt->pafPrivateMetadata[i].size); 
+            pAfCb->pafPrivateMetadata[i].offset = pAfWrt->pafPrivateMetadata[i].offset;
+            pAfCb->pafPrivateMetadata[i].size   = pAfWrt->pafPrivateMetadata[i].size;
+            memcpy(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfWrt->pafPrivateMetadata[i].pMdBuf, pAfWrt->pafPrivateMetadata[i].size);
+        }
+
+        Cache_inv(pAfCb->pafPrivateMetadata, pAfWrt->numPrivateMetadata*sizeof(PAF_PrivateMetadata *), Cache_Type_ALLD, 0);
+        Cache_wait();
+        for (i=0; i<pAfCb->numPrivateMetadata; i++) // FL: only write back numPrivateMetadata
+        {
+            //Log_info4("cbWriteAf: AF: %d nummd: %d offset: %d size: %d ", pCb->afWrtIdx, pAfCb->numPrivateMetadata, pAfCb->pafPrivateMetadata[i].offset,  pAfCb->pafPrivateMetadata[i].size);
+            Cache_wb(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size, Cache_Type_ALLD, 0);
         }
-        
         // update audio frame write index
-        //Log_info2("cbWriteAf:pCb->afWrtIdx=%d, pCb->maxNumAfCb", (IArg)pCb->afWrtIdx, (IArg)pCb->maxNumAfCb); // FL: debug
         pCb->afWrtIdx++;
         if (pCb->afWrtIdx >= pCb->maxNumAfCb)
         {
             pCb->afWrtIdx = 0;
         }
-        //Log_info2("cbWriteAf:pCb->afWrtIdx=%d, pCb->maxNumAfCb", (IArg)pCb->afWrtIdx, (IArg)pCb->maxNumAfCb); // FL: debug
-        
+
+        pCb->afCb[pCb->afWrtIdx].data.sample[0] = &pAfCb->data.sample[pCb->maxAFChanNum - 1][pAfWrt->sampleCount];
+        if(pAfWrt->numPrivateMetadata > 0)
+        {
+            pCb->afCb[pCb->afWrtIdx].pafPrivateMetadata[0].pMdBuf = pAfCb->pafPrivateMetadata[pAfWrt->numPrivateMetadata - 1].pMdBuf + pAfWrt->pafPrivateMetadata[pAfWrt->numPrivateMetadata - 1].size;
+        }
+        else
+        {
+            pCb->afCb[pCb->afWrtIdx].pafPrivateMetadata[0].pMdBuf = pAfCb->pafPrivateMetadata[0].pMdBuf;
+            Cache_wb(pCb->afCb , ASP_DECOP_CB_MAX_NUM_PCM_FRAMES*sizeof(PAF_AudioFrame *), Cache_Type_ALLD, 0);
+            Cache_wait();
+        }
+        Cache_inv(pCb->afCb[pCb->afWrtIdx].pafPrivateMetadata[0].pMdBuf, sizeof(UInt8 *), Cache_Type_ALLD, 0);
+        Cache_wait();
         // update number of audio frames in circular buffer
-        //Log_info1("cbWriteAf:pCb->numAfCb=%d", (IArg)pCb->numAfCb); // FL: debug
         pCb->numAfCb++;
-        //Log_info1("cbWriteAf:pCb->numAfCb=%d", (IArg)pCb->numAfCb); // FL: debug
 
         // (***) FL: revisit
         // Write back circular buffer configuration
         Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
         // write back audio frame
         Cache_wb(pAfCb, sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
-        Cache_wb(pAfCb->data.samsiz, ASP_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+        Cache_wb(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+        Cache_wb(pAfCb->pafPrivateMetadata, pAfWrt->numPrivateMetadata*sizeof(PAF_PrivateMetadata *), Cache_Type_ALLD, 0);
+        Cache_wait();
         // write back PCM data
-        for (i = 0; i < ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        for (i = 0; i < pCb->maxAFChanNum; i++)
         {
             if ((streamMask >> i) & 0x1)
             {
-                Cache_wb(pAfCb->data.sample[i], pCb->decOpFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+                Cache_wb(pAfCb->data.sample[i], pAfWrt->sampleCount * sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
             }
         }
-        
-        // write back private metadata // QIN
-        for (i=0; i<pAfCb->numPrivateMetadata; i++) // FL: only write back numPrivateMetadata
-        {
-            //Cache_wb(&pAfCb->pafPrivateMetadata[i], sizeof(PAF_PrivateMetadata), Cache_Type_ALLD, 0); // FL: unnecessary since part of AF
-            Cache_wb(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size, Cache_Type_ALLD, 0);
-        }
         Cache_wait();
-    }  
-    
+        Log_info3("wrote %d samples into AF %d sourceSel: %d", pAfCb->sampleCount, pCb->afWrtIdx, pCb->sourceSel);
+        // write back private metadata // QIN
+        Log_info4("CBWMETA num=%d  size=%d  offset=%d chrequest=0x%04x", pAfCb->numPrivateMetadata, pAfCb->pafPrivateMetadata[0].size, pAfCb->pafPrivateMetadata[0].offset, pAfCb->channelConfigurationRequest.full);
+    }
+
     // Leave the gate
     GateMP_leave(gateHandle, key);
 
     //Log_info2("cbWriteAf:gate leave, gateHandle=0x%04x, key=%d", (IArg)gateHandle, (IArg)key); // FL: debug
-    
+
     return ASP_DECOP_CB_SOK;
 }
 
index 234d351ad2951fcfea276ff9a1a18f2a729a36d1..197af1dba413bc58b2d49605e887bda5d6afc699 100644 (file)
@@ -278,6 +278,8 @@ Void taskAsdpFxn(
     Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_wait();
     
     // (***) FL: revisit
@@ -292,6 +294,10 @@ Void taskAsdpFxn(
     Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
     size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
     Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
+    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]->size;
+    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), size, Cache_Type_ALLD, 0);
     Cache_wait();
 
     // (***) FL: revisit
@@ -443,6 +449,8 @@ Void taskAsdpFxn(
                     Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
                     size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
                     Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+                    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
+                    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
                     Cache_wait();
                     
                     argIdx = 0; // get decIdx
@@ -512,6 +520,8 @@ Void taskAsdpFxn(
                     Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
                     size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
                     Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+                    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
+                    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
                     Cache_wait();
                     
                     // send dec reset complete message to master
@@ -550,7 +560,7 @@ Void taskAsdpFxn(
                     size = pIpBufConfig->frameLength * pIpBufConfig->sizeofElement;
                     if (sourceSelect == PAF_SOURCE_PCM)
                     {
-                        size *= pIpBufConfig->stride;
+                       size *= pIpBufConfig->stride;
                     }
 
                     bufEnd = (Int) pIpBufConfig->base.pVoid + pIpBufConfig->sizeofBuffer;
@@ -566,8 +576,8 @@ Void taskAsdpFxn(
                     wrapSize = size - chunkSize;
                     // invalidate input data
                     Cache_inv((Ptr)pIpBufConfig->pntr.pSmInt, chunkSize, Cache_Type_ALLD, 0);
-                    TRACE_MSG2("IBUF : pIpBufConfig->pntr.pSmInt: 0x%x and chunkSize: %d", pIpBufConfig->pntr.pSmInt, chunkSize);
                     // invalidate Dec configuration
+                    TRACE_MSG2("IBUF : pIpBufConfig->pntr.pSmInt: 0x%x and chunkSize: %d", (IArg)pIpBufConfig->pntr.pSmInt, chunkSize);
                     Cache_inv(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
                     // status for selected decoder should be invalidated
                     Cache_wait();
@@ -578,7 +588,7 @@ Void taskAsdpFxn(
                     {
                         // invalidate input data
                         Cache_inv((Ptr)pIpBufConfig->base.pSmInt, wrapSize, Cache_Type_ALLD, 0);
-                        TRACE_MSG2("IBUF : pIpBufConfig->base.pSmInt: 0x%x and wrapSize: %d",pIpBufConfig->base.pSmInt, wrapSize);
+                        TRACE_MSG2("IBUF : pIpBufConfig->base.pSmInt: 0x%x and wrapSize: %d", (IArg)pIpBufConfig->base.pSmInt, wrapSize);
                         // status for selected decoder should be invalidated
                         Cache_wait();
                     }
@@ -671,7 +681,7 @@ Void taskAsdpFxn(
                         cbErrno = cbWriteAf(pCbCtl, z, pAfWrt);
                         if (cbErrno < 0)
                         {
-                            SW_BREAKPOINT; // FL: debug
+                            //SW_BREAKPOINT; // FL: debug
                             
                             if (cbErrno == ASP_DECOP_CB_WRITE_OVERFLOW)
                             {
@@ -1228,7 +1238,9 @@ PAF_ASDT_initFrame0(
     Error_init(&eb); 
     
     //maxFrameLength += PA_MODULO - maxFrameLength % PA_MODULO; // compute maximum framelength (needed for ARC support)
-    aLen = numchan[z] * maxFrameLength;
+    //aLen = numchan[z] * maxFrameLength;
+    aLen = numchan[z] * maxFrameLength + (maxFrameLength - FRAMELENGTH); /* Qin - need additional memory for starting offset
+                                                                                     See line 1307 */
 
     //
     // Initialize audio frame elements directly
@@ -1423,6 +1435,9 @@ Int resetAf(
         case PAF_SOURCE_DDP:
             pAudioFrame->data.nSamples = 1536;
             break;
+        case PAF_SOURCE_THD:
+            pAudioFrame->data.nSamples = 5120; //QIN FIX ME
+            break;
         default:  
             pAudioFrame->data.nSamples = FRAMELENGTH;
             break;
index 8fa9a3f499d3f299d51543a32dc88056398b37ca..89496fea714c2c2f8db217b5f72f6dc3e7ee8d03 100644 (file)
@@ -444,7 +444,7 @@ const PAF_ASDT_Params asdp_params_PAi =
     PAF_ASDT_params_decodeStatus,                           // z_pDecodeStatus
     &PAF_ASP_params_decAlgKey,                              // pDecAlgKey
     PAF_AST_streamsFromDecodes_std,                         // streamsFromDecodes
-    1536,                                                   // maxFramelength
+    5120,                                                   // maxFramelength set to match maximum value possible for 48K stream
     PAF_ASDT_params_MetadataBufStatus,                      //metadata buffer status
     NULL //PAF_AST_params_AudioFrameBufStatus                      //Audio frame buffer status
 };
index dccc72a8f7508e448397b84f0ccea4b6813d6245..9a18688e098ab51cef2595bbfcbf052c54fef664 100644 (file)
@@ -59,6 +59,11 @@ All rights reserved.
 #include <ddpat_tid.h>
 #endif
 
+#define _THD_
+#ifdef _THD_
+#include <thd.h>
+#include <thd_tid.h>
+#endif
 //#define _SRC4_
 #ifdef _SRC4_
 #include <src.h>
@@ -75,6 +80,9 @@ const PAF_ASP_LinkInit decLinkInitI13[] =
 #ifdef _DDPAT_
     PAF_ASP_LINKINIT(STD, DDP, TID),
 #endif
+#ifdef _THD_
+    PAF_ASP_LINKINIT(STD, THD, TID),
+#endif
     
     PAF_ASP_LINKNONE,
 };
index b38a62496da6aacfaa63a9b49a0cb9a2c5a31c00..e87da1a89ddf2863faad6d09efdb0aad1f23ea79 100644 (file)
@@ -11,8 +11,8 @@
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_00/psdk_cust/pdk_k2g_1_0_1_0_eng/packages"/>
                                        <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_00/psdk_cust/pdk_k2g_1_0_1_0_eng/packages"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/pasdk/shared&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/boards/k2g/drivers&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/dolby_ip/ddp/Dolby_Digital_Plus_Decoder_Imp/Source_Code/alpha&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/dolby_ip/mat-thd/Dolby_MAT_Decoder_Imp/Source_Code/alpha&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/dolby_ip/oar/Source_Code&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/dolby_ip/oar/Source_Code/alg&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/dolby_ip/oar/Source_Code/alpha&quot;"/>
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_00/psdk_cust/pdk_k2g_1_0_1_0_eng/packages"/>
                                        <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_00/psdk_cust/pdk_k2g_1_0_1_0_eng/packages"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_00/psdk_cust/pdk_k2g_1_0_1_0_eng/packages"/>
+                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_00/psdk_cust/pdk_k2g_1_0_1_0_eng/packages"/>
                                        <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_00/psdk_cust/pdk_k2g_1_0_1_0_eng/packages"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
index 49a8a7750357f8293e1bbfd879e3785e5ea50012..53b11c9ce055ee37f11767e1954f9ce4f6c85564 100644 (file)
@@ -391,7 +391,7 @@ Program.sectMap[".msmcSramHeap"] = "CORE0_MSMC";
 /* Add DDR3 heap */ // formerly SDRAM
 var heapMem2Params = new HeapMem.Params();
 heapMem2Params.instance.name = "heapMemDdr3";
-heapMem2Params.size = 3350528;
+heapMem2Params.size = 4350528;
 heapMem2Params.sectionName = ".ddr3Heap";
 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
 Program.sectMap[".ddr3Heap"] = "CORE0_DDR3";
index 64ae97d37005b137bceb9c3d42f49993c4a81cb7..3e8692f300fb3bbaf9336189fc81d30608e94633 100644 (file)
@@ -56,7 +56,7 @@ All rights reserved.
 #include <ae_a.h>\r
 //#include <dm_a.h>\r
 #include <ddpat_a.h>\r
-//#include <thd_a.h>\r
+#include <thd_a.h>\r
 #include <oar_a.h>\r
 #include <car_a.h>\r
 #include <bmda_a.h>\r
index 79de57330c8b38c2d001365ac41e9d0af03ee4c5..1b3b8d9fb29090642f9b529d28b568f871a18b4d 100644 (file)
@@ -47,8 +47,21 @@ All rights reserved.
 #include <pa_i13_evmk2g_io_a.h> //<pa_i13_evmda830_io_a.h>
 
 #ifndef SIMULATE_SIO
-
+#define DDP
 #ifdef TEST_MULTICHANNEL
+#ifndef DDP
+//THD
+#define CUS_ATBOOT_S \
+    writeDECChannelMapTo16(PAF_LEFT,PAF_RGHT,8,9,2,12,10,11,-3,-3,-3,-3,-3,-3,-3,-3), \
+    writeENCChannelMapFrom16(PAF_LEFT,PAF_RGHT,8,9,2,12,10,11,-3,-3,-3,-3,-3,-3,-3,-3), \
+    writeVOLControlMasterN(0), \
+    writeVOLOffsetMasterN(0x7fff), \
+    writeSYSRecreationModeDirect, \
+    writeSYSChannelConfigurationRequestSurround4_1, \
+    execPAIOutAnalog, \
+    execPAIInHDMI
+#else
+//DDP
 #define CUS_ATBOOT_S \
     writeDECChannelMapTo16(PAF_LEFT,PAF_RGHT,8,9,2,12,10,11,-3,-3,-3,-3,-3,-3,-3,-3), \
     writeENCChannelMapFrom16(PAF_LEFT,PAF_RGHT,8,9,2,12,6,7,-3,-3,-3,-3,-3,-3,-3,-3), \
@@ -58,6 +71,7 @@ All rights reserved.
     writeSYSChannelConfigurationRequestSurround2ATMOS_1(4), \
     execPAIOutAnalog, \
     execPAIInHDMIStereo
+#endif
     //
     //writeENCChannelMapFrom16(PAF_LEFT,PAF_RGHT,8,9,2,12,10,11,-3,-3,-3,-3,-3,-3,-3,-3), \     // Lrs/Rrs
     //writeENCChannelMapFrom16(PAF_LEFT,PAF_RGHT,8,9,2,12,6,7,-3,-3,-3,-3,-3,-3,-3,-3), \       // Ltm/Rtm
index a29bad0aa9051ee859818ba95aa8baaa7c102fa4..c1d6aa47e34a9421e2a1a1d826fd80706d4c3816 100644 (file)
@@ -1,37 +1,31 @@
 
-/*
-Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
-All rights reserved.
-
-* Redistribution and use in source and binary forms, with or without 
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the
-* distribution.
+/******************************************************************************
+* Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com
+*   All rights reserved.
 *
-* Neither the name of Texas Instruments Incorporated nor the names of
-* its contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
+*   Redistribution and use in source and binary forms, with or without
+*   modification, are permitted provided that the following conditions are met:
+*       * Redistributions of source code must retain the above copyright
+*         notice, this list of conditions and the following disclaimer.
+*       * Redistributions in binary form must reproduce the above copyright
+*         notice, this list of conditions and the following disclaimer in the
+*         documentation and/or other materials provided with the distribution.
+*       * Neither the name of Texas Instruments Incorporated nor the
+*         names of its contributors may be used to endorse or promote products
+*         derived from this software without specific prior written permission.
 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
+*   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+*   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+*   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+*   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+*   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+*   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+*   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+*   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+*   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+*   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+*   THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************/
 
 //
 //
@@ -50,24 +44,52 @@ extern void UART_transferCallback(UART_Handle handle,
                                     void *buffer, size_t count);
 #endif
 
+#ifdef SPICALLBACK
+extern void SPI_transferCallback(UART_Handle handle,
+                                    void *buffer, size_t count);
+#endif
+
+/* SPI parameters structure Slave mode*/
+SPI_Params spiParams =
+{
+#ifdef SPICALLBACK
+    SPI_MODE_CALLBACK,  /* transferMode */
+#else
+    SPI_MODE_BLOCKING,  /* transferMode */
+#endif
+    Semaphore_PendState_WAIT_FOREVER,  /* transferTimeout */
+#ifdef SPICALLBACK
+    &SPI_transferCallback,
+#else
+    NULL,               /* transferCallbackFxn */
+#endif
+    SPI_SLAVE,          /* mode */
+    1000000,            /* bitRate */
+    8,                  /* dataSize */
+    SPI_POL0_PHA0,      /* frameFormat */
+    NULL                /* custom */
+};
 
 const DCS7_Params_Dev_Spi DCS7_PARAMS_DEV_SPI =
 {
-    sizeof(DCS7_Params_Dev_Spi)
+    sizeof(DCS7_Params_Dev_Spi),
+    NULL,
+    &spiParams,
+    {0, NULL, NULL, NULL}
 };
 
 const DCS7_Params_Dev_I2c DCS7_PARAMS_DEV_I2C =
 {
     sizeof(DCS7_Params_Dev_I2c),
+    NULL,
+    {I2C_MODE_BLOCKING, NULL, I2C_100kHz, NULL, I2C_SLAVE},
+    {NULL, 0, NULL, 0, 0, NULL, NULL},
+    0x11
 };
 
 const DCS7_Params_Dev_Uart DCS7_PARAMS_DEV_UART =
 {
     sizeof(DCS7_Params_Dev_Uart),
-    0,     // xrxSize
-    0,     // xrxHwm
-    0,     // xrxLwm
-    0,     // xtxSize
     0,     // emask
     NULL,  // hUart
 #ifdef UARTCALLBACK
@@ -75,7 +97,9 @@ const DCS7_Params_Dev_Uart DCS7_PARAMS_DEV_UART =
 #endif
     0,     // isEMDAConfigured
     SRECORD_RES_MAX_S1_CNT * 72 /*ASCII_SRECORD_S1_MAX_SIZE*/, // scratchBufSize
-    NULL   // scratchBuf
+    NULL,  // scratchBuf
+    {0},   // uartParams
+    19200
 };
 
 const DCS7_Params_Dev DCS7_PARAMS_DEV =
@@ -96,19 +120,9 @@ const DCS7_Params DCS7_PARAMS =
     sizeof(DCS7_Params),
     /* DCS7 supports following values for device (dev):
        DCS7_PARAMS_DEV_SPI0 - SPI0 device
-       DCS7_PARAMS_DEV_SPI1 - SPI1 device
        DCS7_PARAMS_DEV_I2C0 - I2C0 device
-       DCS7_PARAMS_DEV_I2C1 - I2C1 device
        DCS7_PARAMS_DEV_UART0 - UART0 device */
     DCS7_PARAMS_DEV_UART0,
-    /* DCS7 supports following values for (psfil):
-       DCS7_PARAMS_PSFIL_ENA - enable processing zero fill
-       DCS7_PARAMS_PSFIL_DIS - disable processing zero fill */
-    DCS7_PARAMS_PSFIL_DIS,
-    /* DCS7 supports following values for processing slc (pslc):
-       DCS7_PARAMS_PSLC_DIS - disable processing slc
-       DCS7_PARAMS_PSLC_ENA - enable processing slc */
-    DCS7_PARAMS_PSLC_ENA,
     /* DCS7 supports following values for error detection and report (edr):
        DCS7_PARAMS_EDR_DIS - disable error detection and report
        DCS7_PARAMS_EDR_ENA - enable error detection and report */
@@ -125,7 +139,7 @@ const DCS7_Params DCS7_PARAMS =
     /* DCS7 device parameters */
     (DCS7_Params_Dev*)&DCS7_PARAMS_DEV,
     /* DCS7 log param */
-    (Void*) &DCS7Trace,
+    (void*) &DCS7Trace,
 };
 
 void DCS7_errorInit()
index 42f5c5c661b30aabbbbbf16c99a13e634a1db074..783768d0eb925242f4478d85333b706e9312cb8a 100644 (file)
@@ -55,6 +55,16 @@ static Void cbReadAfMute(
     Int16 strFrameLen           // stream frame length (output transaction size)
 );
 
+// Init last audio frame configuration info 
+static Void cbInitLastAfInfo(
+    PAF_AudioFrame *pAfRd      // last audio frame stored in CB instance
+);
+
+// Generate mute AF on circular buffer read using the last AF configuration info 
+static Void cbReadMuteWithLastAfInfo (
+    PAF_AST_DecOpCircBuf *pCb,    // decoder output circular buffer control
+    PAF_AudioFrame *pAfRd         // audio frame into which to read
+);
 
 // Initialize circular buffer control
 Int cbCtlInit(
@@ -108,11 +118,14 @@ Int cbInit(
     pCb->strFrameLen = DEF_STR_FRAME_LEN;
     
     // initialize circular buffer maximum number of audio frames
-    pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_PCM;
+    pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_THD;//ASP_DECOP_CB_MAX_NUM_AF_PCM;
     pCb->afWrtIdx = ASP_DECOP_CB_INIT_LAG_PCM;
     pCb->afRdIdx = 0;
     pCb->pcmRdIdx = 0; // 2*256 in behind
     
+    // set default value to PCM configuration
+    pCb->maxAFChanNum   = ASP_DECOP_CB_MAX_NUM_PCM_CH;
+    pCb->maxAFSampCount = DEF_DEC_OP_FRAME_LEN;
     // initialize audio frames
     for (n=0; n<pCb->maxNumAfCb; n++)
     {
@@ -174,6 +187,8 @@ Int cbInit(
     pCb->errUndCnt = 0;
     pCb->errOvrCnt = 0;
     
+    cbInitLastAfInfo(&pCb->lastAf);
+
     // (***) FL: revisit
     // Write back circular buffer configuration
     Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
@@ -250,6 +265,8 @@ Int cbInitSourceSel(
         pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_PCM;
         pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_PCM;
         pCb->pcmRdIdx = 0;
+        pCb->maxAFChanNum = ASP_DECOP_CB_MAX_NUM_PCM_CH;
+        pCb->maxAFSampCount = DEF_DEC_OP_FRAME_LEN;
         
         // initialize audio frames
         for (n=0; n<pCb->maxNumAfCb; n++)
@@ -280,6 +297,40 @@ Int cbInitSourceSel(
         pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_DDP;
         pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_DDP;
         pCb->pcmRdIdx = decOpFrameLen - ASP_DECOP_CB_INIT_LAG_DDP*strFrameLen; // 4*256 behind
+        pCb->maxAFChanNum = ASP_DECOP_CB_MAX_NUM_PCM_CH_DDP;
+        pCb->maxAFSampCount = ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kDDP;
+        
+        // initialize audio frames
+        for (n=0; n<pCb->maxNumAfCb; n++)
+        {
+            pAfCb = &pCb->afCb[n];
+            pAfCb->sampleDecode = sourceSelect;
+            PAF_PROCESS_ZERO(pAfCb->sampleProcess);
+            pAfCb->sampleRate = PAF_SAMPLERATE_48000HZ;
+            pAfCb->sampleCount = decOpFrameLen;
+            pAfCb->channelConfigurationRequest.full = 0;
+            pAfCb->channelConfigurationRequest.part.sat = PAF_CC_SAT_SURROUND4;
+            pAfCb->channelConfigurationRequest.part.sub = PAF_CC_SUB_ONE;
+            pAfCb->channelConfigurationStream.full = 0;
+            pAfCb->channelConfigurationStream.part.sat = PAF_CC_SAT_SURROUND4;
+            pAfCb->channelConfigurationStream.part.sub = PAF_CC_SUB_ONE;
+            
+            // write metadata information updated by decoder
+            pAfCb->bsMetadata_type     = PAF_bsMetadata_channelData;    /* non zero if metadata is attached. */
+            pAfCb->pafBsMetadataUpdate = 0;                             /* indicates whether bit-stream metadata update */
+            pAfCb->numPrivateMetadata  = 0;                             /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
+            pAfCb->bsMetadata_offset   = 0;                             /* offset into audio frame for change in bsMetadata_type field */
+        }
+    }
+    else if (sourceSelect == PAF_SOURCE_THD)
+    {
+        pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_THD;
+        // 0 in behind
+        pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_THD;
+        pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_THD;
+        pCb->pcmRdIdx = 0;
+        pCb->maxAFChanNum = ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT;
+        pCb->maxAFSampCount = ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kMAT;
         
         // initialize audio frames
         for (n=0; n<pCb->maxNumAfCb; n++)
@@ -322,13 +373,13 @@ Int cbInitSourceSel(
     for (n=0; n<pCb->maxNumAfCb; n++)
     {
         pAfCb = &pCb->afCb[n];
-        pAfCb->data.nChannels = ASP_DECOP_CB_MAX_NUM_PCM_CH;
+        pAfCb->data.nChannels = pCb->maxAFChanNum;
         pAfCb->data.nSamples = decOpFrameLen;
-        for (i=0; i<ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        for (i=0; i<pCb->maxAFChanNum; i++)
         {
             pAfCb->data.sample[i] = pPcmBuf;
-            memset(pAfCb->data.sample[i], decOpFrameLen, 0);
-            pPcmBuf += decOpFrameLen;
+            memset(pAfCb->data.sample[i], pCb->maxAFSampCount, 0);
+            pPcmBuf += pCb->maxAFSampCount;
             
             pAfCb->data.samsiz[i] = 0;
         }
@@ -364,17 +415,12 @@ Int cbInitSourceSel(
     for (n=0; n<pCb->maxNumAfCb; n++)
     {
         pAfCb = &pCb->afCb[n];
-        Cache_wb(pAfCb->data.samsiz, ASP_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
-        Cache_wb(pAfCb->data.sample, ASP_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
-        for (i=0; i<ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        Cache_wb(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+        Cache_wb(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
+        for (i=0; i<pCb->maxAFChanNum; i++)
         {
-            Cache_wb(pAfCb->data.sample[i], decOpFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+            Cache_wb(pAfCb->data.sample[i], pCb->maxAFSampCount*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
         }
-        // FL: unnecessary since part of AF
-        //for (i=0; i<PAF_MAX_NUM_PRIVATE_MD; i++)     // Write back metadata //QIN
-        //{
-        //    Cache_wb(&pAfCb->pafPrivateMetadata[i], sizeof(PAF_PrivateMetadata), Cache_Type_ALLD, 0);
-        //}
     }
     Cache_wait();
 
@@ -474,6 +520,7 @@ Int cbReadAf(
     PAF_ChannelMask_HD streamMask;
     Int8 i;
     Int16 j;
+    Int8 numMetadata = 0;
 
     // Get gate handle
     gateHandle = pCbCtl->gateHandle;
@@ -509,7 +556,8 @@ Int cbReadAf(
         // No active writer, not draining circular buffer.
         // Skip UNDerflow check, mute output.
         //
-        cbReadAfMute(pAfRd, pCb->strFrameLen);
+        //cbReadAfMute(pAfRd, pCb->strFrameLen);
+        cbReadMuteWithLastAfInfo(pCb, pAfRd);
         
         // Leave the gate
         GateMP_leave(gateHandle, key);
@@ -529,7 +577,8 @@ Int cbReadAf(
             // Mute output on underflow.
             //
             pCb->errUndCnt++;
-            cbReadAfMute(pAfRd, pCb->strFrameLen);
+            //cbReadAfMute(pAfRd, pCb->strFrameLen);
+            cbReadMuteWithLastAfInfo(pCb, pAfRd);
             //SW_BREAKPOINT; // FL: debug
             
             // Write back circular buffer configuration.
@@ -556,10 +605,9 @@ Int cbReadAf(
         // (***) FL: revisit
         // Invalidate audio frame
         Cache_inv(pAfCb, sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
-        Cache_inv(pAfCb->data.samsiz, ASP_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+        Cache_inv(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
         for (i=0; i<pAfCb->numPrivateMetadata; i++) //QIN // FL: only invalidate numPrivateMetadata
         {
-            //Cache_inv(&pAfCb->pafPrivateMetadata[i], sizeof(PAF_PrivateMetadata), Cache_Type_ALLD, 0); // FL: unnecessary since part of AF
             Cache_inv(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size, Cache_Type_ALLD, 0); // FL: only update metadata package size
         }
         Cache_wait();
@@ -568,7 +616,7 @@ Int cbReadAf(
         streamMask = pAfRd->fxns->channelMask(pAfRd, pAfCb->channelConfigurationStream);
 
         // Invalidate PCM data
-        for (i = 0; i < ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        for (i = 0; i < pCb->maxAFChanNum; i++)
         {
             if ((streamMask >> i) & 0x1)
             {
@@ -592,7 +640,7 @@ Int cbReadAf(
         pAfRd->bsMetadata_offset   = pAfCb->bsMetadata_offset;      /* offset into audio frame for change in bsMetadata_type field */
         
         // read PCM samples
-        for (i = 0; i < ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        for (i = 0; i < pCb->maxAFChanNum; i++)
         {
             if ((streamMask >> i) & 0x1)
             {
@@ -604,6 +652,13 @@ Int cbReadAf(
                 pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
             }
         }
+        
+        for (i = 0; i < PAF_MAX_NUM_PRIVATE_MD; i++)
+        {
+            pAfRd->pafPrivateMetadata[i].offset = 0;
+            pAfRd->pafPrivateMetadata[i].size   = 0;
+        }
+        
         // read metadata //QIN
         for (i = 0; i < pAfCb->numPrivateMetadata; i++) // FL: only read numPrivateMetadata
         {
@@ -622,19 +677,22 @@ Int cbReadAf(
                 //Cache_wait();        
         
                 // the offset is adjusted for segment [pCb->pcmRdIdx, (pCb->pcmRdIdx + pCb->pafFrameLen)]
-                pAfRd->pafPrivateMetadata[i].offset = 0; //pAfCb->pafPrivateMetadata[i].offset - pCb->pcmRdIdx;
-                pAfRd->pafPrivateMetadata[i].size   = pAfCb->pafPrivateMetadata[i].size;
-                memcpy(pAfRd->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size);
+                pAfRd->pafPrivateMetadata[numMetadata].offset = pAfCb->pafPrivateMetadata[i].offset - pCb->pcmRdIdx;
+                pAfRd->pafPrivateMetadata[numMetadata].size   = pAfCb->pafPrivateMetadata[i].size;
+                memcpy(pAfRd->pafPrivateMetadata[numMetadata].pMdBuf, pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size);
+                numMetadata++; //number of metadata associated with current 256 segment of audio samples
             }
             else //reset un-used buf
             {
                 pAfRd->pafPrivateMetadata[i].offset = 0;
                 pAfRd->pafPrivateMetadata[i].size   = 0;
             }
+
         }
+        pAfRd->numPrivateMetadata = numMetadata; //number of metadata associated with current 256 segment of audio samples
         
         pCb->pcmRdIdx += pCb->strFrameLen; // update PCM read index
-        if (pCb->pcmRdIdx == pCb->decOpFrameLen)
+        if (pCb->pcmRdIdx >= pAfCb->sampleCount) 
         {
             // update audio frame read index
             pCb->afRdIdx++;
@@ -649,6 +707,7 @@ Int cbReadAf(
             // update number of audio frames in circular buffer
             pCb->numAfCb--;
         }
+        memcpy (&pCb->lastAf, pAfRd, sizeof(PAF_AudioFrame));
     }
     
     if (pCb->emptyFlag == 1)
@@ -702,7 +761,7 @@ static Void cbReadAfMute(
     {
         if ((streamMask >> i) & 0x1)
         {
-            memset(pAfRd->data.sample[i], strFrameLen, 0);
+            memset(pAfRd->data.sample[i], 0, strFrameLen*sizeof(PAF_AudioData));
         }
         pAfRd->data.samsiz[i] = 0;
     }
@@ -712,3 +771,62 @@ static Void cbReadAfMute(
     pAfRd->numPrivateMetadata  = 0;                             /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
     pAfRd->bsMetadata_offset   = 0;                             /* offset into audio frame for change in bsMetadata_type field */
 }
+// Init last audio frame configuration info 
+static Void cbInitLastAfInfo(
+    PAF_AudioFrame *pAfRd      // last audio frame stored in CB instance
+)
+{
+    pAfRd->sampleDecode = PAF_SOURCE_PCM;
+    PAF_PROCESS_ZERO(pAfRd->sampleProcess);
+    pAfRd->sampleRate = PAF_SAMPLERATE_48000HZ;
+    pAfRd->sampleCount = DEF_DEC_OP_FRAME_LEN;
+    pAfRd->channelConfigurationRequest.full = 0;
+    pAfRd->channelConfigurationRequest.part.sat = PAF_CC_SAT_SURROUND4;
+    pAfRd->channelConfigurationRequest.part.sub = PAF_CC_SUB_ONE;
+    pAfRd->channelConfigurationStream.full = 0;
+    pAfRd->channelConfigurationStream.part.sat = PAF_CC_SAT_SURROUND4;
+    pAfRd->channelConfigurationStream.part.sub = PAF_CC_SUB_ONE;
+
+    pAfRd->bsMetadata_type     = PAF_bsMetadata_none;           /* non zero if metadata is attached. */
+    pAfRd->pafBsMetadataUpdate = 0;                             /* indicates whether bit-stream metadata update */
+    pAfRd->numPrivateMetadata  = 0;                             /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
+    pAfRd->bsMetadata_offset   = 0;                             /* offset into audio frame for change in bsMetadata_type field */
+}
+
+// Generate mute AF on circular buffer read using the last AF configuration info 
+static Void cbReadMuteWithLastAfInfo (
+    PAF_AST_DecOpCircBuf *pCb,    // decoder output circular buffer control
+    PAF_AudioFrame *pAfRd         // audio frame into which to read
+)
+{
+    PAF_ChannelMask_HD streamMask;
+    Int8 i;
+
+    pAfRd->sampleDecode = pCb->lastAf.sampleDecode;
+    PAF_PROCESS_ZERO(pAfRd->sampleProcess);
+    pAfRd->sampleRate  = pCb->lastAf.sampleRate;
+    pAfRd->sampleCount = pCb->strFrameLen;
+    pAfRd->channelConfigurationRequest.full     = pCb->lastAf.channelConfigurationRequest.full;
+    pAfRd->channelConfigurationRequest.part.sat = pCb->lastAf.channelConfigurationRequest.part.sat;
+    pAfRd->channelConfigurationRequest.part.sub = pCb->lastAf.channelConfigurationRequest.part.sub;
+    pAfRd->channelConfigurationStream.full      = pCb->lastAf.channelConfigurationStream.full;
+    pAfRd->channelConfigurationStream.part.sat  = pCb->lastAf.channelConfigurationStream.part.sat;
+    pAfRd->channelConfigurationStream.part.sub  = pCb->lastAf.channelConfigurationStream.part.sub;
+    
+    // compute stream mask
+    streamMask = pAfRd->fxns->channelMask(pAfRd, pAfRd->channelConfigurationStream);
+    // Clear PCM data
+    for (i = 0; i < ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
+    {
+        if ((streamMask >> i) & 0x1)
+        {
+            memset(pAfRd->data.sample[i], 0, pAfRd->sampleCount*sizeof(PAF_AudioData));
+        }
+        pAfRd->data.samsiz[i] = 0;
+    }
+    pAfRd->bsMetadata_type     = PAF_bsMetadata_none;           /* non zero if metadata is attached. */
+    pAfRd->pafBsMetadataUpdate = 0;                             /* indicates whether bit-stream metadata update */
+    pAfRd->numPrivateMetadata  = 0;                             /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
+    pAfRd->bsMetadata_offset   = 0;                             /* offset into audio frame for change in bsMetadata_type field */
+}
+
index 9e06ee9d85e84deebd4353d75564bab8db3bb225..94cdf30f01e83a375d616aa562e2f78495f7c273 100644 (file)
@@ -494,12 +494,16 @@ Void taskAsipFxn(
     Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_wait();
     if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]) Log_info0("ERROR: beta unit for Dec==NULL");
     if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]) Log_info0("ERROR: beta unit for Dec==NULL");
     if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]) Log_info0("ERROR: beta unit for Dec==NULL");
     if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]) Log_info0("ERROR: beta unit for Dec==NULL");
     if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]) Log_info0("ERROR: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]) Log_info0("ERROR: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]) Log_info0("ERROR: beta unit for Dec==NULL");
     
     // (***) FL: revisit
     // invalidate Status structures for Beta Units initialized on Slave
@@ -518,6 +522,12 @@ Void taskAsipFxn(
     Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(Int), Cache_Type_ALLD, 0);
     size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
     Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(Int), Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(Int), Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]->size;
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), size, Cache_Type_ALLD, 0);
     Cache_wait();
     
     // (***) FL: revisit
@@ -1373,30 +1383,31 @@ PAF_ASIT_initPhaseDecOpCircBuf(
         // allocate audio frame PCM sample pointer array
         for (i = 0; i<ASP_DECOP_CB_MAX_NUM_AF; i++)
         {
-            if (!(pCb->afCb[i].data.sample = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_PCM_CH * sizeof(PAF_AudioData *), 4, &eb)))
+            if (!(pCb->afCb[i].data.sample = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT * sizeof(PAF_AudioData *), 4, &eb)))
             {
                 TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
                 SW_BREAKPOINT;
             }
-            if (!(pCb->afCb[i].data.samsiz = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_PCM_CH * sizeof(PAF_AudioSize), 4, &eb)))
+            if (!(pCb->afCb[i].data.samsiz = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT * sizeof(PAF_AudioSize), 4, &eb)))
             {
                 TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
                 SW_BREAKPOINT;
             }                
         }
         // allocate PCM sample buffer
-        if (!(pCb->pcmBuf = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_PCM_BUF_SZ * sizeof(PAF_AudioData), 4, &eb)))
+        if (!(pCb->pcmBuf = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_SHM, ASP_DECOP_CB_PCM_BUF_SZ * sizeof(PAF_AudioData), 4, &eb)))
         {
             TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
             SW_BREAKPOINT;
         }
+        pCb->pcmBufEnd = pCb->pcmBuf + ASP_DECOP_CB_PCM_BUF_SZ;
         // allocate Metadata buffers //QIN
-        if (!(pCb->metaBuf = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_AF * PAF_MAX_PRIVATE_MD_SZ * PAF_MAX_NUM_PRIVATE_MD * sizeof(Int8), 4, &eb)))
+        if (!(pCb->metaBuf = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_SHM, ASP_DECOP_CB_MAX_NUM_AF * PAF_MAX_PRIVATE_MD_SZ * PAF_MAX_NUM_PRIVATE_MD * sizeof(Int8), 4, &eb)))
         {
             TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
             SW_BREAKPOINT;
         }
-        
+        pCb->metaBufEnd = pCb->metaBuf + (ASP_DECOP_CB_MAX_NUM_AF * PAF_MAX_PRIVATE_MD_SZ * PAF_MAX_NUM_PRIVATE_MD);
         // (***) FL: revisit, here PCM is hard-coded for 256 sample dec op frame length        
         // Initialize decoder output circular buffer for PCM
         errno = cbInit(pCb);
@@ -1934,6 +1945,8 @@ PAF_ASIT_decodeProcessing(
                 Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
                 size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
                 Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+                size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
+                Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
                 Cache_wait();
 #endif
 #if 0
@@ -1961,6 +1974,8 @@ PAF_ASIT_decodeProcessing(
                 Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
                 size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
                 Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+                size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
+                Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
                 Cache_wait();
 #endif
                 
@@ -2424,6 +2439,10 @@ PAF_ASIT_decodeInit(
             {
                 frameLength = 1536;
             }
+            else if (sourceSelect == PAF_SOURCE_THD)
+            {
+                frameLength = 1536; //QIN FIX ME
+            }
             else
             {
                 frameLength = 256;
@@ -3036,6 +3055,10 @@ PAF_ASIT_decodeDecode(
             {
                 frameLength = 1536;
             }
+            else if (sourceSelect == PAF_SOURCE_THD)
+            {
+                frameLength = 1536; //QIN FIX ME
+            }
             else
             {
                 frameLength = 256;
index c9194211868041352ead8ca1ae21aaac51f88da0..770c8b822b0d8959efc7cc70cd93a47484573bc0 100644 (file)
@@ -1014,10 +1014,10 @@ PAF_ASOT_initFrame0(
     
     if (aLen_int*aSize!=0) // check size != 0, otherwise malloc throws fatal error
     {
-        if (!(aBuf_int = (PAF_AudioData *)Memory_calloc((IHeap_Handle)HEAP_FRMBUF, aLen_int*aSize, aAlign, &eb)))
+        if (!(aBuf_int = (PAF_AudioData *)Memory_calloc((IHeap_Handle)HEAP_FRMBUF, (aLen_int+(maxFrameLength-FRAMELENGTH))*aSize, aAlign, &eb))) //Qin: Add start offset
         {
             TRACE_TERSE1("PAF_ASOT_initFrame0: AS%d: Memory_calloc failed", as+z);
-            TRACE_TERSE2("  maxFrameLength: %d.  aLen_int*aSize: %d", maxFrameLength, aLen_int*aSize);
+            TRACE_TERSE2("  maxFrameLength: %d.  aLen_int*aSize: %d", maxFrameLength, (aLen_int+(maxFrameLength-FRAMELENGTH))*aSize);
             SW_BREAKPOINT;
             return __LINE__;
         }
@@ -1025,17 +1025,17 @@ PAF_ASOT_initFrame0(
         
     if (aLen_ext*aSize!=0)
     {
-        if (!(aBuf_ext = (PAF_AudioData *)Memory_calloc((IHeap_Handle)HEAP_EXTERNAL, aLen_ext*aSize, aAlign, &eb)))
+        if (!(aBuf_ext = (PAF_AudioData *)Memory_calloc((IHeap_Handle)HEAP_EXTERNAL, (aLen_ext+(maxFrameLength-FRAMELENGTH))*aSize, aAlign, &eb)))//Qin: Add start offset
         {
             TRACE_TERSE1("PAF_ASOT_initFrame0: AS%d: Memory_calloc failed", as+z);
-            TRACE_TERSE2("  maxFrameLength: %d.  aLen_ext*aSize: %d", maxFrameLength, aLen_ext*aSize);
+            TRACE_TERSE2("  maxFrameLength: %d.  aLen_ext*aSize: %d", maxFrameLength, (aLen_ext+(maxFrameLength-FRAMELENGTH))*aSize);
             SW_BREAKPOINT;
             return __LINE__;
         }
     }
     
-    TRACE_TERSE3("  maxFrameLength: %d.  aLen_int*aSize: %d.  aBuf_int: 0x%x", maxFrameLength, aLen_int*aSize, (IArg)aBuf_int);
-    TRACE_TERSE3("  maxFrameLength: %d.  aLen_ext*aSize: %d.  aBuf_ext: 0x%x", maxFrameLength, aLen_ext*aSize, (IArg)aBuf_ext);
+    TRACE_TERSE3("  maxFrameLength: %d.  aLen_int*aSize: %d.  aBuf_int: 0x%x", maxFrameLength, (aLen_int+(maxFrameLength-FRAMELENGTH))*aSize, (IArg)aBuf_int);
+    TRACE_TERSE3("  maxFrameLength: %d.  aLen_ext*aSize: %d.  aBuf_ext: 0x%x", maxFrameLength, (aLen_ext+(maxFrameLength-FRAMELENGTH))*aSize, (IArg)aBuf_ext);
 
     TRACE_TERSE1("PAF_ASOT_initFrame0: AS%d: Memory_calloc for metadata buffers", as+z);
     if (!(metadataBuf = (XDAS_UInt8 *)Memory_calloc((IHeap_Handle)HEAP_MDBUF, pP->pMetadataBufStatus->bufSize*pP->pMetadataBufStatus->NumBuf, pP->pMetadataBufStatus->alignment, &eb)))
index c460e09ac7cceb952653c09ee36cbe5734f304e9..1a85fdc5560fe7652a73c29e25e2c7e3019e3cd7 100644 (file)
@@ -74,18 +74,18 @@ All rights reserved.
 #define SUC_TIH_ISUC SRC_TIH_ISRC
 #endif
 
-//#define _OAR_
-#ifdef _OAR_
-#include <oar.h>
-#include <oar_tig.h>
-#endif
-
 #define _CAR_
 #ifdef _CAR_
 #include <car.h>
 #include <car_tig.h>
 #endif
 
+#define _OAR_
+#ifdef _OAR_
+#include <oar.h>
+#include <oar_tig.h>
+#endif
+
 //#define _DAP_
 #ifdef _DAP_
 #include <dap.h>
@@ -109,14 +109,14 @@ const PAF_ASP_LinkInit aspLinkInitAllI13[] =
     PAF_ASP_LINKINITPARAMS(STD, SRC, TIH, &ISRC_PARAMS_DS_8CH_HBW),
 #endif
 
-#ifdef _OAR_
-    PAF_ASP_LINKINIT(STD, OAR, TIG),
-#endif
-
 #ifdef _CAR_
     PAF_ASP_LINKINIT(STD, CAR, TIG),
 #endif
 
+#ifdef _OAR_
+    PAF_ASP_LINKINIT(STD, OAR, TIG),
+#endif
+
 #ifdef _DAP_
     PAF_ASP_LINKINIT(STD, DAP, TIG),
 #endif
@@ -143,14 +143,14 @@ const PAF_ASP_LinkInit aspLinkInitStdI13[] =
     PAF_ASP_LINKINITPARAMS(STD, SRC, TIH, &ISRC_PARAMS_DS_8CH_HBW),
 #endif
 
-#ifdef _OAR_
-    PAF_ASP_LINKINIT(STD, OAR, TIG),
-#endif
-
 #ifdef _CAR_
     PAF_ASP_LINKINIT(STD, CAR, TIG),
 #endif
 
+#ifdef _OAR_
+    PAF_ASP_LINKINIT(STD, OAR, TIG),
+#endif
+
 #ifdef _DAP_
     PAF_ASP_LINKINIT(STD, DAP, TIG),
 #endif
index f5c32c5bc42f721cdd5147656a1a15c105d0e724..52369f4141dff1071ce821c2fe72d7b373d652b2 100644 (file)
@@ -417,8 +417,8 @@ void hrptredid()
        set_audio_desc(2,2,6,0x7,80);   //AC3
        //set_audio_desc(2,0,0,0,0);        //AC3; (GJ) currently not supported
        set_audio_desc(3,10,8,0x07,0);  // EAC3 //DTS (3,7,6,0x1e,192)
-       //set_audio_desc(4,12,8,0x7F,0);        // MLP (THD) //DTS (4,7,8,0x6,192)
-       set_audio_desc(4,0,0,0,0);      // MLP (THD) //DTS (4,7,8,0x6,192) ; (GJ) currently not supported
+       set_audio_desc(4,12,8,0x7F,0);  // MLP (THD) //DTS (4,7,8,0x6,192)
+       //set_audio_desc(4,0,0,0,0);    // MLP (THD) //DTS (4,7,8,0x6,192) ; (GJ) currently not supported
        // Empty descriptors to be programmed to 0s
        set_audio_desc(5,0,0,0,0);      //AAC LC (5,6,6,0x1f,192);
        set_audio_desc(6,0,0,0,0);
index 22df985b2d66df7a0899eea08d88a8ecf4c55c3b..65d47dd9bce4cbbfead35cc935075b4b64eacd0d 100644 (file)
@@ -815,19 +815,21 @@ Int SAP_reclaim (DEV2_Handle device)
     Log_info2("SAP: Inside SAP_Reclaim with From Device Frame->Addr: 0x%x and Frame->Size: %d", pFrame->addr, pFrame->size);
     if ((device->mode == DEV2_INPUT) && (pFrame->addr != NULL))
     {
-        Cache_inv (pFrame->addr, pFrame->size, Cache_Type_ALL, TRUE);
-
         if(pDevExt->edmaWordSize == 2 && pDevExt->numSers == 4)
         {
+            Cache_inv (pFrame->addr, pFrame->size, Cache_Type_ALL, 0);
+            Cache_wait();
                //note: size here is in # of bytes, so incrementing by 4X32b words ( or 8X16b)
                        //for(i=0; i<(pFrame->size)/(4*4); i+=16)
                        //{
                oldMask = Hwi_disable ();
                                swapHdmi(pFrame->addr, pFrame->size);
                                Hwi_restore(oldMask);
+
+                       Cache_wb (pFrame->addr, pFrame->size, Cache_Type_ALL, 0);
+                       Cache_wait();
                        //}
         }
-
     }
 
 #endif