summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 99561dd)
raw | patch | inline | side by side (parent: 99561dd)
author | Frank Livingston <frank-livingston@ti.com> | |
Fri, 2 Sep 2016 23:05:08 +0000 (18:05 -0500) | ||
committer | Frank Livingston <frank-livingston@ti.com> | |
Fri, 2 Sep 2016 23:05:08 +0000 (18:05 -0500) |
processor_audio_sdk_1_00_00_00/pasdk/common/paf_decOpCircBuf.c | patch | blob | history |
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/common/paf_decOpCircBuf.c b/processor_audio_sdk_1_00_00_00/pasdk/common/paf_decOpCircBuf.c
index dfa8f809c4c95f34207d91f6a3d79fe618c1ed1e..565bea45b973000df3fbc878dc2fe5e30b38ee35 100644 (file)
#include "pafsp.h"
#include "paf_decOpCircBuf.h"
+// Generate mute AF on circular buffer read
+static Void cbReadAfMute(
+ PAF_AudioFrame *pAfRd, // audio frame into which to read
+ Int16 strFrameLen // stream frame length (output transaction size)
+);
+
#define MAX_NUM_AF_PCM ( 4 )
-#define MAX_NUM_AF_DDP ( 2 )
+#define CB_INIT_RD_LAG_PCM ( 2 ) // 0...3
-#define CB_INIT_RD_LAG ( 4 )
+#define MAX_NUM_AF_DDP ( 2 )
+#define CB_INIT_RD_LAG_DDP ( 4 ) // 0...5
// Initialize circular buffer
Int cbInit(
if (sourceSelect == PAF_SOURCE_PCM)
{
pCb->maxNumAfCb = MAX_NUM_AF_PCM;
- pCb->afWrtIdx = CB_INIT_RD_LAG;
+ pCb->afWrtIdx = CB_INIT_RD_LAG_PCM;
pCb->afRdIdx = 0;
pCb->pcmRdIdx = 0; // 2*256 in behind
else if (sourceSelect == PAF_SOURCE_DDP)
{
pCb->maxNumAfCb = MAX_NUM_AF_DDP;
- pCb->afRdIdx = 0;
- pCb->pcmRdIdx = decOpFrameLen - CB_INIT_RD_LAG*strFrameLen;
pCb->afWrtIdx = 1;
+ pCb->afRdIdx = 0;
+ pCb->pcmRdIdx = decOpFrameLen - CB_INIT_RD_LAG_DDP*strFrameLen; // 4*256 behind
// initialize audio frames
for (n=0; n<pCb->maxNumAfCb; n++)
// No active writer, not draining circular buffer.
// Skip UNDerflow check, mute output.
//
- pAfRd->sampleDecode = PAF_SOURCE_PCM;
- PAF_PROCESS_ZERO(pAfRd->sampleProcess);
- pAfRd->sampleRate = PAF_SAMPLERATE_48000HZ;
- pAfRd->sampleCount = pCb->strFrameLen;
- pAfRd->channelConfigurationRequest.full = 0;
- pAfRd->channelConfigurationRequest.part.sat = PAF_CC_SAT_SURROUND4;
- pAfRd->channelConfigurationRequest.part.sub = PAF_CC_SUB_ONE;
- pAfRd->channelConfigurationStream.full = 0;
- pAfRd->channelConfigurationStream.part.sat = PAF_CC_SAT_SURROUND4;
- pAfRd->channelConfigurationStream.part.sub = PAF_CC_SUB_ONE;
-
- // compute stream mask
- streamMask = pAfRd->fxns->channelMask(pAfRd, pAfRd->channelConfigurationStream);
- // Clear PCM data
- for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
- {
- if ((streamMask >> i) & 0x1)
- {
- memset(pAfRd->data.sample[i], pCb->strFrameLen, 0);
- }
- pAfRd->data.samsiz[i] = 0;
- }
+ cbReadAfMute(pAfRd, pCb->strFrameLen);
return PAF_DECOP_CB_SOK;
}
// check underflow
if (pCb->numAfCb <= 0)
{
+ //
+ // Increment underflow count.
+ // Mute output on underflow.
+ //
pCb->errUndCnt++;
+ cbReadAfMute(pAfRd, pCb->strFrameLen);
//SW_BREAKPOINT; // FL: debug
+
+ // Write back circular buffer configuration.
+ Cache_wb(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
+
return PAF_DECOP_CB_READ_UNDERFLOW;
}
}
return 0;
}
+
+// Generate mute AF on circular buffer read
+static Void cbReadAfMute(
+ PAF_AudioFrame *pAfRd, // audio frame into which to read
+ Int16 strFrameLen // stream frame length (output transaction size)
+)
+{
+ PAF_ChannelMask_HD streamMask;
+ Int8 i;
+
+ pAfRd->sampleDecode = PAF_SOURCE_PCM;
+ PAF_PROCESS_ZERO(pAfRd->sampleProcess);
+ pAfRd->sampleRate = PAF_SAMPLERATE_48000HZ;
+ pAfRd->sampleCount = strFrameLen;
+ pAfRd->channelConfigurationRequest.full = 0;
+ pAfRd->channelConfigurationRequest.part.sat = PAF_CC_SAT_SURROUND4;
+ pAfRd->channelConfigurationRequest.part.sub = PAF_CC_SUB_ONE;
+ pAfRd->channelConfigurationStream.full = 0;
+ pAfRd->channelConfigurationStream.part.sat = PAF_CC_SAT_SURROUND4;
+ pAfRd->channelConfigurationStream.part.sub = PAF_CC_SUB_ONE;
+
+ // compute stream mask
+ streamMask = pAfRd->fxns->channelMask(pAfRd, pAfRd->channelConfigurationStream);
+ // Clear PCM data
+ for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
+ {
+ if ((streamMask >> i) & 0x1)
+ {
+ memset(pAfRd->data.sample[i], strFrameLen, 0);
+ }
+ pAfRd->data.samsiz[i] = 0;
+ }
+}
\ No newline at end of file