Loading lib_com/ivas_cnst.h +0 −5 Original line number Diff line number Diff line Loading @@ -172,13 +172,8 @@ typedef enum #define JBM_CLDFB_SLOTS_IN_SUBFRAME 4 #define MAX_JBM_CLDFB_TIMESLOTS 32 #define DEFAULT_JBM_CLDFB_TIMESLOTS 16 #ifdef JBM_MEMORY_OPT #define MAX_JBM_L_FRAME48k ( IVAS_MAX_FRAME_SIZE * 2 ) /* 1920: max. time-scaled frame buffer length (per channel) in samples */ #define MAX_JBM_L_FRAME_NS 40000000L /* 40 ms: time-scaled frame size in ns, proportional to MAX_JBM_L_FRAME48k */ #else #define MAX_JBM_L_FRAME48k 1920 #define MAX_JBM_L_FRAME_NS 40000000L #endif #define MAX_SPAR_INTERNAL_CHANNELS IVAS_SPAR_MAX_CH #define MAX_CLDFB_DIGEST_CHANNELS 3 /* == maximum of ParamISM TCs and ParamMC TCs */ Loading lib_com/ivas_prot.h +0 −13 Original line number Diff line number Diff line Loading @@ -259,7 +259,6 @@ uint32_t ivas_syn_output( int16_t *synth_out /* o : integer 16 bits synthesis signal */ ); #ifdef JBM_MEMORY_OPT void ivas_buffer_interleaved_to_deinterleaved( float *audio, /* i/o: audio buffer */ const int16_t n_channels, /* i : number of channels */ Loading @@ -273,14 +272,6 @@ void ivas_buffer_deinterleaved_to_interleaved( const int16_t frame_length, /* i : frame length (one channel) */ float *audio_out /* o : interleaved audio buffer */ ); #else void ivas_syn_output_f( float *synth[], /* i/o: float synthesis signal */ const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ float *synth_out /* o : integer 16 bits synthesis signal */ ); #endif void ivas_initialize_handles_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ Loading Loading @@ -849,10 +840,6 @@ 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*/ #ifndef JBM_MEMORY_OPT , float *data /* i/o: time-scaled transport channels */ #endif ); void ivas_dec_prepare_renderer( Loading lib_com/ivas_tools.c +0 −36 Original line number Diff line number Diff line Loading @@ -148,7 +148,6 @@ uint32_t ivas_syn_output( return noClipping; } #ifdef JBM_MEMORY_OPT /*-------------------------------------------------------------------* * ivas_buffer_interleaved_to_deinterleaved() Loading Loading @@ -211,41 +210,6 @@ void ivas_buffer_deinterleaved_to_interleaved( return; } #else /*-------------------------------------------------------------------* * ivas_syn_output_f() * * Output ivas synthesis signal with compensation for saturation * returns number of clipped samples *-------------------------------------------------------------------*/ /*! r: number of clipped samples */ void ivas_syn_output_f( float *synth[], /* i/o: float synthesis signal */ const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ float *synth_out /* o : integer 16 bits synthesis signal */ ) { int16_t i, n; /*-----------------------------------------------------------------* * float to integer conversion with saturation control *-----------------------------------------------------------------*/ for ( n = 0; n < n_channels; n++ ) { for ( i = 0; i < output_frame; i++ ) { synth_out[i * n_channels + n] = synth[n][i]; } } return; } #endif /*-------------------------------------------------------------------* * mvr2r_inc() Loading lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define JBM_MEMORY_OPT /* VA: issue 916: optimization of RAM in the JBM decoder */ /* #################### End BE switches ################################## */ Loading lib_dec/ivas_jbm_dec.c +2 −243 Original line number Diff line number Diff line Loading @@ -758,19 +758,10 @@ 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*/ #ifndef JBM_MEMORY_OPT , float *data /* i : transport channels */ #endif ) { #ifdef JBM_MEMORY_OPT float tmp_buf[MAX_JBM_L_FRAME48k]; float *p_data_f[FOA_CHANNELS + MAX_NUM_OBJECTS]; #else 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]; #endif int16_t n, n_render_timeslots, n_ch_cldfb; int16_t ch; DECODER_TC_BUFFER_HANDLE hTcBuffer; Loading @@ -780,7 +771,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( if ( st_ivas->hDecoderConfig->Opt_tsm ) { #ifdef JBM_MEMORY_OPT int16_t n_samples_still_available; int16_t n_ch_full_copy, n_ch_res_copy; Loading Loading @@ -811,47 +801,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( mvr2r( tmp_buf + nSamplesForRendering - *nSamplesResidual, hTcBuffer->tc_buffer_old[ch], *nSamplesResidual ); } } #else int16_t n_samples_still_available, m; int16_t n_ch_full_copy; int16_t n_ch_res_copy; for ( n = 0; n < n_ch_cldfb; n++ ) { p_data_f[n] = &data_f[n][0]; } n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered; hTcBuffer->n_samples_buffered = n_samples_still_available + nSamplesForRendering + hTcBuffer->n_samples_discard; hTcBuffer->n_samples_available = hTcBuffer->n_samples_granularity * ( hTcBuffer->n_samples_buffered / hTcBuffer->n_samples_granularity ); *nSamplesResidual = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_available; n_ch_full_copy = min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); n_ch_res_copy = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; for ( ch = 0; ch < n_ch_full_copy; ch++ ) { set_zero( hTcBuffer->tc[ch], hTcBuffer->n_samples_discard ); mvr2r( hTcBuffer->tc[ch] + hTcBuffer->n_samples_rendered, hTcBuffer->tc[ch] + hTcBuffer->n_samples_discard, n_samples_still_available ); for ( m = 0; m < nSamplesForRendering; m++ ) { hTcBuffer->tc[ch][n_samples_still_available + hTcBuffer->n_samples_discard + m] = data[m * hTcBuffer->nchan_transport_jbm + ch]; } } if ( n_ch_res_copy > 0 ) { for ( ; ch < hTcBuffer->nchan_transport_jbm; ch++ ) { mvr2r( hTcBuffer->tc[ch], p_data_f[ch], n_samples_still_available ); for ( m = 0; m < nSamplesForRendering; m++ ) { p_data_f[ch][n_samples_still_available + m] = data[m * hTcBuffer->nchan_transport_jbm + ch]; } mvr2r( p_data_f[ch] + hTcBuffer->n_samples_available, hTcBuffer->tc[ch], *nSamplesResidual ); } } #endif n_render_timeslots = hTcBuffer->n_samples_available / hTcBuffer->n_samples_granularity; } Loading @@ -862,11 +811,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( p_data_f[n] = &st_ivas->p_output_f[n][0]; } #ifdef JBM_MEMORY_OPT ch = max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); #else ch = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); #endif for ( n = 0; n < ch; n++ ) { hTcBuffer->tc[n] = st_ivas->p_output_f[n]; /* note: buffers needed in the TD decorellator */ Loading Loading @@ -940,11 +885,7 @@ ivas_error ivas_jbm_dec_render( if ( !st_ivas->hDecoderConfig->Opt_tsm ) { #ifdef JBM_MEMORY_OPT for ( n = 0; n < MAX_INTERN_CHANNELS; n++ ) #else for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ ) #endif { st_ivas->hTcBuffer->tc[n] = p_output[n]; } Loading Loading @@ -1397,11 +1338,7 @@ ivas_error ivas_jbm_dec_render( break; case PCM_FLOAT32: #ifdef JBM_MEMORY_OPT ivas_buffer_deinterleaved_to_interleaved( p_output, nchan_out_syn_output, *nSamplesRendered, (float *) data ); #else ivas_syn_output_f( p_output, *nSamplesRendered, nchan_out_syn_output, (float *) data ); #endif break; default: error = IVAS_ERR_UNKNOWN; Loading Loading @@ -1464,7 +1401,6 @@ ivas_error ivas_jbm_dec_flush_renderer( { int16_t ch_idx; #ifdef JBM_MEMORY_OPT /* render available full slots (with new lower granularity) */ for ( ch_idx = 0; ch_idx < max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); ch_idx++ ) { Loading @@ -1472,16 +1408,6 @@ ivas_error ivas_jbm_dec_flush_renderer( mvr2r( hTcBuffer->tc_buffer_old[ch_idx], hTcBuffer->tc[ch_idx], n_samples_to_render ); set_zero( hTcBuffer->tc[ch_idx] + n_samples_to_render, hTcBuffer->n_samples_granularity - n_samples_to_render ); } #else /* render what is still there with zero padding */ for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { /* move it at the beginning of the TC buffer with zero padding */ mvr2r( hTcBuffer->tc[ch_idx] + hTcBuffer->n_samples_rendered, hTcBuffer->tc[ch_idx], n_samples_to_render ); set_zero( hTcBuffer->tc[ch_idx] + n_samples_to_render, hTcBuffer->n_samples_granularity - n_samples_to_render ); mvr2r( hTcBuffer->tc[ch_idx] + hTcBuffer->n_samples_rendered + n_samples_to_render, hTcBuffer->tc[ch_idx] + hTcBuffer->n_samples_granularity, n_samples_still_available ); } #endif /* simple change of the slot info */ hTcBuffer->num_slots = 1; Loading Loading @@ -1683,11 +1609,7 @@ ivas_error ivas_jbm_dec_flush_renderer( ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (int16_t *) data ); break; case PCM_FLOAT32: #ifdef JBM_MEMORY_OPT ivas_buffer_deinterleaved_to_interleaved( p_output, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, (float *) data ); #else ivas_syn_output_f( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (float *) data ); #endif break; default: error = IVAS_ERR_UNKNOWN; Loading Loading @@ -2108,7 +2030,6 @@ int16_t ivas_jbm_dec_get_render_granularity( return render_granularity; } #ifdef JBM_MEMORY_OPT /*--------------------------------------------------------------------------* * ivas_jbm_dec_tc_audio_allocate() Loading Loading @@ -2228,7 +2149,7 @@ static void ivas_jbm_dec_tc_audio_deallocate( return; } #endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_tc_buffer_open() Loading @@ -2245,17 +2166,9 @@ ivas_error ivas_jbm_dec_tc_buffer_open( const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ ) { #ifndef JBM_MEMORY_OPT int16_t nsamp_to_allocate; #endif DECODER_TC_BUFFER_HANDLE hTcBuffer; int16_t nMaxSlotsPerSubframe; #ifdef JBM_MEMORY_OPT ivas_error error; #else int16_t nchan_residual; int16_t ch_idx; #endif /*-----------------------------------------------------------------* * prepare library opening Loading @@ -2270,9 +2183,6 @@ 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 JBM_MEMORY_OPT 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 @@ -2282,80 +2192,16 @@ ivas_error ivas_jbm_dec_tc_buffer_open( hTcBuffer->n_samples_discard = 0; hTcBuffer->n_samples_flushed = 0; hTcBuffer->nb_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; #ifndef JBM_MEMORY_OPT nsamp_to_allocate = 0; #endif nMaxSlotsPerSubframe = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / hTcBuffer->n_samples_granularity; hTcBuffer->num_slots = nMaxSlotsPerSubframe * MAX_PARAM_SPATIAL_SUBFRAMES; set_s( hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, MAX_PARAM_SPATIAL_SUBFRAMES ); #ifdef JBM_MEMORY_OPT if ( ( error = ivas_jbm_dec_tc_audio_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; if ( st_ivas->hDecoderConfig->Opt_tsm ) { n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); n_samp_residual = hTcBuffer->n_samples_granularity - 1; } else { n_samp_full = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); n_samp_residual = 0; } nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; if ( nsamp_to_allocate == 0 ) { hTcBuffer->tc_buffer = NULL; for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } } else { if ( st_ivas->hDecoderConfig->Opt_tsm ) { /* note: the maximum buffer length is for OSBA DISC mode with ISMs -> 15*(1920+239)=32385 samples */ 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; } } else { hTcBuffer->tc_buffer = NULL; } } } #endif st_ivas->hTcBuffer = hTcBuffer; Loading @@ -2378,12 +2224,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ ) { #ifdef JBM_MEMORY_OPT 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; Loading Loading @@ -2425,9 +2266,6 @@ 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 JBM_MEMORY_OPT nchan_residual = nchan_transport_internal - nchan_full; #endif hTcBuffer->n_samples_granularity = n_samples_granularity; #ifdef DEBUGGING Loading @@ -2435,7 +2273,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( assert( ( hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered ) < n_samples_granularity ); #endif #ifdef JBM_MEMORY_OPT /* reallocate TC audio buffers */ ivas_jbm_dec_tc_audio_deallocate( hTcBuffer ); Loading @@ -2444,67 +2281,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( { return error; } #else /* realloc buffers */ if ( hTcBuffer->tc_buffer != NULL ) { free( hTcBuffer->tc_buffer ); hTcBuffer->tc_buffer = NULL; } if ( st_ivas->hDecoderConfig->Opt_tsm ) { n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); n_samp_residual = hTcBuffer->n_samples_granularity - 1; } else { n_samp_full = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); n_samp_residual = 0; } nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; if ( nsamp_to_allocate == 0 ) { hTcBuffer->tc_buffer = NULL; for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } } else { if ( st_ivas->hDecoderConfig->Opt_tsm ) { 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; } } else { hTcBuffer->tc_buffer = NULL; } } #endif return IVAS_ERR_OK; } Loading Loading @@ -2563,26 +2339,9 @@ void ivas_jbm_dec_tc_buffer_close( DECODER_TC_BUFFER_HANDLE *phTcBuffer /* i/o: TC buffer handle */ ) { #ifndef JBM_MEMORY_OPT int16_t i; #endif if ( *phTcBuffer != NULL ) { #ifdef JBM_MEMORY_OPT ivas_jbm_dec_tc_audio_deallocate( *phTcBuffer ); #else for ( i = 0; i < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { ( *phTcBuffer )->tc[i] = NULL; } if ( ( *phTcBuffer )->tc_buffer != NULL ) { free( ( *phTcBuffer )->tc_buffer ); ( *phTcBuffer )->tc_buffer = NULL; } #endif free( *phTcBuffer ); *phTcBuffer = NULL; Loading Loading
lib_com/ivas_cnst.h +0 −5 Original line number Diff line number Diff line Loading @@ -172,13 +172,8 @@ typedef enum #define JBM_CLDFB_SLOTS_IN_SUBFRAME 4 #define MAX_JBM_CLDFB_TIMESLOTS 32 #define DEFAULT_JBM_CLDFB_TIMESLOTS 16 #ifdef JBM_MEMORY_OPT #define MAX_JBM_L_FRAME48k ( IVAS_MAX_FRAME_SIZE * 2 ) /* 1920: max. time-scaled frame buffer length (per channel) in samples */ #define MAX_JBM_L_FRAME_NS 40000000L /* 40 ms: time-scaled frame size in ns, proportional to MAX_JBM_L_FRAME48k */ #else #define MAX_JBM_L_FRAME48k 1920 #define MAX_JBM_L_FRAME_NS 40000000L #endif #define MAX_SPAR_INTERNAL_CHANNELS IVAS_SPAR_MAX_CH #define MAX_CLDFB_DIGEST_CHANNELS 3 /* == maximum of ParamISM TCs and ParamMC TCs */ Loading
lib_com/ivas_prot.h +0 −13 Original line number Diff line number Diff line Loading @@ -259,7 +259,6 @@ uint32_t ivas_syn_output( int16_t *synth_out /* o : integer 16 bits synthesis signal */ ); #ifdef JBM_MEMORY_OPT void ivas_buffer_interleaved_to_deinterleaved( float *audio, /* i/o: audio buffer */ const int16_t n_channels, /* i : number of channels */ Loading @@ -273,14 +272,6 @@ void ivas_buffer_deinterleaved_to_interleaved( const int16_t frame_length, /* i : frame length (one channel) */ float *audio_out /* o : interleaved audio buffer */ ); #else void ivas_syn_output_f( float *synth[], /* i/o: float synthesis signal */ const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ float *synth_out /* o : integer 16 bits synthesis signal */ ); #endif void ivas_initialize_handles_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ Loading Loading @@ -849,10 +840,6 @@ 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*/ #ifndef JBM_MEMORY_OPT , float *data /* i/o: time-scaled transport channels */ #endif ); void ivas_dec_prepare_renderer( Loading
lib_com/ivas_tools.c +0 −36 Original line number Diff line number Diff line Loading @@ -148,7 +148,6 @@ uint32_t ivas_syn_output( return noClipping; } #ifdef JBM_MEMORY_OPT /*-------------------------------------------------------------------* * ivas_buffer_interleaved_to_deinterleaved() Loading Loading @@ -211,41 +210,6 @@ void ivas_buffer_deinterleaved_to_interleaved( return; } #else /*-------------------------------------------------------------------* * ivas_syn_output_f() * * Output ivas synthesis signal with compensation for saturation * returns number of clipped samples *-------------------------------------------------------------------*/ /*! r: number of clipped samples */ void ivas_syn_output_f( float *synth[], /* i/o: float synthesis signal */ const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ float *synth_out /* o : integer 16 bits synthesis signal */ ) { int16_t i, n; /*-----------------------------------------------------------------* * float to integer conversion with saturation control *-----------------------------------------------------------------*/ for ( n = 0; n < n_channels; n++ ) { for ( i = 0; i < output_frame; i++ ) { synth_out[i * n_channels + n] = synth[n][i]; } } return; } #endif /*-------------------------------------------------------------------* * mvr2r_inc() Loading
lib_com/options.h +1 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define JBM_MEMORY_OPT /* VA: issue 916: optimization of RAM in the JBM decoder */ /* #################### End BE switches ################################## */ Loading
lib_dec/ivas_jbm_dec.c +2 −243 Original line number Diff line number Diff line Loading @@ -758,19 +758,10 @@ 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*/ #ifndef JBM_MEMORY_OPT , float *data /* i : transport channels */ #endif ) { #ifdef JBM_MEMORY_OPT float tmp_buf[MAX_JBM_L_FRAME48k]; float *p_data_f[FOA_CHANNELS + MAX_NUM_OBJECTS]; #else 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]; #endif int16_t n, n_render_timeslots, n_ch_cldfb; int16_t ch; DECODER_TC_BUFFER_HANDLE hTcBuffer; Loading @@ -780,7 +771,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( if ( st_ivas->hDecoderConfig->Opt_tsm ) { #ifdef JBM_MEMORY_OPT int16_t n_samples_still_available; int16_t n_ch_full_copy, n_ch_res_copy; Loading Loading @@ -811,47 +801,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( mvr2r( tmp_buf + nSamplesForRendering - *nSamplesResidual, hTcBuffer->tc_buffer_old[ch], *nSamplesResidual ); } } #else int16_t n_samples_still_available, m; int16_t n_ch_full_copy; int16_t n_ch_res_copy; for ( n = 0; n < n_ch_cldfb; n++ ) { p_data_f[n] = &data_f[n][0]; } n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered; hTcBuffer->n_samples_buffered = n_samples_still_available + nSamplesForRendering + hTcBuffer->n_samples_discard; hTcBuffer->n_samples_available = hTcBuffer->n_samples_granularity * ( hTcBuffer->n_samples_buffered / hTcBuffer->n_samples_granularity ); *nSamplesResidual = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_available; n_ch_full_copy = min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); n_ch_res_copy = hTcBuffer->nchan_transport_jbm - hTcBuffer->nchan_buffer_full; for ( ch = 0; ch < n_ch_full_copy; ch++ ) { set_zero( hTcBuffer->tc[ch], hTcBuffer->n_samples_discard ); mvr2r( hTcBuffer->tc[ch] + hTcBuffer->n_samples_rendered, hTcBuffer->tc[ch] + hTcBuffer->n_samples_discard, n_samples_still_available ); for ( m = 0; m < nSamplesForRendering; m++ ) { hTcBuffer->tc[ch][n_samples_still_available + hTcBuffer->n_samples_discard + m] = data[m * hTcBuffer->nchan_transport_jbm + ch]; } } if ( n_ch_res_copy > 0 ) { for ( ; ch < hTcBuffer->nchan_transport_jbm; ch++ ) { mvr2r( hTcBuffer->tc[ch], p_data_f[ch], n_samples_still_available ); for ( m = 0; m < nSamplesForRendering; m++ ) { p_data_f[ch][n_samples_still_available + m] = data[m * hTcBuffer->nchan_transport_jbm + ch]; } mvr2r( p_data_f[ch] + hTcBuffer->n_samples_available, hTcBuffer->tc[ch], *nSamplesResidual ); } } #endif n_render_timeslots = hTcBuffer->n_samples_available / hTcBuffer->n_samples_granularity; } Loading @@ -862,11 +811,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( p_data_f[n] = &st_ivas->p_output_f[n][0]; } #ifdef JBM_MEMORY_OPT ch = max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); #else ch = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); #endif for ( n = 0; n < ch; n++ ) { hTcBuffer->tc[n] = st_ivas->p_output_f[n]; /* note: buffers needed in the TD decorellator */ Loading Loading @@ -940,11 +885,7 @@ ivas_error ivas_jbm_dec_render( if ( !st_ivas->hDecoderConfig->Opt_tsm ) { #ifdef JBM_MEMORY_OPT for ( n = 0; n < MAX_INTERN_CHANNELS; n++ ) #else for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ ) #endif { st_ivas->hTcBuffer->tc[n] = p_output[n]; } Loading Loading @@ -1397,11 +1338,7 @@ ivas_error ivas_jbm_dec_render( break; case PCM_FLOAT32: #ifdef JBM_MEMORY_OPT ivas_buffer_deinterleaved_to_interleaved( p_output, nchan_out_syn_output, *nSamplesRendered, (float *) data ); #else ivas_syn_output_f( p_output, *nSamplesRendered, nchan_out_syn_output, (float *) data ); #endif break; default: error = IVAS_ERR_UNKNOWN; Loading Loading @@ -1464,7 +1401,6 @@ ivas_error ivas_jbm_dec_flush_renderer( { int16_t ch_idx; #ifdef JBM_MEMORY_OPT /* render available full slots (with new lower granularity) */ for ( ch_idx = 0; ch_idx < max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full ); ch_idx++ ) { Loading @@ -1472,16 +1408,6 @@ ivas_error ivas_jbm_dec_flush_renderer( mvr2r( hTcBuffer->tc_buffer_old[ch_idx], hTcBuffer->tc[ch_idx], n_samples_to_render ); set_zero( hTcBuffer->tc[ch_idx] + n_samples_to_render, hTcBuffer->n_samples_granularity - n_samples_to_render ); } #else /* render what is still there with zero padding */ for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { /* move it at the beginning of the TC buffer with zero padding */ mvr2r( hTcBuffer->tc[ch_idx] + hTcBuffer->n_samples_rendered, hTcBuffer->tc[ch_idx], n_samples_to_render ); set_zero( hTcBuffer->tc[ch_idx] + n_samples_to_render, hTcBuffer->n_samples_granularity - n_samples_to_render ); mvr2r( hTcBuffer->tc[ch_idx] + hTcBuffer->n_samples_rendered + n_samples_to_render, hTcBuffer->tc[ch_idx] + hTcBuffer->n_samples_granularity, n_samples_still_available ); } #endif /* simple change of the slot info */ hTcBuffer->num_slots = 1; Loading Loading @@ -1683,11 +1609,7 @@ ivas_error ivas_jbm_dec_flush_renderer( ivas_syn_output( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (int16_t *) data ); break; case PCM_FLOAT32: #ifdef JBM_MEMORY_OPT ivas_buffer_deinterleaved_to_interleaved( p_output, st_ivas->hDecoderConfig->nchan_out, *nSamplesRendered, (float *) data ); #else ivas_syn_output_f( p_output, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, (float *) data ); #endif break; default: error = IVAS_ERR_UNKNOWN; Loading Loading @@ -2108,7 +2030,6 @@ int16_t ivas_jbm_dec_get_render_granularity( return render_granularity; } #ifdef JBM_MEMORY_OPT /*--------------------------------------------------------------------------* * ivas_jbm_dec_tc_audio_allocate() Loading Loading @@ -2228,7 +2149,7 @@ static void ivas_jbm_dec_tc_audio_deallocate( return; } #endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_tc_buffer_open() Loading @@ -2245,17 +2166,9 @@ ivas_error ivas_jbm_dec_tc_buffer_open( const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ ) { #ifndef JBM_MEMORY_OPT int16_t nsamp_to_allocate; #endif DECODER_TC_BUFFER_HANDLE hTcBuffer; int16_t nMaxSlotsPerSubframe; #ifdef JBM_MEMORY_OPT ivas_error error; #else int16_t nchan_residual; int16_t ch_idx; #endif /*-----------------------------------------------------------------* * prepare library opening Loading @@ -2270,9 +2183,6 @@ 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 JBM_MEMORY_OPT 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 @@ -2282,80 +2192,16 @@ ivas_error ivas_jbm_dec_tc_buffer_open( hTcBuffer->n_samples_discard = 0; hTcBuffer->n_samples_flushed = 0; hTcBuffer->nb_subframes = MAX_PARAM_SPATIAL_SUBFRAMES; #ifndef JBM_MEMORY_OPT nsamp_to_allocate = 0; #endif nMaxSlotsPerSubframe = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) / hTcBuffer->n_samples_granularity; hTcBuffer->num_slots = nMaxSlotsPerSubframe * MAX_PARAM_SPATIAL_SUBFRAMES; set_s( hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, MAX_PARAM_SPATIAL_SUBFRAMES ); #ifdef JBM_MEMORY_OPT if ( ( error = ivas_jbm_dec_tc_audio_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; if ( st_ivas->hDecoderConfig->Opt_tsm ) { n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); n_samp_residual = hTcBuffer->n_samples_granularity - 1; } else { n_samp_full = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); n_samp_residual = 0; } nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; if ( nsamp_to_allocate == 0 ) { hTcBuffer->tc_buffer = NULL; for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } } else { if ( st_ivas->hDecoderConfig->Opt_tsm ) { /* note: the maximum buffer length is for OSBA DISC mode with ISMs -> 15*(1920+239)=32385 samples */ 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; } } else { hTcBuffer->tc_buffer = NULL; } } } #endif st_ivas->hTcBuffer = hTcBuffer; Loading @@ -2378,12 +2224,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ ) { #ifdef JBM_MEMORY_OPT 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; Loading Loading @@ -2425,9 +2266,6 @@ 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 JBM_MEMORY_OPT nchan_residual = nchan_transport_internal - nchan_full; #endif hTcBuffer->n_samples_granularity = n_samples_granularity; #ifdef DEBUGGING Loading @@ -2435,7 +2273,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( assert( ( hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered ) < n_samples_granularity ); #endif #ifdef JBM_MEMORY_OPT /* reallocate TC audio buffers */ ivas_jbm_dec_tc_audio_deallocate( hTcBuffer ); Loading @@ -2444,67 +2281,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( { return error; } #else /* realloc buffers */ if ( hTcBuffer->tc_buffer != NULL ) { free( hTcBuffer->tc_buffer ); hTcBuffer->tc_buffer = NULL; } if ( st_ivas->hDecoderConfig->Opt_tsm ) { n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 ); n_samp_residual = hTcBuffer->n_samples_granularity - 1; } else { n_samp_full = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); n_samp_residual = 0; } nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full; nsamp_to_allocate += nchan_residual * n_samp_residual; if ( nsamp_to_allocate == 0 ) { hTcBuffer->tc_buffer = NULL; for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { hTcBuffer->tc[ch_idx] = NULL; } } else { if ( st_ivas->hDecoderConfig->Opt_tsm ) { 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; } } else { hTcBuffer->tc_buffer = NULL; } } #endif return IVAS_ERR_OK; } Loading Loading @@ -2563,26 +2339,9 @@ void ivas_jbm_dec_tc_buffer_close( DECODER_TC_BUFFER_HANDLE *phTcBuffer /* i/o: TC buffer handle */ ) { #ifndef JBM_MEMORY_OPT int16_t i; #endif if ( *phTcBuffer != NULL ) { #ifdef JBM_MEMORY_OPT ivas_jbm_dec_tc_audio_deallocate( *phTcBuffer ); #else for ( i = 0; i < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { ( *phTcBuffer )->tc[i] = NULL; } if ( ( *phTcBuffer )->tc_buffer != NULL ) { free( ( *phTcBuffer )->tc_buffer ); ( *phTcBuffer )->tc_buffer = NULL; } #endif free( *phTcBuffer ); *phTcBuffer = NULL; Loading