I am attempting to get the ECU module in the VoLIB to work on 5509A processor.
I have linked the code and can build my test application. Currently I am just trying to see the code
working on the Simulator to prove that it works.
The code seems to be working - with the exception that the echo canceller is not cancelling the echo.
None of the calls are returning errors and calling the ecuGetPerformance function returns
values that seem correct and are changing.
I have allocated all the memory as requested by the ecuGetSizes function and confirmed the correct
size and allignment on the memory blocks I pass into ecuNew.
I can build and run the test code in the ECU package and that works correctly, with the echo cancelled.
While the code is running, I can see that there is no data being put into the Far-end expanded delay line
and that the Foreground Filter segment coefficients are not updating.
(On the working ECU test code this buffer is full of data and the FG filter does update).
What things should I check that could be causing the ecu to run, without returning errors or exceptions
without returning any errors.
Any pointers or tips would be greatly appreciated.
ALSO: Is there any way to disable the delay line compression, as there seems to be no benefit
to using it on a 5509.
For reference here are some code snippets, showing the relevant ECU structures and calls.
/*************************/
/* The ECU Context Setup */
/*************************/
#define ECHO_CANCEL_FRAME_SIZE 40
#define ECU_SEARCH_FILTER_LENGTH 1024
#define ECU_FILTER_SEGMENT_COUNT 3
ecuContext_t ecuContext =
{
echo_cancel_exception, /* Exception handler */
NULL, /* Debug streaming function pointer */
NULL, /* MIPS Agent open/close event handler */
NULL, /* Search filter swapping function */
NULL , /* Send out function pointer */
NULL, /* Receive out function pointer */
2 * ECHO_CANCEL_FRAME_SIZE, /* Maximum number of samples per frame */
ECU_SEARCH_FILTER_LENGTH , /* Maximum filter length in taps */
ECU_FILTER_SEGMENT_LENGTH, /* Maximum filter segment buffer length in taps */
ECU_FILTER_SEGMENT_COUNT, /* Maximum allowed active filter segments */
3 * ECHO_CANCEL_FRAME_SIZE, /* Maximum y2x delay in samples */
0L, /* Bitfield representing those portions of the
* delay line already expanded. */
NULL, /* Pointer to base of the scratch delay line */
NULL, /* TDM aligned pointer within scratch delay line */
NULL, /* TDM aligned pointer within packed delay line */
};
/*****************************************/
/* Code to Initialise the Echo canceller */
/*****************************************/
tEchoCancel *echo = &gEchoCancel[echoId];
tint ii ;
tint ecuNumberOfBuffers;
const ecomemBuffer_t *internalMemoryBuffers = NULL;
tint ecuStatus;
ecuStatus = ecuGetSizes (&ecuNumberOfBuffers, &internalMemoryBuffers, (void *)NULL);
if ( ecuStatus == ecu_NOERR )
{
// Must copy internal buffers before modifying them
echo->ecuMemoryBuffers = ( ecomemBuffer_t * ) MEM_calloc( SEG_SARAM, sizeof(ecomemBuffer_t) * ecuNumberOfBuffers, 2 );
for ( ii = 0 ; ii < ecuNumberOfBuffers; ii++ )
{
echo->ecuMemoryBuffers[ii] = internalMemoryBuffers[ii] ;
if ( echo->ecuMemoryBuffers[ii].size > 0 )
{
echo->ecuMemoryBuffers[ii].base = (void *)
MEM_calloc( SEG_SARAM, echo->ecuMemoryBuffers[ii].size, 1 << echo->ecuMemoryBuffers[ii].log2align );
if ( echo->ecuMemoryBuffers[ii].base == NULL )
{
ecuStatus = ecu_NOMEMORY ;
break;
}
}
}
if ( ecuStatus == ecu_NOERR )
{
ecuNewConfig_t ecuConfigNew;
echo->ecuInstance = NULL;
ecuConfigNew.ID = echoId + 1 ;
ecuStatus = ecuNew(&echo->ecuInstance, ecuNumberOfBuffers, echo->ecuMemoryBuffers, &ecuConfigNew );
}
}
/*************************************/
/* Code to "Open" the echo Canceller */
/*************************************/
configParam.filter_length = 1024; // 128 Millisecond tail
configParam.config_bitfield = ecu_ENABLE_ECHO_CANCELLER | /* ENABLE ECU, ENABLE NLP, ENABLE UPDATE */
ecu_ENABLE_UPDATE |
ecu_ENABLE_NLP |
ecu_ENABLE_AUTO_UPDATE |
ecu_ENABLE_SEARCH |
ecu_ENABLE_CNG_ADAPT |
ecu_ENABLE_OPNLP_DETECT; ;
configParam.config_bitfield1 = ecu_ENABLE_NLP_PHASE_RND ;
configParam.noise_level = 0 ; /* Use default (-70) if fixed */
configParam.nlp_aggress = 0 ; /* Balance Performance */
configParam.cn_config = 0 ; /* pink noise */
ecuConfig.samples_per_frame = ECHO_CANCEL_FRAME_SIZE;
ecuConfig.cfgParam = &configParam;
ecuConfig.sendOutInst = echo ;
ecuConfig.recOutInst = echo ;
ecuConfig.y2x_delay = ECHO_CANCEL_FRAME_SIZE;
ecuConfig.pcm_expand_tbl = muaTblUlaw;
ecuConfig.pcm_zero = ULAW_ZERO;
ecuOpen( echo->ecuInstance, &ecuConfig );
/**********************************/
/* Code to use the echo canceller */
/**********************************/
ecuSendIn( echo->ecuInstance, receiveData, echo->txBuffer, echo->rxBuffer );