Commit 79bae9a9 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[revert] changes related to FIX_INV_DIFFUSE_WEIGHT,...

[revert] changes related to FIX_INV_DIFFUSE_WEIGHT, FIX_638_ENERGIE_IAC_ROM_TABLES, FIX_20_MS_FRAME_LEN_TABLES_CONVERTER and FIX_HOA_BRIR_EXT_RENDERER - contained in 744_step3_code_changes
parent 25d4517c
Loading
Loading
Loading
Loading
Loading
+1 −389

File changed.

Preview size limit exceeded, changes collapsed.

+0 −43
Original line number Diff line number Diff line
@@ -104,27 +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
 *-----------------------------------------------------------------------------------------*/
static ivas_error read_txt_int32(
    const char *pLine, /* i  : String to read from  */
    int32_t *pTarget   /* o  : Output pointer       */
)
{
    int32_t val = 0;
    if ( sscanf( pLine, "%d", &val ) != 1 )
    {
        return IVAS_ERR_INVALID_RENDER_CONFIG;
    }

    *pTarget = val;

    return IVAS_ERR_OK;
}
#endif

/*-----------------------------------------------------------------------------------------*
 * Function read_txt_vector()
@@ -294,10 +273,6 @@ 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,24 +391,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 )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                    }
                    else if ( strcmp( item, "MAXNUMDIFFUSEBLOCKS" ) == 0 )
                    {
                        if ( read_txt_int32( pValue, &hRenderConfig->maxNumDiffuseBlocks ) != IVAS_ERR_OK )
                        {
                            errorHandler( item, ERROR_VALUE_INVALID );
                            return IVAS_ERR_INVALID_RENDER_CONFIG;
                        }
                    }
#endif
                }
                free( pValue );
            }
+0 −8
Original line number Diff line number Diff line
@@ -44,10 +44,6 @@
#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 +57,6 @@ 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 −659

File changed.

Preview size limit exceeded, changes collapsed.

+0 −58
Original line number Diff line number Diff line
@@ -146,12 +146,7 @@ static void printfAudioBufferOutFilterParams(
    printf( "\nmax Diffuse Fc : %u", pParam->index_frequency_max_diffuse );
    printf( "\n" );
    printf( "\nInverse Diffuse Weights :" );
#ifdef FIX_INV_DIFFUSE_WEIGHT
    printBuf_float32( pParam->inv_diffuse_weight[0], pParam->max_num_ir );
    printBuf_float32( pParam->inv_diffuse_weight[1], pParam->max_num_ir );
#else
    printBuf_float32( pParam->inv_diffuse_weight, pParam->max_num_ir );
#endif
    printf( "\n" );

    /*if (pParam->numDiffuseBlock > 0)
@@ -563,20 +558,11 @@ 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;
@@ -666,17 +652,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 )
        {
@@ -706,9 +685,6 @@ 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,
@@ -736,9 +712,7 @@ 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 )
    {
@@ -1097,37 +1071,11 @@ ivas_error ivas_crend_binaural_filter_design_set_hrtf_fr(
            {
                if ( ppDiffuseWeight[i_chan][0] != -1 && ppDiffuseWeight[i_chan][1] != -1 )
                {
#ifdef FIX_INV_DIFFUSE_WEIGHT
                    if ( cfgReader != NULL )
                    {
                        if ( cfgReader->harmonizeLateReverbBinauralGain )
                        {
                            pParam->inv_diffuse_weight[0][i_chan] = cfgReader->lateReverbCompensationGain[i_chan] * 2.f / ( ppDiffuseWeight[i_chan][0] + ppDiffuseWeight[i_chan][1] );
                            pParam->inv_diffuse_weight[1][i_chan] = pParam->inv_diffuse_weight[0][i_chan];
                        }
                        else
                        {
                            pParam->inv_diffuse_weight[0][i_chan] = cfgReader->lateReverbCompensationGain[i_chan] * 1.f / ppDiffuseWeight[i_chan][0];
                            pParam->inv_diffuse_weight[1][i_chan] = cfgReader->lateReverbCompensationGain[i_chan] * 1.f / ppDiffuseWeight[i_chan][1];
                        }
                    }
                    else
                    {
                        pParam->inv_diffuse_weight[0][i_chan] = 2.f / ( ppDiffuseWeight[i_chan][0] + ppDiffuseWeight[i_chan][1] );
                        pParam->inv_diffuse_weight[1][i_chan] = pParam->inv_diffuse_weight[0][i_chan];
                    }
#else
                    pParam->inv_diffuse_weight[i_chan] = 2.f / ( ppDiffuseWeight[i_chan][0] + ppDiffuseWeight[i_chan][1] );
#endif
                }
                else
                {
#ifdef FIX_INV_DIFFUSE_WEIGHT
                    pParam->inv_diffuse_weight[0][i_chan] = 0; /* pathological case ppEnergyDiffuseFilter[i_ear][i_chan]=0 */
                    pParam->inv_diffuse_weight[1][i_chan] = 0; /* pathological case ppEnergyDiffuseFilter[i_ear][i_chan]=0 */
#else
                    pParam->inv_diffuse_weight[i_chan] = 0; /* pathological case ppEnergyDiffuseFilter[i_ear][i_chan]=0 */
#endif
                }
            }

@@ -1337,19 +1285,13 @@ 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