Commit 7516c0ba authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

Debugging code for H_filter

parent 0b0b5d9a
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -748,15 +748,25 @@ void ivas_reverb_calc_color_levels_fx(
            Word32 temp2 = L_shr( Mpy_32_32( coefB[0], Mpy_32_32( coefB[1], L_shl( cos_w, 15 ) ) ), 1 );
            H_filter = L_add( L_shr( L_add( L_shr( Mpy_32_32( coefB[0], coefB[0] ), 1 ), L_shr( Mpy_32_32( coefB[1], coefB[1] ), 1 ) ), 2 ), L_shr( Mpy_32_32( coefB[0], Mpy_32_32( coefB[1], L_shl( cos_w, 15 ) ) ), 1 ) ); // q = 28

            temp1 = L_shr(Mpy_32_32( coefA[1], coefA[1] ), 3);//Q28
            temp2 = Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) );//Q30
            //temp1 = L_shr(Mpy_32_32( coefA[1], coefA[1] ), 3);//Q28
            temp1 = Mpy_32_32( coefA[1], coefA[1] );          //Q31
            temp2 = L_shl(L_shl(Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ), 1), 1);//Q31
           // temp2 = L_shl(Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ), 1);//Q31
            Word32 temp3 = L_add( ONE_IN_Q31, L_add(temp1,temp2) );//Q31 -> aligns with correct result
            temp3 = BASOP_Util_Divide3232_Scale_newton( H_filter,temp3, &temp );//Q28 divided by Q31, should be in Q28
            temp3 = L_shr( temp3, 1 ); //Q31 // Or change L_shl after ONE_IN_Q31??
            temp3 = Sqrt32( temp3, &temp );//Q31
            H_filter = temp3;//Q31
            //H_filter = BASOP_Util_Divide3232_Scale_newton( H_filter, L_add( ONE_IN_Q28, L_shr( L_add( L_shr( Mpy_32_32( coefA[1], coefA[1] ), 2 ), Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ) ), 1 ) ), &temp );
            //H_filter = Sqrt32( H_filter, &temp );

            temp1 = BASOP_Util_Log2( H_filter );
            temp1 = Mpy_32_32(BASOP_Util_Log2( H_filter ), LOG10_2_Q31);//log10(H_filter) in Q25
            //temp1 = Mpy_32_32( L_add( BASOP_Util_Log2( H_filter ), L_shl( temp, 25 ) ), LOG10_2_Q31 );

            H_filter = BASOP_Util_Divide3232_Scale_newton( H_filter, L_add( ONE_IN_Q28, L_shr( L_add( L_shr( Mpy_32_32( coefA[1], coefA[1] ), 2 ), Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ) ), 1 ) ), &temp );
            //H_filter = BASOP_Util_Divide3232_Scale_newton( H_filter, L_add( ONE_IN_Q28, L_add( L_shr( Mpy_32_32( coefA[1], coefA[1] ), 2 ), L_shl(Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ) , 1 ) ) ), &temp );

            H_filter = Sqrt32( H_filter, &temp );

            T60_est = BASOP_Util_Divide3232_Scale_newton( L_shl( i_mult( -3, pLoop_delays[loop_idx] ), 2 ), Mpy_32_32( Mpy_32_32( L_add( BASOP_Util_Log2( H_filter ), L_shl( temp, 25 ) ), LOG10_2_Q31 ), L_shl( output_Fs, 8 ) ) , &temp ); // conversion of log2 to log10.

            t60[freq_idx] = BASOP_Util_Add_Mant32Exp( T60_est, temp, t60[freq_idx], t60_e[freq_idx], &result_e );
            move16();
            t60_e[freq_idx] = result_e;