Loading lib_rend/ivas_reverb_utils_fx.c +24 −11 Original line number Diff line number Diff line Loading @@ -83,8 +83,8 @@ ivas_error ivas_reverb_prepare_cldfb_params( int16_t idx; #define CLDFB_BAND_WIDTH (400) // TODO: Fixme! const Word16 cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); const Word16 halfstep = 13107200; //Q16 //const Word16 cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); //const Word16 halfstep = 13107200; //Q16 Word32 output_fc_fx[CLDFB_NO_CHANNELS_MAX]; Word32 output_t60_fx[CLDFB_NO_CHANNELS_MAX]; Word32 output_ene_fx[CLDFB_NO_CHANNELS_MAX]; Loading @@ -100,14 +100,14 @@ ivas_error ivas_reverb_prepare_cldfb_params( FOR ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { output_fc_fx[idx] = (Word32) ( ( idx + 0.5f ) * ( MAX_SAMPLING_RATE / ( 2 * CLDFB_NO_CHANNELS_MAX ) ) ) * ONE_IN_Q16; // output_fc_fx[idx] = (Word32) ( ( idx + 0.5f ) * ( MAX_SAMPLING_RATE / ( 2 * CLDFB_NO_CHANNELS_MAX ) ) ) * ONE_IN_Q16; output_fc_fx[idx] = ( ( idx << 1 ) + 1 ) * cldfb_freq_halfstep * ONE_IN_Q16; // output_fc_fx[idx] = ( ( idx << 1 ) + 1 ) * cldfb_freq_halfstep * ONE_IN_Q16; output_fc_fx[idx] = mult( add( ( mult(idx, ONE_IN_Q16) << 1 ), ONE_IN_Q16 ), halfstep );//Debug // output_fc_fx[idx] = mult( add( ( mult(idx, ONE_IN_Q16) << 1 ), ONE_IN_Q16 ), halfstep );//Debug output_fc_fx[idx] = L_add( L_shr( cldfb_band_width, 1 ), L_shl(Mult_32_16( cldfb_band_width, idx ), 15 ) ); int a = 1; // for debugging // int a = 1; // for debugging } // TODO: Replace all these dedicated interpolate functions with just one taking a single input vector and map it to a single output vector. Period. Loading @@ -116,18 +116,20 @@ ivas_error ivas_reverb_prepare_cldfb_params( CLDFB_NO_CHANNELS_MAX, output_fc_fx, output_t60_fx, output_ene_fx ); //write to csv /*FILE *filewriter = fopen("output.csv", "w"); FILE *filewriter = fopen("output.csv", "w"); if (filewriter == NULL) { perror("Failed to open file"); return; // return; } fprintf( filewriter, "T60(old function),DSR (old fucntion)\n" ); FOR( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { fprintf( filewriter, "%f,%f", (float) output_t60_fx / ( 1 << 26 ), (float) output_ene_fx / ( 1 << 30 ) ); }*/ fprintf( filewriter, "%f,%f\n", (float) output_t60_fx[idx] / ( 1 << 26 ), (float) output_ene_fx[idx] / ( 1 << 30 ) ); } fprintf( filewriter, "\n" ); //Testing generalised interpolate function - write values to csv for comparison //T60 Loading @@ -135,6 +137,11 @@ ivas_error ivas_reverb_prepare_cldfb_params( //DSR ivas_reverb_interp_on_freq_grid_fx( pInput_params->nBands, pInput_params->pFc_input_fx, pInput_params->pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX, output_fc_fx, output_ene_fx ); FOR( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { fprintf( filewriter, "%f,%f\n", (float) output_t60_fx[idx] / ( 1 << 26 ), (float) output_ene_fx[idx] / ( 1 << 30 ) ); } //output_t60_fx: Q26, output_ene_fx: Q30 /* adjust DSR for the delay difference */ Loading Loading @@ -174,6 +181,7 @@ ivas_error ivas_reverb_prepare_cldfb_params( } //This function can be condensed ivas_reverb_set_energies( hHrtfStatistics->average_energy_l, hHrtfStatistics->average_energy_r, output_Fs, avg_pwr_left_fx, avg_pwr_right_fx ); //This function returns avg powers for left and right in Q28 -> why?? how?? for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) Loading Loading @@ -259,6 +267,11 @@ static void ivas_reverb_set_energies( #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT ivas_reverb_interpolate_energies_fx( avg_pwr_len, input_fc_fx, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx ); //Retains Q-Format //Avg Energy Left ivas_reverb_interp_on_freq_grid_fx( avg_pwr_len, input_fc_fx, avg_pwr_l, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx ); //Avg Energy Right ivas_reverb_interp_on_freq_grid_fx( avg_pwr_len, input_fc_fx, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_right_fx ); #else ivas_reverb_interpolate_acoustic_data_fx( FFT_SPECTRUM_SIZE, input_fc_fx, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx, avg_pwr_left_e, avg_pwr_right_e ); Loading Loading
lib_rend/ivas_reverb_utils_fx.c +24 −11 Original line number Diff line number Diff line Loading @@ -83,8 +83,8 @@ ivas_error ivas_reverb_prepare_cldfb_params( int16_t idx; #define CLDFB_BAND_WIDTH (400) // TODO: Fixme! const Word16 cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); const Word16 halfstep = 13107200; //Q16 //const Word16 cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); //const Word16 halfstep = 13107200; //Q16 Word32 output_fc_fx[CLDFB_NO_CHANNELS_MAX]; Word32 output_t60_fx[CLDFB_NO_CHANNELS_MAX]; Word32 output_ene_fx[CLDFB_NO_CHANNELS_MAX]; Loading @@ -100,14 +100,14 @@ ivas_error ivas_reverb_prepare_cldfb_params( FOR ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { output_fc_fx[idx] = (Word32) ( ( idx + 0.5f ) * ( MAX_SAMPLING_RATE / ( 2 * CLDFB_NO_CHANNELS_MAX ) ) ) * ONE_IN_Q16; // output_fc_fx[idx] = (Word32) ( ( idx + 0.5f ) * ( MAX_SAMPLING_RATE / ( 2 * CLDFB_NO_CHANNELS_MAX ) ) ) * ONE_IN_Q16; output_fc_fx[idx] = ( ( idx << 1 ) + 1 ) * cldfb_freq_halfstep * ONE_IN_Q16; // output_fc_fx[idx] = ( ( idx << 1 ) + 1 ) * cldfb_freq_halfstep * ONE_IN_Q16; output_fc_fx[idx] = mult( add( ( mult(idx, ONE_IN_Q16) << 1 ), ONE_IN_Q16 ), halfstep );//Debug // output_fc_fx[idx] = mult( add( ( mult(idx, ONE_IN_Q16) << 1 ), ONE_IN_Q16 ), halfstep );//Debug output_fc_fx[idx] = L_add( L_shr( cldfb_band_width, 1 ), L_shl(Mult_32_16( cldfb_band_width, idx ), 15 ) ); int a = 1; // for debugging // int a = 1; // for debugging } // TODO: Replace all these dedicated interpolate functions with just one taking a single input vector and map it to a single output vector. Period. Loading @@ -116,18 +116,20 @@ ivas_error ivas_reverb_prepare_cldfb_params( CLDFB_NO_CHANNELS_MAX, output_fc_fx, output_t60_fx, output_ene_fx ); //write to csv /*FILE *filewriter = fopen("output.csv", "w"); FILE *filewriter = fopen("output.csv", "w"); if (filewriter == NULL) { perror("Failed to open file"); return; // return; } fprintf( filewriter, "T60(old function),DSR (old fucntion)\n" ); FOR( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { fprintf( filewriter, "%f,%f", (float) output_t60_fx / ( 1 << 26 ), (float) output_ene_fx / ( 1 << 30 ) ); }*/ fprintf( filewriter, "%f,%f\n", (float) output_t60_fx[idx] / ( 1 << 26 ), (float) output_ene_fx[idx] / ( 1 << 30 ) ); } fprintf( filewriter, "\n" ); //Testing generalised interpolate function - write values to csv for comparison //T60 Loading @@ -135,6 +137,11 @@ ivas_error ivas_reverb_prepare_cldfb_params( //DSR ivas_reverb_interp_on_freq_grid_fx( pInput_params->nBands, pInput_params->pFc_input_fx, pInput_params->pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX, output_fc_fx, output_ene_fx ); FOR( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { fprintf( filewriter, "%f,%f\n", (float) output_t60_fx[idx] / ( 1 << 26 ), (float) output_ene_fx[idx] / ( 1 << 30 ) ); } //output_t60_fx: Q26, output_ene_fx: Q30 /* adjust DSR for the delay difference */ Loading Loading @@ -174,6 +181,7 @@ ivas_error ivas_reverb_prepare_cldfb_params( } //This function can be condensed ivas_reverb_set_energies( hHrtfStatistics->average_energy_l, hHrtfStatistics->average_energy_r, output_Fs, avg_pwr_left_fx, avg_pwr_right_fx ); //This function returns avg powers for left and right in Q28 -> why?? how?? for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) Loading Loading @@ -259,6 +267,11 @@ static void ivas_reverb_set_energies( #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT ivas_reverb_interpolate_energies_fx( avg_pwr_len, input_fc_fx, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx ); //Retains Q-Format //Avg Energy Left ivas_reverb_interp_on_freq_grid_fx( avg_pwr_len, input_fc_fx, avg_pwr_l, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx ); //Avg Energy Right ivas_reverb_interp_on_freq_grid_fx( avg_pwr_len, input_fc_fx, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_right_fx ); #else ivas_reverb_interpolate_acoustic_data_fx( FFT_SPECTRUM_SIZE, input_fc_fx, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx, avg_pwr_left_e, avg_pwr_right_e ); Loading