Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,7 @@ #define FIX_IGF_NOISE_REPETITION /* Issue 182: fix repetition of same noise in IGF */ #define FIX_126_MDFT_FB_STATIC_MEM /* Issue 126: reduce static mem consumption of the MDFT FB for non-SBA formats */ #define FIX_I214_CLIPPING_STANDALONE_REND /* Issue 214: TD standalone renderer does not handle clipping */ #define FIX_158_DIRAC_MEM /* Issue 158: Reduce memory consumption in the hDirac_mem handle */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading lib_dec/ivas_dirac_dec.c +105 −16 Original line number Diff line number Diff line Loading @@ -49,8 +49,11 @@ /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ #ifdef FIX_158_DIRAC_MEM static void ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); #else static void ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); #endif static void ivas_dirac_free_mem( DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); Loading Loading @@ -714,6 +717,13 @@ ivas_error ivas_dirac_dec_config( } } #ifdef FIX_158_DIRAC_MEM if ( flag_config == DIRAC_OPEN ) { hDirAC->buffer_energy = NULL; } #endif if ( ( flag_config == DIRAC_OPEN && hDirAC->hConfig->dec_param_estim == TRUE ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->hConfig->dec_param_estim == TRUE && dec_param_estim_old == FALSE ) ) ) { hDirAC->index_buffer_intensity = 0; Loading @@ -726,7 +736,12 @@ ivas_error ivas_dirac_dec_config( set_f( hDirAC->buffer_intensity_real[i][j], 0.0f, CLDFB_NO_CHANNELS_MAX ); } } #ifdef FIX_158_DIRAC_MEM if ( hDirAC->buffer_energy == NULL ) { hDirAC->buffer_energy = (float *) count_malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); } #endif set_f( hDirAC->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); } else if ( ( flag_config == DIRAC_OPEN && hDirAC->hConfig->dec_param_estim == FALSE ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->hConfig->dec_param_estim == FALSE && dec_param_estim_old == TRUE ) ) ) Loading @@ -742,6 +757,13 @@ ivas_error ivas_dirac_dec_config( hDirAC->buffer_intensity_real[i][j] = NULL; } } #ifdef FIX_158_DIRAC_MEM if ( hDirAC->buffer_energy != NULL ) { count_free( hDirAC->buffer_energy ); hDirAC->buffer_energy = NULL; } #endif } /* output synthesis */ Loading @@ -752,7 +774,11 @@ ivas_error ivas_dirac_dec_config( { ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); } #ifdef FIX_158_DIRAC_MEM ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ) ); #else ivas_dirac_alloc_mem( hDirAC, &( hDirAC->stack_mem ) ); #endif mvs2s( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); Loading Loading @@ -935,6 +961,13 @@ void ivas_dirac_dec_close( } } } #ifdef FIX_158_DIRAC_MEM if ( hDirAC->buffer_energy != NULL ) { count_free( hDirAC->buffer_energy ); hDirAC->buffer_energy = NULL; } #endif for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { Loading Loading @@ -1091,6 +1124,9 @@ void ivas_dirac_dec_close( static void ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, #ifdef FIX_158_DIRAC_MEM const RENDERER_TYPE renderer_type, #endif DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ) { int16_t num_freq_bands, num_freq_bands_diff, size; Loading @@ -1113,6 +1149,9 @@ static void ivas_dirac_alloc_mem( hDirAC_mem->proto_power_diff_smooth = NULL; hDirAC_mem->direct_responses_square = NULL; hDirAC_mem->frame_dec_f = NULL; #ifdef FIX_158_DIRAC_MEM hDirAC_mem->proto_diffuse_buffer_f = NULL; #endif if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ); Loading @@ -1123,8 +1162,14 @@ static void ivas_dirac_alloc_mem( set_zero( hDirAC_mem->proto_power_diff_smooth, size ); hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ); set_zero( hDirAC_mem->direct_responses_square, size ); #ifdef FIX_158_DIRAC_MEM if ( hDirAC->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) { #endif hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM } #endif } hDirAC->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; hDirAC->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; Loading Loading @@ -1153,7 +1198,17 @@ static void ivas_dirac_alloc_mem( hDirAC->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; /* Prototypes */ #ifdef FIX_158_DIRAC_MEM hDirAC_mem->proto_direct_buffer_f = NULL; hDirAC_mem->proto_diffuse_buffer_f = NULL; if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { #endif hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM if ( hDirAC->proto_signal_decorr_on ) { #endif if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ); Loading @@ -1162,12 +1217,25 @@ static void ivas_dirac_alloc_mem( { hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ); } #ifdef FIX_158_DIRAC_MEM } } #endif hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; /* Gains/power factors*/ #ifdef FIX_158_DIRAC_MEM hDirAC_mem->direct_power_factor = NULL; hDirAC_mem->diffuse_power_factor = NULL; if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { #endif hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ); hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM } #endif hDirAC->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; hDirAC->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; Loading @@ -1175,8 +1243,20 @@ static void ivas_dirac_alloc_mem( hDirAC_mem->onset_filter = NULL; if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { #ifdef FIX_158_DIRAC_MEM if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { #endif hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM if ( hDirAC->proto_signal_decorr_on ) { #endif hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM } } #endif } else { Loading @@ -1184,11 +1264,20 @@ static void ivas_dirac_alloc_mem( { hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ); } #ifndef FIX_158_DIRAC_MEM else { hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * num_freq_bands ); } #endif #ifdef FIX_158_DIRAC_MEM if ( hDirAC->proto_signal_decorr_on ) { #endif hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM } #endif } return; Loading lib_dec/ivas_stat_dec.h +4 −0 Original line number Diff line number Diff line Loading @@ -663,7 +663,11 @@ typedef struct ivas_dirac_dec_data_structure /*Parameter estimation*/ int16_t index_buffer_intensity; float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; #ifdef FIX_158_DIRAC_MEM float *buffer_energy; #else float buffer_energy[DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX]; #endif /*Decoder parameters */ /*Prototypes*/ Loading Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,7 @@ #define FIX_IGF_NOISE_REPETITION /* Issue 182: fix repetition of same noise in IGF */ #define FIX_126_MDFT_FB_STATIC_MEM /* Issue 126: reduce static mem consumption of the MDFT FB for non-SBA formats */ #define FIX_I214_CLIPPING_STANDALONE_REND /* Issue 214: TD standalone renderer does not handle clipping */ #define FIX_158_DIRAC_MEM /* Issue 158: Reduce memory consumption in the hDirac_mem handle */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading
lib_dec/ivas_dirac_dec.c +105 −16 Original line number Diff line number Diff line Loading @@ -49,8 +49,11 @@ /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ #ifdef FIX_158_DIRAC_MEM static void ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, const RENDERER_TYPE renderer_type, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); #else static void ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); #endif static void ivas_dirac_free_mem( DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ); Loading Loading @@ -714,6 +717,13 @@ ivas_error ivas_dirac_dec_config( } } #ifdef FIX_158_DIRAC_MEM if ( flag_config == DIRAC_OPEN ) { hDirAC->buffer_energy = NULL; } #endif if ( ( flag_config == DIRAC_OPEN && hDirAC->hConfig->dec_param_estim == TRUE ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->hConfig->dec_param_estim == TRUE && dec_param_estim_old == FALSE ) ) ) { hDirAC->index_buffer_intensity = 0; Loading @@ -726,7 +736,12 @@ ivas_error ivas_dirac_dec_config( set_f( hDirAC->buffer_intensity_real[i][j], 0.0f, CLDFB_NO_CHANNELS_MAX ); } } #ifdef FIX_158_DIRAC_MEM if ( hDirAC->buffer_energy == NULL ) { hDirAC->buffer_energy = (float *) count_malloc( DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); } #endif set_f( hDirAC->buffer_energy, 0.0f, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); } else if ( ( flag_config == DIRAC_OPEN && hDirAC->hConfig->dec_param_estim == FALSE ) || ( flag_config == DIRAC_RECONFIGURE && ( hDirAC->hConfig->dec_param_estim == FALSE && dec_param_estim_old == TRUE ) ) ) Loading @@ -742,6 +757,13 @@ ivas_error ivas_dirac_dec_config( hDirAC->buffer_intensity_real[i][j] = NULL; } } #ifdef FIX_158_DIRAC_MEM if ( hDirAC->buffer_energy != NULL ) { count_free( hDirAC->buffer_energy ); hDirAC->buffer_energy = NULL; } #endif } /* output synthesis */ Loading @@ -752,7 +774,11 @@ ivas_error ivas_dirac_dec_config( { ivas_dirac_free_mem( &( hDirAC->stack_mem ) ); } #ifdef FIX_158_DIRAC_MEM ivas_dirac_alloc_mem( hDirAC, st_ivas->renderer_type, &( hDirAC->stack_mem ) ); #else ivas_dirac_alloc_mem( hDirAC, &( hDirAC->stack_mem ) ); #endif mvs2s( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); Loading Loading @@ -935,6 +961,13 @@ void ivas_dirac_dec_close( } } } #ifdef FIX_158_DIRAC_MEM if ( hDirAC->buffer_energy != NULL ) { count_free( hDirAC->buffer_energy ); hDirAC->buffer_energy = NULL; } #endif for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { Loading Loading @@ -1091,6 +1124,9 @@ void ivas_dirac_dec_close( static void ivas_dirac_alloc_mem( DIRAC_DEC_HANDLE hDirAC, #ifdef FIX_158_DIRAC_MEM const RENDERER_TYPE renderer_type, #endif DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ) { int16_t num_freq_bands, num_freq_bands_diff, size; Loading @@ -1113,6 +1149,9 @@ static void ivas_dirac_alloc_mem( hDirAC_mem->proto_power_diff_smooth = NULL; hDirAC_mem->direct_responses_square = NULL; hDirAC_mem->frame_dec_f = NULL; #ifdef FIX_158_DIRAC_MEM hDirAC_mem->proto_diffuse_buffer_f = NULL; #endif if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ); Loading @@ -1123,8 +1162,14 @@ static void ivas_dirac_alloc_mem( set_zero( hDirAC_mem->proto_power_diff_smooth, size ); hDirAC_mem->direct_responses_square = (float *) malloc( sizeof( float ) * size ); set_zero( hDirAC_mem->direct_responses_square, size ); #ifdef FIX_158_DIRAC_MEM if ( hDirAC->proto_signal_decorr_on && ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) ) { #endif hDirAC_mem->frame_dec_f = (float *) malloc( sizeof( float ) * 2 * num_outputs_diff * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM } #endif } hDirAC->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; hDirAC->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; Loading Loading @@ -1153,7 +1198,17 @@ static void ivas_dirac_alloc_mem( hDirAC->h_output_synthesis_psd_state.direct_responses = hDirAC_mem->direct_responses; /* Prototypes */ #ifdef FIX_158_DIRAC_MEM hDirAC_mem->proto_direct_buffer_f = NULL; hDirAC_mem->proto_diffuse_buffer_f = NULL; if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { #endif hDirAC_mem->proto_direct_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_protos_dir * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM if ( hDirAC->proto_signal_decorr_on ) { #endif if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * size ); Loading @@ -1162,12 +1217,25 @@ static void ivas_dirac_alloc_mem( { hDirAC_mem->proto_diffuse_buffer_f = (float *) malloc( sizeof( float ) * 2 * MAX_PARAM_SPATIAL_SUBFRAMES * num_outputs_diff * num_freq_bands ); } #ifdef FIX_158_DIRAC_MEM } } #endif hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; hDirAC->h_output_synthesis_psd_state.proto_diffuse_buffer_f = hDirAC_mem->proto_diffuse_buffer_f; /* Gains/power factors*/ #ifdef FIX_158_DIRAC_MEM hDirAC_mem->direct_power_factor = NULL; hDirAC_mem->diffuse_power_factor = NULL; if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { #endif hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ); hDirAC_mem->diffuse_power_factor = (float *) malloc( sizeof( float ) * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM } #endif hDirAC->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; hDirAC->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; Loading @@ -1175,8 +1243,20 @@ static void ivas_dirac_alloc_mem( hDirAC_mem->onset_filter = NULL; if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { #ifdef FIX_158_DIRAC_MEM if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { #endif hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM if ( hDirAC->proto_signal_decorr_on ) { #endif hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * num_outputs_diff * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM } } #endif } else { Loading @@ -1184,11 +1264,20 @@ static void ivas_dirac_alloc_mem( { hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * 5 * num_freq_bands ); } #ifndef FIX_158_DIRAC_MEM else { hDirAC_mem->reference_power = (float *) malloc( sizeof( float ) * num_freq_bands ); } #endif #ifdef FIX_158_DIRAC_MEM if ( hDirAC->proto_signal_decorr_on ) { #endif hDirAC_mem->onset_filter = (float *) malloc( sizeof( float ) * 2 * num_freq_bands ); #ifdef FIX_158_DIRAC_MEM } #endif } return; Loading
lib_dec/ivas_stat_dec.h +4 −0 Original line number Diff line number Diff line Loading @@ -663,7 +663,11 @@ typedef struct ivas_dirac_dec_data_structure /*Parameter estimation*/ int16_t index_buffer_intensity; float *buffer_intensity_real[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF]; #ifdef FIX_158_DIRAC_MEM float *buffer_energy; #else float buffer_energy[DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX]; #endif /*Decoder parameters */ /*Prototypes*/ Loading