summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 05c9e71)
raw | patch | inline | side by side (parent: 05c9e71)
author | Chitresh Gupta <chitresh.g@pathpartnertech.com> | |
Sat, 27 May 2017 13:47:29 +0000 (19:17 +0530) | ||
committer | Chitresh Gupta <chitresh.g@pathpartnertech.com> | |
Sat, 27 May 2017 13:47:29 +0000 (19:17 +0530) |
This implementation also helps to
synchronize CB read and write operation.
synchronize CB read and write operation.
index f2c4a4c96ff34bbf296a9db952d075807790835c..e824a0af33c838db8e27b9019ee8bf27f4ce0bbc 100644 (file)
#define ASP_DECOP_CB_SOK ( 0 ) // ok
#define ASP_DECOP_CB_CTL_INIT_INV_GATE ( ASP_DECOP_CB_SOK-1 ) // error: invalid gate handle
#define ASP_DECOP_CB_ERR_START ( ASP_DECOP_CB_CTL_INIT_INV_GATE )
-#define ASP_DECOP_CB_MAX_NUM_AF ( 10 ) // decoder output circular buffer maximum number audio frames
+#define ASP_DECOP_CB_MAX_NUM_AF ( 15 ) // decoder output circular buffer maximum number audio frames
#define ASP_DECOP_CB_MAX_NUM_PCM_CH ( 16 ) // decoder output circular buffer maximum number audio PCM channels
-#define ASP_DECOP_CB_MAX_NUM_PCM_FRAMES ( 10 ) // decoder output circular buffer maximum number PCM frames //Qin - Increased to prevent cb overflow for ddp.
+#define ASP_DECOP_CB_MAX_NUM_PCM_FRAMES ( 15 ) // decoder output circular buffer maximum number PCM frames //Qin - Increased to prevent cb overflow for ddp.
#define ASP_DECOP_CB_MAX_PCM_FRAME_LEN ( 6*256 ) // decoder output circular buffer maximum PCM frame length
#define ASP_DECOP_CB_MAX_NUM_PCM_CH_DDP ( 16 ) // decoder output circular buffer maximum number audio PCM channels for DDP
#define ASP_DECOP_CB_MAX_NUM_AF_PCM ( 4 )
#define ASP_DECOP_CB_INIT_LAG_PCM ( 2 ) // 1...3
-#define ASP_DECOP_CB_INIT_WRTIDX_PCM ( ASP_DECOP_CB_INIT_LAG_PCM )
+#define ASP_DECOP_CB_INIT_WRTIDX_PCM ( 0 )
#define ASP_DECOP_CB_INIT_RDIDX_PCM ( 0 )
#define ASP_DECOP_CB_MAX_NUM_AF_DDP ( 2 )
-#define ASP_DECOP_CB_INIT_LAG_DDP ( 4 ) // 0...5
-#define ASP_DECOP_CB_INIT_WRTIDX_DDP ( 1 )
+#define ASP_DECOP_CB_INIT_LAG_DDP ( 1 ) // 0...5
+#define ASP_DECOP_CB_INIT_WRTIDX_DDP ( 0 )
#define ASP_DECOP_CB_INIT_RDIDX_DDP ( 0 )
-#define ASP_DECOP_CB_MAX_NUM_AF_THD ( 10 )
-#define ASP_DECOP_CB_INIT_LAG_THD ( 3 ) // ( 6 )
-#define ASP_DECOP_CB_INIT_WRTIDX_THD ( 1 ) // ( ASP_DECOP_CB_INIT_LAG_THD )
+#define ASP_DECOP_CB_MAX_NUM_AF_THD ( 15 )
+#define ASP_DECOP_CB_INIT_LAG_THD ( 5 ) // 5*20ms = 80 ms, For the worst case of 100 ms
+#define ASP_DECOP_CB_INIT_WRTIDX_THD ( 0 ) //ASP_DECOP_CB_INIT_LAG_THD )
#define ASP_DECOP_CB_INIT_RDIDX_THD ( 0 )
#define ASP_DECODE_CB_GATE_NAME ( "AspDecOpCbGate" )
#define ASP_DECODE_CB_GATE_REGION_ID ( 0 )
Int8 sourceSel; // selected source
Int8 afRdIdx; // audio frame CB read index
Int8 afWrtIdx; // audio frame CB write index
+ Int8 afLagIdx; // audio frame CB Lag idx,
+ Int8 afInitialLag; // Initial delay/lag between CB write and read
Int16 pcmRdIdx; // pcm buffer read index
Int8 numAfCb; // current number frames in CB
Int8 maxNumAfCb; // maximum number of audio frames in CB
diff --git a/pasdk/test_arm/framework/aspDecOpCircBuf_slave.c b/pasdk/test_arm/framework/aspDecOpCircBuf_slave.c
index a5de2f00e80e75e6b16b24c0e9a23ffce3143dcf..50b2d861d04d4aecaf53d169985e421bea9728f3 100644 (file)
// update flags
pCb->writerActiveFlag = 1;
pCb->emptyFlag = 0;
+ pCb->afLagIdx = 0;
// (***) FL: revisit
// Write back circular buffer configuration
Cache_wait();
// update number of audio frames in circular buffer
pCb->numAfCb++;
+ // Update CB Lag index
+ if (pCb->afLagIdx < pCb->afInitialLag)
+ {
+ pCb->afLagIdx += 1;
+ }
+
// (***) FL: revisit
// Write back circular buffer configuration
diff --git a/pasdk/test_arm/framework/audioStreamDecodeProc.c b/pasdk/test_arm/framework/audioStreamDecodeProc.c
index 4ed99b029145bc35535c6da2b4f23003116b37e9..cfe72fdedf1921645e40666ba814b6ce99317ed1 100644 (file)
UInt32 gSlaveDecDeactivateCnt =0;
+//#define CAPTURE_DECODER_OUTSAMPLES_PP
+#ifdef CAPTURE_DECODER_OUTSAMPLES_PP
+
+#define CAP_FRAME_SAMPLES 2000
+Uint32 sampCountCapFrame = 0;
+int tempCap_decSampleOut[CAP_FRAME_SAMPLES] = {0.0};
+#endif
+
/*
* ======== taskAsdpFxn ========
* Audio Stream Decode Processing task function
// Log_info0("capAfWrite() error");
//}
+ #ifdef CAPTURE_DECODER_OUTSAMPLES_PP
+
+ if (sampCountCapFrame < CAP_FRAME_SAMPLES)
+ {
+ tempCap_decSampleOut[sampCountCapFrame] = pAfWrt->sampleCount;
+ sampCountCapFrame++;
+ }
+ #endif
+
GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_107);
cbErrno = cbWriteAf(pCbCtl, z, pAfWrt);
if ((cbErrno < 0) && (cbErrno != ASP_DECOP_CB_WRITE_OVERFLOW))
diff --git a/pasdk/test_dsp/framework/aspDecOpCircBuf_master.c b/pasdk/test_dsp/framework/aspDecOpCircBuf_master.c
index 47bd334850dae532cc4635188544f473cbadec6b..bc546a9b957f1291a5ad36a79e37cc3794a0d386 100644 (file)
// set output frame length
pCb->strFrameLen = strFrameLen;
+
+ pCb->afInitialLag = 0; // default No lag
+ pCb->afLagIdx = 0;
+
// initialize circular buffer maximum number of audio frames
if (sourceSelect == PAF_SOURCE_PCM)
{
pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_PCM;
// 2*256 in behind
+ pCb->afInitialLag = ASP_DECOP_CB_INIT_LAG_PCM;
pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_PCM;
pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_PCM;
pCb->pcmRdIdx = 0;
// 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
+ pCb->afInitialLag = ASP_DECOP_CB_INIT_LAG_DDP;
+ pCb->pcmRdIdx = 0; //decOpFrameLen - ASP_DECOP_CB_INIT_LAG_DDP*strFrameLen; // 4*256 behind
pCb->maxAFChanNum = ASP_DECOP_CB_MAX_NUM_PCM_CH_DDP;
pCb->maxAFSampCount = ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kDDP;
else if (sourceSelect == PAF_SOURCE_THD)
{
pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_THD;
- // 0 in behind
+ pCb->afInitialLag = ASP_DECOP_CB_INIT_LAG_THD;
pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_THD;
pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_THD;
pCb->pcmRdIdx = 0;
return ASP_DECOP_CB_READ_INVSTATE;
}
- if ((pCb->writerActiveFlag == 0) && (pCb->emptyFlag == 0))
+ if (((pCb->writerActiveFlag == 0) && (pCb->emptyFlag == 0)) || (pCb->afLagIdx < pCb->afInitialLag))
{
//
// No active writer, not draining circular buffer.