Loading lib_com/ivas_dirac_com.c +75 −23 Original line number Diff line number Diff line Loading @@ -1360,8 +1360,16 @@ void computeDiffuseness_fixed( move32(); Word32 *p_tmp; const Word32 *p_tmp_c; #ifdef FIX_867 const Word16 *p_q_tmp_c; #endif Word16 min_q_shift1, min_q_shift2, exp1, exp2, q_tmp; Word16 q_ene, q_intensity, q_intensity_slow; #ifdef FIX_867 Word16 q_ene[CLDFB_NO_CHANNELS_MAX]; #else Word16 q_ene; #endif Word16 q_intensity, q_intensity_slow; /* Compute Intensity slow and energy slow buffer_intensity and buffer_energy */ Loading @@ -1370,16 +1378,15 @@ void computeDiffuseness_fixed( set_zero_fx( energy_slow, CLDFB_NO_CHANNELS_MAX ); /* Calculate max possible shift for the buffer buffer_energy and buffer_intensity */ #ifdef FIX_867 min_q_shift1 = find_guarded_bits_fx(DIRAC_NO_COL_AVG_DIFF); #else min_q_shift1 = Q31; move16(); #ifndef FIX_867 min_q_shift1 = s_min( min_q_shift1, getScaleFactor32( buffer_energy, i_mult( DIRAC_NO_COL_AVG_DIFF, num_freq_bands ) ) ); min_q_shift1 = sub( min_q_shift1, find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ) ); #else min_q_shift1 = find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ); #endif min_q_shift2 = Q31; move16(); FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) Loading @@ -1390,9 +1397,8 @@ void computeDiffuseness_fixed( } } min_q_shift2 = sub( min_q_shift2, find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ) ); #ifdef FIX_867 q_ene = min_q_shift1; set16_fx( q_ene, Q31 - find_guarded_bits_fx(DIRAC_NO_COL_AVG_DIFF), num_freq_bands ); #else q_ene = add( q_factor_energy[0], min_q_shift1 ); #endif Loading @@ -1400,24 +1406,49 @@ void computeDiffuseness_fixed( q_intensity = add( q_factor_intensity[0], min_q_shift2 ); move16(); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { #ifdef FIX_867 p_tmp_c = buffer_energy + i * num_freq_bands; p_q_tmp_c = q_factor_energy + i * num_freq_bands; FOR(k = 0; k < num_freq_bands; k++) { /* Energy slow */ Word32 tmp1; Word16 tmp1_q; #ifdef FIX_867_DBG assert(norm_l(p_tmp_c[k])==0); assert(p_tmp_c[k]>=0); #endif tmp1 = L_shr(p_tmp_c[k], min_q_shift1); tmp1_q = sub(p_q_tmp_c[k], min_q_shift1); IF( LT_16(tmp1_q, q_ene[k]) ) { energy_slow[k] = L_shr(energy_slow[k], sub(q_ene[k], tmp1_q)); q_ene[k] = tmp1_q; energy_slow[k] = L_add(energy_slow[k], tmp1); } ELSE { tmp1 = L_shr( tmp1, sub(tmp1_q, q_ene[k]) ); energy_slow[k] = L_add(energy_slow[k], tmp1); } #ifdef FIX_867_DBG assert(energy_slow[k]>=0); #endif } #else /* Energy slow */ p_tmp_c = buffer_energy + i * num_freq_bands; #ifndef FIX_867 q_tmp = add( q_factor_energy[i], min_q_shift1 ); #endif FOR( k = 0; k < num_freq_bands; k++ ) { #ifdef FIX_867 q_tmp = add( q_factor_energy[i * num_freq_bands + k], min_q_shift1 ); tmp = L_shr( p_tmp_c[k], min_q_shift1 ); #else tmp = L_shl( p_tmp_c[k], min_q_shift1 ); #endif IF( LT_16( q_tmp, q_ene ) ) { energy_slow[k] = L_add( L_shr( energy_slow[k], sub( q_ene, q_tmp ) ), tmp ); Loading @@ -1428,18 +1459,12 @@ void computeDiffuseness_fixed( energy_slow[k] = L_add( energy_slow[k], L_shr( tmp, sub( q_tmp, q_ene ) ) ); move32(); } #ifdef FIX_867 q_ene = s_min( q_ene, q_tmp ); #endif } #ifndef FIX_867 q_ene = s_min( q_ene, q_tmp ); #endif /* Intensity slow */ #ifndef FIX_867 q_tmp = add( q_factor_intensity[i], min_q_shift2 ); #endif FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) { p_tmp = buffer_intensity[j][i]; Loading @@ -1458,6 +1483,7 @@ void computeDiffuseness_fixed( } } } q_intensity = s_min( q_intensity, q_tmp ); } min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) ); Loading Loading @@ -1490,7 +1516,11 @@ void computeDiffuseness_fixed( tmp = Sqrt32( p_tmp[i], &exp1 ); tmp = BASOP_Util_Divide3232_Scale_cadence( tmp, L_add( energy_slow[i], EPSILLON_FX ), &exp2 ); #ifdef FIX_867 q_tmp = add(sub(31, exp2), sub(sub(31, exp1), q_ene[i])); #else q_tmp = add( sub( 31, exp2 ), sub( sub( 31, exp1 ), q_ene ) ); #endif IF( LT_16( q_tmp, Q30 ) ) { Loading Loading @@ -1522,6 +1552,28 @@ void computeDiffuseness_fixed( *q_diffuseness = Q30; move16(); #if 0 exp1 = L_norm_arr(diffuseness, num_freq_bands); Scale_sig32(diffuseness,num_freq_bands,exp1); *q_diffuseness = add(*q_diffuseness, exp1); #endif #ifdef FIX_867 FOR(Word16 l = 0; l < num_freq_bands; l++) { static FILE *f = 0; if (f == 0) f = fopen("diffuseness", "w"); Word32 m = diffuseness[i]; Word16 e = *q_diffuseness; 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 return; } #endif Loading lib_dec/ivas_dirac_dec.c +9 −2 Original line number Diff line number Diff line Loading @@ -4637,7 +4637,14 @@ void ivas_dirac_dec_render_sf_fx( #endif move16(); computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); } /*-----------------------------------------------------------------* Loading Loading @@ -5064,7 +5071,7 @@ void ivas_dirac_dec_render_sf_fx( IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { #ifdef FIX_867 FOR( Word16 l = 0; l < size_ho; l++ ) FOR( Word16 l = 0; l < 0; l++ ) { IF( NE_16( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth[l], Q26 ) ) { Loading lib_rend/ivas_dirac_output_synthesis_dec.c +19 −3 Original line number Diff line number Diff line Loading @@ -2045,18 +2045,19 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( num_freq_bands, 0 ); /*Q(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ #ifdef FIX_867_DBG Word16 cur_idx = imult1616(ch_idx, num_freq_bands); FOR(Word16 l = 0; l < num_freq_bands; l++) { static FILE *f = 0; if (f == 0) f = fopen("cy_cross_dir_smooth1", "w"); Word32 m = h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands_diff + l]; Word16 e = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth[ch_idx * num_freq_bands_diff + l]; Word32 m = h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[cur_idx + l]; Word16 e = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth[cur_idx + 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); fprintf(f, "%d %d %d %d %f\n", ch_idx, l, m, e, f1); } #endif } Loading Loading @@ -6377,6 +6378,21 @@ void ivas_dirac_dec_compute_gain_factors_fx( move32(); } #ifdef FIX_867_DBG FOR(Word16 l = 0; l < num_freq_bands; l++) { static FILE *f = 0; if (f == 0) f = fopen("direct_gain_factor1", "w"); Word32 m = direct_gain_factor[i]; Word16 e = *max_exp_direct_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", l, m, e, f1); } #endif return; } Loading Loading
lib_com/ivas_dirac_com.c +75 −23 Original line number Diff line number Diff line Loading @@ -1360,8 +1360,16 @@ void computeDiffuseness_fixed( move32(); Word32 *p_tmp; const Word32 *p_tmp_c; #ifdef FIX_867 const Word16 *p_q_tmp_c; #endif Word16 min_q_shift1, min_q_shift2, exp1, exp2, q_tmp; Word16 q_ene, q_intensity, q_intensity_slow; #ifdef FIX_867 Word16 q_ene[CLDFB_NO_CHANNELS_MAX]; #else Word16 q_ene; #endif Word16 q_intensity, q_intensity_slow; /* Compute Intensity slow and energy slow buffer_intensity and buffer_energy */ Loading @@ -1370,16 +1378,15 @@ void computeDiffuseness_fixed( set_zero_fx( energy_slow, CLDFB_NO_CHANNELS_MAX ); /* Calculate max possible shift for the buffer buffer_energy and buffer_intensity */ #ifdef FIX_867 min_q_shift1 = find_guarded_bits_fx(DIRAC_NO_COL_AVG_DIFF); #else min_q_shift1 = Q31; move16(); #ifndef FIX_867 min_q_shift1 = s_min( min_q_shift1, getScaleFactor32( buffer_energy, i_mult( DIRAC_NO_COL_AVG_DIFF, num_freq_bands ) ) ); min_q_shift1 = sub( min_q_shift1, find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ) ); #else min_q_shift1 = find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ); #endif min_q_shift2 = Q31; move16(); FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) Loading @@ -1390,9 +1397,8 @@ void computeDiffuseness_fixed( } } min_q_shift2 = sub( min_q_shift2, find_guarded_bits_fx( DIRAC_NO_COL_AVG_DIFF ) ); #ifdef FIX_867 q_ene = min_q_shift1; set16_fx( q_ene, Q31 - find_guarded_bits_fx(DIRAC_NO_COL_AVG_DIFF), num_freq_bands ); #else q_ene = add( q_factor_energy[0], min_q_shift1 ); #endif Loading @@ -1400,24 +1406,49 @@ void computeDiffuseness_fixed( q_intensity = add( q_factor_intensity[0], min_q_shift2 ); move16(); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { #ifdef FIX_867 p_tmp_c = buffer_energy + i * num_freq_bands; p_q_tmp_c = q_factor_energy + i * num_freq_bands; FOR(k = 0; k < num_freq_bands; k++) { /* Energy slow */ Word32 tmp1; Word16 tmp1_q; #ifdef FIX_867_DBG assert(norm_l(p_tmp_c[k])==0); assert(p_tmp_c[k]>=0); #endif tmp1 = L_shr(p_tmp_c[k], min_q_shift1); tmp1_q = sub(p_q_tmp_c[k], min_q_shift1); IF( LT_16(tmp1_q, q_ene[k]) ) { energy_slow[k] = L_shr(energy_slow[k], sub(q_ene[k], tmp1_q)); q_ene[k] = tmp1_q; energy_slow[k] = L_add(energy_slow[k], tmp1); } ELSE { tmp1 = L_shr( tmp1, sub(tmp1_q, q_ene[k]) ); energy_slow[k] = L_add(energy_slow[k], tmp1); } #ifdef FIX_867_DBG assert(energy_slow[k]>=0); #endif } #else /* Energy slow */ p_tmp_c = buffer_energy + i * num_freq_bands; #ifndef FIX_867 q_tmp = add( q_factor_energy[i], min_q_shift1 ); #endif FOR( k = 0; k < num_freq_bands; k++ ) { #ifdef FIX_867 q_tmp = add( q_factor_energy[i * num_freq_bands + k], min_q_shift1 ); tmp = L_shr( p_tmp_c[k], min_q_shift1 ); #else tmp = L_shl( p_tmp_c[k], min_q_shift1 ); #endif IF( LT_16( q_tmp, q_ene ) ) { energy_slow[k] = L_add( L_shr( energy_slow[k], sub( q_ene, q_tmp ) ), tmp ); Loading @@ -1428,18 +1459,12 @@ void computeDiffuseness_fixed( energy_slow[k] = L_add( energy_slow[k], L_shr( tmp, sub( q_tmp, q_ene ) ) ); move32(); } #ifdef FIX_867 q_ene = s_min( q_ene, q_tmp ); #endif } #ifndef FIX_867 q_ene = s_min( q_ene, q_tmp ); #endif /* Intensity slow */ #ifndef FIX_867 q_tmp = add( q_factor_intensity[i], min_q_shift2 ); #endif FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) { p_tmp = buffer_intensity[j][i]; Loading @@ -1458,6 +1483,7 @@ void computeDiffuseness_fixed( } } } q_intensity = s_min( q_intensity, q_tmp ); } min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) ); Loading Loading @@ -1490,7 +1516,11 @@ void computeDiffuseness_fixed( tmp = Sqrt32( p_tmp[i], &exp1 ); tmp = BASOP_Util_Divide3232_Scale_cadence( tmp, L_add( energy_slow[i], EPSILLON_FX ), &exp2 ); #ifdef FIX_867 q_tmp = add(sub(31, exp2), sub(sub(31, exp1), q_ene[i])); #else q_tmp = add( sub( 31, exp2 ), sub( sub( 31, exp1 ), q_ene ) ); #endif IF( LT_16( q_tmp, Q30 ) ) { Loading Loading @@ -1522,6 +1552,28 @@ void computeDiffuseness_fixed( *q_diffuseness = Q30; move16(); #if 0 exp1 = L_norm_arr(diffuseness, num_freq_bands); Scale_sig32(diffuseness,num_freq_bands,exp1); *q_diffuseness = add(*q_diffuseness, exp1); #endif #ifdef FIX_867 FOR(Word16 l = 0; l < num_freq_bands; l++) { static FILE *f = 0; if (f == 0) f = fopen("diffuseness", "w"); Word32 m = diffuseness[i]; Word16 e = *q_diffuseness; 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 return; } #endif Loading
lib_dec/ivas_dirac_dec.c +9 −2 Original line number Diff line number Diff line Loading @@ -4637,7 +4637,14 @@ void ivas_dirac_dec_render_sf_fx( #endif move16(); computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); } /*-----------------------------------------------------------------* Loading Loading @@ -5064,7 +5071,7 @@ void ivas_dirac_dec_render_sf_fx( IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { #ifdef FIX_867 FOR( Word16 l = 0; l < size_ho; l++ ) FOR( Word16 l = 0; l < 0; l++ ) { IF( NE_16( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth[l], Q26 ) ) { Loading
lib_rend/ivas_dirac_output_synthesis_dec.c +19 −3 Original line number Diff line number Diff line Loading @@ -2045,18 +2045,19 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( num_freq_bands, 0 ); /*Q(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ #ifdef FIX_867_DBG Word16 cur_idx = imult1616(ch_idx, num_freq_bands); FOR(Word16 l = 0; l < num_freq_bands; l++) { static FILE *f = 0; if (f == 0) f = fopen("cy_cross_dir_smooth1", "w"); Word32 m = h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands_diff + l]; Word16 e = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth[ch_idx * num_freq_bands_diff + l]; Word32 m = h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[cur_idx + l]; Word16 e = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth[cur_idx + 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); fprintf(f, "%d %d %d %d %f\n", ch_idx, l, m, e, f1); } #endif } Loading Loading @@ -6377,6 +6378,21 @@ void ivas_dirac_dec_compute_gain_factors_fx( move32(); } #ifdef FIX_867_DBG FOR(Word16 l = 0; l < num_freq_bands; l++) { static FILE *f = 0; if (f == 0) f = fopen("direct_gain_factor1", "w"); Word32 m = direct_gain_factor[i]; Word16 e = *max_exp_direct_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", l, m, e, f1); } #endif return; } Loading