Commit 29a47f45 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for 3GPP issue 954: High frequency differences above 6 kHz, 7.1+4 MC with FER at 32kbps

link #954
parent c3b61cca
Loading
Loading
Loading
Loading
Loading
+46 −3
Original line number Diff line number Diff line
@@ -4726,13 +4726,41 @@ void ivas_dirac_dec_render_sf_fx(
        {
            IF( LT_16( q_reference_power_smooth, DirAC_mem.reference_power_q ) )
            {
                scale_sig32( reference_power_fx, hSpatParamRendCom->num_freq_bands, sub( q_reference_power_smooth, DirAC_mem.reference_power_q ) ); // q_reference_power_smooth
                Word32 temp;
                FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ )
                {
                    temp = L_shl( reference_power_fx[i], sub( q_reference_power_smooth, DirAC_mem.reference_power_q ) );
                    test();
                    IF( temp == 0 && ( reference_power_fx[i] != 0 ) )
                    {
                        reference_power_fx[i] = 1;
                    }
                    ELSE
                    {
                        reference_power_fx[i] = temp;
                    }
                    move32();
                }
                DirAC_mem.reference_power_q = q_reference_power_smooth;
                move16();
            }
            ELSE
            {
                scale_sig32( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, sub( DirAC_mem.reference_power_q, q_reference_power_smooth ) ); // reference_power_q
                Word32 temp;
                FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ )
                {
                    temp = L_shl( reference_power_smooth_fx[i], sub( DirAC_mem.reference_power_q, q_reference_power_smooth ) );
                    test();
                    IF( temp == 0 && ( reference_power_smooth_fx[i] != 0 ) )
                    {
                        reference_power_smooth_fx[i] = 1;
                    }
                    ELSE
                    {
                        reference_power_smooth_fx[i] = temp;
                    }
                    move32();
                }
                q_reference_power_smooth = DirAC_mem.reference_power_q;
                move16();
            }
@@ -4940,7 +4968,22 @@ void ivas_dirac_dec_render_sf_fx(
        }
        ELSE
        {
            scale_sig32( reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, sub( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, q_reference_power_smooth ) ); // reference_power_smooth_prev_q
            Word32 temp;
            FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ )
            {
                temp = L_shl( reference_power_smooth_fx[i], sub( hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q, q_reference_power_smooth ) );
                test();
                IF( temp == 0 && ( reference_power_smooth_fx[i] != 0 ) )
                {
                    reference_power_smooth_fx[i] = 1;
                }
                ELSE
                {
                    reference_power_smooth_fx[i] = temp;
                }
                move32();
            }

            q_reference_power_smooth = hDirACRend->h_output_synthesis_psd_state.reference_power_smooth_prev_q;
            move16();
        }
+39 −8
Original line number Diff line number Diff line
@@ -3015,7 +3015,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
    /*-----------------------------------------------------------------*
     * compute target PSDs
     *-----------------------------------------------------------------*/

    IF( enc_param_start_band == 0 )
    {
        IF( EQ_16( h_dirac_output_synthesis_params->use_onset_filters, 1 ) )
@@ -3447,10 +3446,16 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
            *( p_cy_auto_dir_smooth_prev++ ) = L_shr_r( L_tmp, q_tmp ); // q_cy_auto_dir_smooth_prev_local

            move32();
            *( p_cy_cross_dir_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_cross_dir_smooth++ ) ) ),
            *( p_cy_cross_dir_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_cross_dir_smooth ) ) ),
                                                     Mpy_32_32( g2, ( *( p_cy_cross_dir_smooth_prev ) ) ) ); // (Q31, q_cy_cross_dir_smooth_prev) -> q_cy_cross_dir_smooth_prev
            move32();

            test();
            if ( *( p_cy_cross_dir_smooth_prev ) == 0 && ( *( p_cy_cross_dir_smooth ) != 0 ) )
            {
                *( p_cy_cross_dir_smooth_prev ) = 1;
                move32();
            }
            ( p_cy_cross_dir_smooth++ );
            power_smooth_temp = L_shl( *p_power_smooth, norm_l( *p_power_smooth ) );
            L_tmp = Mpy_32_32( power_smooth_temp, L_tmp ); // proto_power_smooth_q + norm_l( *p_power_smooth ) ) + q_cy_auto_dir_smooth_prev_local - 31
            exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q, norm_l( *p_power_smooth ) ),
@@ -3481,12 +3486,29 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
            p_gains_dir++;

            /*diffuse*/
            *( p_cy_auto_diff_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_auto_diff_smooth++ ) ) ),
            *( p_cy_auto_diff_smooth_prev ) = L_add( Mpy_32_32( g1, ( *( p_cy_auto_diff_smooth ) ) ),
                                                     Mpy_32_32( g2, ( *( p_cy_auto_diff_smooth_prev ) ) ) ); // (Q31, q_cy_auto_diff_smooth_prev) -> q_cy_auto_diff_smooth_prev

            test();
            if ( *( p_cy_auto_diff_smooth_prev ) == 0 && ( *( p_cy_auto_diff_smooth ) != 0 ) )
            {
                *( p_cy_auto_diff_smooth_prev ) = 1;
                move32();
            }
            ( p_cy_auto_diff_smooth++ );
            move32();

            power_smooth_temp = L_shl( *p_power_smooth, norm_l( *p_power_smooth ) );     // proto_power_smooth_q + norm_l( *p_power_smooth )
            L_tmp = Mpy_32_32( power_smooth_temp, ( *( p_cy_auto_diff_smooth_prev++ ) ) ); // proto_power_smooth_q + norm_l( *p_power_smooth ) ) + q_cy_auto_diff_smooth_prev - 31
            L_tmp = Mpy_32_32( power_smooth_temp, ( *( p_cy_auto_diff_smooth_prev ) ) ); // proto_power_smooth_q + norm_l( *p_power_smooth ) ) + q_cy_auto_diff_smooth_prev - 31

            test();
            test();
            if ( L_tmp == 0 && ( power_smooth_temp != 0 && *( p_cy_auto_diff_smooth_prev ) != 0 ) )
            {
                L_tmp = 1;
                move32();
            }
            ( p_cy_auto_diff_smooth_prev++ );
            exp = sub( Q31, sub( add( add( h_dirac_output_synthesis_state->proto_power_smooth_q, norm_l( *p_power_smooth ) ),
                                      h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev ),
                                 Q31 ) );
@@ -6041,8 +6063,17 @@ static void computeTargetPSDs_direct_subframe_fx(
    Word32 direct_power[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */

    /* estimate direct and diffuse power */
    v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power

    FOR( i = 0; i < num_freq_bands; i++ )
    {
        direct_power[i] = Mpy_32_32( direct_power_factor[i], reference_power[i] );
        move32();
        test();
        if ( direct_power[i] == 0 && ( direct_power_factor[i] != 0 && reference_power[i] != 0 ) )
        {
            direct_power[i] = 1;
            move32();
        }
    }
    /* compute target auto and cross PSDs of current frame (smoothed) */
    FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx )
    {