Commit e20a847a authored by emerit's avatar emerit
Browse files

check and fix switches

parent d6a9befd
Loading
Loading
Loading
Loading
+54 −53
Original line number Diff line number Diff line
@@ -2676,7 +2676,7 @@ ivas_error ivas_rend_openCrend(
            hCrend->freq_buffer_im_diffuse_fx = NULL;
        }
#endif
    }

        max_total_ir_len = add( extract_l( L_shr( L_add( L_shl( Mult_32_32( hHrtf->latency_s_fx, output_Fs ), 1 ), 1 ), 1 ) ), subframe_length ); /*(int16_t) ( hHrtf->latency_s_fx * output_Fs + 0.5f ) + subframe_length;*/
        IF( GT_16( max_total_ir_len, 0 ) )
        {
@@ -2711,7 +2711,7 @@ ivas_error ivas_rend_openCrend(
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections" );
                }
            IF( ( error = ivas_er_init_handle( hCrend->reflections ) ) != IVAS_ERR_OK )
                IF( NE_32( ( error = ivas_er_init_handle( hCrend->reflections ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
@@ -2733,7 +2733,7 @@ ivas_error ivas_rend_openCrend(
                ivas_shoebox_config_init( &hCrend->reflections->shoebox_lib.cal, hRendCfg );

                /* Init and compute Reflections */
            IF( ( error = ivas_er_init( hCrend->reflections, inConfig ) ) != IVAS_ERR_OK )
                IF( NE_32( ( error = ivas_er_init( hCrend->reflections, inConfig ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
@@ -2753,6 +2753,7 @@ ivas_error ivas_rend_openCrend(
        ( *pCrend )->binaural_latency_ns = Mult_32_32( ( *pCrend )->hHrtfCrend->latency_s_fx, (Word32) 1000000000 );
#endif
        move32();
    }

    ( *pCrend )->hCrend = hCrend;
    return IVAS_ERR_OK;
+19 −20
Original line number Diff line number Diff line
@@ -460,7 +460,7 @@ static ivas_error DefaultBSplineModel_fx(
    model->elevBsStart = defaultHRIR_rom_elevBsStart;
    move16();
#else
    model->UseItdModel = 1;
    model->UseItdModel = 1; // Q0
    move16();
    model->SplineDegree = 4; // Q0
    move16();
@@ -657,7 +657,7 @@ static ivas_error DefaultBSplineModel_fx(
            model->AlphaL_fx = defaultHRIR_rom_AlphaL32_fx;
            model->AlphaL_e = sub( 15, defaultHRIR_rom_Alpha32_Q_fx );
#else
            model->AlphaL_fx = (const Word32 *) defaultHRIR_rom_AlphaL32_fx;
            model->AlphaL_fx = (const Word32 *) defaultHRIR_rom_AlphaL32_fx; // Q30
            model->AlphaL_e = 1;
            move16();
#endif
@@ -665,7 +665,7 @@ static ivas_error DefaultBSplineModel_fx(
            model->AlphaR_fx = defaultHRIR_rom_AlphaR32_fx;
            model->AlphaR_e = sub( 15, defaultHRIR_rom_Alpha32_Q_fx );
#else
            model->AlphaR_fx = (const Word32 *) defaultHRIR_rom_AlphaR32_fx;
            model->AlphaR_fx = (const Word32 *) defaultHRIR_rom_AlphaR32_fx; // Q30
            model->AlphaR_e = 1;
            move16();
#endif
@@ -673,7 +673,7 @@ static ivas_error DefaultBSplineModel_fx(
            model->EL_fx = defaultHRIR_rom_EL32_fx;
            model->EL_e = sub( 31, defaultHRIR_rom_E32_Q_fx );
#else
            model->EL_fx = (const Word32 *) defaultHRIR_rom_EL32_fx;
            model->EL_fx = (const Word32 *) defaultHRIR_rom_EL32_fx; // Q28
            model->EL_e = 3;
            move16();
#endif
@@ -681,11 +681,11 @@ static ivas_error DefaultBSplineModel_fx(
            model->ER_fx = defaultHRIR_rom_ER32_fx;
            model->ER_e = sub( 31, defaultHRIR_rom_E32_Q_fx );
#else
            model->ER_fx = (const Word32 *) defaultHRIR_rom_ER32_fx;
            model->ER_fx = (const Word32 *) defaultHRIR_rom_ER32_fx; // Q28
            model->ER_e = 3;
            move16();
#endif
            model->K = 86;
            model->K = 86; // Q0
            move16();
            IF( HrFiltSet_p->ModelParams.UseItdModel )
            {
@@ -698,7 +698,7 @@ static ivas_error DefaultBSplineModel_fx(
            model->AlphaL_fx = defaultHRIR_rom_AlphaL16_fx;
            model->AlphaL_e = sub( 15, defaultHRIR_rom_Alpha16_Q_fx );
#else
            model->AlphaL_fx = (const Word32 *) defaultHRIR_rom_AlphaL16_fx;
            model->AlphaL_fx = (const Word32 *) defaultHRIR_rom_AlphaL16_fx; // Q30
            model->AlphaL_e = 1;
            move16();
#endif
@@ -706,7 +706,7 @@ static ivas_error DefaultBSplineModel_fx(
            model->AlphaR_fx = defaultHRIR_rom_AlphaR16_fx;
            model->AlphaR_e = sub( 15, defaultHRIR_rom_Alpha16_Q_fx );
#else
            model->AlphaR_fx = (const Word32 *) defaultHRIR_rom_AlphaR16_fx;
            model->AlphaR_fx = (const Word32 *) defaultHRIR_rom_AlphaR16_fx; // Q30
            model->AlphaR_e = 1;
            move16();
#endif
@@ -714,7 +714,7 @@ static ivas_error DefaultBSplineModel_fx(
            model->EL_fx = defaultHRIR_rom_EL16_fx;
            model->EL_e = sub( 31, defaultHRIR_rom_E16_Q_fx );
#else
            model->EL_fx = (const Word32 *) defaultHRIR_rom_EL16_fx;
            model->EL_fx = (const Word32 *) defaultHRIR_rom_EL16_fx; // Q28
            model->EL_e = 3;
            move16();
#endif
@@ -722,11 +722,11 @@ static ivas_error DefaultBSplineModel_fx(
            model->ER_fx = defaultHRIR_rom_ER16_fx;
            model->ER_e = sub( 31, defaultHRIR_rom_E16_Q_fx );
#else
            model->ER_fx = (const Word32 *) defaultHRIR_rom_ER16_fx;
            model->ER_fx = (const Word32 *) defaultHRIR_rom_ER16_fx; // Q28
            model->ER_e = 3;
            move16();
#endif
            model->K = 43;
            model->K = 43; // Q0
            move16();
            IF( HrFiltSet_p->ModelParams.UseItdModel )
            {
@@ -751,7 +751,7 @@ static ivas_error DefaultBSplineModel_fx(
    modelITD->elevBsStart = defaultHRIR_rom_ITD_elevBsStart;
    move16();
#else
    modelITD->N = 4;
    modelITD->N = 4; // Q0
    move16();
    modelITD->elevDim2 = 20; // Q0
    move16();
@@ -780,13 +780,13 @@ static ivas_error DefaultBSplineModel_fx(
    modelITD->elevBsStart[3] = 21; // Q0
    move16();
#endif
    modelITD->elevKSeq_fx = defaultHRIR_rom_ITD_elevKSeq_fx;
    modelITD->elevKSeq_fx = defaultHRIR_rom_ITD_elevKSeq_fx; // Q22
#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    modelITD->elevKSeq_e = defaultHRIR_rom_ITD_elevKSeq_Q_fx;
    modelITD->azimBsLen = defaultHRIR_rom_ITD_azimBsLen;
    modelITD->azimBsStart = defaultHRIR_rom_ITD_azimBsStart;
#else
    modelITD->azimBsLen[0] = 11;
    modelITD->azimBsLen[0] = 11; // Q0
    move16();
    modelITD->azimBsLen[1] = 21; // Q0
    move16();
@@ -806,19 +806,18 @@ static ivas_error DefaultBSplineModel_fx(
    modelITD->azimSegSamples = 10; // Q0
    move16();
#endif
    modelITD->azimKSeq_fx = defaultHRIR_rom_ITD_azimKSeq_fx;
    modelITD->azimKSeq_fx = defaultHRIR_rom_ITD_azimKSeq_fx;    // Q22
#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    modelITD->azimKSeq_e = defaultHRIR_rom_ITD_azimKSeq_Q_fx;
    modelITD->W_fx = defaultHRIR_rom_ITD_W_fx;
    modelITD->W_e = sub( 15, defaultHRIR_rom_ITD_W_Q_fx );
#else
    modelITD->W_fx = (const Word32 *) defaultHRIR_rom_ITD_W_fx; // Q25

    modelITD->W_e = 6;
    move16();
#endif
    modelITD->azimBsShape_fx = defaultHRIR_rom_ITD_azimBsShape_fx;
    modelITD->elevBsShape_fx = defaultHRIR_rom_ITD_elevBsShape_fx;
    modelITD->azimBsShape_fx = defaultHRIR_rom_ITD_azimBsShape_fx; // Q30
    modelITD->elevBsShape_fx = defaultHRIR_rom_ITD_elevBsShape_fx; // Q30

    HRTF_model_precalc( model );

@@ -827,7 +826,7 @@ static ivas_error DefaultBSplineModel_fx(
    move16();
    HrFiltSet_p->factor_Q_latency_s_fx = sub( 31, HrFiltSet_p->factor_Q_latency_s_fx );
#endif
    HrFiltSet_p->latency_s_fx = defaultHRIR_rom_latency_s_fx;
    HrFiltSet_p->latency_s_fx = defaultHRIR_rom_latency_s_fx; // Q31
    move32();
    HrFiltSet_p->SampleRate = output_Fs; // Q0
    move32();
+0 −1
Original line number Diff line number Diff line
@@ -854,7 +854,6 @@ void ivas_masa_ext_dirac_render_fx(
    Word32 *output_f[],                /* i/o: input/output signals in time domain q11*/
    const Word16 num_subframes         /* i  : number of subframes to render       */
);

/*----------------------------------------------------------------------------------*
 * HRTF
 *----------------------------------------------------------------------------------*/
+8 −7
Original line number Diff line number Diff line
@@ -1337,6 +1337,7 @@ static void set_reverb_acoustic_data_fx(
        pParams->pHrtf_avg_pwr_response_r_const_fx = (const Word32 *) pParams->pHrtf_avg_pwr_response_r_fx;
        pParams->pHrtf_inter_aural_coherence_const_fx = (const Word32 *) pParams->pHrtf_inter_aural_coherence_fx;
    }

    /* interpolate input table data for T60 and DSR to the FFT filter grid */
    ivas_reverb_interpolate_acoustic_data_fx( nr_fc_input, pFc_input_fx, pAcoustic_rt60_fx, pAcoustic_dsr_fx,
                                              nr_fc_fft_filter, pFc_fx, pRt60_fx, pDsr_fx, pRt60_e, pDsr_e );
+10 −7
Original line number Diff line number Diff line
@@ -338,21 +338,21 @@ static BINAURAL_INPUT_AUDIO_CONFIG audio_cfg_2_binaural_cfg(
#ifdef FIX_POINT_HRTF_FILE_OPTIM
static ivas_error TDREND_LoadBSplineBinaryITD(
#else
static ivas_error LoadBSplineBinaryITD(
static void LoadBSplineBinaryITD(
#endif
    ModelParamsITD_t *modelITD, /* i/o: ITD model parameter structure */
    FILE *f_hrtf                /* i  : HR filter data file handle    */
)
{
#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    Word16 tmp;
#ifndef FIX_TDREND_HRTF_FILE_FORMAT
    Word16 i;
#endif
    if ( modelITD == NULL || f_hrtf == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#else
    Word16 tmp, i;
#endif
#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    fread( &modelITD->elevDim3, sizeof( Word16 ), 1, f_hrtf );
    modelITD->elevKSeq_dyn_fx = (Word16 *) malloc( ( modelITD->elevDim3 - 2 ) * sizeof( Word16 ) );
@@ -469,6 +469,8 @@ static ivas_error LoadBSplineBinaryITD(
    modelITD->azimBsStart = modelITD->azimBsStart_dyn_fx;
    modelITD->elevBsLen = modelITD->elevBsLen_dyn_fx;
    modelITD->elevBsStart = modelITD->elevBsStart_dyn_fx;

    return IVAS_ERR_OK;
#else
    float *W_dyn_local = (float *) malloc( tmp * sizeof( float ) );
    fread( W_dyn_local, sizeof( float ), tmp, f_hrtf );
@@ -521,9 +523,9 @@ static ivas_error LoadBSplineBinaryITD(
    move16();
    modelITD->azimBsShape_fx = (const Word32 *) modelITD->azimBsShape_dyn_fx;
    modelITD->elevBsShape_fx = (const Word32 *) modelITD->elevBsShape_dyn_fx;
#endif

    return IVAS_ERR_OK;
    return;
#endif
}
/*-------------------------------------------------------------------*
 * TDREND_LoadBSplineBinary()
@@ -3267,6 +3269,7 @@ ivas_error create_SetOfHRTF_from_binary(
#else
        if ( hHRTF != NULL )
        {
            /* Create the HRTF reading the raw data from the binary file */
            if ( ( create_HRTF_from_rawdata( hHRTF, hrtf_data ) ) != IVAS_ERR_OK )
            {
                return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Could not create HRTF from binary file" );