Replaced "DTS_BUILD" compiler flag with "bsMetadata_type" check. This fixed the ...
authorSu <qsu@ti.com>
Wed, 8 Nov 2017 21:43:00 +0000 (16:43 -0500)
committerSu <qsu@ti.com>
Wed, 8 Nov 2017 21:43:00 +0000 (16:43 -0500)
pasdk/test_arm/framework/aspDecOpCircBuf_slave.c
pasdk/test_dsp/framework/aspDecOpCircBuf_master.c

index 30615c26104efaf6cb652be69be04a8bece6fa56..3f0b688248644b2e81c1f8a7a49bff043bf1ef1c 100644 (file)
@@ -728,42 +728,44 @@ Int cbWriteAf(
             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 */
             
-#ifdef DTS_BUILD
-        pAfCb->mode = pAfWrt->mode;                                       /* mode is used in DTSX to pass info to PARMA */
-        pAfCb->numChansUsedForMetadata = pAfWrt->numChansUsedForMetadata; /* if metadata is used in DTSX*/
-        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->mode = pAfWrt->mode;                                       /* mode is used in DTSX to pass info to PARMA */
+                       pAfCb->numChansUsedForMetadata = pAfWrt->numChansUsedForMetadata; /* if metadata is used in DTSX*/
+                       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];
+                       if (pAfCb->bsMetadata_type == PAF_bsMetadata_DTS_X)
+                       {
+                               //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++)
-            {
+                       else
+                       {
+                               streamMask = pAfWrt->fxns->channelMask(pAfWrt, pAfCb->channelConfigurationStream);
+                               for (i = 0; i < pCb->maxAFChanNum; i++)
+                               {
 
-                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];
-                    }
+                                       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];
+                                               }
 
-                    pAfCb->data.samsiz[i] = pAfWrt->data.samsiz[i];
-                }
-            }
-#endif
+                                               pAfCb->data.samsiz[i] = pAfWrt->data.samsiz[i];
+                                       }
+                               }
+                       }
             // Update PCM samples per channel
             pCb->numPcmSampsPerCh += pAfWrt->sampleCount;
             
@@ -878,21 +880,24 @@ 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++)
-            {
-                               if ((streamMask >> i) & 0x1)
-                               {
+                       if (pAfCb->bsMetadata_type == PAF_bsMetadata_DTS_X)
+                       {       
+                               //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);
-                }
-            }
-#endif
+                               }
+                       }
+                       else 
+                       {
+                               for (i = 0; i < pCb->maxAFChanNum; i++)
+                               {
+                                       if ((streamMask >> i) & 0x1)
+                                       {
+                                               Cache_wb(pAfCb->data.sample[i], pAfWrt->sampleCount * sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+                                       }
+                               }
+                       }
             Cache_wait();
 
 #if 0 // (***) FL: shows timing of CB write
index 086fd8dd318e60b07a85290a2299638a8f8f45e4..9d04a7c4ffa17fb17a84db056524393236c583d0 100644 (file)
@@ -780,7 +780,6 @@ Int cbReadAf(
             // Increment underflow count
             //
             pCb->errAfUndCnt++;
-
             // Mute output on underflow
             //cbReadAfMute(pAfRd, pCb->strFrameLen);
             cbReadMuteWithLastAfInfo(pCb, pAfRd);
@@ -870,15 +869,13 @@ Int cbReadAf(
         pAfRd->bsMetadata_type     = pAfCb->bsMetadata_type;        /* non zero if private metadata is attached. */
         pAfRd->pafBsMetadataUpdate = pAfCb->pafBsMetadataUpdate;    /* indicates whether bit-stream metadata update */
         pAfRd->bsMetadata_offset   = pAfCb->bsMetadata_offset;      /* offset into audio frame for change in bsMetadata_type field */
-        
-#ifdef DTS_BUILD
+        //Following parameters are used in DTSX
         pAfRd->mode = pAfCb->mode;                                       /* mode is used in DTSX to pass info to PARMA */
         pAfRd->numChansUsedForMetadata = pAfCb->numChansUsedForMetadata; /* if metadata is used in DTSX */
         pAfRd->pafBsFixedData = pAfCb->pafBsFixedData;                   /* if true, do not convert float to fixed in DTSX metadata transfer */
         pAfRd->root = pAfCb->root;                                       /* used for channel MASK in DTSX. BAD IDEA, need fix */
         pAfRd->resetCount = pAfCb->resetCount;                           /* used for communication between DTSX and PARMA */
 
-#endif         
         // Compute stream mask for current CB AF.
         // Mask indicates which channels are present in AF.
         // Mask needed for cache invalidate and read of PCM samples in AF.
@@ -888,22 +885,25 @@ 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];
+               if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
+               {
+                       //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++)
-        {
-            if ((streamMask >> i) & 0x1)
+               else
+               {
+                       // Read CB AF samsiz array
+                       for (i = 0; i < pCb->maxAFChanNum; i++)
                        {
-                pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
-            }
-        }
-#endif
+                               if ((streamMask >> i) & 0x1)
+                               {
+                                       pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
+                               }
+                       }
+               }
         // FL: brute force clear of Read AF PCM data
         // Reset Read AF PCM data
         //for (i = 0; i < pCb->maxAFChanNum; i++)
@@ -940,45 +940,51 @@ 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);
+                       if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
+                       {
+                               //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++)
-            {
-                               if ((streamMask >> i) & 0x1)
+                       else
+                       {
+                               for (i = 0; i < pCb->maxAFChanNum; i++)
                                {
-                    Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], numSampsRd*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
-                }
-            }
-#endif
+                                       if ((streamMask >> i) & 0x1)
+                                       {
+                                               Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], numSampsRd*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+                                       }
+                               }
+                       }
             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];
