Commit 08ee70d1 authored by vaillancour's avatar vaillancour
Browse files

correction to port of flp 1504

parent bc40dbf0
Loading
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -1367,23 +1367,25 @@ void stereo_dft_enc_compute_itd_fx(
        hStereoClassif->xtalk_fv_fx[E_gainIPD] = L_shr_r( g_IPD, 10 ); // Q15
        move32();

        L_temp = BASOP_Util_Add_Mant32Exp( sum_nrg_L, sum_nrg_L_e, L_negate( sum_nrg_R ), sum_nrg_R_e, &L_temp_e );
  
#ifdef NONBE_FIX_1063_DIV_BY_ZERO_SUMNRG
        IF( L_sub( sum_nrg_L, sum_nrg_R ) >= 0 )
        IF( L_temp >= 0 )
        {
            sum_nrg_delta = L_max( L_sub( sum_nrg_L, sum_nrg_R ), 1 << sum_nrg_L_e );
            L_temp = BASOP_Util_Add_Mant32Exp( L_temp, L_temp_e, MAX_32, 0, &L_temp_e );
        }
        ELSE
        {
            sum_nrg_delta = L_min( L_sub( sum_nrg_L, sum_nrg_R ), L_negate( 1 << sum_nrg_L_e ) );
            L_temp = BASOP_Util_Add_Mant32Exp( L_temp, L_temp_e, MIN_32, 0, &L_temp_e );
        }
        //angle_rot = fabsf( atanf( 2.0f * ( grand_dot_prod_real ) / sum_nrg_delta ) );
#else
        // angle_rot = fabsf( atanf( 2.0f * ( grand_dot_prod_real ) / ( sum_nrg_L - sum_nrg_R + 1.0f ) ) );
#endif
        L_temp = BASOP_Util_Add_Mant32Exp( sum_nrg_L, sum_nrg_L_e, L_negate( sum_nrg_R ), sum_nrg_R_e, &L_temp_e );
        L_temp = BASOP_Util_Add_Mant32Exp( L_temp, L_temp_e, MAX_32, 0, &L_temp_e );
#endif        
        
        L_temp2 = BASOP_Util_Divide3232_Scale_cadence( grand_dot_prod_real, L_temp, &L_temp2_e );
        L_temp2_e = add( L_temp2_e, sub( add( grand_dot_prod_real_e, 1 ), L_temp_e ) );


        angle_rot = L_abs( BASOP_util_atan( L_shr_r_sat( L_temp2, ( sub( 6, L_temp2_e ) ) ) ) ); // Q14
        // angle_rot = L_abs( BASOP_util_atan2( grand_dot_prod_real, L_temp, sub( add( grand_dot_prod_real_e, 1 ), L_temp_e ) ) ); // Q13