Loading lib_com/ivas_pca_tools.c +78 −42 Original line number Diff line number Diff line Loading @@ -560,6 +560,22 @@ void dquat2mat( return; } static Word16 check_bound( Word32 tmp ) { IF( GT_32( tmp, MAX16B ) ) { return MAX16B; } ELSE IF( LT_32( tmp, MIN16B ) ) { return MIN16B; } ELSE { return extract_l( tmp ); } } #ifdef IVAS_FLOAT_FIXED void dquat2mat_fx( const Word16 *ql, Loading Loading @@ -605,37 +621,37 @@ void dquat2mat_fx( dx = mult( d, x ); dy = mult( d, y ); dz = mult( d, z ); m[0] = sub( sub( aw, bx ), add( cy, dz ) ); m[0] = check_bound( L_sub( L_sub( aw, bx ), L_add( cy, dz ) ) ); move16(); m[1] = sub( sub( cz, dy ), add( ax, bw ) ); m[1] = check_bound( L_sub( L_sub( cz, dy ), L_add( ax, bw ) ) ); move16(); m[2] = add( sub( sub( negate( ay ), bz ), cw ), dx ); m[2] = check_bound( L_add( L_sub( L_sub( negate( ay ), bz ), cw ), dx ) ); move16(); m[3] = sub( sub( by, az ), add( cx, dw ) ); m[3] = check_bound( L_sub( L_sub( by, az ), L_add( cx, dw ) ) ); move16(); m[4] = add( sub( add( bw, ax ), dy ), cz ); m[4] = check_bound( L_add( L_sub( L_add( bw, ax ), dy ), cz ) ); move16(); m[5] = add( add( add( negate( bx ), aw ), dz ), cy ); m[5] = check_bound( L_add( L_add( L_add( negate( bx ), aw ), dz ), cy ) ); move16(); m[6] = sub( sub( add( negate( by ), az ), dw ), cx ); m[6] = check_bound( L_sub( L_sub( L_add( negate( by ), az ), dw ), cx ) ); move16(); m[7] = add( sub( sub( negate( bz ), ay ), dx ), cw ); m[7] = check_bound( L_add( L_sub( L_sub( negate( bz ), ay ), dx ), cw ) ); move16(); m[8] = sub( add( add( cw, dx ), ay ), bz ); m[8] = check_bound( L_sub( L_add( L_add( cw, dx ), ay ), bz ) ); move16(); m[9] = sub( sub( add( negate( cx ), dw ), az ), by ); m[9] = check_bound( L_sub( L_sub( L_add( negate( cx ), dw ), az ), by ) ); move16(); m[10] = add( add( add( negate( cy ), dz ), aw ), bx ); m[10] = check_bound( L_add( L_add( L_add( negate( cy ), dz ), aw ), bx ) ); move16(); m[11] = sub( add( sub( negate( cz ), dy ), ax ), bw ); m[11] = check_bound( L_sub( L_add( L_sub( negate( cz ), dy ), ax ), bw ) ); move16(); m[12] = add( add( sub( dw, cx ), by ), az ); m[12] = check_bound( L_add( L_add( L_sub( dw, cx ), by ), az ) ); move16(); m[13] = add( sub( sub( negate( dx ), cw ), bz ), ay ); m[13] = check_bound( L_add( L_sub( L_sub( negate( dx ), cw ), bz ), ay ) ); move16(); m[14] = sub( add( sub( negate( dy ), cz ), bw ), ax ); m[14] = check_bound( L_sub( L_add( L_sub( negate( dy ), cz ), bw ), ax ) ); move16(); m[15] = add( add( add( negate( dz ), cy ), bx ), aw ); m[15] = check_bound( L_add( L_add( L_add( negate( dz ), cy ), bx ), aw ) ); move16(); return; Loading Loading @@ -828,11 +844,11 @@ static void norm_quat_fx( move16(); norm_q = dotp_fx( q, q, IVAS_PCA_INTERP, &exp1 ); exp1 = sub( 31, add( exp1, 2 ) ); norm_q = ISqrt32( norm_q, &exp1 ); /*q(15 - exp)*/ norm_q = ISqrt32( norm_q, &exp1 ); /*Q(31 - exp)*/ FOR( i = 0; i < IVAS_PCA_INTERP; i++ ) { q[i] = mult( q[i], extract_l( L_shr( norm_q, 15 ) ) ); // todo : recheck q[i] = round_fx( L_shl( Mpy_32_16_1( norm_q, q[i] ), exp1 ) ); /* Q(15) */ move16(); } Loading Loading @@ -922,7 +938,7 @@ void pca_interp_preproc_fx( { Word16 alpha; Word16 j; Word16 tmp, tmp2, tmp3; Word16 tmp, tmp2, tmp3, tmp_e; FOR( j = 0; j < len; j++ ) { tmp = sub( len, 1 ); Loading @@ -933,11 +949,12 @@ void pca_interp_preproc_fx( } ELSE { alpha = idiv1616( j, tmp ); // the increment can be updated by simple delta //q15 alpha = BASOP_Util_Divide1616_Scale( j, tmp, &tmp_e ); // the increment can be updated by simple delta alpha = shl_sat( alpha, tmp_e ); /* Q15 */ } tmp2 = mult( EVS_PI_FX, alpha ); // q13 tmp3 = getCosWord16( tmp2 ); // q14 alpha = shr( sub( ONE_IN_Q14, tmp3 ), 1 ); // q15 tmp2 = mult( EVS_PI_FX, alpha ); /* Q13 */ tmp3 = getCosWord16( tmp2 ); /* Q14 */ alpha = sub_sat( ONE_IN_Q14, tmp3 ); /* Q15 */ alpha = sub( MAX_16, alpha ); quat_nlerp_preproc_fx( prev_ql, ql, alpha, &ql_interp[j * IVAS_PCA_INTERP] ); quat_nlerp_preproc_fx( prev_qr, qr, alpha, &qr_interp[j * IVAS_PCA_INTERP] ); Loading Loading @@ -986,16 +1003,30 @@ static void sp2cart_fx( Word16 *q ) { Word16 s1, s2, s1s2; s1 = getSinWord16( ph1 ); // q15 s2 = getSinWord16( ph2 ); // q15 s1s2 = mult( s1, s2 ); // q15 q[3] = mult( getSinWord16( ph3 ), s1s2 ); // q15 Word16 sin_ph3, cos_ph3; sin_ph3 = cos_ph3 = ph3; move16(); q[2] = mult( getCosWord16( ph3 ), s1s2 ); // q15 move16(); q[1] = mult( getCosWord16( ph2 ), s1 ); // q15 IF( GT_16( ph3, 12868 /* PI in Q12 */ ) ) { sin_ph3 = sub( 12868, ph3 ); /* sin(x) = sin(PI - x) */ cos_ph3 = sub( 25736, ph3 ); /* cos(x) = cos(2*PI - x) */ } sin_ph3 = shl( sin_ph3, 1 ); /* Q12 -> Q13 */ cos_ph3 = shl( cos_ph3, 1 ); /* Q12 -> Q13 */ s1 = getSinWord16( ph1 ); /* Q15 */ s2 = getSinWord16( ph2 ); /* Q15 */ s1s2 = mult( s1, s2 ); /* Q15 */ q[3] = mult( getSinWord16( sin_ph3 ), s1s2 ); /* Q15 */ move16(); q[2] = shl_sat( mult( getCosWord16( cos_ph3 ), s1s2 ), 1 ); /* Q15 */ move16(); q[0] = shl_sat( getCosWord16( ph1 ), 1 ); // q15 q[1] = shl_sat( mult( getCosWord16( ph2 ), s1 ), 1 ); /* Q15 */ move16(); q[0] = shl_sat( getCosWord16( ph1 ), 1 ); /* Q15 */ move16(); return; Loading @@ -1021,9 +1052,9 @@ static Word16 calc_n2_fx( { Word16 n2; Word32 temp; temp = L_mult( 23040, getSinWord16( ph1 ) ); // q8 n2 = round_fx( temp ); n2 = shr( n2, 7 ); temp = L_mult( 23040, getSinWord16( ph1 ) ); /* Q8 + Q15 + Q1 = Q24 */ n2 = round_fx( temp ); /* Q24 -> Q8 */ n2 = shr( n2, 8 ); IF( s_and( n2, 1 ) == 0 ) { n2 = add( n2, 1 ); Loading Loading @@ -1061,10 +1092,10 @@ static Word16 calc_n3_fx( const Word16 ph2 ) { Word16 n3; Word16 temp1 = mult( getSinWord16( ph2 ), getSinWord16( ph1 ) ); // q7 + q15 - q15 n3 = round_fx( L_mult( temp1, getSinWord16( ph2 ) ) ); // q7 + q15 - q15 Word16 temp1 = mult( getSinWord16( ph2 ), getSinWord16( ph1 ) ); /* Q15 */ n3 = round_fx( L_mult( temp1, 23040 /* 180.0f in Q7 */ ) ); /* Q15 + Q7 + Q1 - Q16 -> Q7*/ n3 = shr( n3, 8 ); n3 = shr( n3, 7 ); IF( n3 == 0 ) { Loading Loading @@ -1489,9 +1520,11 @@ void pca_dec_s3_fx( num_fx = 12868; move16(); d_fx = idiv1616( num_fx, n1 ); // Q12 d_fx = idiv1616( num_fx, sub( n1, 1 ) ); // Q12 ph1_q_fx = i_mult( index1, d_fx ); // Q12 ph1_q_fx = shl( ph1_q_fx, 1 ); /* Q12 -> Q13 */ n2 = calc_n2_fx( ph1_q_fx ); j = L_sub( j, ivas_pca_offset_index1[index1] ); Loading Loading @@ -1521,6 +1554,7 @@ void pca_dec_s3_fx( move16(); d_fx = idiv1616( num_fx, sub( n2, 1 ) ); // Q12 ph2_q_fx = i_mult( index2, d_fx ); // Q12 ph2_q_fx = shl( ph2_q_fx, 1 ); /* Q12 -> Q13 */ } j = L_sub( j, ivas_pca_offset_index2[add( index2, get_pca_offset_n2_fx( index1 ) )] ); Loading @@ -1536,11 +1570,13 @@ void pca_dec_s3_fx( } ELSE { num_fx = 6434; Word16 exp; num_fx = 25736; /* PI2 in Q12 */ move16(); d_fx = idiv1616( num_fx, n3 ); // Q10 ph3_q_fx = round_fx( L_mult( index3, d_fx ) ); // Q10 // ph3_q_fx = shl(ph3_q_fx, 2); d_fx = BASOP_Util_Divide1616_Scale( num_fx, n3, &exp ); /* Q12 */ exp = add( 3 - 15, exp ); d_fx = shl( d_fx, sub( exp, 3 ) ); /* Q12 */ ph3_q_fx = i_mult( index3, d_fx ); /* Q12 */ } sp2cart_fx( ph1_q_fx, ph2_q_fx, ph3_q_fx, q_fx ); Loading lib_dec/ivas_stereo_switching_dec.c +2 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,8 @@ static ivas_error allocate_CoreCoder_TCX_fx( // st->hTcxDec->CngLevelBackgroundTrace_bfi = 0; //initializing to avoid garbage overflow; set16_fx( st->hTcxDec->syn_OverlFB, 0, L_FRAME48k / 2 ); set16_fx( st->hTcxDec->old_synth, 0, OLD_SYNTH_INTERNAL_DEC ); st->hTcxDec->q_old_synth = 0; move16(); set16_fx( st->hTcxDec->synth_history_fx, 0, L_PROT48k + L_FRAME48k ); } Loading lib_dec/updt_dec_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -1007,7 +1007,7 @@ void ivas_updt_dec_common_fx( IF( EQ_16( st_fx->core, HQ_CORE ) ) { st_fx->stab_fac_fx = extract_l( L_min( MAX_16, L_add( L_shr( STAB_FAC_EST1_FX, Q15 ), Madd_32_32( L_shr( Mpy_32_16_1( STAB_FAC_EST2_FX, st_fx->hHQ_core->mem_env_delta ), Q15 ), STAB_FAC_EST3_FX, st_fx->log_energy_diff_lt_fx ) ) ) ); st_fx->stab_fac_fx = extract_l( L_min( MAX_16, L_add( L_shr( STAB_FAC_EST1_FX, Q15 ), Madd_32_32( Mpy_32_16_1( STAB_FAC_EST2_FX, st_fx->hHQ_core->mem_env_delta ), STAB_FAC_EST3_FX, st_fx->log_energy_diff_lt_fx ) ) ) ); st_fx->stab_fac_fx = s_max( 0, st_fx->stab_fac_fx ); } st_fx->stab_fac_smooth_lt_fx = extract_h( L_add( L_mult( ENV_SMOOTH_FAC_FX, st_fx->stab_fac_fx ), Loading lib_rend/ivas_dirac_dec_binaural_functions.c +4 −3 Original line number Diff line number Diff line Loading @@ -7805,7 +7805,6 @@ static void ivas_masa_ext_rend_parambin_internal_fx( /* CLDFB Analysis of input */ Word16 q_cldfb = Q11; FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { FOR( ch = 0; ch < numInChannels; ch++ ) Loading @@ -7813,6 +7812,8 @@ static void ivas_masa_ext_rend_parambin_internal_fx( test(); IF( ch == 0 || EQ_16( nchan_transport, 2 ) ) { Word16 q_cldfb = Q11; move16(); cldfbAnalysis_ts_fx_fixed_q( &( output_fx[ch][nBins * slot] ), Cldfb_RealBuffer_in_fx[ch][slot], Loading @@ -7823,8 +7824,8 @@ static void ivas_masa_ext_rend_parambin_internal_fx( { /* At mono input duplicate the channel to dual-mono, and apply gain correction to ensure same overall level as in stereo mode */ v_multc_fixed( Cldfb_RealBuffer_in_fx[0][slot], 151800249 /* INV_SQRT_2 in Q31 */, Cldfb_RealBuffer_in_fx[0][slot], nBins ); v_multc_fixed( Cldfb_ImagBuffer_in_fx[0][slot], 151800249 /* INV_SQRT_2 in Q31 */, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); v_multc_fixed( Cldfb_RealBuffer_in_fx[0][slot], 1518500224 /* INV_SQRT_2 in Q31 */, Cldfb_RealBuffer_in_fx[0][slot], nBins ); v_multc_fixed( Cldfb_ImagBuffer_in_fx[0][slot], 1518500224 /* INV_SQRT_2 in Q31 */, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); Copy32( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); Copy32( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); Loading lib_rend/ivas_dirac_output_synthesis_dec.c +7 −2 Original line number Diff line number Diff line Loading @@ -3483,6 +3483,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( /*-----------------------------------------------------------------* * gain interpolation and output streams *-----------------------------------------------------------------*/ Word16 q_align = sub( h_dirac_output_synthesis_state->proto_direct_buffer_f_q, h_dirac_output_synthesis_state->proto_power_diff_smooth_q ); if ( h_dirac_output_synthesis_params->max_band_decorr != 0 ) { q_align = sub( h_dirac_output_synthesis_state->proto_direct_buffer_f_q, h_dirac_output_synthesis_state->proto_diffuse_buffer_f_q ); } FOR( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) { Loading Loading @@ -3521,10 +3526,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( { g = L_add( Mpy_32_32( g1, *( p_gain_1++ ) ), Mpy_32_32( g2, *( p_gain_2++ ) ) ); // (Q31, gains_diff_prev_q) -> gains_diff_prev_q RealBuffer[k][buf_idx][l] = L_add( L_shr( RealBuffer[k][buf_idx][l], Q1 ), L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), Q1 ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), sub( Q1, q_align ) ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 move32(); ImagBuffer[k][buf_idx][l] = L_add( L_shr( ImagBuffer[k][buf_idx][l], Q1 ), L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), Q1 ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), sub( Q1, q_align ) ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 move32(); } Loading Loading
lib_com/ivas_pca_tools.c +78 −42 Original line number Diff line number Diff line Loading @@ -560,6 +560,22 @@ void dquat2mat( return; } static Word16 check_bound( Word32 tmp ) { IF( GT_32( tmp, MAX16B ) ) { return MAX16B; } ELSE IF( LT_32( tmp, MIN16B ) ) { return MIN16B; } ELSE { return extract_l( tmp ); } } #ifdef IVAS_FLOAT_FIXED void dquat2mat_fx( const Word16 *ql, Loading Loading @@ -605,37 +621,37 @@ void dquat2mat_fx( dx = mult( d, x ); dy = mult( d, y ); dz = mult( d, z ); m[0] = sub( sub( aw, bx ), add( cy, dz ) ); m[0] = check_bound( L_sub( L_sub( aw, bx ), L_add( cy, dz ) ) ); move16(); m[1] = sub( sub( cz, dy ), add( ax, bw ) ); m[1] = check_bound( L_sub( L_sub( cz, dy ), L_add( ax, bw ) ) ); move16(); m[2] = add( sub( sub( negate( ay ), bz ), cw ), dx ); m[2] = check_bound( L_add( L_sub( L_sub( negate( ay ), bz ), cw ), dx ) ); move16(); m[3] = sub( sub( by, az ), add( cx, dw ) ); m[3] = check_bound( L_sub( L_sub( by, az ), L_add( cx, dw ) ) ); move16(); m[4] = add( sub( add( bw, ax ), dy ), cz ); m[4] = check_bound( L_add( L_sub( L_add( bw, ax ), dy ), cz ) ); move16(); m[5] = add( add( add( negate( bx ), aw ), dz ), cy ); m[5] = check_bound( L_add( L_add( L_add( negate( bx ), aw ), dz ), cy ) ); move16(); m[6] = sub( sub( add( negate( by ), az ), dw ), cx ); m[6] = check_bound( L_sub( L_sub( L_add( negate( by ), az ), dw ), cx ) ); move16(); m[7] = add( sub( sub( negate( bz ), ay ), dx ), cw ); m[7] = check_bound( L_add( L_sub( L_sub( negate( bz ), ay ), dx ), cw ) ); move16(); m[8] = sub( add( add( cw, dx ), ay ), bz ); m[8] = check_bound( L_sub( L_add( L_add( cw, dx ), ay ), bz ) ); move16(); m[9] = sub( sub( add( negate( cx ), dw ), az ), by ); m[9] = check_bound( L_sub( L_sub( L_add( negate( cx ), dw ), az ), by ) ); move16(); m[10] = add( add( add( negate( cy ), dz ), aw ), bx ); m[10] = check_bound( L_add( L_add( L_add( negate( cy ), dz ), aw ), bx ) ); move16(); m[11] = sub( add( sub( negate( cz ), dy ), ax ), bw ); m[11] = check_bound( L_sub( L_add( L_sub( negate( cz ), dy ), ax ), bw ) ); move16(); m[12] = add( add( sub( dw, cx ), by ), az ); m[12] = check_bound( L_add( L_add( L_sub( dw, cx ), by ), az ) ); move16(); m[13] = add( sub( sub( negate( dx ), cw ), bz ), ay ); m[13] = check_bound( L_add( L_sub( L_sub( negate( dx ), cw ), bz ), ay ) ); move16(); m[14] = sub( add( sub( negate( dy ), cz ), bw ), ax ); m[14] = check_bound( L_sub( L_add( L_sub( negate( dy ), cz ), bw ), ax ) ); move16(); m[15] = add( add( add( negate( dz ), cy ), bx ), aw ); m[15] = check_bound( L_add( L_add( L_add( negate( dz ), cy ), bx ), aw ) ); move16(); return; Loading Loading @@ -828,11 +844,11 @@ static void norm_quat_fx( move16(); norm_q = dotp_fx( q, q, IVAS_PCA_INTERP, &exp1 ); exp1 = sub( 31, add( exp1, 2 ) ); norm_q = ISqrt32( norm_q, &exp1 ); /*q(15 - exp)*/ norm_q = ISqrt32( norm_q, &exp1 ); /*Q(31 - exp)*/ FOR( i = 0; i < IVAS_PCA_INTERP; i++ ) { q[i] = mult( q[i], extract_l( L_shr( norm_q, 15 ) ) ); // todo : recheck q[i] = round_fx( L_shl( Mpy_32_16_1( norm_q, q[i] ), exp1 ) ); /* Q(15) */ move16(); } Loading Loading @@ -922,7 +938,7 @@ void pca_interp_preproc_fx( { Word16 alpha; Word16 j; Word16 tmp, tmp2, tmp3; Word16 tmp, tmp2, tmp3, tmp_e; FOR( j = 0; j < len; j++ ) { tmp = sub( len, 1 ); Loading @@ -933,11 +949,12 @@ void pca_interp_preproc_fx( } ELSE { alpha = idiv1616( j, tmp ); // the increment can be updated by simple delta //q15 alpha = BASOP_Util_Divide1616_Scale( j, tmp, &tmp_e ); // the increment can be updated by simple delta alpha = shl_sat( alpha, tmp_e ); /* Q15 */ } tmp2 = mult( EVS_PI_FX, alpha ); // q13 tmp3 = getCosWord16( tmp2 ); // q14 alpha = shr( sub( ONE_IN_Q14, tmp3 ), 1 ); // q15 tmp2 = mult( EVS_PI_FX, alpha ); /* Q13 */ tmp3 = getCosWord16( tmp2 ); /* Q14 */ alpha = sub_sat( ONE_IN_Q14, tmp3 ); /* Q15 */ alpha = sub( MAX_16, alpha ); quat_nlerp_preproc_fx( prev_ql, ql, alpha, &ql_interp[j * IVAS_PCA_INTERP] ); quat_nlerp_preproc_fx( prev_qr, qr, alpha, &qr_interp[j * IVAS_PCA_INTERP] ); Loading Loading @@ -986,16 +1003,30 @@ static void sp2cart_fx( Word16 *q ) { Word16 s1, s2, s1s2; s1 = getSinWord16( ph1 ); // q15 s2 = getSinWord16( ph2 ); // q15 s1s2 = mult( s1, s2 ); // q15 q[3] = mult( getSinWord16( ph3 ), s1s2 ); // q15 Word16 sin_ph3, cos_ph3; sin_ph3 = cos_ph3 = ph3; move16(); q[2] = mult( getCosWord16( ph3 ), s1s2 ); // q15 move16(); q[1] = mult( getCosWord16( ph2 ), s1 ); // q15 IF( GT_16( ph3, 12868 /* PI in Q12 */ ) ) { sin_ph3 = sub( 12868, ph3 ); /* sin(x) = sin(PI - x) */ cos_ph3 = sub( 25736, ph3 ); /* cos(x) = cos(2*PI - x) */ } sin_ph3 = shl( sin_ph3, 1 ); /* Q12 -> Q13 */ cos_ph3 = shl( cos_ph3, 1 ); /* Q12 -> Q13 */ s1 = getSinWord16( ph1 ); /* Q15 */ s2 = getSinWord16( ph2 ); /* Q15 */ s1s2 = mult( s1, s2 ); /* Q15 */ q[3] = mult( getSinWord16( sin_ph3 ), s1s2 ); /* Q15 */ move16(); q[2] = shl_sat( mult( getCosWord16( cos_ph3 ), s1s2 ), 1 ); /* Q15 */ move16(); q[0] = shl_sat( getCosWord16( ph1 ), 1 ); // q15 q[1] = shl_sat( mult( getCosWord16( ph2 ), s1 ), 1 ); /* Q15 */ move16(); q[0] = shl_sat( getCosWord16( ph1 ), 1 ); /* Q15 */ move16(); return; Loading @@ -1021,9 +1052,9 @@ static Word16 calc_n2_fx( { Word16 n2; Word32 temp; temp = L_mult( 23040, getSinWord16( ph1 ) ); // q8 n2 = round_fx( temp ); n2 = shr( n2, 7 ); temp = L_mult( 23040, getSinWord16( ph1 ) ); /* Q8 + Q15 + Q1 = Q24 */ n2 = round_fx( temp ); /* Q24 -> Q8 */ n2 = shr( n2, 8 ); IF( s_and( n2, 1 ) == 0 ) { n2 = add( n2, 1 ); Loading Loading @@ -1061,10 +1092,10 @@ static Word16 calc_n3_fx( const Word16 ph2 ) { Word16 n3; Word16 temp1 = mult( getSinWord16( ph2 ), getSinWord16( ph1 ) ); // q7 + q15 - q15 n3 = round_fx( L_mult( temp1, getSinWord16( ph2 ) ) ); // q7 + q15 - q15 Word16 temp1 = mult( getSinWord16( ph2 ), getSinWord16( ph1 ) ); /* Q15 */ n3 = round_fx( L_mult( temp1, 23040 /* 180.0f in Q7 */ ) ); /* Q15 + Q7 + Q1 - Q16 -> Q7*/ n3 = shr( n3, 8 ); n3 = shr( n3, 7 ); IF( n3 == 0 ) { Loading Loading @@ -1489,9 +1520,11 @@ void pca_dec_s3_fx( num_fx = 12868; move16(); d_fx = idiv1616( num_fx, n1 ); // Q12 d_fx = idiv1616( num_fx, sub( n1, 1 ) ); // Q12 ph1_q_fx = i_mult( index1, d_fx ); // Q12 ph1_q_fx = shl( ph1_q_fx, 1 ); /* Q12 -> Q13 */ n2 = calc_n2_fx( ph1_q_fx ); j = L_sub( j, ivas_pca_offset_index1[index1] ); Loading Loading @@ -1521,6 +1554,7 @@ void pca_dec_s3_fx( move16(); d_fx = idiv1616( num_fx, sub( n2, 1 ) ); // Q12 ph2_q_fx = i_mult( index2, d_fx ); // Q12 ph2_q_fx = shl( ph2_q_fx, 1 ); /* Q12 -> Q13 */ } j = L_sub( j, ivas_pca_offset_index2[add( index2, get_pca_offset_n2_fx( index1 ) )] ); Loading @@ -1536,11 +1570,13 @@ void pca_dec_s3_fx( } ELSE { num_fx = 6434; Word16 exp; num_fx = 25736; /* PI2 in Q12 */ move16(); d_fx = idiv1616( num_fx, n3 ); // Q10 ph3_q_fx = round_fx( L_mult( index3, d_fx ) ); // Q10 // ph3_q_fx = shl(ph3_q_fx, 2); d_fx = BASOP_Util_Divide1616_Scale( num_fx, n3, &exp ); /* Q12 */ exp = add( 3 - 15, exp ); d_fx = shl( d_fx, sub( exp, 3 ) ); /* Q12 */ ph3_q_fx = i_mult( index3, d_fx ); /* Q12 */ } sp2cart_fx( ph1_q_fx, ph2_q_fx, ph3_q_fx, q_fx ); Loading
lib_dec/ivas_stereo_switching_dec.c +2 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,8 @@ static ivas_error allocate_CoreCoder_TCX_fx( // st->hTcxDec->CngLevelBackgroundTrace_bfi = 0; //initializing to avoid garbage overflow; set16_fx( st->hTcxDec->syn_OverlFB, 0, L_FRAME48k / 2 ); set16_fx( st->hTcxDec->old_synth, 0, OLD_SYNTH_INTERNAL_DEC ); st->hTcxDec->q_old_synth = 0; move16(); set16_fx( st->hTcxDec->synth_history_fx, 0, L_PROT48k + L_FRAME48k ); } Loading
lib_dec/updt_dec_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -1007,7 +1007,7 @@ void ivas_updt_dec_common_fx( IF( EQ_16( st_fx->core, HQ_CORE ) ) { st_fx->stab_fac_fx = extract_l( L_min( MAX_16, L_add( L_shr( STAB_FAC_EST1_FX, Q15 ), Madd_32_32( L_shr( Mpy_32_16_1( STAB_FAC_EST2_FX, st_fx->hHQ_core->mem_env_delta ), Q15 ), STAB_FAC_EST3_FX, st_fx->log_energy_diff_lt_fx ) ) ) ); st_fx->stab_fac_fx = extract_l( L_min( MAX_16, L_add( L_shr( STAB_FAC_EST1_FX, Q15 ), Madd_32_32( Mpy_32_16_1( STAB_FAC_EST2_FX, st_fx->hHQ_core->mem_env_delta ), STAB_FAC_EST3_FX, st_fx->log_energy_diff_lt_fx ) ) ) ); st_fx->stab_fac_fx = s_max( 0, st_fx->stab_fac_fx ); } st_fx->stab_fac_smooth_lt_fx = extract_h( L_add( L_mult( ENV_SMOOTH_FAC_FX, st_fx->stab_fac_fx ), Loading
lib_rend/ivas_dirac_dec_binaural_functions.c +4 −3 Original line number Diff line number Diff line Loading @@ -7805,7 +7805,6 @@ static void ivas_masa_ext_rend_parambin_internal_fx( /* CLDFB Analysis of input */ Word16 q_cldfb = Q11; FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { FOR( ch = 0; ch < numInChannels; ch++ ) Loading @@ -7813,6 +7812,8 @@ static void ivas_masa_ext_rend_parambin_internal_fx( test(); IF( ch == 0 || EQ_16( nchan_transport, 2 ) ) { Word16 q_cldfb = Q11; move16(); cldfbAnalysis_ts_fx_fixed_q( &( output_fx[ch][nBins * slot] ), Cldfb_RealBuffer_in_fx[ch][slot], Loading @@ -7823,8 +7824,8 @@ static void ivas_masa_ext_rend_parambin_internal_fx( { /* At mono input duplicate the channel to dual-mono, and apply gain correction to ensure same overall level as in stereo mode */ v_multc_fixed( Cldfb_RealBuffer_in_fx[0][slot], 151800249 /* INV_SQRT_2 in Q31 */, Cldfb_RealBuffer_in_fx[0][slot], nBins ); v_multc_fixed( Cldfb_ImagBuffer_in_fx[0][slot], 151800249 /* INV_SQRT_2 in Q31 */, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); v_multc_fixed( Cldfb_RealBuffer_in_fx[0][slot], 1518500224 /* INV_SQRT_2 in Q31 */, Cldfb_RealBuffer_in_fx[0][slot], nBins ); v_multc_fixed( Cldfb_ImagBuffer_in_fx[0][slot], 1518500224 /* INV_SQRT_2 in Q31 */, Cldfb_ImagBuffer_in_fx[0][slot], nBins ); Copy32( Cldfb_RealBuffer_in_fx[0][slot], Cldfb_RealBuffer_in_fx[1][slot], nBins ); Copy32( Cldfb_ImagBuffer_in_fx[0][slot], Cldfb_ImagBuffer_in_fx[1][slot], nBins ); Loading
lib_rend/ivas_dirac_output_synthesis_dec.c +7 −2 Original line number Diff line number Diff line Loading @@ -3483,6 +3483,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( /*-----------------------------------------------------------------* * gain interpolation and output streams *-----------------------------------------------------------------*/ Word16 q_align = sub( h_dirac_output_synthesis_state->proto_direct_buffer_f_q, h_dirac_output_synthesis_state->proto_power_diff_smooth_q ); if ( h_dirac_output_synthesis_params->max_band_decorr != 0 ) { q_align = sub( h_dirac_output_synthesis_state->proto_direct_buffer_f_q, h_dirac_output_synthesis_state->proto_diffuse_buffer_f_q ); } FOR( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) { Loading Loading @@ -3521,10 +3526,10 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( { g = L_add( Mpy_32_32( g1, *( p_gain_1++ ) ), Mpy_32_32( g2, *( p_gain_2++ ) ) ); // (Q31, gains_diff_prev_q) -> gains_diff_prev_q RealBuffer[k][buf_idx][l] = L_add( L_shr( RealBuffer[k][buf_idx][l], Q1 ), L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), Q1 ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), sub( Q1, q_align ) ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 move32(); ImagBuffer[k][buf_idx][l] = L_add( L_shr( ImagBuffer[k][buf_idx][l], Q1 ), L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), Q1 ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 L_shr( Mpy_32_32( g, ( *( p_power_smooth_diff++ ) ) ), sub( Q1, q_align ) ) ); // (gains_diff_prev_q, q_proto_direct_buffer) >> Q1 -> gains_diff_prev_q + q_proto_direct_buffer - 32 move32(); } Loading