Commit 051dfe14 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for 3GPP issue 985: Stereo to MONO decoding: energy drop below 1 kHz

link #985
parent f7d1e1f8
Loading
Loading
Loading
Loading
Loading
+22 −5
Original line number Diff line number Diff line
@@ -223,7 +223,12 @@ void stereo_dft_unify_dmx_fx(
            Word16 j;
            Word32 sum_nrg_Mid, sum_abs, dot_prod_abs;
            Word16 wR, wL;
            Word16 norm_sum_nrg_L, norm_sum_nrg_R, norm_dot_prod_real, norm_dot_prod_imag, guard_bit, min_norm, q_sum_nrg_L, q_sum_nrg_R, q_dot_prod_real;
            Word16 norm_sum_nrg_L = 63, norm_sum_nrg_R = 63, norm_dot_prod_real = 63, norm_dot_prod_imag = 63, guard_bit = 2 /*find_guarded_bits_fx( 4 )*/, min_norm, q_sum_nrg_L, q_sum_nrg_R, q_dot_prod_real;
            move16();
            move16();
            move16();
            move16();
            move16();
            Word16 exp_sum_nrg_l, exp_sum_nrg_R, exp_dot_prod_abs, exp_sum_nrg_Mid;
            Word32 sum_nrg_L_32, sum_nrg_R_32, dot_prod_real_32, dot_prod_img_32;
            Word64 sum_nrg_L = 0, sum_nrg_R = 0;
@@ -242,10 +247,22 @@ void stereo_dft_unify_dmx_fx(
                dot_prod_img = W_add( dot_prod_img, W_sub( W_mult_32_32( DFT_L[2 * j + 1], DFT_R[2 * j] ), W_mult_32_32( DFT_L[2 * j], DFT_R[2 * j + 1] ) ) );   /* 2 * q_dft + 1 */
            }

            IF( sum_nrg_L != 0 )
            {
                norm_sum_nrg_L = W_norm( sum_nrg_L );
            }
            IF( sum_nrg_R != 0 )
            {
                norm_sum_nrg_R = W_norm( sum_nrg_R );
            }
            IF( dot_prod_real != 0 )
            {
                norm_dot_prod_real = W_norm( dot_prod_real );
            }
            IF( dot_prod_img != 0 )
            {
                norm_dot_prod_imag = W_norm( dot_prod_img );
            }

            guard_bit = find_guarded_bits_fx( 4 );
            min_norm = s_min( s_min( s_min( norm_sum_nrg_L, norm_sum_nrg_R ), norm_dot_prod_real ), norm_dot_prod_imag ) - guard_bit;