Commit 63ce43bf authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

debugging code

parent 7516c0ba
Loading
Loading
Loading
Loading
+26 −16
Original line number Diff line number Diff line
@@ -743,27 +743,37 @@ void ivas_reverb_calc_color_levels_fx(

            cos_w = getCosWord16R2( (Word16) L_abs( L_shl( Mpy_32_32( pFc[freq_idx], fs_inverted ), 1 ) ) );                                                                                                                 // q = 15 

            //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
            Word32 temp1 = 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 );
            Word32 temp2 = L_shr( Mpy_32_32( coefB[0], Mpy_32_32( coefB[1], L_shl( cos_w, 15 ) ) ), 1 );
            Word32 temp1, temp2, temp3;
            //Word32 temp1 = 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 );
            //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
            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
            //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
            //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

            temp1 = Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) );//Q30
            //temp1 = L_shl(Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ),1); //2.0f * coefA[1] * cos_w in Q30
            temp1 = L_shl_sat(Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ),2); //2.0f * coefA[1] * cos_w in Q31
            temp1 = L_shr( temp1, 3 );//temp1 in Q28
            temp2 =  Mpy_32_32( coefA[1], coefA[1] ); // coefA[1] * coefA[1} in Q31 -> must right shift by 3
            temp2 = L_shr(temp2,3)//temp1 in Q28
;
            temp3 = L_add( ONE_IN_Q28, L_add(temp1, temp2));
            H_filter = BASOP_Util_Divide3232_Scale_newton( H_filter, temp3, &temp );
            //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 );
            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 = 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 );

            //temp1 = Mpy_32_32( temp1, L_shl(output_Fs,15) );//Denominator in Q9
            //temp2 = i_mult( -3, pLoop_delays[loop_idx] );

            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.