Loading lib_dec/lib_dec.c +23 −4 Original line number Diff line number Diff line Loading @@ -88,7 +88,9 @@ struct IVAS_DEC int16_t tsm_max_scaling; int16_t timeScalingDone; /* have we done already one TSM in a 20ms frame? */ float tsm_quality; #ifndef REMOVE_APA_BUFFER2 float *apaExecBuffer; /* Buffer for APA scaling */ #endif PCMDSP_APA_HANDLE hTimeScaler; bool needNewFrame; bool hasBeenFedFrame; Loading Loading @@ -182,7 +184,9 @@ ivas_error IVAS_DEC_Open( } hIvasDec = *phIvasDec; hIvasDec->hVoIP = NULL; #ifndef REMOVE_APA_BUFFER2 hIvasDec->apaExecBuffer = NULL; #endif hIvasDec->hTimeScaler = NULL; hIvasDec->tsm_scale = 100; hIvasDec->tsm_max_scaling = 0; Loading Loading @@ -380,11 +384,12 @@ void IVAS_DEC_Close( apa_exit( &( *phIvasDec )->hTimeScaler ); #ifndef REMOVE_APA_BUFFER2 if ( ( *phIvasDec )->apaExecBuffer != NULL ) { free( ( *phIvasDec )->apaExecBuffer ); } #endif if ( ( *phIvasDec )->flushbuffer != NULL ) { free( ( *phIvasDec )->flushbuffer ); Loading Loading @@ -1282,7 +1287,11 @@ ivas_error IVAS_DEC_GetSamplesDecoder( st_ivas = hIvasDec->st_ivas; #ifdef LIB_DEC_REVISION #ifdef REMOVE_APA_BUFFER2 isInitialized_voip = hIvasDec->hTimeScaler != NULL; #else isInitialized_voip = hIvasDec->apaExecBuffer != NULL; #endif #endif if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) /* wait for the first good frame */ Loading Loading @@ -1385,15 +1394,17 @@ ivas_error IVAS_DEC_GetSamplesDecoder( return IVAS_ERR_UNKNOWN; } #ifndef REMOVE_APA_BUFFER2 #ifdef MY_DEBUG set_f( hIvasDec->apaExecBuffer, 0, nTransportChannels * APA_BUF_PER_CHANNEL ); #endif #endif #ifdef REMOVE_APA_BUFFER /* move decoded audio buffers st_ivas->p_output_f[][] to a serial buffer hTcBuffer->tc_buffer[] */ ivas_syn_output_f( st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, st_ivas->hTcBuffer->tc_buffer ); #ifdef REMOVE_APA_BUFFER2aa #ifdef REMOVE_APA_BUFFER2 if ( apa_exec( hIvasDec->hTimeScaler, st_ivas->hTcBuffer->tc_buffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, st_ivas->hTcBuffer->tc_buffer, &nTimeScalerOutSamples ) != 0 ) #else if ( apa_exec( hIvasDec->hTimeScaler, st_ivas->hTcBuffer->tc_buffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) Loading Loading @@ -1422,15 +1433,17 @@ ivas_error IVAS_DEC_GetSamplesDecoder( * Feed decoded transport channels samples to the renderer *-----------------------------------------------------------------*/ #ifndef REMOVE_APA_BUFFER2 #ifdef MY_DEBUG for ( int16_t ch = 0; ch < min( st_ivas->hTcBuffer->nchan_transport_jbm, st_ivas->hTcBuffer->nchan_buffer_full ); ch++ ) { set_f( st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); } #endif #endif #ifdef LIB_DEC_REVISION #ifdef REMOVE_APA_BUFFER2aa #ifdef REMOVE_APA_BUFFER2 ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesTcsScaled, &nResidualSamples, st_ivas->hTcBuffer->tc_buffer ); #else ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ); Loading @@ -1442,9 +1455,11 @@ ivas_error IVAS_DEC_GetSamplesDecoder( } #endif #ifndef REMOVE_APA_BUFFER2 #ifdef MY_DEBUG set_f( hIvasDec->apaExecBuffer, 0, nTransportChannels * APA_BUF_PER_CHANNEL ); #endif #endif if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { Loading Loading @@ -5151,12 +5166,14 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( } } #ifndef REMOVE_APA_BUFFER2 if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); #endif #ifndef LIB_DEC_REVISION } #endif Loading @@ -5172,6 +5189,7 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( return IVAS_ERR_INIT_ERROR; } #ifndef REMOVE_APA_BUFFER2 /* realloc apa_exe_buffer */ #ifdef JBM_MEMORY_OPTaa apa_buffer_size = MAX_JBM_L_FRAME48k; Loading @@ -5184,6 +5202,7 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); #endif #ifndef LIB_DEC_REVISION } /* realloc apa_exe_buffer */ Loading Loading
lib_dec/lib_dec.c +23 −4 Original line number Diff line number Diff line Loading @@ -88,7 +88,9 @@ struct IVAS_DEC int16_t tsm_max_scaling; int16_t timeScalingDone; /* have we done already one TSM in a 20ms frame? */ float tsm_quality; #ifndef REMOVE_APA_BUFFER2 float *apaExecBuffer; /* Buffer for APA scaling */ #endif PCMDSP_APA_HANDLE hTimeScaler; bool needNewFrame; bool hasBeenFedFrame; Loading Loading @@ -182,7 +184,9 @@ ivas_error IVAS_DEC_Open( } hIvasDec = *phIvasDec; hIvasDec->hVoIP = NULL; #ifndef REMOVE_APA_BUFFER2 hIvasDec->apaExecBuffer = NULL; #endif hIvasDec->hTimeScaler = NULL; hIvasDec->tsm_scale = 100; hIvasDec->tsm_max_scaling = 0; Loading Loading @@ -380,11 +384,12 @@ void IVAS_DEC_Close( apa_exit( &( *phIvasDec )->hTimeScaler ); #ifndef REMOVE_APA_BUFFER2 if ( ( *phIvasDec )->apaExecBuffer != NULL ) { free( ( *phIvasDec )->apaExecBuffer ); } #endif if ( ( *phIvasDec )->flushbuffer != NULL ) { free( ( *phIvasDec )->flushbuffer ); Loading Loading @@ -1282,7 +1287,11 @@ ivas_error IVAS_DEC_GetSamplesDecoder( st_ivas = hIvasDec->st_ivas; #ifdef LIB_DEC_REVISION #ifdef REMOVE_APA_BUFFER2 isInitialized_voip = hIvasDec->hTimeScaler != NULL; #else isInitialized_voip = hIvasDec->apaExecBuffer != NULL; #endif #endif if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) /* wait for the first good frame */ Loading Loading @@ -1385,15 +1394,17 @@ ivas_error IVAS_DEC_GetSamplesDecoder( return IVAS_ERR_UNKNOWN; } #ifndef REMOVE_APA_BUFFER2 #ifdef MY_DEBUG set_f( hIvasDec->apaExecBuffer, 0, nTransportChannels * APA_BUF_PER_CHANNEL ); #endif #endif #ifdef REMOVE_APA_BUFFER /* move decoded audio buffers st_ivas->p_output_f[][] to a serial buffer hTcBuffer->tc_buffer[] */ ivas_syn_output_f( st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, st_ivas->hTcBuffer->tc_buffer ); #ifdef REMOVE_APA_BUFFER2aa #ifdef REMOVE_APA_BUFFER2 if ( apa_exec( hIvasDec->hTimeScaler, st_ivas->hTcBuffer->tc_buffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, st_ivas->hTcBuffer->tc_buffer, &nTimeScalerOutSamples ) != 0 ) #else if ( apa_exec( hIvasDec->hTimeScaler, st_ivas->hTcBuffer->tc_buffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) Loading Loading @@ -1422,15 +1433,17 @@ ivas_error IVAS_DEC_GetSamplesDecoder( * Feed decoded transport channels samples to the renderer *-----------------------------------------------------------------*/ #ifndef REMOVE_APA_BUFFER2 #ifdef MY_DEBUG for ( int16_t ch = 0; ch < min( st_ivas->hTcBuffer->nchan_transport_jbm, st_ivas->hTcBuffer->nchan_buffer_full ); ch++ ) { set_f( st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); } #endif #endif #ifdef LIB_DEC_REVISION #ifdef REMOVE_APA_BUFFER2aa #ifdef REMOVE_APA_BUFFER2 ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesTcsScaled, &nResidualSamples, st_ivas->hTcBuffer->tc_buffer ); #else ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ); Loading @@ -1442,9 +1455,11 @@ ivas_error IVAS_DEC_GetSamplesDecoder( } #endif #ifndef REMOVE_APA_BUFFER2 #ifdef MY_DEBUG set_f( hIvasDec->apaExecBuffer, 0, nTransportChannels * APA_BUF_PER_CHANNEL ); #endif #endif if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { Loading Loading @@ -5151,12 +5166,14 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( } } #ifndef REMOVE_APA_BUFFER2 if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); #endif #ifndef LIB_DEC_REVISION } #endif Loading @@ -5172,6 +5189,7 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( return IVAS_ERR_INIT_ERROR; } #ifndef REMOVE_APA_BUFFER2 /* realloc apa_exe_buffer */ #ifdef JBM_MEMORY_OPTaa apa_buffer_size = MAX_JBM_L_FRAME48k; Loading @@ -5184,6 +5202,7 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); #endif #ifndef LIB_DEC_REVISION } /* realloc apa_exe_buffer */ Loading