Commit 79e8caa0 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_20_MS_FRAME_LEN_TABLES_CONVERTER

parent d89158b5
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -151,7 +151,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define SPLIT_REND_WITH_HEAD_ROT  */                  /* Dlb,FhG: Split Rendering contributions 21 and 35 */

#define FIX_20_MS_FRAME_LEN_TABLES_CONVERTER            /* Orange : generate_tables_converter tools can generate rom for 5 and 20 ms frame length */
#define FIX_955_FASTCONV_REND_IN_ISM                    /* VA: put FastConv rendering call under DEBUGGING */
#define FIX_969_USAN_IGF_ARITH                          /* FhG: issue 969: fix USAN error in igf_sce_dec; same issue as #962 */
#define FIX_959_MASA_LINEAR_REND                        /* VA: issue 959: remove unused calling of ivas_sba_linear_renderer() in MASA rendering */
+0 −6
Original line number Diff line number Diff line
@@ -104,7 +104,6 @@ static ivas_error read_txt_float(
    return IVAS_ERR_OK;
}

#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
/*-----------------------------------------------------------------------------------------*
 * Function read_txt_uint32()
 * Reads a float value from a line
@@ -124,7 +123,6 @@ static ivas_error read_txt_int32(

    return IVAS_ERR_OK;
}
#endif

/*-----------------------------------------------------------------------------------------*
 * Function read_txt_vector()
@@ -294,10 +292,8 @@ ivas_error ConfigReader_read(
    hRenderConfig->diffuseEnergyThreshold = DEFAULT_DIFFUSE_ENERGY_THRESHOLD;
    hRenderConfig->diffuseCutOffFreqThreshold = DEFAULT_DIFFUSE_CUT_OFF_FREQ_THRESHOLD;
    hRenderConfig->directCutOffFreqThreshold = DEFAULT_DIRECT_CUT_OFF_FREQ_THRESHOLD;
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
    hRenderConfig->maxNumDirectBlocks = DEFAULT_MAX_NUM_DIRECT_BLOCKS;
    hRenderConfig->maxNumDiffuseBlocks = DEFAULT_MAX_NUM_DIFFUSE_BLOCKS;
#endif
    /* read file line by line */
    while ( fgets( pConfig_str, file_size, pConfigFile ) != NULL )
    {
@@ -416,7 +412,6 @@ ivas_error ConfigReader_read(
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                    }
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
                    else if ( strcmp( item, "MAXNUMDIRECTBLOCKS" ) == 0 )
                    {
                        if ( read_txt_int32( pValue, &hRenderConfig->maxNumDirectBlocks ) != IVAS_ERR_OK )
@@ -433,7 +428,6 @@ ivas_error ConfigReader_read(
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                    }
#endif
                }
                free( pValue );
            }
+0 −4
Original line number Diff line number Diff line
@@ -44,10 +44,8 @@
#define DEFAULT_DIFFUSE_ENERGY_THRESHOLD       ( -25.f )
#define DEFAULT_DIFFUSE_CUT_OFF_FREQ_THRESHOLD ( -20.f )
#define DEFAULT_DIRECT_CUT_OFF_FREQ_THRESHOLD  ( -20.f )
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
#define DEFAULT_MAX_NUM_DIRECT_BLOCKS  ( 40 )
#define DEFAULT_MAX_NUM_DIFFUSE_BLOCKS ( 40 )
#endif


typedef struct ConfigReader
@@ -61,10 +59,8 @@ typedef struct ConfigReader
    float diffuseEnergyThreshold;                          /* use to find the time end limit of the diffuse part (te).  diffuse part. It is a ratio in dB between diffuse part after te and complete diffuse HRIR/BRIR energies. The more the value is near zero the smallest is te, complexity decrease. */
    float diffuseCutOffFreqThreshold;                      /* threshold in dB to determine the cut off (fcdiff) frequency for each slice of the diffuse IR. ratio in dB between the energy after fcdiff and the total energy. The more the value is near zero the smallest is fcdiff, complexity decrease */
    float directCutOffFreqThreshold;                       /* threshold in dB to determine the cut off (fcdirect) frequency for each slice of the direct IR. Do not applied to first slice. ratio in dB between the energy after fcdirect and the total energy. The more the value is near zero the smallest is fcdirect, complexity decrease */
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
    int32_t maxNumDirectBlocks;  /* max number of direct blocks */
    int32_t maxNumDiffuseBlocks; /* max number of diffuse blocks */
#endif
} ConfigReader, *ConfigReaderHandle;

typedef enum
+0 −12
Original line number Diff line number Diff line
@@ -268,10 +268,8 @@ int main( int argc, char *argv[] )
    cfgBrirOptim.endEnergyThreshold = DEFAULT_END_ENERGY_THRESHOLD;
    cfgBrirOptim.harmonizeLateReverbBinauralGain = 1;
    cfgBrirOptim.optimize = 1;
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
    cfgBrirOptim.maxNumDirectBlocks = DEFAULT_MAX_NUM_DIRECT_BLOCKS;
    cfgBrirOptim.maxNumDiffuseBlocks = DEFAULT_MAX_NUM_DIFFUSE_BLOCKS;
