Fixed DTSX 192kHz problem.
authorSu <qsu@ti.com>
Fri, 20 Oct 2017 15:17:59 +0000 (11:17 -0400)
committerSu <qsu@ti.com>
Fri, 20 Oct 2017 15:17:59 +0000 (11:17 -0400)
3p-ip-dts
pasdk/test_arm/framework/aspDecOpCircBuf_slave.c
pasdk/test_dsp/framework/aspDecOpCircBuf_master.c

index f8969ee0e362028e4bdc8d61c357a19e27b46a1e..25bb4f8dd5de8fd32f375d68c0d132e3181ef4ed 160000 (submodule)
--- a/3p-ip-dts
+++ b/3p-ip-dts
@@ -1 +1 @@
-Subproject commit f8969ee0e362028e4bdc8d61c357a19e27b46a1e
+Subproject commit 25bb4f8dd5de8fd32f375d68c0d132e3181ef4ed
index 62cf64262af006bc19c9c50fa97d137b9eef1abb..30615c26104efaf6cb652be69be04a8bece6fa56 100644 (file)
@@ -237,7 +237,26 @@ Int cbInitDecWrite(
         pCb->pcmRdIdx = 0;
         pCb->maxAFChanNum = ASP_DECOP_CB_MAX_NUM_PCM_CH_DTS;
         pCb->maxAFSampCount = ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kDTS;
+        switch (pDecInitAf->sampleRate)
+        {
+            case PAF_SAMPLERATE_44100HZ:
+            case PAF_SAMPLERATE_48000HZ:
+                decOpFrameLen = 256;
+                break;
+            case PAF_SAMPLERATE_88200HZ:
+            case PAF_SAMPLERATE_96000HZ:
+                decOpFrameLen = (256*2);
+                break;
+            case PAF_SAMPLERATE_176400HZ:
+            case PAF_SAMPLERATE_192000HZ:
+                decOpFrameLen = (256*4);
+                break;
+            default:
+                decOpFrameLen = 256;
+                break;
+        }
 
+#if 0          
         // initialize audio frames
         for (n=0; n<pCb->maxNumAfCb; n++)
         {
@@ -259,6 +278,7 @@ Int cbInitDecWrite(
             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 */
         }
+#endif
     }
     else
     {
@@ -714,15 +734,27 @@ Int cbWriteAf(
         pAfCb->pafBsFixedData = pAfWrt->pafBsFixedData;                   /* if true, do not convert float to fixed in DTSX metadata transfer */
         pAfCb->root = pAfWrt->root;                                       /* used for channel MASK in DTSX . BAD IDEA, need fix */
         pAfCb->resetCount = pAfWrt->resetCount;                           /* used for communication between DTSX and PARMA */
+                       pAfCb->data.nChannels = pAfWrt->data.nChannels;                   /* number of channels used */
 #endif         
             // write PCM samples
+#ifdef DTS_BUILD
+                       //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+            for (i = 0; i < pAfWrt->data.nChannels; i++)
+                       { 
+                               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];
+                       }
+#else
             streamMask = pAfWrt->fxns->channelMask(pAfWrt, pAfCb->channelConfigurationStream);
             for (i = 0; i < pCb->maxAFChanNum; i++)
             {
-#ifndef DTS_BUILD
-            if ((streamMask >> i) & 0x1)
-#endif
-            { //DTSX needs up to 16 channels to transfer metadata.
+
+                if ((streamMask >> i) & 0x1)
+                { //DTSX needs up to 16 channels to transfer metadata.
                     for (j = 0; j < pAfWrt->sampleCount; j++)
                     {
                         pAfCb->data.sample[i][j] = pAfWrt->data.sample[i][j];
@@ -731,7 +763,7 @@ Int cbWriteAf(
                     pAfCb->data.samsiz[i] = pAfWrt->data.samsiz[i];
                 }
             }
-            
+#endif
             // Update PCM samples per channel
             pCb->numPcmSampsPerCh += pAfWrt->sampleCount;
             
@@ -846,15 +878,21 @@ Int cbWriteAf(
             Cache_wb(pAfCb->pafPrivateMetadata, pAfWrt->numPrivateMetadata*sizeof(PAF_PrivateMetadata *), Cache_Type_ALLD, 0);
             Cache_wait();
             // write back PCM data
+#ifdef DTS_BUILD
+                       //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+            for (i = 0; i < pAfWrt->data.nChannels; i++)
+                       { 
+                               Cache_wb(pAfCb->data.sample[i], pAfWrt->sampleCount * sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+            }
+#else
             for (i = 0; i < pCb->maxAFChanNum; i++)
             {
-#ifndef DTS_BUILD
-            if ((streamMask >> i) & 0x1)
-#endif
-            {//DTSX needs up to 16 channels to transfer metadata.
-                    Cache_wb(pAfCb->data.sample[i], pAfWrt->sampleCount * sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+                               if ((streamMask >> i) & 0x1)
+                               {
+                                       Cache_wb(pAfCb->data.sample[i], pAfWrt->sampleCount * sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
                 }
             }
+#endif
             Cache_wait();
 
 #if 0 // (***) FL: shows timing of CB write
index bdf202db544ffd4b7c96d7930d6b863641f87ace..086fd8dd318e60b07a85290a2299638a8f8f45e4 100644 (file)
@@ -888,17 +888,22 @@ Int cbReadAf(
         Cache_inv(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
         Cache_wait();
         
+#ifdef DTS_BUILD
+               //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+               for (i = 0; i < pAfCb->data.nChannels; i++)
+               { 
+           pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
+               }
+#else
         // Read CB AF samsiz array
         for (i = 0; i < pCb->maxAFChanNum; i++)
         {
-#ifndef DTS_BUILD
             if ((streamMask >> i) & 0x1)
-#endif
-                       {//DTSX needs up to 16 channels to transfer metadata.
+                       {
                 pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
             }
         }
-
+#endif
         // FL: brute force clear of Read AF PCM data
         // Reset Read AF PCM data
         //for (i = 0; i < pCb->maxAFChanNum; i++)
@@ -935,31 +940,45 @@ Int cbReadAf(
             Cache_wait();
 
             // Cache invalidate CB AF PCM samples
+#ifdef DTS_BUILD
+                       //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+                       for (i = 0; i < pAfCb->data.nChannels; i++)
+                       { 
+                               Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], numSampsRd*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+                       }
+#else
             for (i = 0; i < pCb->maxAFChanNum; i++)
             {
-#ifndef DTS_BUILD
                                if ((streamMask >> i) & 0x1)
-#endif
-                               {//DTSX needs up to 16 channels to transfer metadata.
+                               {
                     Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], numSampsRd*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
                 }
             }
+#endif
             Cache_wait();
 
             // Read PCM samples from CB AF
+#ifdef DTS_BUILD
+                       //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+                       for (i = 0; i < pAfCb->data.nChannels; i++)
+                       { 
+                               for (j = 0; j < numSampsRd; j++)
+                               {
+                                       pAfRd->data.sample[i][pcmWrtIdx+j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
+                               }
+                       }
+#else
             for (i = 0; i < pCb->maxAFChanNum; i++)
             {
-#ifndef DTS_BUILD
                                if ((streamMask >> i) & 0x1)
-#endif
-                               {//DTSX needs up to 16 channels to transfer metadata.
+                               {
                     for (j = 0; j < numSampsRd; j++)
                     {
                         pAfRd->data.sample[i][pcmWrtIdx+j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
                     }
                 }
             }
-
+#endif
             // Cache invalidate CB AF unused metadata
             for (i = pCb->prvMdRdIdx; i < pAfCb->numPrivateMetadata; i++)
             {
@@ -1043,16 +1062,21 @@ Int cbReadAf(
         if (totNumSampsRd < pCb->strFrameLen)
         {
             // Clear remaining Read AF PCM samples
+#ifdef DTS_BUILD
+                       //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+                       for (i = 0; i < pAfCb->data.nChannels; i++)
+                       { 
+                               memset(&pAfRd->data.sample[i][pcmWrtIdx], 0, (pCb->strFrameLen-totNumSampsRd));
+                       }
+#else
             for (i = 0; i < pCb->maxAFChanNum; i++)
             {
-#ifndef DTS_BUILD
                                if ((streamMask >> i) & 0x1)
-#endif
-                               {//DTSX needs up to 16 channels to transfer metadata.
+                               {
                     memset(&pAfRd->data.sample[i][pcmWrtIdx], 0, (pCb->strFrameLen-totNumSampsRd));
                 }
             }
-            
+#endif            
             if (pCb->writerActiveFlag == 1)
             {
                 //