diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.c b/pasdk/test_dsp/framework/audioStreamInpProc.c
index a15feb73041832158099bf58b4169bbef0e49105..e39d3b90ff2755366a8c8e46c6e3625e5d5e1886 100644 (file)
#include "aspMsg_common.h"
#include "aspMsg_master.h"
#include "aspDecOpCircBuf_master.h"
+#include "aspOutInitSync_master.h"
#include "audioStreamProc_common.h"
#include "audioStreamProc_master.h"
#include "audioStreamInpProc.h"
#define TR_MOD trace
// Allow a developer to selectively enable tracing.
-#define CURRENT_TRACE_MASK 0x21
+#define CURRENT_TRACE_MASK 0x27
#define TRACE_MASK_TERSE 0x01 // only flag errors and show init
#define TRACE_MASK_GENERAL 0x02 // half dozen lines per frame
#define __TASK_NAME__ "TaskAsip"
+
+//
+// Audio Stream Input Task definitions
+//
+
+#define ASIP_FRAMELEN_SS_DEFAULT ( 256 )
+// FL: pP->frameLength
+//#define ASIP_FRAMELEN_SS_PCM ( FRAMELENGTH )
+// FL: (***) hard-coded
+#define ASIP_FRAMELEN_SS_DDP_AC3 ( 1536 )
+// FL: (***) hard-coded
+#define ASIP_FRAMELEN_SS_THD ( 1536 )
+
+#define ASIP_FRAMELEN_SS_DTS ( 512 )
+
+// Compute decoder frame length based on selected source
+static Int getFrameLengthSourceSel(
+ const PAF_ASIT_Params *pP,
+ Int8 sourceSelect
+);
+
LINNO_DEFN(TaskAsip); /* Line number macros */
ERRNO_DEFN(TaskAsip); /* Error number macros */
};
// Global debug counters */
-UInt32 gTaskAsipCnt =0;
+UInt32 gAsipRxSioReclaimCnt =0;
UInt32 gAsipInitCnt =0;
UInt32 gAsipInfo1Cnt =0;
UInt32 gAsipInfo2Cnt =0;
UInt32 gAsipInfo1_ErrCnt =0;
UInt32 gAsipInfo2_PrimaryErrCnt =0;
UInt32 gAsipInfo2_ErrCnt =0;
+// debug
UInt32 gCapIbReset_cnt =0;
UInt32 gCapIb_cnt =0;
-// debug
UInt32 gCbWrtAfErrCnt =0; // decoder output circular buffer write error count (returned from ARM to DSP)
+// For writeDECCommandRestart
+volatile UInt32 gCommandOutputTask_SYNC =0;
+volatile UInt32 gCommandOutputTask_ACK =0;
#include "dbgDib.h" // debug
Int errno; /* error number */
Int zMD, zMI, zMS, zX;
Int loopCount = 0; // used to stop trace to see startup behavior.
- UInt32 curTime;
Int size;
// Messaging
ASP_Msg *pAspMsg;
// - AlgKey: Dec/Enc chain to Array Initialization
// - Device: I/O Device Initialization
// - DecOpCircBuf: Decoder Output Circular Buffer
- // - Unused: (available)
+ // - OutIS: Output Init-Sync
//
LINNO_RPRT(TaskAsip, -2);
for (i=0; i < lengthof(pP->fxns->initPhase); i++)
Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+ Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+ Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+ Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
Cache_wait();
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]) Log_info0("ERROR: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]) Log_info0("WARNING: beta unit for Dec==NULL");
// (***) FL: revisit
// invalidate Status structures for Beta Units initialized on Slave
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), size, Cache_Type_ALLD, 0);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), size, Cache_Type_ALLD, 0);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), size, Cache_Type_ALLD, 0);
- Cache_wait();
+ //
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
#ifdef NON_CACHE_STATUS
// Get the shared status structure GateMP handles. Initialized at slave.
{
Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_THD);
}
+ if (statusOp_Init(GATEMP_INDEX_DTS) == STATUSOP_INIT_FAIL)
+ {
+ Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_DTS);
+ }
#endif
-
// (***) FL: revisit
// invalidate Dec configuration
Cache_inv(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
// any error forces idling of input
if (errno)
{
+ // If gCommandOutputTask_SYNC invoked by writeDECCommandRestart, wait for output task in sync ...
+ if (gCommandOutputTask_SYNC) {
+ TRACE_VERBOSE1("TaskAsip: writeDECCommandRestart issued ... Wait for ack from output task side (errno=%d)", errno);
+ // Wait for ack
+ while (gCommandOutputTask_ACK == 0) {
+ Task_sleep(1);
+ }
+ TRACE_VERBOSE0("TaskAsip: writeDECCommandRestart issued ... Sync-ed! Startover the process");
+ gCommandOutputTask_ACK = 0;
+ gCommandOutputTask_SYNC = 0;
+ }
+
for (z=INPUT1; z < INPUTN; z++)
{
if (pAstCfg->xInp[z].hRxSio)
GATEMP_INDEX_DEC);
pfpBegin(PFP_ID_ASIT_1, pAsitCfg->taskHandle); // PFP begin
gNumPfpAsit1++;
+ // (***) FL: re-visit, hard-coded to use FRAMELENGTH (pP->frameLength) inside function
errno = pP->fxns->autoProcessing(pP, pQ, pAsitCfg, tempVar8, NULL);
pfpEnd(PFP_ID_ASIT_1, PFP_FINISH_MEAS); // PFP end
gNumPfpAsit1--;
- if (errno) // (***) FL: re-visit this, hard-coded to use PCM framelength inside function
+ if (errno)
{
TRACE_VERBOSE1("TaskAsip: autoProcessing returns 0x%x, continue", errno);
continue;
continue;
}
- // FL: debug, reset IB capture buffer
+#if 0 // debug, reset IB capture buffer
capIbReset();
gCapIbReset_cnt++;
Log_info0("capIbReset()");
+#endif
- // FL: send source select message to slave
+ // send source select message to slave
*(Int32 *)&asipMsgBuf[0] = sourceSelect;
if(AspMsgSend(ASP_SLAVE_DEC_SOURCE_SELECT, ASP_MASTER_DEC_SOURCE_SELECT_DONE,
asipMsgBuf, NULL) != ASP_MSG_NO_ERR)
} // End of main processing loop for (;;)
- Log_info0("Exit taskAsipFxn()");
+ //Log_info0("Exit taskAsipFxn()");
}
// -----------------------------------------------------------------------------
return 0;
} //PAF_ASIT_initPhaseDevice
+// (***) FL: move to ASOT
// -----------------------------------------------------------------------------
// ASIT Initialization Function - Decoder Output Circular Buffer
//
Int errno; /* error number */
Error_Block eb;
Int i;
+ ACP_Handle acp;
+ Int betaPrimeOffset;
+ Int zS;
// FL: (***)revisit
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
as = pAstCfg->as;
zMS = pAstCfg->masterStr;
- /* Decode output circular buffer memory */
+ // Decode output circular buffer memory
if (!(pAstCfg->xDecOpCb = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM,
DECODEN * sizeof (*pAstCfg->xDecOpCb), 4, &eb)))
{
TRACE_TERSE3("PAF_ASIT_initPhaseDecOpCircBuf. (pAsitCfg->xDecOpCb) %d bytes from space %d at 0x%x.",
DECODEN * sizeof (*pAstCfg->xDecOpCb),
HEAP_ID_INTERNAL1_SHM, (IArg)pAstCfg->xDecOpCb);
-
+
for (z=DECODE1; z < DECODEN; z++)
{
pCb = &pAstCfg->xDecOpCb[z];
SW_BREAKPOINT;
}
#endif
+ }
- // (***) FL: revisit, here PCM is hard-coded for 256 sample dec op frame length
- // Initialize decoder output circular buffer for PCM
+ for (z = DECODE1; z < DECODEN; z++)
+ {
+ //
+ // Initialize decoder output circular
+ //
+
+ // Initialize status
+ pAstCfg->xDecOpCb[z].cbStatus = *pP->z_pDecOpCircBufStatus[z];
+
+ // Default initialization
errno = cbInit(pCb);
if (errno)
{
return errno;
}
}
-
+
+ // Get ASIT ACP handle
+ acp = pAsitCfg->acp;
+ if (!acp)
+ {
+ TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: ACP algorithm instance creation failed", as+zMS);
+ return __LINE__;
+ }
+
+ // Get Beta Prime offset
+ ((ALG_Handle)acp)->fxns->algControl((ALG_Handle) acp,
+ ACP_GETBETAPRIMEOFFSET, (IALG_Status *)&betaPrimeOffset);
+
+ for (z = DECODE1; z < DECODEN; z++)
+ {
+ // ACP attach CB
+ zS = pP->streamsFromDecodes[z];
+ acp->fxns->attach(acp, ACP_SERIES_STD,
+ STD_BETA_DECOPCB + betaPrimeOffset * (as-1+zS),
+ (IALG_Status *)&pAstCfg->xDecOpCb[z].cbStatus);
+ }
+
return 0;
} //PAF_ASIT_initPhaseDecOpCircBuf
+// -----------------------------------------------------------------------------
+// ASIT Initialization Function - Output Init-Sync
+//
+// Name: PAF_ASIT_initPhaseOutIS
+// Purpose: Audio Stream Input Task Function for initialization of Output Init-Sync.
+//
+Int
+PAF_ASIT_initPhaseOutIS(
+ const PAF_ASIT_Params *pP,
+ const PAF_ASIT_Patchs *pQ,
+ PAF_ASIT_Config *pAsitCfg
+)
+{
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* decode counter */
+ PAF_AST_OutInitSyncInfo *pOutISI;
+ Error_Block eb;
+ Int i;
+
+
+ pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ as = pAstCfg->as;
+
+ /* Output Init-Sync memory */
+ if (!(pAstCfg->xOutIsi = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM,
+ DECODEN * sizeof (*pAstCfg->xOutIsi), 4, &eb)))
+ {
+ TRACE_TERSE1("PAF_ASIT_initPhaseOutIS: AS%d: Memory_calloc failed", as);
+ SW_BREAKPOINT;
+ return __LINE__;
+ }
+
+ // Reset all decoder stage flags
+ for (z=DECODE1; z < DECODEN; z++)
+ {
+ // Get address of Output Init-Sync Info
+ pOutISI = &pAstCfg->xOutIsi[z];
+ for (i = 0; i < ASP_OUTIS_NUM_DEC_STAGES; i++)
+ {
+ // Reset flag value
+ pOutISI->decStageOutInitSyncInfo[i].decFlag = 0;
+ }
+ }
+
+ return 0;
+} // PAF_ASIT_initPhaseOutIS
+
+
#if 0
// -----------------------------------------------------------------------------
// AST Processing Function - Pass-Through Processing
}
//frameLength = pP->fxns->computeFrameLength (pcmAlgMaster, FRAMELENGTH,
// pC->xDec[zMD].decodeStatus.bufferRatio);
- frameLength = FRAMELENGTH; // FL: fix PCM frameLength for alpha release.
-
+ frameLength = FRAMELENGTH; // (***) FL: fix PCM frameLength
+
if (errno = SIO_ctrl(pAstCfg->xInp[zMI].hRxSio,
PAF_SIO_CONTROL_SET_PCMFRAMELENGTH, frameLength))
{
enum { INIT, INFO1, INFO2, DECODE, FINAL, QUIT } state;
ALG_Handle alg[DECODEN_MAX];
Int zMD;
- Int zMS;
- Int size;
- //PAF_InpBufConfig *pIpBufConfig;
+ //Int zMS;
Int frame; // decoder input frame count
Int block; // (***) FL: formerly -- decoder output block count / input frame
Int8 tempVar8, temp2Var8;
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
zMD = pAstCfg->masterDec;
- zMS = pAstCfg->masterStr;
+ //zMS = pAstCfg->masterStr;
for (z=DECODE1; z < DECODEN; z++)
{
errno = pP->fxns->decodeDecode(pP, pQ, pAsitCfg, sourceSelect, frame, block);
if (errno)
{
- gAsipDecodeErrCnt++;
- TRACE_TERSE1("PAF_ASIT_decodeProcessing: state: DECODE. decodeDecode err 0x%04x", errno);
+ gAsipDecodeErrCnt++;
+ TRACE_TERSE1("PAF_ASIT_decodeProcessing: state: DECODE. decodeDecode err 0x%04x", errno);
break;
}
tempVar8 |= 0x80;
sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.command2),
tempVar8, GATEMP_INDEX_DEC);
+
+ // Invoke command to output task to break the loop
+ gCommandOutputTask_SYNC = 1;
+
return (ASPERR_QUIT);
default: // command unknown - ignore
break;
)
{
PAF_AST_Config *pAstCfg;
- PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
+ //PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode/encode counter */
Int errno; /* error number */
zMI = pP->zone.master;
(void)as; // clear compiler warning in case not used with tracing disabled
- pCbCtl = &pAsitCfg->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
+ //pCbCtl = &pAsitCfg->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
// reset frameCount
for (z=DECODE1; z < DECODEN; z++)
FRAMELENGTH,
pC->xDec[z].decodeStatus.bufferRatio);
#endif
-#if 0 // (***) FL: revisit. Bypass computeFrameLength().
+#if 0 // (***) FL: revisit. Bypass decoder computeFrameLength() function.
frameLength = pP->fxns->computeFrameLength(z,
FRAMELENGTH,
pC->xDec[z].decodeStatus.bufferRatio);
#else
- if (sourceSelect == PAF_SOURCE_PCM)
- {
- frameLength = PAF_SYS_FRAMELENGTH;
- }
- else if ((sourceSelect == PAF_SOURCE_DDP) || (sourceSelect == PAF_SOURCE_AC3))
- {
- frameLength = 1536;
- }
- else if (sourceSelect == PAF_SOURCE_THD)
- {
- frameLength = 1536; //QIN FIX ME
- }
- else
- {
- frameLength = 256;
- }
+ // Compute decoder frame length based on source selection
+ frameLength = getFrameLengthSourceSel(pP, sourceSelect);
#endif
pAstCfg->xDec[z].decodeControl.frameLength = frameLength;
pAstCfg->xDec[z].decodeInStruct.sampleCount = frameLength;
pAstCfg->xDec[z].decodeControl.sampleRate = PAF_SAMPLERATE_UNKNOWN;
-
+
+#if 0 // FL: Moved to ARM:ASDT:INFO
// Initialize decoder output circular buffer for selected source
errno = cbInitSourceSel(pCbCtl, z, sourceSelect, frameLength, FRAMELENGTH, 0);
if (errno)
{
- SW_BREAKPOINT; // FL: debug
+ SW_BREAKPOINT; // debug
return errno;
}
- // FL: debug
+ // debug
cbLog(pCbCtl, z, 1, "PAF_ASIT_decodeInit:cbInitSourceSel");
+#endif
if (z != zMD)
{
Int zMD;
Int zMI;
Int zMS;
- UInt32 curTime;
Int argIdx;
Int8 tempVar8;
Int tempVar;
// FL: revisit
//Int size;
//PAF_InpBufConfig *pIpBufConfig;
+ // debug
+ //UInt32 curTime;
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
as = pAstCfg->as;
return ASPERR_RECLAIM;
}
- // FL: debug, capture input buffer
+#if 0 // debug, capture input buffer
capIb(pAstCfg->xInp[zMI].pInpBuf);
gCapIb_cnt++;
+#endif
#if 0 // (***) FL: shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
// (***) debug // B5
// Simulate Rx SIO_reclaim() pend
//
//Semaphore_pend(semaphoreRxAudio, BIOS_WAIT_FOREVER);
- gTaskAsipCnt++;
- curTime = Clock_getTicks();
+ //curTime = Clock_getTicks();
//System_printf("System time in TaskAsipFxn Rx audio = %lu\n", (ULong)curTime);
//Log_info1("System time in TaskAsipFxn Rx audio = %u", curTime);
//Log_info1("decodeInfo():Rx SIO reclaim(), system time = %u", curTime);
+
+ gAsipRxSioReclaimCnt++;
} //pAstCfg->xInp[zMI].hRxSio
// Decode info
(IArg)pAstCfg->xInp[z].pInpBuf->base.pVoid,
(IArg)pAstCfg->xInp[z].pInpBuf->head.pVoid);
- // FL: debug, capture input buffer
- //capIbPcm(pAstCfg->xInp[z].pInpBuf);
+#if 0 // debug, capture input buffer
+ capIbPcm(pAstCfg->xInp[z].pInpBuf);
+#endif
// (***) FL: revisit
// write back Dec configuration
FRAMELENGTH,
pC->xDec[z].decodeStatus.bufferRatio);
#endif
-#if 0 // (***) FL: revisit. Bypass computeFrameLength().
+#if 0 // (***) FL: revisit. Bypass decoder computeFrameLength() function.
frameLength = pP->fxns->computeFrameLength(z,
FRAMELENGTH,
pC->xDec[z].decodeStatus.bufferRatio);
#else
- if (sourceSelect == PAF_SOURCE_PCM)
- {
- frameLength = PAF_SYS_FRAMELENGTH;
- }
- else if ((sourceSelect == PAF_SOURCE_DDP) || (sourceSelect == PAF_SOURCE_AC3))
- {
- frameLength = 1536;
- }
- else if (sourceSelect == PAF_SOURCE_THD)
- {
- frameLength = 1536; //QIN FIX ME
- }
- else
- {
- frameLength = 256;
- }
+ // Compute decoder frame length based on source selection
+ frameLength = getFrameLengthSourceSel(pP, sourceSelect);
#endif
// // modify for different decoders
// if (sourceSelect == PAF_SOURCE_THD)
// {
-// start_profiling = 1;
+// start_profiling = 1;
// }
// else
// {
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode/encode counter */
Int argIdx;
- Int errno; /* error number */
Int8 tempVar8;
char decMsgBuf[ASP_MSG_BUF_LEN];
}
}
#endif
+
+// Compute decoder frame length based on selected source
+static Int getFrameLengthSourceSel(
+ const PAF_ASIT_Params *pP,
+ Int8 sourceSelect
+)
+{
+ Int frameLength;
+
+ switch(sourceSelect)
+ {
+ case PAF_SOURCE_PCM:
+ frameLength = FRAMELENGTH;
+ break;
+ case PAF_SOURCE_AAC:
+ frameLength = 1024;
+ break;
+ case PAF_SOURCE_AC3:
+ case PAF_SOURCE_DDP:
+ frameLength = ASIP_FRAMELEN_SS_DDP_AC3;
+ break;
+ case PAF_SOURCE_THD:
+ frameLength = ASIP_FRAMELEN_SS_THD;
+ break;
+ case PAF_SOURCE_DTS:
+ case PAF_SOURCE_DTSHD:
+ case PAF_SOURCE_DTS12:
+ case PAF_SOURCE_DTS13:
+ case PAF_SOURCE_DTS14:
+ case PAF_SOURCE_DTS16:
+ case PAF_SOURCE_DTSALL:
+ frameLength = ASIP_FRAMELEN_SS_DTS;
+ break;
+ default:
+ frameLength = ASIP_FRAMELEN_SS_DEFAULT;
+ break;
+ }
+
+ return frameLength;
+}