Commit 3cf96ec2 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_158_DIRAC_MEM

parent 752e51df
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -148,7 +148,6 @@
#define FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS              /* Issue 124: do not allocate unused plc struct in IVAS modes which is only used in EVS mono */
#define SBA_BR_SWITCHING                                /* Issue 114: Changes for sba bit rate switching*/
#define FIX_ITD                                         /* Contribution 16: TD renderer ITD improvement and code cleanup */
#define FIX_158_DIRAC_MEM                               /* Issue 158: Reduce memory consumption in the hDirac_mem handle */
#define BRATE_SWITCHING_FRAMEWORK                       /* Bitrate switching changes related to the general framework  */
#define BRATE_SWITCHING_RENDERING                       /* Bitrate switching changes related to the renderers */
#define FIX_185_REDUCE_MD_BITS                          /* Issue 185: Crash in SBA encoder for 24.4 kbps HOA3 input with longer testvector */
+0 −48
Original line number Diff line number Diff line
@@ -49,11 +49,7 @@
/*-----------------------------------------------------------------------*
 * 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 );

@@ -723,12 +719,10 @@ 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;
@@ -741,12 +735,10 @@ 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 ) ) )
@@ -762,13 +754,11 @@ 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 */
@@ -779,11 +769,7 @@ 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 );

@@ -967,13 +953,11 @@ 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++ )
    {
@@ -1130,9 +1114,7 @@ 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;
@@ -1165,14 +1147,10 @@ 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;
@@ -1201,17 +1179,13 @@ 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 );
@@ -1220,25 +1194,19 @@ 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;

@@ -1246,20 +1214,14 @@ 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
    {
@@ -1267,20 +1229,10 @@ 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;
+0 −4
Original line number Diff line number Diff line
@@ -673,11 +673,7 @@ 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*/