Commit 28573ed7 authored by Manuel Jander's avatar Manuel Jander
Browse files

Increase precision of computeTargetPSDs_direct_subframe_fx().

parent c25d8eab
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -4142,9 +4142,6 @@ static void computeTargetPSDs_direct_subframe_fx(
    Word16 q_cy_auto_dir_smooth_local[2];
#else
    Word16 ch_idx, cur_idx, i, q_tmp;
#ifdef FIX_867_CLDFB_NRG_SCALE
    Word32 L_tmp[CLDFB_NO_CHANNELS_MAX];
#else
    Word64 W_tmp[CLDFB_NO_CHANNELS_MAX], W_max;
    set64_fx( W_tmp, 0, CLDFB_NO_CHANNELS_MAX );
#endif
@@ -4158,14 +4155,12 @@ static void computeTargetPSDs_direct_subframe_fx(
    {
        direct_power[i] = Mpy_32_32( direct_power_factor[i], reference_power[i] );
        move32();
#ifndef FIX_867_CLDFB_NRG_SCALE
        test();
        if ( direct_power[i] == 0 && ( direct_power_factor[i] != 0 && reference_power[i] != 0 ) )
        {
            direct_power[i] = 1;
            move32();
        }
#endif
    }
#else
    v_mult_fixed( direct_power_factor, reference_power, direct_power, num_freq_bands );
@@ -4215,9 +4210,15 @@ static void computeTargetPSDs_direct_subframe_fx(
        q_tmp = L_norm_arr( &direct_responses_square[cur_idx], num_freq_bands );
        Copy_Scale_sig32( &direct_responses_square[cur_idx], L_tmp, num_freq_bands, q_tmp );
        v_mult_fixed( direct_power, L_tmp, &cy_auto_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, q_tmp) -> q_reference_power + q_tmp
        Scale_sig32( &cy_auto_dir_smooth[cur_idx] + CLDFB_NO_CHANNELS_HALF, s_max( sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 0 ), sub( q_reference_power[0], q_reference_power[1] ) );
        q_cy_auto_dir_smooth[ch_idx] = add( q_reference_power[0], q_tmp );

        q_cy_auto_dir_smooth_local[0] = add( add( q_reference_power[0], q_tmp ), L_norm_arr( cy_auto_dir_smooth + cur_idx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) );
        q_cy_auto_dir_smooth_local[1] = add( add( q_reference_power[1], q_tmp ), L_norm_arr( cy_auto_dir_smooth + cur_idx + CLDFB_NO_CHANNELS_HALF, s_max( sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 0 ) ) );
        q_cy_auto_dir_smooth[ch_idx] = s_min( q_cy_auto_dir_smooth_local[0], q_cy_auto_dir_smooth_local[1] );
        move16();

        Scale_sig32( cy_auto_dir_smooth + cur_idx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) , sub( q_cy_auto_dir_smooth[ch_idx], add( q_reference_power[0], q_tmp ) ) );
        Scale_sig32( cy_auto_dir_smooth + cur_idx + CLDFB_NO_CHANNELS_HALF, s_max( sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), 0 ), sub(  q_cy_auto_dir_smooth[ch_idx], add( q_reference_power[1], q_tmp ) ) );

#endif
        v_mult_fixed( direct_power, &direct_responses[cur_idx], &cy_cross_dir_smooth[cur_idx], num_freq_bands ); // (q_reference_power, Q31) -> q_reference_power
#ifdef FIX_867_CLDFB_NRG_SCALE