#endif

    for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
    {
@@ -1111,9 +1109,7 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
    {
        uint16_t frame_len = L_FRAME48k;
        int32_t maxDel = maxDel48kHz * DEFAULT_SAMPLERATE / sample_rates[indSR];
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
        float mdft_scale_fact;
#endif
        switch ( sample_rates[indSR] )
        {
            case 8000:
@@ -1130,15 +1126,11 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
                frame_len = L_FRAME48k;
                break;
        }
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
        mdft_scale_fact = (float) L_FRAME48k / (float) frame_len;
#endif
        if ( frame_len_ms == 5 )
        {
            frame_len = frame_len >> 2;
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
            mdft_scale_fact = (float) ( L_FRAME48k * 0.25f ) / (float) frame_len;
#endif
        }

        data_IR_current = sofa_data_IR_val_48k;
@@ -1254,18 +1246,14 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
        {
            ivas_crend_binaural_filter_design_compute_filters_params( ivas_hrtf, frame_len, &hrtf_data, &index_start, &index_end, &max_ir_len, cfgReader );
            ivas_crend_binaural_filter_design_set_hrtf_fr( ivas_hrtf, frame_len,
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
                                                           mdft_scale_fact,
#endif
                                                           &hrtf_data, index_start, index_end, &max_ir_len, cfgReader );
        }
        else
        {
            ivas_set_hrtf_fr( &hrtf_data, ivas_hrtf, frame_len
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
                              ,
                              mdft_scale_fact
#endif
            );
        }
        hrtf_data.latency_s += 0.000000001f;
+0 −25
Original line number Diff line number Diff line
@@ -559,20 +559,12 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params(
        {
            pParam->num_iterations[i_chan][0]++;
        }
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
        /* max MAX_LENGTH_DIRECT_FILTER */
        if ( pParam->num_iterations[i_chan][0] > cfgReader->maxNumDirectBlocks )
        {
            pParam->num_iterations[i_chan][0] = cfgReader->maxNumDirectBlocks;
        }
        pParam->num_iterations[i_chan][1] = pParam->num_iterations[i_chan][0];
#else
        pParam->num_iterations[i_chan][1] = pParam->num_iterations[i_chan][0];
        if ( pParam->num_iterations[i_chan][0] > IVAS_MAX_NUM_DIRECT_BLOCKS )
        {
            pParam->num_iterations[i_chan][0] = IVAS_MAX_NUM_DIRECT_BLOCKS;
        }
#endif
    }

    pParam->max_num_iterations = 0;
@@ -662,17 +654,10 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params(
        }

        /* max MAX_NUM_DIFFUSE_BLOCKS */
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
        if ( numDiffuseBlock > cfgReader->maxNumDiffuseBlocks )
        {
            numDiffuseBlock = cfgReader->maxNumDiffuseBlocks;
        }
#else
        if ( numDiffuseBlock > IVAS_MAX_NUM_DIFFUSE_BLOCKS )
        {
            numDiffuseBlock = IVAS_MAX_NUM_DIFFUSE_BLOCKS;
        }
#endif

        for ( i_ear = 0; i_ear < 2; ++i_ear )
        {
@@ -702,9 +687,7 @@ ivas_error ivas_crend_binaural_filter_design_compute_filters_params(
ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr(
    ivas_hrtf_t *pFirData,
    const int16_t frame_len,
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
    float mdft_scale_fact,
#endif
    HRTFS_DATA *pParam,
    int32_t index_start,
    int32_t index_end,
@@ -732,9 +715,6 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr(
    float ppEnergyDiffuseFilter[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS] = { { 0 } }; /* diffuse filter energies ( ppEnergyDiffuseFilter[ear][channel] ) */
    float ppDiffuseWeight[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS] = { { 0 } };       /* diffuse weights ( ppDiffuseWeight[ear][channel] ) */
    float delayf;
#ifndef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
    float mdft_scale_fact = ( (float) L_FRAME48k * 0.25f ) / frame_len;
#endif

    if ( cfgReader != NULL )
    {
@@ -1325,19 +1305,14 @@ ivas_error ivas_set_hrtf_fr(
    HRTFS_DATA *crend_hrtf,
    ivas_hrtf_t *hrtf,
    const int16_t output_frame
#ifdef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
    ,
    float mdft_scale_fact
#endif
)
{
    int32_t i, j, m, n;
    float data_ir_flt[L_FRAME48k] = { 0.0f };
    int32_t tmp_ir_len, in_len, k;

#ifndef FIX_20_MS_FRAME_LEN_TABLES_CONVERTER
    float mdft_scale_fact = ( (float) L_FRAME48k * 0.25f ) / output_frame;
#endif

    crend_hrtf->max_num_ir = (int16_t) hrtf->m;

Loading