Loading lib_com/wi_fx.c +106 −8 Original line number Diff line number Diff line Loading @@ -434,7 +434,9 @@ Word16 DTFS_alignment_full_fx( Word16 n, fshift_fx; Word32 corr_fx, maxcorr_fx; Word16 Eshift, Adiff_fx; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif /* Calculating the expected alignment shift */ Eshift = mult_r(ph_offset_fx, shl(X2_DTFS_fx.lag_fx, 7)); /* confirmed I<2 by smv12.org, Q7 */ Loading Loading @@ -468,8 +470,13 @@ Word16 DTFS_alignment_full_fx( FOR (k=0; k<=HalfLag; k++) { #ifdef BASOP_NOGLOB ab1[k] = round_fx_o(L_mac_o(L_mult_o(X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow), &Overflow); /* Q(-15); */ ab2[k] = round_fx_o(L_msu_o(L_mult_o(X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow), &Overflow); /* Q(-15); */ #else ab1[k] = round_fx(L_mac(L_mult(X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k]), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k])); /* Q(-15); */ ab2[k] = round_fx(L_msu(L_mult(X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k]), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k])); /* Q(-15); */ #endif } IF (FR_flag == 0) { Loading Loading @@ -499,9 +506,15 @@ Word16 DTFS_alignment_full_fx( temp1 = add(n,shl(X2_DTFS_fx.lag_fx,1)); /* add lag_fx in Q1to make positive */ FOR (k=0; k<=HalfLag; k++) { #ifdef BASOP_NOGLOB corr_fx = L_mac_o(corr_fx, ab1[k], C_fx[(2*temp)%(4*X2_DTFS_fx.lag_fx)], &Overflow); corr_fx = L_mac_o(corr_fx, ab2[k], S_fx[(2*temp)%(4*X2_DTFS_fx.lag_fx)], &Overflow); temp = add_o(temp, temp1, &Overflow); #else corr_fx = L_mac(corr_fx, ab1[k], C_fx[(2*temp)%(4*X2_DTFS_fx.lag_fx)]); corr_fx = L_mac(corr_fx, ab2[k], S_fx[(2*temp)%(4*X2_DTFS_fx.lag_fx)]); temp = add(temp, temp1); #endif } if (GT_32(corr_fx, maxcorr_fx)) Loading Loading @@ -603,7 +616,9 @@ void Q2phaseShift_fx( Word16 k ; Word16 temp, HalfLag; Word32 temp2; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif temp2 = L_deposit_l(0); HalfLag = s_min(shr(X_fx->lag_fx, 1),X_fx->nH_fx); Loading @@ -614,9 +629,15 @@ void Q2phaseShift_fx( FOR (k=0; k<=HalfLag; k++) { temp = X_fx->a_fx[k]; #ifdef BASOP_NOGLOB X_fx->a_fx[k] = round_fx_o(L_msu_o(L_mult_o(temp, C_fx[temp2%(4*Lag)], &Overflow), X_fx->b_fx[k], S_fx[temp2%(4*Lag)], &Overflow), &Overflow) ; /* X.Q */ X_fx->b_fx[k] = round_fx_o(L_mac_o(L_mult_o(X_fx->b_fx[k], C_fx[temp2%(4*Lag)], &Overflow), temp, S_fx[temp2%(4*Lag)], &Overflow), &Overflow) ; temp2 = L_add_o(temp2, (Word32)ph, &Overflow); #else X_fx->a_fx[k] = round_fx(L_msu(L_mult(temp, C_fx[temp2 % (4 * Lag)]), X_fx->b_fx[k], S_fx[temp2 % (4 * Lag)])); /* X.Q */ X_fx->b_fx[k] = round_fx(L_mac(L_mult(X_fx->b_fx[k], C_fx[temp2 % (4 * Lag)]), temp, S_fx[temp2 % (4 * Lag)])); temp2 = L_add(temp2, (Word32)ph); #endif } } Loading @@ -627,9 +648,15 @@ void Q2phaseShift_fx( FOR (k=0; k<=HalfLag; k++) { temp = X_fx->a_fx[k]; #ifdef BASOP_NOGLOB X_fx->a_fx[k] = round_fx_o(L_mac_o(L_mult_o(temp, C_fx[temp2%(4*Lag)], &Overflow), X_fx->b_fx[k], S_fx[temp2%(4*Lag)], &Overflow), &Overflow) ; /* X.Q */ X_fx->b_fx[k] = round_fx_o(L_msu_o(L_mult_o(X_fx->b_fx[k], C_fx[temp2%(4*Lag)], &Overflow), temp, S_fx[temp2%(4*Lag)], &Overflow), &Overflow) ; temp2 = add_o((Word16)temp2, negate(ph), &Overflow); #else X_fx->a_fx[k] = round_fx(L_mac(L_mult(temp, C_fx[temp2%(4*Lag)]), X_fx->b_fx[k], S_fx[temp2%(4*Lag)])) ; /* X.Q */ X_fx->b_fx[k] = round_fx(L_msu(L_mult(X_fx->b_fx[k], C_fx[temp2%(4*Lag)]), temp, S_fx[temp2%(4*Lag)])) ; temp2 = add((Word16)temp2, negate(ph)); #endif } } } Loading Loading @@ -912,19 +939,33 @@ void DTFS_to_fs_fx( FOR ( k=1; k<=nH; k++ ) { #ifdef BASOP_NOGLOB X_fx->a_fx[k]=round_fx_o(L_shl_o(La[k], temp, &Overflow), &Overflow); /* Q(8+temp-16)=Q(temp-8) */ X_fx->a_fx[k]=mult_ro(X_fx->a_fx[k], inv_lag, &Overflow); move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ X_fx->b_fx[k]=round_fx_o(L_shl_o(Lb[k], temp, &Overflow), &Overflow); /* Q(8+temp-16)=Q(temp-8) */ X_fx->b_fx[k]=mult_ro(X_fx->b_fx[k], inv_lag, &Overflow); move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ #else X_fx->a_fx[k]=round_fx(L_shl(La[k], temp)); /* Q(8+temp-16)=Q(temp-8) */ X_fx->a_fx[k]=mult_r(X_fx->a_fx[k], inv_lag); move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ X_fx->b_fx[k]=round_fx(L_shl(Lb[k], temp)); /* Q(8+temp-16)=Q(temp-8) */ X_fx->b_fx[k]=mult_r(X_fx->b_fx[k], inv_lag); move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ #endif } /* IF ( N%2 == 0 ) */ IF ( s_and(N,1) == 0 ) { #ifdef BASOP_NOGLOB X_fx->a_fx[k]=round_fx_o(L_shl_o(La[k], temp, &Overflow), &Overflow); /* Q(8+temp-16)=Q(temp-8) */ X_fx->a_fx[k]=mult_ro(X_fx->a_fx[k], inv_lag, &Overflow); #else X_fx->a_fx[k]=round_fx(L_shl(La[k], temp)); /* Q(8+temp-16)=Q(temp-8) */ X_fx->a_fx[k]=mult_r(X_fx->a_fx[k], inv_lag); #endif move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ X_fx->b_fx[k]=0; move16(); Loading Loading @@ -1558,7 +1599,9 @@ Word32 DTFS_getEngy_fx( Word16 k, HalfLag_fx; Word32 en_fx=0; Word16 temp_a_fx,temp_b_fx; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif HalfLag_fx = shr(sub(X_fx->lag_fx, 1), 1); HalfLag_fx = s_min(HalfLag_fx,X_fx->nH_fx); FOR (k=1; k<=HalfLag_fx; k++) Loading @@ -1568,14 +1611,22 @@ Word32 DTFS_getEngy_fx( temp_b_fx = X_fx->b_fx[k]; move16(); #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx, temp_a_fx, temp_a_fx, &Overflow); en_fx = L_mac0_o(en_fx, temp_b_fx, temp_b_fx, &Overflow); #else en_fx = L_mac0(en_fx, temp_a_fx, temp_a_fx); en_fx = L_mac0(en_fx, temp_b_fx, temp_b_fx); #endif } en_fx = L_shr(en_fx, 1); temp_a_fx = X_fx->a_fx[0]; #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx,temp_a_fx, temp_a_fx, &Overflow); #else en_fx = L_mac0(en_fx,temp_a_fx, temp_a_fx); #endif /* IF (X_fx->lag_fx%2 == 0) */ IF (s_and(X_fx->lag_fx,1) == 0) { Loading @@ -1584,8 +1635,13 @@ Word32 DTFS_getEngy_fx( temp_b_fx = X_fx->b_fx[k]; move16(); #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx, temp_a_fx, temp_a_fx, &Overflow); en_fx = L_mac0_o(en_fx, temp_b_fx, temp_b_fx, &Overflow); #else en_fx = L_mac0(en_fx, temp_a_fx, temp_a_fx); en_fx = L_mac0(en_fx, temp_b_fx, temp_b_fx); #endif } return en_fx ; /* 2*X1.Q+1=Q13 */ Loading Loading @@ -1617,21 +1673,37 @@ Word32 DTFS_getEngy_P2A_fx( { Word16 k, HalfLag_fx; Word32 en_fx=0; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif HalfLag_fx = shr(sub(X_fx->lag_fx, 1), 1); HalfLag_fx = s_min(HalfLag_fx,X_fx->nH_fx); FOR (k=1; k<=HalfLag_fx; k++) { #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow); en_fx = L_mac0_o(en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow); #else en_fx = L_mac0(en_fx, X_fx->a_fx[k], X_fx->a_fx[k]); en_fx = L_mac0(en_fx, X_fx->b_fx[k], X_fx->b_fx[k]); #endif } en_fx = L_shr(en_fx, 1); #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx,X_fx->a_fx[0], X_fx->a_fx[0], &Overflow); #else en_fx = L_mac0(en_fx,X_fx->a_fx[0], X_fx->a_fx[0]); #endif /* IF (X_fx->lag_fx%2 == 0) */ IF (s_and(X_fx->lag_fx,1) == 0) { #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow); en_fx = L_mac0_o(en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow); #else en_fx = L_mac0(en_fx, X_fx->a_fx[k], X_fx->a_fx[k]); en_fx = L_mac0(en_fx, X_fx->b_fx[k], X_fx->b_fx[k]); #endif } return en_fx ; /* 2*X1.Q */ Loading Loading @@ -3483,7 +3555,9 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE_FX X_fx,Word32 *pos_fx, Word16 *Qpos, Word16 expa,expb,fraca,fracb,scale; Word16 exp,tmp; Word32 L_tmp; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif L_sum=DTFS_getEngy_P2A_fx(&X_fx); /* 2Q */ DTFS_fast_fs_inv_fx(&X_fx,time_fx , 256, 8); Loading Loading @@ -3524,17 +3598,29 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE_FX X_fx,Word32 *pos_fx, Word16 *Qpos, ELSE { expa = norm_l(maxPosEn_fx); #ifdef BASOP_NOGLOB fraca = extract_h(L_shl_o(maxPosEn_fx,expa, &Overflow)); #else fraca = extract_h(L_shl(maxPosEn_fx,expa)); #endif expa = sub(30,add(expa,1)); expb = norm_l(L_sum); #ifdef BASOP_NOGLOB fracb = round_fx_o(L_shl_o(L_sum,expb, &Overflow), &Overflow); #else fracb = round_fx(L_shl(L_sum,expb)); #endif expb = sub(30,add(expb,shl(X_fx.Q,1))); scale = shr(sub(fraca,fracb),15); #ifdef BASOP_NOGLOB fracb = shl_o(fracb,scale, &Overflow); #else fracb = shl(fracb,scale); #endif expb = sub(expb,scale); tmp = div_s(fracb,fraca); Loading @@ -3555,17 +3641,29 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE_FX X_fx,Word32 *pos_fx, Word16 *Qpos, { expa = norm_l(maxNegEn_fx); #ifdef BASOP_NOGLOB fraca = extract_h(L_shl_o(maxNegEn_fx,expa, &Overflow)); #else fraca = extract_h(L_shl(maxNegEn_fx,expa)); #endif expa = 30-expa- 1; expb = norm_l(L_sum); #ifdef BASOP_NOGLOB fracb = round_fx_o(L_shl_o(L_sum,expb, &Overflow), &Overflow); #else fracb = round_fx(L_shl(L_sum,expb)); #endif expb = 30-expb - (2*X_fx.Q); scale = shr(sub(fraca,fracb),15); #ifdef BASOP_NOGLOB fracb = shl_o(fracb,scale, &Overflow); #else fracb = shl(fracb,scale); #endif expb = sub(expb,scale); tmp = div_s(fracb,fraca); Loading lib_enc/ppp_enc_fx.c +24 −2 Original line number Diff line number Diff line Loading @@ -658,11 +658,12 @@ static Word16 DTFS_alignment_fine_new_fx(DTFS_STRUCTURE_FX X1_fx, DTFS_STRUCTURE #ifdef BASOP_NOGLOB corr_fx = L_mac_o(corr_fx, ab1[k], C_fx[temp % (4 * X2_fx.lag_fx)], &Overflow); corr_fx = L_mac_o(corr_fx, ab2[k], S_fx[temp % (4 * X2_fx.lag_fx)], &Overflow); temp = add_o(temp, temp1, &Overflow); #else corr_fx = L_mac(corr_fx, ab1[k], C_fx[temp % (4 * X2_fx.lag_fx)]); corr_fx = L_mac(corr_fx, ab2[k], S_fx[temp % (4 * X2_fx.lag_fx)]); #endif temp = add(temp, temp1); #endif } temp = sub(32767, extract_l(L_shr(L_mult(82, abs_s(n)), 1))); /* Q15 */ Qcorr = norm_l(corr_fx); Loading Loading @@ -753,7 +754,9 @@ static void LPCPowSpect_fx( Word32 Ltemp, Lw; Word32 Lacc; Word16 tmp, exp; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif FOR(k = 0; k < Nf; k++) { Loading Loading @@ -784,9 +787,15 @@ static void LPCPowSpect_fx( t1 = add(t1, (Word16)L_shr(Ltemp, 16)); /* t1 is interpolated cos(w) */ Ltemp = L_shr(L_mult(LPC[i], t1), 1); /* Ltemp in Q27 */ #ifdef BASOP_NOGLOB Re = L_add_o(Re, Ltemp, &Overflow); /* Re=1-sum(LPC[i]*cos(Lw)); */ Ltemp = L_add_o(Lw, 0x6000, &Overflow); /* add 0.75, which is 3pi/2 to convert sin to cos */ Ltemp = L_shl_o(Ltemp, 10, &Overflow); /* Q25 */ #else Re = L_add(Re, Ltemp); /* Re=1-sum(LPC[i]*cos(Lw)); */ Ltemp = L_add(Lw, 0x6000); /* add 0.75, which is 3pi/2 to convert sin to cos */ Ltemp = L_shl(Ltemp, 10); /* Q25 */ #endif w = extract_h(Ltemp); /* w is equivalent cos index */ dl = extract_l(Ltemp); /* dl is 6 bit left-over for interpolation */ w = s_and(w, 511); Loading @@ -808,8 +817,13 @@ static void LPCPowSpect_fx( t1 = add(t1, (Word16)L_shr(Ltemp, 16)); /* t1 is interpolated cos(w) */ Ltemp = L_shr(L_mult(LPC[i], t1), 1); /* Ltemp in Q27 */ #ifdef BASOP_NOGLOB Im = L_sub_o(Im, Ltemp, &Overflow); /* Im=sum(LPC[i]*sin(Lw)) */ Lw = L_add_o(Lw, freq[k], &Overflow); /* Lw=(i+1)*freq[k] */ #else Im = L_sub(Im, Ltemp); /* Im=sum(LPC[i]*sin(Lw)) */ Lw = L_add(Lw, freq[k]); /* Lw=(i+1)*freq[k] */ #endif } /* If necessary, we can block-normalize Re and Im to improve precision */ dh = extract_h(Re); Loading @@ -824,7 +838,11 @@ static void LPCPowSpect_fx( ELSE Lacc = L_mult0(dh, dl); #ifdef BASOP_NOGLOB Lacc = L_add_o(L_shr(Lacc, 15), L_shr(L_mult_o(dh, dh, &Overflow), 1), &Overflow); /* Lacc=Re*Re */ #else Lacc = L_add(L_shr(Lacc, 15), L_shr(L_mult(dh, dh), 1)); /* Lacc=Re*Re */ #endif dh = extract_h(Im); dl = extract_l(Im); Loading Loading @@ -855,7 +873,11 @@ static void LPCPowSpect_fx( move16(); } Ltemp = L_deposit_h(tmp); #ifdef BASOP_NOGLOB out[k] = round_fx_o(L_shl_o(Ltemp, negate(add(exp, 8)), &Overflow), &Overflow); #else out[k] = round_fx(L_shl(Ltemp, negate(add(exp, 8)))); #endif /* out[k] = shl(tmp,-exp-8); in Q7 */ Loading lib_enc/voiced_enc_fx.c +23 −1 Original line number Diff line number Diff line Loading @@ -738,7 +738,11 @@ ivas_error ppp_voiced_encoder_fx( Ltemp1 = L_negate(Ltemp1); } expa = norm_l(Ltemp2); #ifdef BASOP_NOGLOB fraca = extract_h(L_shl_o(Ltemp2,expa, &Overflow)); #else fraca = extract_h(L_shl(Ltemp2,expa)); #endif expa = sub(30,expa); expb = norm_l(Ltemp1); Loading @@ -746,12 +750,20 @@ ivas_error ppp_voiced_encoder_fx( expb = sub(30, add(expb, Qadj)); scale = shr(sub(fraca,fracb),15); #ifdef BASOP_NOGLOB fracb = shl_o(fracb,scale, &Overflow); #else fracb = shl(fracb,scale); #endif expb = sub(expb,scale); tmp = div_s(fracb,fraca); exp = sub(expb,expa); #ifdef BASOP_NOGLOB Ltemp_fx = L_shl_o(tmp, add(exp,14), &Overflow); #else Ltemp_fx = L_shl(tmp, add(exp,14)); #endif /*-------------------------------------------*/ sp_hb_enratio_fx = L_add(Ltemp_fx, 0); /* Q29 */ } Loading Loading @@ -1293,7 +1305,11 @@ static void synthesis_filter_fx (Word16 b[], Word16 x[], Word16 y[], Word16 buf[ FOR (j = P - 1; j > 0; j--) { /* acc = L_sub(acc, L_mult(memory[j], coef[j])); */ #ifdef BASOP_NOGLOB acc = L_msu_o(acc, buf[j], b[j], &Overflow);/*Q13 */ #else acc = L_msu(acc, buf[j], b[j]);/*Q13 */ #endif buf[j] = buf[j - 1]; move16(); } Loading Loading @@ -1494,7 +1510,9 @@ static Word16 DTFS_alignment_extract_td_fx(Word16* x1, Word16* x2, Word16 lag) { Word16 j, k, idx, Adiff_fx; Word32 maxcorr, corr; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif maxcorr = L_add(MIN_32, 0); Adiff_fx = (Word16)(s_max(4, shr(lag, 3))); Loading @@ -1505,7 +1523,11 @@ static Word16 DTFS_alignment_extract_td_fx(Word16* x1, Word16* x2, Word16 lag) corr = L_deposit_l(0); FOR(k = 0; k < lag; k++) { #ifdef BASOP_NOGLOB corr = L_mac_o(corr, x1[k], x2[(k - j + lag) % lag], &Overflow); #else corr = L_mac(corr, x1[k], x2[(k - j + lag) % lag]); #endif } if (GT_32(corr, maxcorr)) { Loading Loading
lib_com/wi_fx.c +106 −8 Original line number Diff line number Diff line Loading @@ -434,7 +434,9 @@ Word16 DTFS_alignment_full_fx( Word16 n, fshift_fx; Word32 corr_fx, maxcorr_fx; Word16 Eshift, Adiff_fx; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif /* Calculating the expected alignment shift */ Eshift = mult_r(ph_offset_fx, shl(X2_DTFS_fx.lag_fx, 7)); /* confirmed I<2 by smv12.org, Q7 */ Loading Loading @@ -468,8 +470,13 @@ Word16 DTFS_alignment_full_fx( FOR (k=0; k<=HalfLag; k++) { #ifdef BASOP_NOGLOB ab1[k] = round_fx_o(L_mac_o(L_mult_o(X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow), &Overflow); /* Q(-15); */ ab2[k] = round_fx_o(L_msu_o(L_mult_o(X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow), &Overflow); /* Q(-15); */ #else ab1[k] = round_fx(L_mac(L_mult(X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k]), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k])); /* Q(-15); */ ab2[k] = round_fx(L_msu(L_mult(X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k]), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k])); /* Q(-15); */ #endif } IF (FR_flag == 0) { Loading Loading @@ -499,9 +506,15 @@ Word16 DTFS_alignment_full_fx( temp1 = add(n,shl(X2_DTFS_fx.lag_fx,1)); /* add lag_fx in Q1to make positive */ FOR (k=0; k<=HalfLag; k++) { #ifdef BASOP_NOGLOB corr_fx = L_mac_o(corr_fx, ab1[k], C_fx[(2*temp)%(4*X2_DTFS_fx.lag_fx)], &Overflow); corr_fx = L_mac_o(corr_fx, ab2[k], S_fx[(2*temp)%(4*X2_DTFS_fx.lag_fx)], &Overflow); temp = add_o(temp, temp1, &Overflow); #else corr_fx = L_mac(corr_fx, ab1[k], C_fx[(2*temp)%(4*X2_DTFS_fx.lag_fx)]); corr_fx = L_mac(corr_fx, ab2[k], S_fx[(2*temp)%(4*X2_DTFS_fx.lag_fx)]); temp = add(temp, temp1); #endif } if (GT_32(corr_fx, maxcorr_fx)) Loading Loading @@ -603,7 +616,9 @@ void Q2phaseShift_fx( Word16 k ; Word16 temp, HalfLag; Word32 temp2; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif temp2 = L_deposit_l(0); HalfLag = s_min(shr(X_fx->lag_fx, 1),X_fx->nH_fx); Loading @@ -614,9 +629,15 @@ void Q2phaseShift_fx( FOR (k=0; k<=HalfLag; k++) { temp = X_fx->a_fx[k]; #ifdef BASOP_NOGLOB X_fx->a_fx[k] = round_fx_o(L_msu_o(L_mult_o(temp, C_fx[temp2%(4*Lag)], &Overflow), X_fx->b_fx[k], S_fx[temp2%(4*Lag)], &Overflow), &Overflow) ; /* X.Q */ X_fx->b_fx[k] = round_fx_o(L_mac_o(L_mult_o(X_fx->b_fx[k], C_fx[temp2%(4*Lag)], &Overflow), temp, S_fx[temp2%(4*Lag)], &Overflow), &Overflow) ; temp2 = L_add_o(temp2, (Word32)ph, &Overflow); #else X_fx->a_fx[k] = round_fx(L_msu(L_mult(temp, C_fx[temp2 % (4 * Lag)]), X_fx->b_fx[k], S_fx[temp2 % (4 * Lag)])); /* X.Q */ X_fx->b_fx[k] = round_fx(L_mac(L_mult(X_fx->b_fx[k], C_fx[temp2 % (4 * Lag)]), temp, S_fx[temp2 % (4 * Lag)])); temp2 = L_add(temp2, (Word32)ph); #endif } } Loading @@ -627,9 +648,15 @@ void Q2phaseShift_fx( FOR (k=0; k<=HalfLag; k++) { temp = X_fx->a_fx[k]; #ifdef BASOP_NOGLOB X_fx->a_fx[k] = round_fx_o(L_mac_o(L_mult_o(temp, C_fx[temp2%(4*Lag)], &Overflow), X_fx->b_fx[k], S_fx[temp2%(4*Lag)], &Overflow), &Overflow) ; /* X.Q */ X_fx->b_fx[k] = round_fx_o(L_msu_o(L_mult_o(X_fx->b_fx[k], C_fx[temp2%(4*Lag)], &Overflow), temp, S_fx[temp2%(4*Lag)], &Overflow), &Overflow) ; temp2 = add_o((Word16)temp2, negate(ph), &Overflow); #else X_fx->a_fx[k] = round_fx(L_mac(L_mult(temp, C_fx[temp2%(4*Lag)]), X_fx->b_fx[k], S_fx[temp2%(4*Lag)])) ; /* X.Q */ X_fx->b_fx[k] = round_fx(L_msu(L_mult(X_fx->b_fx[k], C_fx[temp2%(4*Lag)]), temp, S_fx[temp2%(4*Lag)])) ; temp2 = add((Word16)temp2, negate(ph)); #endif } } } Loading Loading @@ -912,19 +939,33 @@ void DTFS_to_fs_fx( FOR ( k=1; k<=nH; k++ ) { #ifdef BASOP_NOGLOB X_fx->a_fx[k]=round_fx_o(L_shl_o(La[k], temp, &Overflow), &Overflow); /* Q(8+temp-16)=Q(temp-8) */ X_fx->a_fx[k]=mult_ro(X_fx->a_fx[k], inv_lag, &Overflow); move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ X_fx->b_fx[k]=round_fx_o(L_shl_o(Lb[k], temp, &Overflow), &Overflow); /* Q(8+temp-16)=Q(temp-8) */ X_fx->b_fx[k]=mult_ro(X_fx->b_fx[k], inv_lag, &Overflow); move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ #else X_fx->a_fx[k]=round_fx(L_shl(La[k], temp)); /* Q(8+temp-16)=Q(temp-8) */ X_fx->a_fx[k]=mult_r(X_fx->a_fx[k], inv_lag); move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */ X_fx->b_fx[k]=round_fx(L_shl(Lb[k], temp)); /* Q(8+temp-16)=Q(temp-8) */ X_fx->b_fx[k]=mult_r(X_fx->b_fx[k], inv_lag); move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */ #endif } /* IF ( N%2 == 0 ) */ IF ( s_and(N,1) == 0 ) { #ifdef BASOP_NOGLOB X_fx->a_fx[k]=round_fx_o(L_shl_o(La[k], temp, &Overflow), &Overflow); /* Q(8+temp-16)=Q(temp-8) */ X_fx->a_fx[k]=mult_ro(X_fx->a_fx[k], inv_lag, &Overflow); #else X_fx->a_fx[k]=round_fx(L_shl(La[k], temp)); /* Q(8+temp-16)=Q(temp-8) */ X_fx->a_fx[k]=mult_r(X_fx->a_fx[k], inv_lag); #endif move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */ X_fx->b_fx[k]=0; move16(); Loading Loading @@ -1558,7 +1599,9 @@ Word32 DTFS_getEngy_fx( Word16 k, HalfLag_fx; Word32 en_fx=0; Word16 temp_a_fx,temp_b_fx; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif HalfLag_fx = shr(sub(X_fx->lag_fx, 1), 1); HalfLag_fx = s_min(HalfLag_fx,X_fx->nH_fx); FOR (k=1; k<=HalfLag_fx; k++) Loading @@ -1568,14 +1611,22 @@ Word32 DTFS_getEngy_fx( temp_b_fx = X_fx->b_fx[k]; move16(); #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx, temp_a_fx, temp_a_fx, &Overflow); en_fx = L_mac0_o(en_fx, temp_b_fx, temp_b_fx, &Overflow); #else en_fx = L_mac0(en_fx, temp_a_fx, temp_a_fx); en_fx = L_mac0(en_fx, temp_b_fx, temp_b_fx); #endif } en_fx = L_shr(en_fx, 1); temp_a_fx = X_fx->a_fx[0]; #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx,temp_a_fx, temp_a_fx, &Overflow); #else en_fx = L_mac0(en_fx,temp_a_fx, temp_a_fx); #endif /* IF (X_fx->lag_fx%2 == 0) */ IF (s_and(X_fx->lag_fx,1) == 0) { Loading @@ -1584,8 +1635,13 @@ Word32 DTFS_getEngy_fx( temp_b_fx = X_fx->b_fx[k]; move16(); #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx, temp_a_fx, temp_a_fx, &Overflow); en_fx = L_mac0_o(en_fx, temp_b_fx, temp_b_fx, &Overflow); #else en_fx = L_mac0(en_fx, temp_a_fx, temp_a_fx); en_fx = L_mac0(en_fx, temp_b_fx, temp_b_fx); #endif } return en_fx ; /* 2*X1.Q+1=Q13 */ Loading Loading @@ -1617,21 +1673,37 @@ Word32 DTFS_getEngy_P2A_fx( { Word16 k, HalfLag_fx; Word32 en_fx=0; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif HalfLag_fx = shr(sub(X_fx->lag_fx, 1), 1); HalfLag_fx = s_min(HalfLag_fx,X_fx->nH_fx); FOR (k=1; k<=HalfLag_fx; k++) { #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow); en_fx = L_mac0_o(en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow); #else en_fx = L_mac0(en_fx, X_fx->a_fx[k], X_fx->a_fx[k]); en_fx = L_mac0(en_fx, X_fx->b_fx[k], X_fx->b_fx[k]); #endif } en_fx = L_shr(en_fx, 1); #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx,X_fx->a_fx[0], X_fx->a_fx[0], &Overflow); #else en_fx = L_mac0(en_fx,X_fx->a_fx[0], X_fx->a_fx[0]); #endif /* IF (X_fx->lag_fx%2 == 0) */ IF (s_and(X_fx->lag_fx,1) == 0) { #ifdef BASOP_NOGLOB en_fx = L_mac0_o(en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow); en_fx = L_mac0_o(en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow); #else en_fx = L_mac0(en_fx, X_fx->a_fx[k], X_fx->a_fx[k]); en_fx = L_mac0(en_fx, X_fx->b_fx[k], X_fx->b_fx[k]); #endif } return en_fx ; /* 2*X1.Q */ Loading Loading @@ -3483,7 +3555,9 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE_FX X_fx,Word32 *pos_fx, Word16 *Qpos, Word16 expa,expb,fraca,fracb,scale; Word16 exp,tmp; Word32 L_tmp; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif L_sum=DTFS_getEngy_P2A_fx(&X_fx); /* 2Q */ DTFS_fast_fs_inv_fx(&X_fx,time_fx , 256, 8); Loading Loading @@ -3524,17 +3598,29 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE_FX X_fx,Word32 *pos_fx, Word16 *Qpos, ELSE { expa = norm_l(maxPosEn_fx); #ifdef BASOP_NOGLOB fraca = extract_h(L_shl_o(maxPosEn_fx,expa, &Overflow)); #else fraca = extract_h(L_shl(maxPosEn_fx,expa)); #endif expa = sub(30,add(expa,1)); expb = norm_l(L_sum); #ifdef BASOP_NOGLOB fracb = round_fx_o(L_shl_o(L_sum,expb, &Overflow), &Overflow); #else fracb = round_fx(L_shl(L_sum,expb)); #endif expb = sub(30,add(expb,shl(X_fx.Q,1))); scale = shr(sub(fraca,fracb),15); #ifdef BASOP_NOGLOB fracb = shl_o(fracb,scale, &Overflow); #else fracb = shl(fracb,scale); #endif expb = sub(expb,scale); tmp = div_s(fracb,fraca); Loading @@ -3555,17 +3641,29 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE_FX X_fx,Word32 *pos_fx, Word16 *Qpos, { expa = norm_l(maxNegEn_fx); #ifdef BASOP_NOGLOB fraca = extract_h(L_shl_o(maxNegEn_fx,expa, &Overflow)); #else fraca = extract_h(L_shl(maxNegEn_fx,expa)); #endif expa = 30-expa- 1; expb = norm_l(L_sum); #ifdef BASOP_NOGLOB fracb = round_fx_o(L_shl_o(L_sum,expb, &Overflow), &Overflow); #else fracb = round_fx(L_shl(L_sum,expb)); #endif expb = 30-expb - (2*X_fx.Q); scale = shr(sub(fraca,fracb),15); #ifdef BASOP_NOGLOB fracb = shl_o(fracb,scale, &Overflow); #else fracb = shl(fracb,scale); #endif expb = sub(expb,scale); tmp = div_s(fracb,fraca); Loading
lib_enc/ppp_enc_fx.c +24 −2 Original line number Diff line number Diff line Loading @@ -658,11 +658,12 @@ static Word16 DTFS_alignment_fine_new_fx(DTFS_STRUCTURE_FX X1_fx, DTFS_STRUCTURE #ifdef BASOP_NOGLOB corr_fx = L_mac_o(corr_fx, ab1[k], C_fx[temp % (4 * X2_fx.lag_fx)], &Overflow); corr_fx = L_mac_o(corr_fx, ab2[k], S_fx[temp % (4 * X2_fx.lag_fx)], &Overflow); temp = add_o(temp, temp1, &Overflow); #else corr_fx = L_mac(corr_fx, ab1[k], C_fx[temp % (4 * X2_fx.lag_fx)]); corr_fx = L_mac(corr_fx, ab2[k], S_fx[temp % (4 * X2_fx.lag_fx)]); #endif temp = add(temp, temp1); #endif } temp = sub(32767, extract_l(L_shr(L_mult(82, abs_s(n)), 1))); /* Q15 */ Qcorr = norm_l(corr_fx); Loading Loading @@ -753,7 +754,9 @@ static void LPCPowSpect_fx( Word32 Ltemp, Lw; Word32 Lacc; Word16 tmp, exp; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif FOR(k = 0; k < Nf; k++) { Loading Loading @@ -784,9 +787,15 @@ static void LPCPowSpect_fx( t1 = add(t1, (Word16)L_shr(Ltemp, 16)); /* t1 is interpolated cos(w) */ Ltemp = L_shr(L_mult(LPC[i], t1), 1); /* Ltemp in Q27 */ #ifdef BASOP_NOGLOB Re = L_add_o(Re, Ltemp, &Overflow); /* Re=1-sum(LPC[i]*cos(Lw)); */ Ltemp = L_add_o(Lw, 0x6000, &Overflow); /* add 0.75, which is 3pi/2 to convert sin to cos */ Ltemp = L_shl_o(Ltemp, 10, &Overflow); /* Q25 */ #else Re = L_add(Re, Ltemp); /* Re=1-sum(LPC[i]*cos(Lw)); */ Ltemp = L_add(Lw, 0x6000); /* add 0.75, which is 3pi/2 to convert sin to cos */ Ltemp = L_shl(Ltemp, 10); /* Q25 */ #endif w = extract_h(Ltemp); /* w is equivalent cos index */ dl = extract_l(Ltemp); /* dl is 6 bit left-over for interpolation */ w = s_and(w, 511); Loading @@ -808,8 +817,13 @@ static void LPCPowSpect_fx( t1 = add(t1, (Word16)L_shr(Ltemp, 16)); /* t1 is interpolated cos(w) */ Ltemp = L_shr(L_mult(LPC[i], t1), 1); /* Ltemp in Q27 */ #ifdef BASOP_NOGLOB Im = L_sub_o(Im, Ltemp, &Overflow); /* Im=sum(LPC[i]*sin(Lw)) */ Lw = L_add_o(Lw, freq[k], &Overflow); /* Lw=(i+1)*freq[k] */ #else Im = L_sub(Im, Ltemp); /* Im=sum(LPC[i]*sin(Lw)) */ Lw = L_add(Lw, freq[k]); /* Lw=(i+1)*freq[k] */ #endif } /* If necessary, we can block-normalize Re and Im to improve precision */ dh = extract_h(Re); Loading @@ -824,7 +838,11 @@ static void LPCPowSpect_fx( ELSE Lacc = L_mult0(dh, dl); #ifdef BASOP_NOGLOB Lacc = L_add_o(L_shr(Lacc, 15), L_shr(L_mult_o(dh, dh, &Overflow), 1), &Overflow); /* Lacc=Re*Re */ #else Lacc = L_add(L_shr(Lacc, 15), L_shr(L_mult(dh, dh), 1)); /* Lacc=Re*Re */ #endif dh = extract_h(Im); dl = extract_l(Im); Loading Loading @@ -855,7 +873,11 @@ static void LPCPowSpect_fx( move16(); } Ltemp = L_deposit_h(tmp); #ifdef BASOP_NOGLOB out[k] = round_fx_o(L_shl_o(Ltemp, negate(add(exp, 8)), &Overflow), &Overflow); #else out[k] = round_fx(L_shl(Ltemp, negate(add(exp, 8)))); #endif /* out[k] = shl(tmp,-exp-8); in Q7 */ Loading
lib_enc/voiced_enc_fx.c +23 −1 Original line number Diff line number Diff line Loading @@ -738,7 +738,11 @@ ivas_error ppp_voiced_encoder_fx( Ltemp1 = L_negate(Ltemp1); } expa = norm_l(Ltemp2); #ifdef BASOP_NOGLOB fraca = extract_h(L_shl_o(Ltemp2,expa, &Overflow)); #else fraca = extract_h(L_shl(Ltemp2,expa)); #endif expa = sub(30,expa); expb = norm_l(Ltemp1); Loading @@ -746,12 +750,20 @@ ivas_error ppp_voiced_encoder_fx( expb = sub(30, add(expb, Qadj)); scale = shr(sub(fraca,fracb),15); #ifdef BASOP_NOGLOB fracb = shl_o(fracb,scale, &Overflow); #else fracb = shl(fracb,scale); #endif expb = sub(expb,scale); tmp = div_s(fracb,fraca); exp = sub(expb,expa); #ifdef BASOP_NOGLOB Ltemp_fx = L_shl_o(tmp, add(exp,14), &Overflow); #else Ltemp_fx = L_shl(tmp, add(exp,14)); #endif /*-------------------------------------------*/ sp_hb_enratio_fx = L_add(Ltemp_fx, 0); /* Q29 */ } Loading Loading @@ -1293,7 +1305,11 @@ static void synthesis_filter_fx (Word16 b[], Word16 x[], Word16 y[], Word16 buf[ FOR (j = P - 1; j > 0; j--) { /* acc = L_sub(acc, L_mult(memory[j], coef[j])); */ #ifdef BASOP_NOGLOB acc = L_msu_o(acc, buf[j], b[j], &Overflow);/*Q13 */ #else acc = L_msu(acc, buf[j], b[j]);/*Q13 */ #endif buf[j] = buf[j - 1]; move16(); } Loading Loading @@ -1494,7 +1510,9 @@ static Word16 DTFS_alignment_extract_td_fx(Word16* x1, Word16* x2, Word16 lag) { Word16 j, k, idx, Adiff_fx; Word32 maxcorr, corr; #ifdef BASOP_NOGLOB Flag Overflow = 0; #endif maxcorr = L_add(MIN_32, 0); Adiff_fx = (Word16)(s_max(4, shr(lag, 3))); Loading @@ -1505,7 +1523,11 @@ static Word16 DTFS_alignment_extract_td_fx(Word16* x1, Word16* x2, Word16 lag) corr = L_deposit_l(0); FOR(k = 0; k < lag; k++) { #ifdef BASOP_NOGLOB corr = L_mac_o(corr, x1[k], x2[(k - j + lag) % lag], &Overflow); #else corr = L_mac(corr, x1[k], x2[(k - j + lag) % lag]); #endif } if (GT_32(corr, maxcorr)) { Loading