Commit bfdca295 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

optimize calculation of q_cy_auto_dir_smooth and cy_cross_dir_smooth

parent 6c0f3d8e
Loading
Loading
Loading
Loading
+43 −11
Original line number Diff line number Diff line
@@ -4050,6 +4050,33 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
        /*Only direct prototype*/
        FOR( ; l < num_freq_bands; l++ )
        {
#ifdef FIX_867_DBG
			{
				static FILE *f = 0;
				if (f == 0)
					f = fopen("cy_auto_dir_smooth_prev", "w");

				Word32 m = *p_cy_auto_dir_smooth;
				Word16 e = h_dirac_output_synthesis_state->q_cy_auto_dir_smooth[k*num_freq_bands + l];
				float f1_m = (float)m;
				float f1_e = powf(2, e);
				float f1 = f1_m / f1_e;
				fprintf(f, "%d %d %d %f\n", l, m, e, f1);
			}
			{
				static FILE *f = 0;
				if (f == 0)
					f = fopen("p_power_smooth", "w");

				Word32 m = *p_power_smooth;
				Word16 e = h_dirac_output_synthesis_state->proto_power_smooth_q;
				float f1_m = (float)m;
				float f1_e = powf(2, e);
				float f1 = f1_m / f1_e;
				fprintf(f, "%d %d %d %f\n", l, m, e, f1);
			}
#endif

            /*Direct*/
            g1 = alpha[l]; // Q31
            move32();
@@ -4070,6 +4097,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
                *( 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
@@ -6820,7 +6848,19 @@ static void computeTargetPSDs_direct_subframe_fx(
    FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx )
    {
        cur_idx = imult1616( ch_idx, num_freq_bands );
#ifdef FIX_867
		FOR(i = 0; i < num_freq_bands; i++)
		{
			W_tmp[i]  = W_mult_32_32(direct_power[i], direct_responses_square[cur_idx + i]); // q_reference_power + Q31 + 1
			q_tmp = W_norm(W_tmp[i]);
			cy_auto_dir_smooth[cur_idx + i] = W_extract_h( W_shl(W_tmp[i], q_tmp) );
			q_cy_auto_dir_smooth[ch_idx + i] = add(q_reference_power[i], q_tmp);
			move16();

			cy_cross_dir_smooth[cur_idx + i] = Mpy_32_32(direct_power[i], direct_responses[cur_idx+i]);
			q_cy_cross_dir_smooth[cur_idx + i] = q_reference_power[i];
		}
#else
        W_max = 0;
        move64();
        FOR( i = 0; i < num_freq_bands; i++ )
@@ -6837,25 +6877,17 @@ static void computeTargetPSDs_direct_subframe_fx(
        {
            cy_auto_dir_smooth[cur_idx + i] = W_extract_h( W_shl( W_tmp[i], q_tmp ) ); /*q_reference_power+q_tmp*/
            move32();
#ifdef FIX_867
            q_cy_auto_dir_smooth[cur_idx + i] = add( q_reference_power[i], q_tmp );
            move16();

            q_cy_cross_dir_smooth[cur_idx + i] = q_reference_power[i];
            move16();
#endif
        }
#ifndef FIX_867
        q_cy_auto_dir_smooth[ch_idx] = add( *q_reference_power, q_tmp );
        move16();
#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
#endif
    }

#ifndef FIX_867
    *q_cy_cross_dir_smooth = *q_reference_power;
#endif
	move16();
#endif

    return;
}