Added metadata support in circular buffering. Integrated AR and BMDA.
authorSu <qsu@ti.com>
Thu, 4 Aug 2016 20:35:32 +0000 (16:35 -0400)
committerSu <qsu@ti.com>
Thu, 4 Aug 2016 20:35:32 +0000 (16:35 -0400)
procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.c
procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.h
procsdk_audio_x_xx_xx_xx/test_dsp/application/app.cfg
procsdk_audio_x_xx_xx_xx/test_dsp/application/app.cmd
procsdk_audio_x_xx_xx_xx/test_dsp/application/itopo/evmk2g/alpha/i13_a.h
procsdk_audio_x_xx_xx_xx/test_dsp/application/itopo/evmk2g/atboot.c
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamInpProc.c
procsdk_audio_x_xx_xx_xx/test_dsp/framework/itopo/patchs.c
readme_demo.txt

index 5bb89adb40407ca0c2009d0cce5e6f5c7c0c1927..31ccf41e5694a54af3c63915f93f08aed16485e8 100644 (file)
@@ -8,7 +8,7 @@
 #include "paf_decOpCircBuf.h"
 
 #define MAX_NUM_AF_PCM      ( 4 )
-#define MAX_NUM_AF_DDP      ( 3 ) //Qin - Increased to prevent cb overflow.
+#define MAX_NUM_AF_DDP      ( 2 ) //Qin - Increased to prevent cb overflow.
 
 #define CB_INIT_RD_LAG      ( 2 )
 
