Add Decoder Output Circular Buffer reset function
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_dsp / framework / aspDecOpCircBuf_master.c
index dbeb8100e18af5609d522761c86df08c0586156a..1e677e35b6875afb4c14869f852ad27cbbd80398 100644 (file)
@@ -49,12 +49,6 @@ All rights reserved.
 #define DEF_DEC_OP_FRAME_LEN    ( 256 )     // default decoder output frame length
 #define DEF_STR_FRAME_LEN       ( 256 )     // default stream frame length
 
-#define MAX_NUM_AF_PCM      ( 4 )
-#define CB_INIT_RD_LAG_PCM  ( 2 ) // 0...3
-
-#define MAX_NUM_AF_DDP      ( 2 )
-#define CB_INIT_RD_LAG_DDP  ( 4 ) // 0...5
-
 // Generate mute AF on circular buffer read
 static Void cbReadAfMute(
     PAF_AudioFrame *pAfRd,      // audio frame into which to read
@@ -114,8 +108,8 @@ Int cbInit(
     pCb->strFrameLen = DEF_STR_FRAME_LEN;
     
     // initialize circular buffer maximum number of audio frames
-    pCb->maxNumAfCb = MAX_NUM_AF_PCM;
-    pCb->afWrtIdx = CB_INIT_RD_LAG_PCM;
+    pCb->maxNumAfCb = 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
     
@@ -245,16 +239,17 @@ Int cbInitSourceSel(
     // initialize circular buffer maximum number of audio frames
     if (sourceSelect == PAF_SOURCE_PCM)
     {
-        pCb->maxNumAfCb = MAX_NUM_AF_PCM;
-        pCb->afWrtIdx = CB_INIT_RD_LAG_PCM;
-        pCb->afRdIdx = 0;
-        pCb->pcmRdIdx = 0; // 2*256 in behind
+        pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_PCM;
+        // 2*256 in behind
+        pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_PCM;
+        pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_PCM;
+        pCb->pcmRdIdx = 0;
         
         // initialize audio frames
         for (n=0; n<pCb->maxNumAfCb; n++)
         {
             pAfCb = &pCb->afCb[n];
-            pAfCb->sampleDecode = PAF_SOURCE_PCM;
+            pAfCb->sampleDecode = sourceSelect;
             PAF_PROCESS_ZERO(pAfCb->sampleProcess);
             pAfCb->sampleRate = PAF_SAMPLERATE_48000HZ;
             pAfCb->sampleCount = decOpFrameLen;
@@ -268,16 +263,17 @@ Int cbInitSourceSel(
     }
     else if (sourceSelect == PAF_SOURCE_DDP)
     {
-        pCb->maxNumAfCb = MAX_NUM_AF_DDP;
-        pCb->afWrtIdx = 1;
-        pCb->afRdIdx = 0;
-        pCb->pcmRdIdx = decOpFrameLen - CB_INIT_RD_LAG_DDP*strFrameLen; // 4*256 behind
+        pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_DDP;
+        // 4*256 in behind
+        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
         
         // initialize audio frames
         for (n=0; n<pCb->maxNumAfCb; n++)
         {
             pAfCb = &pCb->afCb[n];
-            pAfCb->sampleDecode = PAF_SOURCE_DDP;
+            pAfCb->sampleDecode = sourceSelect;
             PAF_PROCESS_ZERO(pAfCb->sampleProcess);
             pAfCb->sampleRate = PAF_SAMPLERATE_48000HZ;
             pAfCb->sampleCount = decOpFrameLen;