diff --git a/pasdk/test_dsp/framework/audioStreamOutDec.c b/pasdk/test_dsp/framework/audioStreamOutDec.c
index d7510c8c99f09f237d965863e614dbf62f91e816..c3886e54c7fd108173803da59c488e2db7d341ec 100644 (file)
*
*/
/*
- * ======== audioStreamOutProcDec.c ========
+ * ======== audioStreamOutDec.c ========
*/
#include <string.h> // for memset
#include "audioStreamOutProc.h"
#include "audioStreamOutIo.h"
#include "audioStreamOutDec.h"
+#include "ioConfig.h" //TODO: remove this header
+#include "ioPhy.h"
#define ENC_Handle PCE_Handle /* works for all: PCE */
// debug
#include "evmc66x_gpio_dbg.h"
+#include "dbgCapAf.h"
PAF_AST_DecOpCircBufStats gCbStats; // circular buffer stats
// debug
)
{
PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ PAF_AST_IoOut *pOut; // ASOT IO configuration
Int as; // Audio Stream Number (1, 2, etc.) */
Int zO, zS;
Int z; // encode counter
status = ASOP_DOP_SOK;
pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ pOut = pAsotCfg->pIoOut; // get pointer to ASOT IO configuration
as = pAstCfg->as;
for (z=ENCODE1; z < ENCODEN; z++)
{
zO = pP->outputsFromEncodes[z];
zS = pP->streamsFromEncodes[z];
- if (pAstCfg->xOut[zO].hTxSio && pAstCfg->xEnc[z].encodeStatus.mode)
+ if (pOut[zO].hIoPhy && pAstCfg->xEnc[z].encodeStatus.mode)
{
Int select = pAstCfg->xEnc[z].encodeStatus.select;
ALG_Handle encAlg = pAstCfg->xEnc[z].encAlg[select];
return status;
}
-// Purpose: Reset ASP chain, execute ENC info, and initiate Output
+// Purpose: Dec Info1 stub function
Int asopDecOutProcInfo1(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
Int frame
)
{
- PAF_AST_Config *pAstCfg;
- PAF_AST_IoOut *pOut;
- Int zO, zS;
- Int z; // decode/encode counter
- Int errno; // error number
- Int status; // status code
+ return ASOP_DOP_SOK;
+}
+
+// Purpose: Reset ASP chain, execute ENC info, and initiate Output
+Int asopDecOutProcDec1(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg,
+ Int frame
+)
+{
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ PAF_AST_IoOut *pOut; // ASOT IO configuration
+ Int zO, zS;
+ Int z; // decode/encode counter
+ Int errno; // error number
+ Int status; // status code
status = ASOP_DOP_SOK;
pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
//
// Reset ASP chain
//
- TRACE_VERBOSE0("asopDecOutProcInfo1: calling streamChainFunction.");
- errno = streamChainFunction(pP, pQ, pAsotCfg, PAF_ASP_CHAINFRAMEFXNS_RESET, 1, frame);
+ TRACE_VERBOSE0("asopDecOutProcDec1: calling streamChainFunction.");
+ errno = streamChainFunction(pP, pQ, pAsotCfg, PAF_ASP_CHAINFRAMEFXNS_RESET, 1, frame); // SRC reset is called inside;
if (errno)
{
- TRACE_TERSE1("asopDecOutProcInfo1: streamChainFunction returns errno 0x%x ", errno);
- status = ASOP_DOP_ERR_INFO1_ASPCHAINRESET;
+ TRACE_TERSE1("asopDecOutProcDec1: streamChainFunction returns errno 0x%x ", errno);
+ status = ASOP_DOP_ERR_DEC1_ASPCHAINRESET;
return status;
}
//
// Encode Info
//
- TRACE_VERBOSE0("asopDecOutProcInfo1: calling enc->info.");
+ TRACE_VERBOSE0("asopDecOutProcDec1: calling enc->info.");
for (z=ENCODE1; z < ENCODEN; z++)
{
Int zO = pP->outputsFromEncodes[z];
&pAstCfg->xEnc[z].encodeStatus);
if (errno)
{
- TRACE_TERSE1("asopDecOutProcInfo1: info returns errno 0x%x ", errno);
- status = ASOP_DOP_ERR_INFO1_ENCINFO;
+ TRACE_TERSE1("asopDecOutProcDec1: info returns errno 0x%x ", errno);
+ status = ASOP_DOP_ERR_DEC1_ENCINFO;
return status;
}
}
errno = asopSetCheckRateX(pP, pQ, pAsotCfg, 0);
if (errno)
{
- TRACE_TERSE1("asopDecOutProcInfo1: info returns errno 0x%x ", errno);
- status = ASOP_DOP_ERR_INFO1_SETRATEX;
+ TRACE_TERSE1("asopDecOutProcDec1: info returns errno 0x%x ", errno);
+ status = ASOP_DOP_ERR_DEC1_SETRATEX;
return status;
}
errno = asopStartOutput(pP, pQ, pAsotCfg);
if (errno)
{
- TRACE_TERSE1("asopDecOutProcInfo1: asopStartOutput returns errno 0x%x ", errno);
- status = ASOP_DOP_ERR_INFO1_STARTOUTPUT;
+ TRACE_TERSE1("asopDecOutProcDec1: asopStartOutput returns errno 0x%x ", errno);
+ status = ASOP_DOP_ERR_DEC1_STARTOUTPUT;
return status;
}
+#if 0
// Find first Output associated with Master Stream
zO = OUTPUT1;
for (z=ENCODE1; z < ENCODEN; z++)
}
}
- // Start output transfer
- // FL, New IO: API for single Output
- asopPhyTransferStart(&pOut[zO]);
+ // Initialize Output buffer configuration
+ errno = asopInitOutBufConfig(&pAstCfg->xOut[zO], &pOut[zO]);
+ if (errno)
+ {
+ TRACE_TERSE1("asopDecOutProcInfo1: asopInitOutBufConfig returns errno 0x%x ", errno);
+ status = ASOP_DOP_ERR_DEC1_INITOUTBUFCFG;
+ return status;
+ }
+#endif
return status;
-} //asopDecOutProcInfo1
+} //asopDecOutProcDec1
// Purpose: Re-initiate Output
Int asopDecOutProcInfo2(
Int frame
)
{
- PAF_AST_Config *pAstCfg;
- PAF_AST_IoOut *pOut;
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ PAF_AST_IoOut *pOut; // ASIO IO configuration
Int zO, zS;
- Int z; // decode/encode counter
- Int errno; // error number
- Int status; // status code
+ Int z; // decode/encode counter
+ Int errno; // error number
+ Int status; // status code
status = ASOP_DOP_SOK;
pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
for (z=DECODE1; z < DECODEN; z++)
{
+#if 0 // FL: moved to PAF_ASOT_initSyncDecDecode1()
// Initialize decoder output circular buffer for stream reads
errno = cbInitStreamRead(pCbCtl, z);
if (errno)
status = ASOP_DOP_ERR_INIT_CBINITREAD;
return status;
}
+#endif
// Start decoder output circular buffer reads
errno = cbReadStart(pCbCtl, z);
#if 0 // debug, capture audio frame
if (capAfWrite(pAfRd, PAF_LEFT) != CAP_AF_SOK)
+// if (capAfWrite(pAfRd, PAF_RIGHT) != CAP_AF_SOK)
{
Log_info0("asopDecOutProcStream:capAfWrite() error");
}
return status;
}
+#if 0 // debug, capture audio frame
+ if (capAfWrite(pAfRd, PAF_LEFT) != CAP_AF_SOK)
+ {
+ Log_info0("asopDecOutProcStream:capAfWrite() error");
+ }
+#endif
+
return status;
} //asopDecodeStream
Int frame
)
{
- PAF_AST_Config *pAstCfg;
- PAF_AST_IoOut *pOut;
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ PAF_AST_IoOut *pOut; // ASIO IO configuration
Int as; // Audio Stream Number (1, 2, etc.)
Int zX, zE, zS;
Int z; // encode/output counter
if (pOut[z].hIoPhy)
{
- // update length (e.g. ARC may have changed)
- pAstCfg->xOut[z].outBufConfig.lengthofFrame =
+ //uint32_t phyXferSizeOld;
+
+ // update length (e.g. ARC may have changed) - moved out of this function
+/* pAstCfg->xOut[z].outBufConfig.lengthofFrame =
pAstCfg->xEnc[zE].encodeInStruct.pAudioFrame->sampleCount;
-
+*/
TRACE_GEN2("asopDecodeEncode: AS%d: processing frame %d -- idle", as+zS, frame);
-#if 0 // FL NEWIO: add similar thing to be figured out
+#if 0 // FL, New IO: add similar thing to be figured out
+ // Update framework Phy transfer size
+ phyXferSizeOld = pOut[z].phyXferSize;
+ pOut[z].phyXferSize = pAstCfg->xOut[z].outBufConfig.lengthofFrame * pOut[z].stride * WORD_SIZE_PCM;
+ // Update IO Phy transfer size
ioPhyCtl.code = IOPHY_CTL_FRAME_SIZE;
- ioPhyCtl.params.xferFrameSize = pAstCfg->xOut[z].outBufConfig.lengthofFrame
- * ASOP_OUTBUF_STRIDE * ASOP_NUM_BYTES_PCM_SAMPLE;
+ ioPhyCtl.params.xferFrameSize = pOut[z].phyXferSize;
ioPhyControl(pOut[z].hIoPhy, &ioPhyCtl);
-
+ // Update IO Buff delay to match Phy transfer size
+ if(pOut[z].phyXferSize != phyXferSizeOld) {
+ ioBuffAdjustDelay(pOut[z].hIoBuff, pOut[z].phyXferSize * (NUM_PRIME_XFERS+1));
+ }
+/*
errno = SIO_reclaim(pAstCfg->xOut[z].hTxSio,(Ptr *) &pAstCfg->xOut[z].pOutBuf, NULL);
if (errno < 0)
{
TRACE_TERSE2("PAF_ASOT_decodeEncode: AS%d: SIO_reclaim returns error %d", as+zS, -errno);
return -errno; // SIO negates error codes
}
+*/
#endif
#if 0 // debug
// Encode data
for (z=ENCODE1; z < ENCODEN; z++)
{
+#if 0 // debug, capture audio frame
+ PAF_AudioFrame *pAfRd;
+ pAfRd = pAstCfg->xEnc[z].encodeInStruct.pAudioFrame;
+ if (capAfWrite(pAfRd, PAF_LEFT) != CAP_AF_SOK)
+ {
+ Log_info0("asopDecOutProcEncode:capAfWrite() error");
+ }
+#endif
+
Int zS = pP->streamsFromEncodes[z];
(void)zS; // clear compiler warning in case not used with tracing disabled
if (pAstCfg->xEnc[z].encodeStatus.mode)
TRACE_GEN2("PAF_ASOT_decodeEncode: AS%d: processing frame %d -- output <ignored>", as+zS, frame);
}
#endif
- if (pOut[z].hIoPhy)
- {
- TRACE_GEN2("asopDecOutProcEncode: AS%d: processing frame %d -- output", as+zS, frame);
- errno = asopWriteOpBuffers(&pAstCfg->xOut[z].outBufConfig, &pOut[z]);
- if (errno)
- {
- status = ASOP_DOP_ERR_ENCODE_WRTOPBUFS;
- return status;
- }
- }
}
return status;
Int frame
)
{
- PAF_AST_Config *pAstCfg;
- PAF_AST_IoOut *pOut;
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ PAF_AST_IoOut *pOut; // ASIO IO configuration
PAF_AST_DecOpCircBufCtl *pCbCtl; // Decoder output circular buffer control
Int as; // Audio Stream Number (1, 2, etc.)
Int z; // decode/encode counter
? "asopStreamChainFunction: AS%d: processing frame %d -- audio stream (final)"
: "asopStreamChainFunction: AS%d: processing frame %d -- audio stream (?????)",
as+z, logArg);
- errno = (*func) (chain, frame);
+ errno = (*func) (chain, frame); // ASP chain reset function: SRC is the 1st in the chain and reset
TRACE_VERBOSE2("asopStreamChainFunction: AS%d: errno 0x%x.", as+z, errno);
if (errno && abortOnError)