Commit 83a229c7 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '3gpp_issue_996_fix' into 'main'

Fix for 3GPP issue 996: Low-frequency "thump" in MASA format using bitrate switching and output to MONO [allow regression]

See merge request !766
parents f07beab7 0f18a0e6
Loading
Loading
Loading
Loading
+12 −41
Original line number Diff line number Diff line
@@ -3471,47 +3471,18 @@ void protoSignalComputation2_fx(
        // 20480 = 10 in Q11
        lr_total_bb_ratio_fx = Mpy_32_16_1( temp, 20480 ); // Q21

        temp = Mpy_32_32( a_fx, left_hi_power_fx ); // 2*(q_cldfb+min_q_shift) -31
        IF( LT_16( q_temp, stereo_type_detect->q_left_hi_power ) )
        {
            stereo_type_detect->left_hi_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->left_hi_power_fx ), sub( stereo_type_detect->q_left_hi_power, q_temp ) ) ); // q_temp
        stereo_type_detect->left_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, left_hi_power_fx ), sub( 31, q_temp ), Mpy_32_32( b_fx, stereo_type_detect->left_hi_power_fx ), sub( 31, stereo_type_detect->q_left_hi_power ), &stereo_type_detect->q_left_hi_power );
        move32();
            stereo_type_detect->q_left_hi_power = q_temp;
        stereo_type_detect->q_left_hi_power = sub( 31, stereo_type_detect->q_left_hi_power );
        move16();
        }
        ELSE
        {
            stereo_type_detect->left_hi_power_fx = L_add( L_shr( temp, sub( q_temp, stereo_type_detect->q_left_hi_power ) ), Mpy_32_32( b_fx, stereo_type_detect->left_hi_power_fx ) ); // stereo_type_detect->q_left_hi_power
            move32();
        }

        temp = Mpy_32_32( a_fx, right_hi_power_fx ); // 2*(q_cldfb+min_q_shift) -31
        IF( LT_16( q_temp, stereo_type_detect->q_right_hi_power ) )
        {
            stereo_type_detect->right_hi_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->right_hi_power_fx ), sub( stereo_type_detect->q_right_hi_power, q_temp ) ) ); // q_temp
        stereo_type_detect->right_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, right_hi_power_fx ), sub( 31, q_temp ), Mpy_32_32( b_fx, stereo_type_detect->right_hi_power_fx ), sub( 31, stereo_type_detect->q_right_hi_power ), &stereo_type_detect->q_right_hi_power );
        move32();
            stereo_type_detect->q_right_hi_power = q_temp;
        stereo_type_detect->q_right_hi_power = sub( 31, stereo_type_detect->q_right_hi_power );
        move16();
        }
        ELSE
        {
            stereo_type_detect->right_hi_power_fx = L_add( L_shr( temp, sub( q_temp, stereo_type_detect->q_right_hi_power ) ), Mpy_32_32( b_fx, stereo_type_detect->right_hi_power_fx ) ); // stereo_type_detect->q_right_hi_power
            move32();
        }

        temp = Mpy_32_32( a_fx, total_hi_power_fx ); // 2*(q_cldfb+min_q_shift) -31
        IF( LT_16( q_temp, stereo_type_detect->q_total_hi_power ) )
        {
            stereo_type_detect->total_hi_power_fx = L_add( temp, L_shr( Mpy_32_32( b_fx, stereo_type_detect->total_hi_power_fx ), sub( stereo_type_detect->q_total_hi_power, q_temp ) ) ); // q_temp
        stereo_type_detect->total_hi_power_fx = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, total_hi_power_fx ), sub( 31, q_temp ), Mpy_32_32( b_fx, stereo_type_detect->total_hi_power_fx ), sub( 31, stereo_type_detect->q_total_hi_power ), &stereo_type_detect->q_total_hi_power );
        move32();
            stereo_type_detect->q_total_hi_power = q_temp;
        stereo_type_detect->q_total_hi_power = sub( 31, stereo_type_detect->q_total_hi_power );
        move16();
        }
        ELSE
        {
            stereo_type_detect->total_hi_power_fx = L_add( L_shr( temp, sub( q_temp, stereo_type_detect->q_total_hi_power ) ), Mpy_32_32( b_fx, stereo_type_detect->total_hi_power_fx ) ); // stereo_type_detect->q_total_hi_power
            move32();
        }

        IF( LT_16( stereo_type_detect->q_left_hi_power, stereo_type_detect->q_right_hi_power ) )
        {