@@ -22,6 +22,7 @@ Int cbInit(
 {
     PAF_AudioFrame *pAfCb;
     PAF_AudioData *pPcmBuf;
+    Int8 *pMetaBuf; //QIN
     Int8 n;
     Int8 i;
 
@@ -88,6 +89,7 @@ Int cbInit(
     
     // initialize audio frame PCM buffers
     pPcmBuf = pCb->pcmBuf;
+       pMetaBuf = pCb->metaBuf; //QIN
     for (n=0; n<pCb->maxNumAfCb; n++)
     {
         pAfCb = &pCb->afCb[n];
@@ -100,9 +102,16 @@ Int cbInit(
             pPcmBuf += decOpFrameLen;
             
             pAfCb->data.samsiz[i] = 0;
+        }
+               //Initialize metadata buffers //QIN
+        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;
         }
     }
-    
     // update flags
     pCb->writerActiveFlag = 0;
     pCb->readerActiveFlag = 0;
@@ -124,6 +133,10 @@ Int cbInit(
         {
             Cache_wb(pAfCb->data.sample[i], decOpFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
         }
+        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();
 
@@ -137,6 +150,7 @@ Int cbWriteStart(
 {
     PAF_AudioFrame *pAfCb;
     Int8 n;
+    Int8 i;
 
     // (***) FL: hackin'
     // Invalidate circular buffer configuration.
@@ -150,6 +164,10 @@ Int cbWriteStart(
     {
         pAfCb = &pCb->afCb[n];
         Cache_inv(pAfCb->data.sample, PAF_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
+        for (i=0; i<PAF_MAX_NUM_PRIVATE_MD; i++) //QIN
+        {
+             Cache_inv(&pAfCb->pafPrivateMetadata[i], sizeof(PAF_PrivateMetadata), Cache_Type_ALLD, 0);
+           }
     }
     Cache_wait();
             
@@ -309,6 +327,11 @@ Int cbReadAf(
         // Invalidate audio frame
         Cache_inv(pAfCb, sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
         Cache_inv(pAfCb->data.samsiz, PAF_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+        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->pafPrivateMetadata[i].pMdBuf, PAF_MAX_PRIVATE_MD_SZ*sizeof(Int8), Cache_Type_ALLD, 0);
+        }
         Cache_wait();
 
         // compute stream mask
@@ -331,7 +354,11 @@ Int cbReadAf(
         pAfRd->sampleCount = pCb->strFrameLen;
         pAfRd->channelConfigurationRequest = pAfCb->channelConfigurationRequest;
         pAfRd->channelConfigurationStream = pAfCb->channelConfigurationStream;
-
+        // read metadata information updated by decoder //QIN
+        pAfRd->bsMetadata_type     = pAfCb->bsMetadata_type;        /* non zero if metadata is attached. */
+               pAfRd->pafBsMetadataUpdate = pAfCb->pafBsMetadataUpdate;    /* indicates whether bit-stream metadata update */
+        pAfRd->numPrivateMetadata  = pAfCb->numPrivateMetadata;     /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
+        pAfRd->bsMetadata_offset   = pAfCb->bsMetadata_offset;      /* offset into audio frame for change in bsMetadata_type field */
         // read PCM samples
         for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
         {
@@ -345,7 +372,31 @@ Int cbReadAf(
                 pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
             }
         }
-        
+        // read metadata //QIN
+        for (i = 0; i < PAF_MAX_NUM_PRIVATE_MD; i++)
+        {
+            //Invalidate metadata data
+           Cache_inv(&pAfCb->pafPrivateMetadata[i], sizeof(PAF_PrivateMetadata), Cache_Type_ALLD, 0);
+            Cache_wait();        
+            if ((pAfCb->pafPrivateMetadata[i].offset >= pCb->pcmRdIdx) 
+                    &&(pAfCb->pafPrivateMetadata[i].offset < (pCb->pcmRdIdx + pCb->strFrameLen))
+                            &&(pAfCb->pafPrivateMetadata[i].size))
+            {
+                //Invalidate metadata data
+               Cache_inv(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size, Cache_Type_ALLD, 0);
+                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);
+            }
+                   else //reset un-used buf
+                   {
+                           pAfRd->pafPrivateMetadata[i].offset = 0;
+                           pAfRd->pafPrivateMetadata[i].size   = 0;
+                   }
+        }
         pCb->pcmRdIdx += pCb->strFrameLen; // update PCM read index
         if (pCb->pcmRdIdx == pCb->decOpFrameLen)
         {
@@ -424,12 +475,13 @@ Int cbWriteAf(
         }
 #endif        
 
-        // check overflow
-        if (pCb->numAfCb >= pCb->maxNumAfCb)
-        {
-            return PAF_DECOP_CB_WRITE_OVERFLOW;
-        }
 
+        // check overflow
+        //if (pCb->numAfCb >= pCb->maxNumAfCb)
+        //{
+        //    return PAF_DECOP_CB_WRITE_OVERFLOW;
+        //}
+        while (pCb->numAfCb >= pCb->maxNumAfCb); //Qin replace with while loop for debugging
         // get pointer to current audio frame in circular buffer
         pAfCb = &pCb->afCb[pCb->afWrtIdx];
            
@@ -440,7 +492,11 @@ Int cbWriteAf(
         pAfCb->sampleCount = pAfWrt->sampleCount;
         pAfCb->channelConfigurationRequest = pAfWrt->channelConfigurationRequest;
         pAfCb->channelConfigurationStream = pAfWrt->channelConfigurationStream;
-        
+        // write metadata information updated by decoder//QIN
+        pAfCb->bsMetadata_type     = pAfWrt->bsMetadata_type;        /* non zero if metadata is attached. */
+               pAfCb->pafBsMetadataUpdate = pAfWrt->pafBsMetadataUpdate;    /* indicates whether bit-stream metadata update */
+        pAfCb->numPrivateMetadata  = pAfWrt->numPrivateMetadata;     /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
+        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);
         for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
@@ -456,6 +512,21 @@ Int cbWriteAf(
             }
         }
         
+        //Write metadata to circular buffer //QIN
+        for (i = 0; i < PAF_MAX_NUM_PRIVATE_MD; i++)
+        {
+            if (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); 
+                   }
+                   else 
+                   {
+                pAfCb->pafPrivateMetadata[i].offset = 0; 
+               pAfCb->pafPrivateMetadata[i].size   = 0; 
+                   }
+        }
         // update audio frame write index
         pCb->afWrtIdx++;
         if (pCb->afWrtIdx >= pCb->maxNumAfCb)
@@ -480,6 +551,12 @@ Int cbWriteAf(
                 Cache_wb(pAfCb->data.sample[i], pCb->decOpFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
             }
         }
+
+        for (i=0; i<PAF_MAX_NUM_PRIVATE_MD; i++) //QIN
+        {
+            Cache_wb(&pAfCb->pafPrivateMetadata[i], sizeof(PAF_PrivateMetadata), Cache_Type_ALLD, 0);
+            Cache_wb(pAfCb->pafPrivateMetadata[i].pMdBuf, PAF_MAX_PRIVATE_MD_SZ*sizeof(Int8), Cache_Type_ALLD, 0);
+        }
         Cache_wait();
     }  
     
index 0f0f8b90d128b7b0b144ceb49a1bb47c39b511ae..1c3350e6ca3fc454618fec3e6cd5002d5ef65796 100644 (file)
@@ -12,7 +12,7 @@
 
 #define PAF_DECOP_CB_MAX_NUM_AF             ( 4 )       // decoder output circular buffer maximum number audio frames
 #define PAF_DECOP_CB_MAX_NUM_PCM_CH         ( 16 )      // decoder output circular buffer maximum number audio PCM channels
-#define PAF_DECOP_CB_MAX_NUM_PCM_FRAMES     ( 3 )       // decoder output circular buffer maximum number PCM frames //Qin - Increased to prevent cb overflow for ddp.
+#define PAF_DECOP_CB_MAX_NUM_PCM_FRAMES     ( 2 )       // decoder output circular buffer maximum number PCM frames //Qin - Increased to prevent cb overflow for ddp.
 #define PAF_DECOP_CB_MAX_PCM_FRAME_LEN      ( 6*256 )   // decoder output circular buffer maximum PCM frame length
 #define PAF_DECOP_CB_PCM_BUF_SZ             ( PAF_DECOP_CB_MAX_NUM_PCM_CH * PAF_DECOP_CB_MAX_NUM_PCM_FRAMES * PAF_DECOP_CB_MAX_PCM_FRAME_LEN )
 
@@ -20,6 +20,7 @@
 typedef struct PAF_DecodeOpCircBuf {
         PAF_AudioFrame *afCb;   // audio frame CB
         PAF_AudioData *pcmBuf;  // PCM buffer, contains PCM data associated with audio frames
+        Int8          *metaBuf; // metafdata buffer, contains metadata associated with audio frames //QIN
         Int8 afRdIdx;           // audio frame CB read index
         Int8 afWrtIdx;          // audio frame CB write index
         Int16 pcmRdIdx;         // pcm buffer read index
index f7e9e9486aac33be93fa47da78ccf8be2df41709..6b61b589ca942382e06b66c6bf50501602f392bc 100644 (file)
@@ -46,7 +46,7 @@ xdc.global.SR0_cacheEnable = true;
 xdc.global.SrMsmcMem_cacheEnable = true;
 xdc.global.SrDDr3Mem_cacheEnable = true;
 xdc.global.procName = "CORE0";
-var ipc_cfg = xdc.loadCapsule("../../shared/ipc.cfg.xs");
+var ipc_cfg = xdc.loadCapsule("C:/ti/procsdk_audio_x_xx_xx_xx/shared/ipc.cfg.xs");
 
 /* select ipc libraries */
 var Build = xdc.useModule('ti.sdo.ipc.Build');
index 720ec88fdef2e383c22e7ba192a221fa6b0faa87..9b9214bdbc23f3ec37c68131e0ec66ef8530c30c 100644 (file)
@@ -1,4 +1,7 @@
 -i"C:\ti\procsdk_audio_x_xx_xx_xx\paf\pa\build\c66x\release"
+-i"C:\ti\procsdk_audio_x_xx_xx_xx\oar\CCS_OAR_lib\make"
+-i"C:\ti\procsdk_audio_x_xx_xx_xx\bmda\Source_Code\make\c66x\release"
+-i"C:\ti\procsdk_audio_x_xx_xx_xx\intrinsics\Dolby_Intrinsics_Imp\lib_elf_C66"
 
 -l"acp_elf.lib"
 -l"asp_std_elf.lib"
@@ -8,6 +11,9 @@
 -l"pce2_elf.lib"
 -l"pcm1_elf.lib"
 -l"dcs7_elf.lib"
+-l"dolby_oar_lib.lib"
+-l"bmda_elf.lib"
+-l"dlb_intrinsics_c66_float_release.lib"
 
 SECTIONS
 {
index a3055c06887f042ce4f7b7d178abce792250b6f6..72d95f7d795f7f04650c918bcb28f0778c1d90f7 100644 (file)
@@ -56,5 +56,6 @@
 //#include <thd_a.h>\r
 //#include <dm_a.h>\r
 //#include <pce_a.h>\r
-\r
+#include <oar_a.h>\r
+#include <bmda_a.h>\r
 #endif /* _I13_A_H_ */\r
index 1246413d3648879fe7dc78b39bf957860584f32e..bd82fa665ffa61a0c84b045e7a01d766ae5d5001 100644 (file)
@@ -56,7 +56,6 @@
     writeVOLOffsetMasterN(0x7fff), \
     writeSYSRecreationModeDirect, \
     writeSYSChannelConfigurationRequestSurround4_1, \
-    writeDDPJOCDecodeModeDisable, \
     execPAIOutAnalog, \
     execPAIInHDMIStereo
 #else
index c4e9b8c378cb15a19f1a84562502df3080cc0960..e91275a7c4a21f4ada96ad488a3630a9aebac084 100644 (file)
@@ -885,6 +885,12 @@ PAF_ASIT_initPhaseMalloc(
             }
             // allocate PCM sample buffer
             if (!(pC->xDec[z].decOpCb.pcmBuf = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, PAF_DECOP_CB_PCM_BUF_SZ * sizeof(PAF_AudioData), 4, &eb)))
+            {
+                TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
+                SW_BREAKPOINT;
+            }
+               // allocate Metadata buffers //QIN
+            if (!(pC->xDec[z].decOpCb.metaBuf = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, PAF_DECOP_CB_MAX_NUM_AF * PAF_MAX_PRIVATE_MD_SZ * PAF_MAX_NUM_PRIVATE_MD * sizeof(Int8), 4, &eb)))
             {
                 TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
                 SW_BREAKPOINT;
@@ -2338,6 +2344,7 @@ PAF_ASIT_decodeInit(
                 return errno;
 #endif
             
+            pC->xDec[z].decodeStatus.aspGearControl = 0;//QIN,  aspGearControl seems un-initialized
             gear = pC->xDec[z].decodeStatus.aspGearControl;
             pC->xDec[z].decodeStatus.aspGearStatus = gear < GEARS ? gear : 0;
             
index 39efe276f8161194e3da9a7a7ab3d7c94e1877c9..8f76d3b3192694b96ba994fed207babbab34f83d 100644 (file)
 #define SUC_TIH_ISUC SRC_TIH_ISRC
 #endif
 
+#define _OAR_
+#ifdef _OAR_
+#include <oar.h>
+#include <oar_tig.h>
+#endif
+
+#define _BMDA_
+#ifdef _BMDA_
+#include <bmda.h>
+#include <bmda_tig.h>
+#endif
 #if 0 // FL: slave
 const PAF_ASP_LinkInit decLinkInitI13[] =
 {
@@ -93,6 +104,12 @@ 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 _BMDA_
+       PAF_ASP_LINKINIT(STD, BMDA, TIG),
+#endif
        PAF_ASP_LINKNONE,
 };
 
@@ -103,6 +120,12 @@ const PAF_ASP_LinkInit aspLinkInitNilI13[] =
 
 const PAF_ASP_LinkInit aspLinkInitStdI13[] =
 {
+#ifdef _OAR_
+       PAF_ASP_LINKINIT(STD, OAR, TIG),
+#endif
+#ifdef _BMDA_
+       PAF_ASP_LINKINIT(STD, BMDA, TIG),
+#endif
     PAF_ASP_LINKNONE,
 };
 
index e17e04c6bb374b2590123328a8e791308b7ebf05..19281ab177f6a3dfba329e63dce034e2f05b7f05 100644 (file)
@@ -4,6 +4,7 @@ Update log:
     06-30-16: Add note concerning PAF Makefile ROOTDIR variable
     07-08-16: Add information on UART LLD build
     07-14-16: Add note concerning <root>
+    08-04-16: Add DDP(JOC), OAR and BMDA
     
 NOTE: Below mentioned <root> has only been verified for <root>=c:\ti.
       Using another <root> will require changes to makefiles (e.g. DDP, Intrinsics)
@@ -14,8 +15,8 @@ NOTE: Below mentioned <root> has only been verified for <root>=c:\ti.
         
         PAF: 
             Git repo: git@gitorious.design.ti.com:dolby-harmonious/os_paf_dev.git
-            Branch: dev_psdkaudio_frank
-            Commit: 30071e3
+            Branch: dev_psdkaudio_qin
+            Commit: 941aaf7
             
             Clone Git repo into <root>\procsdk_audio_x_xx_xx_xx\paf\.
             
@@ -28,11 +29,26 @@ NOTE: Below mentioned <root> has only been verified for <root>=c:\ti.
             
         DDP: 
             Git repo: git@gitorious.design.ti.com:dolby-harmonious/ddp.git
-            Branch: dev_psdkaudio_frank
-            Commit: f8f9271
+            Branch: pp_harmonious_dev
+            Commit: ab55d5b
             
             Clone Git repo into <root>\procsdk_audio_x_xx_xx_xx\ddp\.
 
+        OAR: 
+            Git repo: git@gitorious.design.ti.com:dolby-harmonious/oar.git
+            Branch: dev_psdkaudio_qin
+            Commit: bd93259
+            
+            Clone Git repo into <root>\procsdk_audio_x_xx_xx_xx\oar\.
+
+        BMDA: 
+            Git repo: git@gitorious.design.ti.com:dolby-harmonious/bmda.git
+            Branch: dev_psdkaudio_qin
+            Commit: 55fada2
+            
+            Clone Git repo into <root>\procsdk_audio_x_xx_xx_xx\bmda\.
+
+
     Build instructions:
         PAF:
             Rebuild paf libraries:
@@ -60,7 +76,22 @@ NOTE: Below mentioned <root> has only been verified for <root>=c:\ti.
                 4) From DOS prompt, execute:
                     > make
             
-        UART LLD:
+         OAR:
+            Rebuild OAR libraries:
+                1) Open DOS prompt
+                2) cd <root>\oar\CCS_OAR_lib\make
+                3) Execute:
+                    > make
+  
+        BMDA:
+            Rebuild BMDA libraries:
+                1) Open DOS prompt
+                2) cd <root>\bmda\Source_Code\make
+                3) Execute:
+                    > make
+                
+
+       UART LLD:
             1) Open DOS prompt
             2) cd <root>\pdk_k2g_1_0_1\packages
             3) Execute: