Loading lib_rend/ivas_dirac_output_synthesis_dec_fx.c +24 −24 Original line number Diff line number Diff line Loading @@ -2022,31 +2022,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); #ifndef FIX_867_CLDFB_NRG_SCALE // Scale cy_auto_diff_smooth_fx if required IF( diff_start_band != 0 ) { #ifdef FIX_867_CLDFB_NRG_SCALE /* Is this necessary at all ? */ q_com = s_min( s_min( q_reference_power_smooth[0], q_reference_power_smooth[1] ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); scale_sig32( reference_power_smooth, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, i_mult( num_freq_bands, nchan_target_psds ), sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ); /*h_dirac_output_synthesis_state->q_cy_auto_diff_smooth -> q_com*/ q_reference_power_smooth[0] = q_com; q_reference_power_smooth[1] = q_com; move16(); move16(); h_dirac_output_synthesis_state->reference_power_smooth_prev_q[0] = q_com; h_dirac_output_synthesis_state->reference_power_smooth_prev_q[1] = q_com; move16(); move16(); h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; move16(); #else q_com = s_min( *q_reference_power_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); scale_sig32( reference_power_smooth, num_freq_bands, sub( q_com, *q_reference_power_smooth ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, num_freq_bands, sub( q_com, *q_reference_power_smooth ) ); /**q_reference_power_smooth->q_com*/ Loading @@ -2060,8 +2039,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; move16(); #endif } #endif computeTargetPSDs_diffuse_subframe_fx( nchan_target_psds, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor_fx, Loading Loading @@ -4250,24 +4229,45 @@ static void computeTargetPSDs_diffuse_subframe_fx( { Word16 ch_idx, cur_idx; Word32 diffuse_power[CLDFB_NO_CHANNELS_MAX]; /* segment auxiliary buffer; size: num_freq_bands. */ #ifdef FIX_867_CLDFB_NRG_SCALE Word16 q_cy_auto_diff_smooth_new; #endif /* estimate direct and diffuse power */ v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power #ifdef FIX_867_CLDFB_NRG_SCALE Scale_sig32( diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_reference_power[0], q_reference_power[1] ) ); q_cy_auto_diff_smooth_new = q_reference_power[0]; move16(); IF ( LT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) { Scale_sig32( diffuse_power, num_freq_bands, sub( *q_cy_auto_diff_smooth, q_reference_power[0] ) ); q_cy_auto_diff_smooth_new = *q_cy_auto_diff_smooth; move16(); } #endif /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { cur_idx = imult1616( ch_idx, num_freq_bands ); #ifdef FIX_867_CLDFB_NRG_SCALE IF ( GT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) { Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, sub( q_reference_power[0], *q_cy_auto_diff_smooth ) ); } #endif v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ) ); // (q_reference_power, Q31) -> q_reference_power } #ifdef FIX_867_CLDFB_NRG_SCALE *q_cy_auto_diff_smooth = q_cy_auto_diff_smooth_new; move16(); #else *q_cy_auto_diff_smooth = *q_reference_power; move16(); #endif return; } Loading lib_rend/lib_rend.c +24 −1 Original line number Diff line number Diff line Loading @@ -8455,7 +8455,6 @@ static void intermidiate_ext_dirac_render( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], tmp ); move16(); move16(); #else /* Possible improvement: normalize both scale regions individually. */ tmp = 0; move16(); FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) Loading Loading @@ -8488,12 +8487,36 @@ static void intermidiate_ext_dirac_render( move16(); #endif #ifdef FIX_867_CLDFB_NRG_SCALE #if 0 /* Possible improvement: normalize both scale regions individually. */ tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ) ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ); hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ); move16(); #else tmp = 0; FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) { tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ) ) ); } FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) { scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ); move16(); FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) { tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); } FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) { scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ); move16(); #endif #else tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ) ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ Loading Loading
lib_rend/ivas_dirac_output_synthesis_dec_fx.c +24 −24 Original line number Diff line number Diff line Loading @@ -2022,31 +2022,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); #ifndef FIX_867_CLDFB_NRG_SCALE // Scale cy_auto_diff_smooth_fx if required IF( diff_start_band != 0 ) { #ifdef FIX_867_CLDFB_NRG_SCALE /* Is this necessary at all ? */ q_com = s_min( s_min( q_reference_power_smooth[0], q_reference_power_smooth[1] ), h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); scale_sig32( reference_power_smooth, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( reference_power_smooth + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, s_min( num_freq_bands, CLDFB_NO_CHANNELS_HALF ), sub( q_com, q_reference_power_smooth[0] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_com, q_reference_power_smooth[1] ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, i_mult( num_freq_bands, nchan_target_psds ), sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ); /*h_dirac_output_synthesis_state->q_cy_auto_diff_smooth -> q_com*/ q_reference_power_smooth[0] = q_com; q_reference_power_smooth[1] = q_com; move16(); move16(); h_dirac_output_synthesis_state->reference_power_smooth_prev_q[0] = q_com; h_dirac_output_synthesis_state->reference_power_smooth_prev_q[1] = q_com; move16(); move16(); h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; move16(); #else q_com = s_min( *q_reference_power_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); scale_sig32( reference_power_smooth, num_freq_bands, sub( q_com, *q_reference_power_smooth ) ); /**q_reference_power_smooth->q_com*/ scale_sig32( h_dirac_output_synthesis_state->reference_power_smooth_prev_fx, num_freq_bands, sub( q_com, *q_reference_power_smooth ) ); /**q_reference_power_smooth->q_com*/ Loading @@ -2060,8 +2039,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = q_com; move16(); #endif } #endif computeTargetPSDs_diffuse_subframe_fx( nchan_target_psds, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor_fx, Loading Loading @@ -4250,24 +4229,45 @@ static void computeTargetPSDs_diffuse_subframe_fx( { Word16 ch_idx, cur_idx; Word32 diffuse_power[CLDFB_NO_CHANNELS_MAX]; /* segment auxiliary buffer; size: num_freq_bands. */ #ifdef FIX_867_CLDFB_NRG_SCALE Word16 q_cy_auto_diff_smooth_new; #endif /* estimate direct and diffuse power */ v_mult_fixed( diffuse_power_factor, reference_power, diffuse_power, num_freq_bands ); // (Q31, q_reference_power) -> q_reference_power #ifdef FIX_867_CLDFB_NRG_SCALE Scale_sig32( diffuse_power + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), sub( q_reference_power[0], q_reference_power[1] ) ); q_cy_auto_diff_smooth_new = q_reference_power[0]; move16(); IF ( LT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) { Scale_sig32( diffuse_power, num_freq_bands, sub( *q_cy_auto_diff_smooth, q_reference_power[0] ) ); q_cy_auto_diff_smooth_new = *q_cy_auto_diff_smooth; move16(); } #endif /* compute target auto and cross PSDs of current frame (smoothed) */ FOR( ch_idx = 0; ch_idx < num_channels; ++ch_idx ) { cur_idx = imult1616( ch_idx, num_freq_bands ); #ifdef FIX_867_CLDFB_NRG_SCALE IF ( GT_16( *q_cy_auto_diff_smooth, q_reference_power[0] ) ) { Scale_sig32( &cy_auto_diff_smooth[cur_idx], start_band, sub( q_reference_power[0], *q_cy_auto_diff_smooth ) ); } #endif v_multc_fixed( &diffuse_power[start_band], diffuse_responses_square[ch_idx], &cy_auto_diff_smooth[cur_idx + start_band], sub( num_freq_bands, start_band ) ); // (q_reference_power, Q31) -> q_reference_power } #ifdef FIX_867_CLDFB_NRG_SCALE *q_cy_auto_diff_smooth = q_cy_auto_diff_smooth_new; move16(); #else *q_cy_auto_diff_smooth = *q_reference_power; move16(); #endif return; } Loading
lib_rend/lib_rend.c +24 −1 Original line number Diff line number Diff line Loading @@ -8455,7 +8455,6 @@ static void intermidiate_ext_dirac_render( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1] = add( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q[1], tmp ); move16(); move16(); #else /* Possible improvement: normalize both scale regions individually. */ tmp = 0; move16(); FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) Loading Loading @@ -8488,12 +8487,36 @@ static void intermidiate_ext_dirac_render( move16(); #endif #ifdef FIX_867_CLDFB_NRG_SCALE #if 0 /* Possible improvement: normalize both scale regions individually. */ tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ) ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ); hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ); move16(); #else tmp = 0; FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) { tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ) ) ); } FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) { scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, s_min( CLDFB_NO_CHANNELS_HALF, hSpatParamRendCom->num_freq_bands ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[0] ); move16(); FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) { tmp = s_min( tmp, L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ) ) ); } FOR( slot_idx = 0; slot_idx < hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len; slot_idx = add( slot_idx, hSpatParamRendCom->num_freq_bands ) ) { scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx + CLDFB_NO_CHANNELS_HALF, s_max( 0, sub( hSpatParamRendCom->num_freq_bands, CLDFB_NO_CHANNELS_HALF ) ), tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ } hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] = add( tmp, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q[1] ); move16(); #endif #else tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, imult1616( hDirACRend->num_protos_dir, hSpatParamRendCom->num_freq_bands ) ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len, tmp ); /* Q(hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q + tmp) */ Loading