]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/commitdiff
PASDK-443:Add PP updates for CB nominal delay
authorFrank Livingston <frank-livingston@ti.com>
Wed, 8 Nov 2017 19:59:33 +0000 (13:59 -0600)
committerFrank Livingston <frank-livingston@ti.com>
Wed, 8 Nov 2017 19:59:33 +0000 (13:59 -0600)
Move CB nominal delay hold off to ARM.
This ensures hold off for ND is correct for THD input
frames of variable  size.

pasdk/test_arm/framework/aspDecOpCircBuf_slave.c
pasdk/test_dsp/framework/aspDecOpCircBuf_master.c

index 413894df47d99bb7b562876ec9dc87f401573a67..2281dd25765b175fd71d70960299b5a515dc2566 100644 (file)
@@ -819,22 +819,15 @@ Int cbWriteAf(
             //    pCb->afLagIdx += 1;
             //}
             
-            // Update CB primed flag
-            // calculate number of delta samples before allowing CB read
+            // Update CB primed flag.
+            // Calculate number of delta samples before allowing CB read.
             if (pCb->primedFlag == 0)
             {
                 pCb->primedFlag = 1;
                 
-                // Calculate number of output frames to block reader.
-                // This is sample count reader waits before allowed to actually read samples from the CB.
-                //pCb->deltaSamps = (pCb->targetNDSamps - pAfWrt->sampleCount + (pCb->strFrameLen-1)) / pCb->strFrameLen * pCb->strFrameLen;
-                
-                // FL: CB read decrements by strFrameLen and tests for >0, so rounding to strFrameLen is unnecessary
-                //pCb->deltaSamps = pCb->targetNDSamps - pAfWrt->sampleCount;
-                
-                // FL: THD has variable number of AUs per frame. 
-                //     Some frames can be quite large (e.g. 96 AUs), and delta samples calculation small or even negative.
-                //     In this case, there won't be any reader hold off, and no nominal delay in the CB.
+                // THD has variable number of AUs per frame. 
+                // Some frames can be quite large (e.g. 96 AUs), and delta samples calculation small or even negative.
+                // In this case, there won't be any reader hold off, and no nominal delay in the CB.
                 pCb->deltaSamps = pCb->targetNDSamps;
                 
                 // debug
@@ -844,6 +837,12 @@ Int cbWriteAf(
                 //    gPrimedFlagCnt++;
             }
 
+            // Update delta samples using number of write audio frame samples.
+            if (pCb->deltaSamps > 0)
+            {
+               pCb->deltaSamps = pCb->deltaSamps - pAfWrt->sampleCount;
+            }
+            
             // Write back circular buffer configuration
             Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
             // write back audio frame
index bdf202db544ffd4b7c96d7930d6b863641f87ace..d63fe0e3f8401ae29518ace9524eedcab79cf3ba 100644 (file)
@@ -739,26 +739,15 @@ Int cbReadAf(
     //
     // Hold off read of PCM samples from CB until Nominal Delay satisfied
     //
-    //if ((pCb->primedFlag == 0) || ((pCb->primedFlag==1) && (pCb->deltaSamps > 0))
     if ((pCb->primedFlag == 0) || (pCb->deltaSamps > 0))
     {
         pCb->readAfNdCnt++;
         
-        if (pCb->primedFlag == 1)
-        {
-            pCb->deltaSamps = pCb->deltaSamps - pCb->strFrameLen;
-            
-            // debug
-            //gDeltaSampsBuf[gDeltaSampsBufIdx] = pCb->deltaSamps;
-            //if (gDeltaSampsBufIdx < 20)
-            //    gDeltaSampsBufIdx++;
-        }
-        
         cbReadMuteWithLastAfInfo(pCb, pAfRd);
         
         // Write back circular buffer configuration.
         Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
-        Cache_wait();    
+        Cache_wait();
         
         // Leave the gate
         GateMP_leave(gateHandle, key);
@@ -1131,9 +1120,9 @@ Int cbReadAf(
                 pCb->cb_samples_op[pCb->cb_opCnt] = pAfRd->sampleCount;
                 pCb->cb_op_owner[pCb->cb_opCnt] = CB_OP_R;
                 // log idxs
-                pCb->cb_afRdIdx[pCb->cb_opCnt] = pCb->afRdIdx;
+                pCb->cb_afRdIdx[pCb->cb_opCnt] = (pCb->pcmRdIdx == 0) ? (pCb->afRdIdx-1) : (pCb->afRdIdx);
                 pCb->cb_afWrtIdx[pCb->cb_opCnt] = pCb->afWrtIdx;
-                pCb->cb_numAfCb[pCb->cb_opCnt] = pCb->numAfCb; // numAfCb might not be pointing to this instance
+                pCb->cb_numAfCb[pCb->cb_opCnt] = (pCb->pcmRdIdx == 0) ? (pCb->numAfCb+1) : (pCb->numAfCb); // numAfCb might not be pointing to this instance
                 pCb->cb_opCnt++;
             }
         }