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

fix indexing problems

parent 60a00622
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -4980,22 +4980,6 @@ void ivas_dirac_dec_render_sf_fx(
            q_reference_power_smooth = sub( q_reference_power_smooth, 1 );
#endif


#ifdef FIX_867_DBG
            FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ )
            {
                static FILE *f = 0;
                if ( f == 0 )
                    f = fopen( "reference_power_smooth_fx", "w" );

                Word32 m = reference_power_smooth_fx[i];
                Word16 e = q_reference_power_smooth[i];
                float f1_m = (float) m;
                float f1_e = powf( 2, e );
                float f1 = f1_m / f1_e;
                fprintf( f, "%d %d %d %f\n", i, m, e, f1 );
            }
#endif
        }
    }

+67 −4
Original line number Diff line number Diff line
@@ -4071,6 +4071,21 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
            g2 = L_sub( ONE_IN_Q31, g1 ); // Q31
            W_temp = W_add( W_mult_32_32( g1, ( *( p_cy_auto_dir_smooth++ ) ) ),
                            W_mult_32_32( g2, ( *( p_cy_auto_dir_smooth_prev ) ) ) ); /*32+q_cy_auto_dir_smooth_prev_local*/
#ifdef FIX_867_DBG
			{
				static FILE *f = 0;
				if (f == 0)
					f = fopen("p_cy_auto_dir_smooth_prev", "w");

				Word32 m = *p_cy_auto_dir_smooth_prev;
				Word16 e = q_cy_auto_dir_smooth_prev_local[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);
			}
#endif

            q_tmp = W_norm( W_temp );
            L_tmp = W_extract_h( W_shl( W_temp, q_tmp ) );              // q_cy_auto_dir_smooth_prev_local + q_tmp
            *( p_cy_auto_dir_smooth_prev++ ) = L_shr_r( L_tmp, q_tmp ); // q_cy_auto_dir_smooth_prev_local
@@ -4088,9 +4103,23 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(

            ( p_cy_cross_dir_smooth++ );
            power_smooth_temp = L_shl( *p_power_smooth, norm_l( *p_power_smooth ) );
#ifdef FIX_867_DBG
			{
				static FILE *f = 0;
				if (f == 0)
					f = fopen("p_power_smooth1", "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
            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 ) ),
                                      add( q_cy_auto_dir_smooth_prev_local[k], q_tmp ) ),
                                      add( q_cy_auto_dir_smooth_prev_local[k*num_freq_bands + l], q_tmp ) ),
                                 Q31 ) );

            *( p_gains_dir ) = Sqrt32( L_tmp, &exp ); // (Q31 - exp)
@@ -6832,6 +6861,22 @@ static void computeTargetPSDs_direct_subframe_fx(
    /* segment auxiliary buffer */
    Word32 direct_power[CLDFB_NO_CHANNELS_MAX]; /* size: num_freq_bands. */

#ifdef FIX_867_DBG
	FOR(i = 0; i < num_freq_bands; i++)
	{
		static FILE *f = 0;
		if (f == 0)
			f = fopen("reference_power_smooth_fx", "w");

		Word32 m = reference_power[i];
		Word16 e = q_reference_power[i];
		float f1_m = (float)m;
		float f1_e = powf(2, e);
		float f1 = f1_m / f1_e;
		fprintf(f, "%d %d %d %f\n", i, m, e, f1);
	}
#endif

    /* estimate direct and diffuse power */
    FOR( i = 0; i < num_freq_bands; i++ )
    {
@@ -6854,7 +6899,7 @@ static void computeTargetPSDs_direct_subframe_fx(
			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);
			q_cy_auto_dir_smooth[cur_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]);
@@ -6905,7 +6950,25 @@ static void computeTargetPSDs_direct_subframe_fx(
			float f1_m = (float)m;
			float f1_e = powf(2, e);
			float f1 = f1_m / f1_e;
			fprintf(f, "%d %d %d %f\n", i, m, e, f1);
			fprintf(f, "%d %d %d %d %f\n", ch_idx, i, m, e, f1);
		}
	}

	FOR(ch_idx = 0; ch_idx < num_channels; ++ch_idx)
	{
		cur_idx = imult1616(ch_idx, num_freq_bands);
		FOR(i = 0; i < num_freq_bands; i++)
		{
			static FILE *f = 0;
			if (f == 0)
				f = fopen("cy_cross_dir_smooth1", "w");

			Word32 m = cy_cross_dir_smooth[cur_idx + i];
			Word16 e = q_cy_cross_dir_smooth[cur_idx + i];
			float f1_m = (float)m;
			float f1_e = powf(2, e);
			float f1 = f1_m / f1_e;
			fprintf(f, "%d %d %d %d %f\n", ch_idx, i, m, e, f1);
		}
	}
#endif