+                       if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
+                       {
+                               //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++)
-            {
-                               if ((streamMask >> i) & 0x1)
+                       else
+                       {
+                               for (i = 0; i < pCb->maxAFChanNum; i++)
                                {
-                    for (j = 0; j < numSampsRd; j++)
-                    {
-                        pAfRd->data.sample[i][pcmWrtIdx+j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
-                    }
-                }
-            }
-#endif
+                                       if ((streamMask >> i) & 0x1)
+                                       {
+                                               for (j = 0; j < numSampsRd; j++)
+                                               {
+                                                       pAfRd->data.sample[i][pcmWrtIdx+j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
+                                               }
+                                       }
+                               }
+                       }
             // Cache invalidate CB AF unused metadata
             for (i = pCb->prvMdRdIdx; i < pAfCb->numPrivateMetadata; i++)
             {
@@ -1062,21 +1068,23 @@ 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));
+                       if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
+                       {
+                               //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++)
-            {
-                               if ((streamMask >> i) & 0x1)
+                       else{
+                               for (i = 0; i < pCb->maxAFChanNum; i++)
                                {
-                    memset(&pAfRd->data.sample[i][pcmWrtIdx], 0, (pCb->strFrameLen-totNumSampsRd));
-                }
-            }
-#endif            
+                                       if ((streamMask >> i) & 0x1)
+                                       {
+                                               memset(&pAfRd->data.sample[i][pcmWrtIdx], 0, (pCb->strFrameLen-totNumSampsRd));
+                                       }
+                               }
+                       }        
             if (pCb->writerActiveFlag == 1)
             {
                 //
@@ -1215,10 +1223,8 @@ static Void cbReadAfMute(
     // Clear PCM data
     for (i = 0; i < ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
     {
-#ifndef DTS_BUILD
         if ((streamMask >> i) & 0x1)
-#endif
-               {//DTSX needs up to 16 channels to transfer metadata.
+               {
             memset(pAfRd->data.sample[i], 0, strFrameLen*sizeof(PAF_AudioData));
         }
         pAfRd->data.samsiz[i] = 0;
@@ -1298,10 +1304,8 @@ static Void cbReadMuteWithLastAfInfo(
     // Clear PCM data
     for (i = 0; i < ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
     {
-#ifndef DTS_BUILD
         if ((streamMask >> i) & 0x1)
-#endif
-               {//DTSX needs up to 16 channels to transfer metadata.
+               {
             memset(pAfRd->data.sample[i], 0, pAfRd->sampleCount*sizeof(PAF_AudioData));
         }
         pAfRd->data.samsiz[i] = 0;
@@ -1310,13 +1314,12 @@ static Void cbReadMuteWithLastAfInfo(
     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 */
-#ifdef DTS_BUILD
+    //Following parameters are used in DTSX
        pAfRd->mode = 0;                                            /* mode used by PARMA */
        pAfRd->numChansUsedForMetadata = 15;                        /* constant of 15 */
        pAfRd->pafBsFixedData = TRUE;                               /* if true, do not convert float to fixed in DTSX metadata transfer */
        pAfRd->root = 0x1BF;                                        /* used for channel MASK in DTSX. 0x1BF = 7.1 as defined in dtshd_dec_api_common.h */
     pAfRd->resetCount = 0;                                      /* used for communication between DTSX and PARMA */
-#endif         
 }
 
 // Check circular buffer drain state