Loading lib_com/ivas_prot.h +1 −1 Original line number Diff line number Diff line Loading @@ -840,7 +840,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ float *data /* i/o: transport channels/output synthesis signal */ float *data /* i/o: time-scaled transport channels */ ); void ivas_dec_prepare_renderer( Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ #define OPT_TC // separate heap memory from hTcBuffer->tcBuffer[] //#define FIX_OSBA_BR_SW_FLUSH // this is non-BE bugfix #define REMOVE_APA_BUFFER // remove hIvasDec->apaExecBuffer[] #define REMOVE_APA_BUFFER2 #define MY_DEBUG #endif Loading lib_dec/ivas_jbm_dec.c +129 −9 Original line number Diff line number Diff line Loading @@ -792,13 +792,24 @@ void ivas_jbm_dec_feed_tc_to_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ float *data /* i : transport channels */ float *data /* i : time-scaled transport channels */ ) { #ifdef REMOVE_APA_BUFFER2 float apa_buff[12 * MAX_JBM_L_FRAME48k]; #endif float data_f[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k]; /* 'float' buffer for transport channels that will be directly converted with the CLDFB */ float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS]; int16_t n, n_render_timeslots; #ifdef REMOVE_APA_BUFFER2 int16_t n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); // mvr2r( data, apa_buff, min( st_ivas->hTcBuffer->nchan_transport_jbm, st_ivas->hTcBuffer->nchan_buffer_full ) * n_samp_full ); mvr2r( data, apa_buff, st_ivas->hTcBuffer->nchan_transport_jbm * n_samp_full ); // set_zero( data, st_ivas->hTcBuffer->nchan_transport_jbm * n_samp_full ); data = apa_buff; #endif push_wmops( "ivas_jbm_dec_feed_tc_to_renderer" ); for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ ) { Loading Loading @@ -2174,6 +2185,93 @@ int16_t ivas_jbm_dec_get_render_granularity( } #endif #ifdef REMOVE_APA_BUFFER /*--------------------------------------------------------------------------* * ivas_jbm_dec_tc_buffer_allocate() * * open and initialize JBM transport channel buffer *--------------------------------------------------------------------------*/ static ivas_error ivas_jbm_dec_tc_buffer_allocate( DECODER_TC_BUFFER_HANDLE hTcBuffer, /* i/o: JBM TSM buffer handle */ const int32_t output_Fs, /* i : output sampling rate */ const int16_t Opt_tsm /* i : TSM option flag */ ) { int16_t nsamp_to_allocate; int16_t ch_idx, n_samp_full, n_samp_residual, offset; if ( Opt_tsm ) { #ifdef REMOVE_APA_BUFFER n_samp_full = ( NS2SA( output_Fs, MAX_JBM_L_FRAME_NS ) ); #else n_samp_full = ( NS2SA( output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); #endif n_samp_residual = hTcBuffer->n_samples_granularity - 1; } else { n_samp_full = (int16_t) ( output_Fs / FRAMES_PER_SEC ); n_samp_residual = 0; } nsamp_to_allocate = max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ) * n_samp_full; if ( Opt_tsm ) { /* note: this is stack memory buffer for time-scale modified audio signals */ if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); } set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); offset = 0; for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; offset += n_samp_full; } for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) { hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; offset += n_samp_residual; } for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } /* memory buffer for TC audio samples not rendered in the previous frame */ for ( ch_idx = 0; ch_idx < max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); ch_idx++ ) { if ( ( hTcBuffer->tc_buffer_old[ch_idx] = (float *) malloc( n_samp_residual * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); } set_zero( hTcBuffer->tc_buffer_old[ch_idx], n_samp_residual ); } for ( ; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++ ) { hTcBuffer->tc_buffer_old[ch_idx] = NULL; } } else { hTcBuffer->tc_buffer = NULL; for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) // VE: number of channels could be lowered?? { hTcBuffer->tc[ch_idx] = NULL; } } return IVAS_ERR_OK; } #endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_tc_buffer_open() Loading @@ -2193,8 +2291,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open( int16_t nsamp_to_allocate; DECODER_TC_BUFFER_HANDLE hTcBuffer; int16_t nMaxSlotsPerSubframe; #ifdef REMOVE_APA_BUFFER ivas_error error; #else int16_t nchan_residual; int16_t ch_idx; #endif /*-----------------------------------------------------------------* * prepare library opening Loading @@ -2209,7 +2311,9 @@ ivas_error ivas_jbm_dec_tc_buffer_open( hTcBuffer->nchan_transport_jbm = nchan_transport_jbm; hTcBuffer->nchan_transport_internal = nchan_transport_internal; hTcBuffer->nchan_buffer_full = nchan_full; #ifndef REMOVE_APA_BUFFER nchan_residual = nchan_transport_internal - nchan_full; #endif hTcBuffer->n_samples_granularity = n_samples_granularity; hTcBuffer->n_samples_available = 0; hTcBuffer->n_samples_buffered = 0; Loading @@ -2225,6 +2329,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open( set_s( hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, MAX_PARAM_SPATIAL_SUBFRAMES ); #ifdef REMOVE_APA_BUFFER if ( ( error = ivas_jbm_dec_tc_buffer_allocate( hTcBuffer, st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->Opt_tsm ) ) != IVAS_ERR_OK ) { return error; } #else { int16_t n_samp_full, n_samp_residual; int32_t offset; Loading @@ -2245,14 +2355,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open( #ifdef OPT_TC nsamp_to_allocate = max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ) * n_samp_full; if ( nsamp_to_allocate == 0 && nchan_residual * n_samp_residual == 0 ) #else nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; #endif if ( nsamp_to_allocate == 0 ) #endif { hTcBuffer->tc_buffer = NULL; Loading Loading @@ -2310,6 +2418,7 @@ ivas_error ivas_jbm_dec_tc_buffer_open( } } } #endif st_ivas->hTcBuffer = hTcBuffer; Loading @@ -2332,13 +2441,17 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ ) { #ifdef REMOVE_APA_BUFFER int16_t ch_idx; ivas_error error; #else int16_t nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual; int16_t ch_idx; #endif DECODER_TC_BUFFER_HANDLE hTcBuffer; hTcBuffer = st_ivas->hTcBuffer; /* if granularity changes, adapt subframe_nb_slots */ if ( n_samples_granularity != hTcBuffer->n_samples_granularity ) { Loading @@ -2349,7 +2462,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( nMaxSlotsPerSubframeNew = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / n_samples_granularity; #ifdef DEBUGGING nMaxSlotsPerSubframeOld = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / st_ivas->hTcBuffer->n_samples_granularity; int16_t nMaxSlotsPerSubframeOld = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / st_ivas->hTcBuffer->n_samples_granularity; assert( hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered - 1] == nMaxSlotsPerSubframeOld ); if ( n_samples_granularity < hTcBuffer->n_samples_granularity ) { Loading @@ -2376,7 +2489,9 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( hTcBuffer->nchan_transport_jbm = nchan_transport_jbm; hTcBuffer->nchan_transport_internal = nchan_transport_internal; hTcBuffer->nchan_buffer_full = nchan_full; #ifndef REMOVE_APA_BUFFER nchan_residual = nchan_transport_internal - nchan_full; #endif hTcBuffer->n_samples_granularity = n_samples_granularity; #ifdef DEBUGGING Loading @@ -2401,6 +2516,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( #endif } #ifdef REMOVE_APA_BUFFER if ( ( error = ivas_jbm_dec_tc_buffer_allocate( hTcBuffer, st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->Opt_tsm ) ) != IVAS_ERR_OK ) { return error; } #else if ( st_ivas->hDecoderConfig->Opt_tsm ) { #ifdef REMOVE_APA_BUFFER Loading @@ -2418,14 +2539,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( #ifdef OPT_TC nsamp_to_allocate = max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ) * n_samp_full; if ( nsamp_to_allocate == 0 && nchan_residual * n_samp_residual == 0 ) #else nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; #endif if ( nsamp_to_allocate == 0 ) #endif { hTcBuffer->tc_buffer = NULL; for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) Loading Loading @@ -2480,6 +2599,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( hTcBuffer->tc_buffer = NULL; } } #endif return IVAS_ERR_OK; } Loading lib_dec/lib_dec.c +13 −5 Original line number Diff line number Diff line Loading @@ -1360,7 +1360,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( #ifdef MY_DEBUG for ( int16_t ch = 0; ch < min( hIvasDec->st_ivas->hTcBuffer->nchan_transport_jbm, hIvasDec->st_ivas->hTcBuffer->nchan_buffer_full ); ch++ ) { set_f( hIvasDec->st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); set_f( st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); } #endif Loading Loading @@ -1391,9 +1391,13 @@ ivas_error IVAS_DEC_GetSamplesDecoder( #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( hIvasDec->st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, hIvasDec->st_ivas->hTcBuffer->tc_buffer ); ivas_syn_output_f( st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, st_ivas->hTcBuffer->tc_buffer ); if ( apa_exec( hIvasDec->hTimeScaler, hIvasDec->st_ivas->hTcBuffer->tc_buffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) #ifdef REMOVE_APA_BUFFER2aa 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 ) #endif #else #ifdef LIB_DEC_REVISION ivas_syn_output_f( hIvasDec->st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, hIvasDec->apaExecBuffer ); Loading @@ -1419,14 +1423,18 @@ ivas_error IVAS_DEC_GetSamplesDecoder( *-----------------------------------------------------------------*/ #ifdef MY_DEBUG for ( int16_t ch = 0; ch < min( hIvasDec->st_ivas->hTcBuffer->nchan_transport_jbm, hIvasDec->st_ivas->hTcBuffer->nchan_buffer_full ); ch++ ) for ( int16_t ch = 0; ch < min( st_ivas->hTcBuffer->nchan_transport_jbm, st_ivas->hTcBuffer->nchan_buffer_full ); ch++ ) { set_f( hIvasDec->st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); set_f( st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); } #endif #ifdef LIB_DEC_REVISION #ifdef REMOVE_APA_BUFFER2aa 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 ); #endif #else if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ) ) != IVAS_ERR_OK ) { Loading Loading
lib_com/ivas_prot.h +1 −1 Original line number Diff line number Diff line Loading @@ -840,7 +840,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ float *data /* i/o: transport channels/output synthesis signal */ float *data /* i/o: time-scaled transport channels */ ); void ivas_dec_prepare_renderer( Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ #define OPT_TC // separate heap memory from hTcBuffer->tcBuffer[] //#define FIX_OSBA_BR_SW_FLUSH // this is non-BE bugfix #define REMOVE_APA_BUFFER // remove hIvasDec->apaExecBuffer[] #define REMOVE_APA_BUFFER2 #define MY_DEBUG #endif Loading
lib_dec/ivas_jbm_dec.c +129 −9 Original line number Diff line number Diff line Loading @@ -792,13 +792,24 @@ void ivas_jbm_dec_feed_tc_to_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ float *data /* i : transport channels */ float *data /* i : time-scaled transport channels */ ) { #ifdef REMOVE_APA_BUFFER2 float apa_buff[12 * MAX_JBM_L_FRAME48k]; #endif float data_f[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k]; /* 'float' buffer for transport channels that will be directly converted with the CLDFB */ float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS]; int16_t n, n_render_timeslots; #ifdef REMOVE_APA_BUFFER2 int16_t n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) ); // mvr2r( data, apa_buff, min( st_ivas->hTcBuffer->nchan_transport_jbm, st_ivas->hTcBuffer->nchan_buffer_full ) * n_samp_full ); mvr2r( data, apa_buff, st_ivas->hTcBuffer->nchan_transport_jbm * n_samp_full ); // set_zero( data, st_ivas->hTcBuffer->nchan_transport_jbm * n_samp_full ); data = apa_buff; #endif push_wmops( "ivas_jbm_dec_feed_tc_to_renderer" ); for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ ) { Loading Loading @@ -2174,6 +2185,93 @@ int16_t ivas_jbm_dec_get_render_granularity( } #endif #ifdef REMOVE_APA_BUFFER /*--------------------------------------------------------------------------* * ivas_jbm_dec_tc_buffer_allocate() * * open and initialize JBM transport channel buffer *--------------------------------------------------------------------------*/ static ivas_error ivas_jbm_dec_tc_buffer_allocate( DECODER_TC_BUFFER_HANDLE hTcBuffer, /* i/o: JBM TSM buffer handle */ const int32_t output_Fs, /* i : output sampling rate */ const int16_t Opt_tsm /* i : TSM option flag */ ) { int16_t nsamp_to_allocate; int16_t ch_idx, n_samp_full, n_samp_residual, offset; if ( Opt_tsm ) { #ifdef REMOVE_APA_BUFFER n_samp_full = ( NS2SA( output_Fs, MAX_JBM_L_FRAME_NS ) ); #else n_samp_full = ( NS2SA( output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); #endif n_samp_residual = hTcBuffer->n_samples_granularity - 1; } else { n_samp_full = (int16_t) ( output_Fs / FRAMES_PER_SEC ); n_samp_residual = 0; } nsamp_to_allocate = max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ) * n_samp_full; if ( Opt_tsm ) { /* note: this is stack memory buffer for time-scale modified audio signals */ if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); } set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); offset = 0; for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; offset += n_samp_full; } for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) { hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; offset += n_samp_residual; } for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } /* memory buffer for TC audio samples not rendered in the previous frame */ for ( ch_idx = 0; ch_idx < max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); ch_idx++ ) { if ( ( hTcBuffer->tc_buffer_old[ch_idx] = (float *) malloc( n_samp_residual * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); } set_zero( hTcBuffer->tc_buffer_old[ch_idx], n_samp_residual ); } for ( ; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++ ) { hTcBuffer->tc_buffer_old[ch_idx] = NULL; } } else { hTcBuffer->tc_buffer = NULL; for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) // VE: number of channels could be lowered?? { hTcBuffer->tc[ch_idx] = NULL; } } return IVAS_ERR_OK; } #endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_tc_buffer_open() Loading @@ -2193,8 +2291,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open( int16_t nsamp_to_allocate; DECODER_TC_BUFFER_HANDLE hTcBuffer; int16_t nMaxSlotsPerSubframe; #ifdef REMOVE_APA_BUFFER ivas_error error; #else int16_t nchan_residual; int16_t ch_idx; #endif /*-----------------------------------------------------------------* * prepare library opening Loading @@ -2209,7 +2311,9 @@ ivas_error ivas_jbm_dec_tc_buffer_open( hTcBuffer->nchan_transport_jbm = nchan_transport_jbm; hTcBuffer->nchan_transport_internal = nchan_transport_internal; hTcBuffer->nchan_buffer_full = nchan_full; #ifndef REMOVE_APA_BUFFER nchan_residual = nchan_transport_internal - nchan_full; #endif hTcBuffer->n_samples_granularity = n_samples_granularity; hTcBuffer->n_samples_available = 0; hTcBuffer->n_samples_buffered = 0; Loading @@ -2225,6 +2329,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open( set_s( hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, MAX_PARAM_SPATIAL_SUBFRAMES ); #ifdef REMOVE_APA_BUFFER if ( ( error = ivas_jbm_dec_tc_buffer_allocate( hTcBuffer, st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->Opt_tsm ) ) != IVAS_ERR_OK ) { return error; } #else { int16_t n_samp_full, n_samp_residual; int32_t offset; Loading @@ -2245,14 +2355,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open( #ifdef OPT_TC nsamp_to_allocate = max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ) * n_samp_full; if ( nsamp_to_allocate == 0 && nchan_residual * n_samp_residual == 0 ) #else nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; #endif if ( nsamp_to_allocate == 0 ) #endif { hTcBuffer->tc_buffer = NULL; Loading Loading @@ -2310,6 +2418,7 @@ ivas_error ivas_jbm_dec_tc_buffer_open( } } } #endif st_ivas->hTcBuffer = hTcBuffer; Loading @@ -2332,13 +2441,17 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ ) { #ifdef REMOVE_APA_BUFFER int16_t ch_idx; ivas_error error; #else int16_t nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual; int16_t ch_idx; #endif DECODER_TC_BUFFER_HANDLE hTcBuffer; hTcBuffer = st_ivas->hTcBuffer; /* if granularity changes, adapt subframe_nb_slots */ if ( n_samples_granularity != hTcBuffer->n_samples_granularity ) { Loading @@ -2349,7 +2462,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( nMaxSlotsPerSubframeNew = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / n_samples_granularity; #ifdef DEBUGGING nMaxSlotsPerSubframeOld = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / st_ivas->hTcBuffer->n_samples_granularity; int16_t nMaxSlotsPerSubframeOld = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / st_ivas->hTcBuffer->n_samples_granularity; assert( hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered - 1] == nMaxSlotsPerSubframeOld ); if ( n_samples_granularity < hTcBuffer->n_samples_granularity ) { Loading @@ -2376,7 +2489,9 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( hTcBuffer->nchan_transport_jbm = nchan_transport_jbm; hTcBuffer->nchan_transport_internal = nchan_transport_internal; hTcBuffer->nchan_buffer_full = nchan_full; #ifndef REMOVE_APA_BUFFER nchan_residual = nchan_transport_internal - nchan_full; #endif hTcBuffer->n_samples_granularity = n_samples_granularity; #ifdef DEBUGGING Loading @@ -2401,6 +2516,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( #endif } #ifdef REMOVE_APA_BUFFER if ( ( error = ivas_jbm_dec_tc_buffer_allocate( hTcBuffer, st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->Opt_tsm ) ) != IVAS_ERR_OK ) { return error; } #else if ( st_ivas->hDecoderConfig->Opt_tsm ) { #ifdef REMOVE_APA_BUFFER Loading @@ -2418,14 +2539,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( #ifdef OPT_TC nsamp_to_allocate = max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ) * n_samp_full; if ( nsamp_to_allocate == 0 && nchan_residual * n_samp_residual == 0 ) #else nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; #endif if ( nsamp_to_allocate == 0 ) #endif { hTcBuffer->tc_buffer = NULL; for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) Loading Loading @@ -2480,6 +2599,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( hTcBuffer->tc_buffer = NULL; } } #endif return IVAS_ERR_OK; } Loading
lib_dec/lib_dec.c +13 −5 Original line number Diff line number Diff line Loading @@ -1360,7 +1360,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( #ifdef MY_DEBUG for ( int16_t ch = 0; ch < min( hIvasDec->st_ivas->hTcBuffer->nchan_transport_jbm, hIvasDec->st_ivas->hTcBuffer->nchan_buffer_full ); ch++ ) { set_f( hIvasDec->st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); set_f( st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); } #endif Loading Loading @@ -1391,9 +1391,13 @@ ivas_error IVAS_DEC_GetSamplesDecoder( #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( hIvasDec->st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, hIvasDec->st_ivas->hTcBuffer->tc_buffer ); ivas_syn_output_f( st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, st_ivas->hTcBuffer->tc_buffer ); if ( apa_exec( hIvasDec->hTimeScaler, hIvasDec->st_ivas->hTcBuffer->tc_buffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) #ifdef REMOVE_APA_BUFFER2aa 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 ) #endif #else #ifdef LIB_DEC_REVISION ivas_syn_output_f( hIvasDec->st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, hIvasDec->apaExecBuffer ); Loading @@ -1419,14 +1423,18 @@ ivas_error IVAS_DEC_GetSamplesDecoder( *-----------------------------------------------------------------*/ #ifdef MY_DEBUG for ( int16_t ch = 0; ch < min( hIvasDec->st_ivas->hTcBuffer->nchan_transport_jbm, hIvasDec->st_ivas->hTcBuffer->nchan_buffer_full ); ch++ ) for ( int16_t ch = 0; ch < min( st_ivas->hTcBuffer->nchan_transport_jbm, st_ivas->hTcBuffer->nchan_buffer_full ); ch++ ) { set_f( hIvasDec->st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); set_f( st_ivas->hTcBuffer->tc[ch], 0, hIvasDec->nSamplesFrame + hIvasDec->nSamplesFrame / 2 ); } #endif #ifdef LIB_DEC_REVISION #ifdef REMOVE_APA_BUFFER2aa 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 ); #endif #else if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ) ) != IVAS_ERR_OK ) { Loading