Loading lib_com/fd_cng_com.c +49 −31 Original line number Diff line number Diff line Loading @@ -961,56 +961,63 @@ void SynthesisSTFT_fx( Word32 *timeDomainOutput, Word32 *olapBuffer, const Word16 *olapWin, const int16_t tcx_transition, const Word16 tcx_transition, HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ const int16_t element_mode, /* i : element mode */ const int16_t nchan_out /* i : number of output channels */ const Word16 element_mode, /* i : element mode */ const Word16 nchan_out /* i : number of output channels */ ) { int16_t i; Word16 i; Word32 buf_fx[M + 1 + 320], tmp_fx; /* Perform IFFT */ RFFTN_fx( fftBuffer, hFdCngCom->fftSineTab_fx, hFdCngCom->fftlen, 1 ); /* Handle overlap in P/S domain for stereo */ IF( ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT ) && nchan_out == 2 ) test(); test(); IF( ( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_DFT ) ) && EQ_16( nchan_out, 2 ) ) { mvl2l( olapBuffer + 3 * hFdCngCom->frameSize / 4 - ( M + 1 ), buf_fx, hFdCngCom->frameSize + M + 1 ); set_l( olapBuffer, 0, hFdCngCom->fftlen ); Copy32( olapBuffer + sub( i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ), ( M + 1 ) ), buf_fx, add( hFdCngCom->frameSize, M + 1 ) ); set32_fx( olapBuffer, 0, hFdCngCom->fftlen ); } ELSE { mvl2l( olapBuffer + hFdCngCom->frameSize, olapBuffer, hFdCngCom->frameSize ); set_l( olapBuffer + hFdCngCom->frameSize, 0, hFdCngCom->frameSize ); /*olapBuffer, fftBuffer, olapWin*/ Copy32( olapBuffer + hFdCngCom->frameSize, olapBuffer, hFdCngCom->frameSize ); set32_fx( olapBuffer + hFdCngCom->frameSize, 0, hFdCngCom->frameSize ); /*olapBuffer, fftBuffer, olapWin*/ } IF( tcx_transition ) { FOR( i = 0; i < 5 * hFdCngCom->frameSize / 4; i++ ) FOR( i = 0; i < i_mult( 5, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = fftBuffer[i]; move32(); } } ELSE { FOR( i = hFdCngCom->frameSize / 4; i < 3 * hFdCngCom->frameSize / 4; i++ ) FOR( i = hFdCngCom->frameSize / 4; i < i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = L_add( olapBuffer[i], Mpy_32_16_1( fftBuffer[i], olapWin[i - hFdCngCom->frameSize / 4] ) ); olapBuffer[i] = L_add( olapBuffer[i], Mpy_32_16_1( fftBuffer[i], olapWin[sub( i, shr( hFdCngCom->frameSize, 2 ) )] ) ); move32(); } FOR( ; i < 5 * hFdCngCom->frameSize / 4; i++ ) FOR( ; i < i_mult( 5, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = fftBuffer[i]; move32(); } } FOR( ; i < 7 * hFdCngCom->frameSize / 4; i++ ) FOR( ; i < i_mult( 7, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = Mpy_32_16_1( fftBuffer[i], olapWin[i - 3 * hFdCngCom->frameSize / 4] ); olapBuffer[i] = Mpy_32_16_1( fftBuffer[i], olapWin[sub( i, i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ) )] ); move32(); } FOR( ; i < hFdCngCom->fftlen; i++ ) { olapBuffer[i] = 0; move32(); } Word32 fftScale = 0; Loading @@ -1018,10 +1025,12 @@ void SynthesisSTFT_fx( { case 640: fftScale = FFT_SCALING_640; break; move32(); BREAK; case 512: fftScale = FFT_SCALING_512; break; move32(); BREAK; default: assert( !"Not supported FFT length!" ); } Loading @@ -1029,32 +1038,36 @@ void SynthesisSTFT_fx( // v_multc(olapBuffer + hFdCngCom->frameSize / 4, (float)(hFdCngCom->fftlen / 2), timeDomainOutput, hFdCngCom->frameSize); v_multc_fixed( olapBuffer + hFdCngCom->frameSize / 4, fftScale, timeDomainOutput, hFdCngCom->frameSize ); // Q_in - 9 /* Get excitation */ IF( ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT ) && nchan_out == 2 ) test(); test(); IF( ( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_DFT ) ) && EQ_16( nchan_out, 2 ) ) { FOR( i = 0; i < hFdCngCom->frameSize / 2; i++ ) { buf_fx[i + ( M + 1 )] = L_add( buf_fx[i + ( M + 1 )], olapBuffer[i + hFdCngCom->frameSize / 4] ); buf_fx[i + ( M + 1 )] = L_add( buf_fx[i + ( M + 1 )], olapBuffer[add( i, shr( hFdCngCom->frameSize, 2 ) )] ); move32(); } // v_multc(buf, (float)(hFdCngCom->fftlen / 2), buf, M + 1 + hFdCngCom->frameSize); v_multc_fixed( buf_fx, fftScale, buf_fx, M + 1 + hFdCngCom->frameSize ); v_multc_fixed( buf_fx, fftScale, buf_fx, add( M + 1, hFdCngCom->frameSize ) ); } ELSE { // v_multc(olapBuffer + hFdCngCom->frameSize / 4 - (M + 1), (float)(hFdCngCom->fftlen / 2), buf, M + 1 + hFdCngCom->frameSize); v_multc_fixed( olapBuffer + ( hFdCngCom->frameSize / 4 ) - ( M + 1 ), fftScale, buf_fx, M + 1 + hFdCngCom->frameSize ); v_multc_fixed( olapBuffer + sub( shr( hFdCngCom->frameSize, 2 ), ( M + 1 ) ), fftScale, buf_fx, add( M + 1, hFdCngCom->frameSize ) ); } tmp_fx = buf_fx[0]; move32(); // preemph(buf + 1, PREEMPH_FAC_FLT, M + hFdCngCom->frameSize, &tmp); preemph_ivas_fx( buf_fx + 1, PREEMPH_FAC, M + hFdCngCom->frameSize, &tmp_fx ); preemph_ivas_fx( buf_fx + 1, PREEMPH_FAC, add( M, hFdCngCom->frameSize ), &tmp_fx ); // residu(hFdCngCom->A_cng_flt, M, buf + 1 + M, hFdCngCom->exc_cng_flt, hFdCngCom->frameSize); // floatToFixed_arr( hFdCngCom->A_cng_flt, hFdCngCom->A_cng, Q13, M + 1 ); // residu_ivas_fx( hFdCngCom->A_cng, Q13, M, buf_fx + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); residu_ivas_fx( hFdCngCom->A_cng, ( 15 - norm_s( hFdCngCom->A_cng[0] - 1 ) ), M, buf_fx + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); residu_ivas_fx( hFdCngCom->A_cng, sub( 15, norm_s( hFdCngCom->A_cng[0] - 1 ) ), M, buf_fx + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); for ( i = 0; i < hFdCngCom->frameSize; i++ ) { hFdCngCom->exc_cng_flt[i] = fix_to_float( hFdCngCom->exc_cng_32fx[i], Q_in - 9 ); hFdCngCom->exc_cng_flt[i] = fix_to_float( hFdCngCom->exc_cng_32fx[i], sub( Q_in, 9 ) ); } return; Loading Loading @@ -1149,7 +1162,8 @@ void SynthesisSTFT_dirac_fx( FOR( i = shr( hFdCngCom->frameSize, 2 ); i < i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = L_add( olapBuffer[i], Mpy_32_16_1( fftBuffer[i], olapWin[i - hFdCngCom->frameSize / 4] ) ); olapBuffer[i] = L_add( olapBuffer[i], Mpy_32_16_1( fftBuffer[i], olapWin[sub( i, shr( hFdCngCom->frameSize, 2 ) )] ) ); move32(); } FOR( ; i < i_mult( 5, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { Loading Loading @@ -1186,14 +1200,15 @@ void SynthesisSTFT_dirac_fx( } /* Get time-domain signal */ v_multc_fixed( olapBuffer + hFdCngCom->frameSize / 4, fftScale, timeDomainOutput, samples_out ); // Q_in - 9 v_multc_fixed( olapBuffer + shr( hFdCngCom->frameSize, 2 ), fftScale, timeDomainOutput, samples_out ); // Q_in - 9 /* Get excitation */ v_multc_fixed( olapBuffer + ( hFdCngCom->frameSize / 4 ) - ( M + 1 ), fftScale, buf, M + 1 + hFdCngCom->frameSize ); v_multc_fixed( olapBuffer + sub( shr( hFdCngCom->frameSize, 2 ), ( M + 1 ) ), fftScale, buf, add( M + 1, hFdCngCom->frameSize ) ); tmp = buf[0]; move32(); preemph_ivas_fx( buf + 1, PREEMPH_FAC, M + hFdCngCom->frameSize, &tmp ); // residu_ivas_fx( hFdCngCom->A_cng, Q13, M, buf + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); residu_ivas_fx( hFdCngCom->A_cng, 15 - norm_s( hFdCngCom->A_cng[0] - 1 ), M, buf + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); residu_ivas_fx( hFdCngCom->A_cng, sub( 15, norm_s( hFdCngCom->A_cng[0] - 1 ) ), M, buf + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); /* update and window olapBuf if we have a output frame that is shorter than the default frame size...*/ IF( LT_16( samples_out, hFdCngCom->frameSize ) ) Loading @@ -1202,7 +1217,8 @@ void SynthesisSTFT_dirac_fx( } FOR( i = i_mult( 5, shr( hFdCngCom->frameSize, 2 ) ); i < i_mult( 7, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = Mpy_32_16_1( olapBuffer[i], olapWin[i - 3 * hFdCngCom->frameSize / 4] ); olapBuffer[i] = Mpy_32_16_1( olapBuffer[i], olapWin[sub( i, i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ) )] ); move32(); } return; Loading Loading @@ -1286,9 +1302,10 @@ Word32 rand_gauss_fx( temp = own_random( seed ); temp = L_add( temp, own_random( seed ) ); temp = L_add( temp, own_random( seed ) ); temp = L_shr( temp, 15 - q ); temp = L_shr( temp, sub( 15, q ) ); *x = temp; move32(); return temp; } Loading @@ -1311,6 +1328,7 @@ Word16 rand_gauss_fix( temp = L_add( temp, shr( own_random( seed ), Q2 ) ); *x = (Word16) temp; move32(); return (Word16) temp; } Loading lib_com/fd_cng_com_fx.c +37 −3 Original line number Diff line number Diff line Loading @@ -395,10 +395,12 @@ void compress_range( if ( in_s != 0 ) { out[i] = extract_h( L_tmp ); move16(); } if ( out[i] == 0 ) { out[i] = 1; move16(); } } } Loading @@ -417,10 +419,12 @@ void compress_range( if ( in[i] != 0 ) { out[i] = extract_h( L_tmp ); move16(); } if ( out[i] == 0 ) { out[i] = 1; move16(); } } } Loading Loading @@ -523,7 +527,7 @@ void expand_range_var_exp( move32(); Word32 tmp_low_lim = L_shr( low_lim, maxOutExp ); IF( LT_32( out[i], tmp_low_lim ) ) if ( LT_32( out[i], tmp_low_lim ) ) { out[i] = tmp_low_lim; move32(); Loading Loading @@ -603,6 +607,7 @@ void minimum_statistics( Word16 msNoiseFloor16; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif Loading Loading @@ -765,7 +770,7 @@ void minimum_statistics( FOR( j = start; j < stop; j++ ) { /* Compute optimal smoothing parameter for PSD estimation */ test(); /* Compute optimal smoothing parameter for PSD estimation */ test(); IF( ( scalar == 0 ) || ( msNoiseFloor[j] == 0 ) ) { Loading Loading @@ -827,6 +832,7 @@ void minimum_statistics( /* Compute the PSD (smoothed periodogram) in each band */ msPsd[j] = round_fx( L_add( Mpy_32_16_1( msAlpha[j], msPsd[j] ), Mpy_32_16_1( L_sub( 2147483647l /*1.0 Q31*/, msAlpha[j] ), msPeriodog[j] ) ) ); move16(); } msPsdSum[cnt] = dotp_s_fx( msPsd + start, psize + start, current_len, CNG_HS ); move32(); Loading Loading @@ -1077,6 +1083,7 @@ void minimum_statistics( FOR( j = 0; j < len; j++ ) { msCurrentMinOut[j] = L_deposit_h( msPeriodog[j] ); move32(); } set32_fx( hFdCngCom->msAlphaCor, 2147483647l /*1.0 Q31*/, cnt ); set32_fx( msAlpha, 0l /*0.0 Q31*/, len ); Loading Loading @@ -1123,6 +1130,7 @@ void minimum_statistics( FOR( j = 0; j < len; j++ ) { msNoiseEst[j] = round_fx( L_mac( L_mult( 31130 /*0.95 Q15*/, msNoiseEst[j] ), 1638 /*0.05 Q15*/, msNoiseFloor[j] ) ); move16(); } } #ifdef IVAS_CODE_CNG_COM Loading Loading @@ -1221,6 +1229,7 @@ void minimum_statistics_fx( Word16 msNoiseFloor16; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif Loading Loading @@ -1379,7 +1388,7 @@ void minimum_statistics_fx( FOR( j = start; j < stop; j++ ) { /* Compute optimal smoothing parameter for PSD estimation */ test(); /* Compute optimal smoothing parameter for PSD estimation */ test(); IF( ( scalar == 0 ) || ( msNoiseFloor[j] == 0 ) ) { Loading Loading @@ -1441,6 +1450,7 @@ void minimum_statistics_fx( /* Compute the PSD (smoothed periodogram) in each band */ msPsd[j] = round_fx( L_add( Mpy_32_16_1( msAlpha[j], msPsd[j] ), Mpy_32_16_1( L_sub( 2147483647l /*1.0 Q31*/, msAlpha[j] ), msPeriodog[j] ) ) ); move16(); } msPsdSum[cnt] = dotp_s_fx( msPsd + start, psize + start, current_len, CNG_HS ); move32(); Loading Loading @@ -1691,6 +1701,7 @@ void minimum_statistics_fx( FOR( j = 0; j < len; j++ ) { msCurrentMinOut[j] = L_deposit_h( msPeriodog[j] ); move32(); } set32_fx( hFdCngCom->msAlphaCor, 2147483647l /*1.0 Q31*/, cnt ); set32_fx( msAlpha, 0l /*0.0 Q31*/, len ); Loading Loading @@ -1731,12 +1742,14 @@ void minimum_statistics_fx( ELSE { hFdCngCom->msFrCnt = add( hFdCngCom->msFrCnt, 1 ); move16(); } /* Smooth noise estimate during CNG phases */ FOR( j = 0; j < len; j++ ) { msNoiseEst[j] = round_fx( L_mac( L_mult( 31130 /*0.95 Q15*/, msNoiseEst[j] ), 1638 /*0.05 Q15*/, msNoiseFloor[j] ) ); move16(); } } if ( enc_dec == DEC && element_mode == IVAS_CPE_TD ) Loading Loading @@ -1804,6 +1817,7 @@ void apply_scale( { *scale = L_add( *scale, L_deposit_h( scaleTable[i].scale ) ); move32(); } } Loading Loading @@ -1837,6 +1851,7 @@ Word16 apply_scale_ind( { *scale = L_add( *scale, L_deposit_h( scaleTable[i].scale ) ); move32(); } return i; } Loading Loading @@ -1864,7 +1879,9 @@ void apply_scale_ivas_fx( assert( i < scaleTableSize ); *scale = L_add( *scale, L_deposit_h( scaleTable[i].scale ) ); move32(); *index = i; move16(); } #endif // IVAS_FLOAT_FIXED /*------------------------------------------------------------------- Loading Loading @@ -1961,6 +1978,7 @@ void scalebands( delta = 0; move16(); partpowLD64M1 = 0L; /* to avoid compilation warnings */ move32(); /* Interpolate the bin/band-wise levels from the partition levels */ IF( EQ_16( nband, npart ) ) Loading Loading @@ -2102,6 +2120,7 @@ void scalebands_fx( delta = 0; move16(); partpowLD64M1 = 0L; /* to avoid compilation warnings */ move32(); /* Interpolate the bin/band-wise levels from the partition levels */ IF( EQ_16( nband, npart ) ) Loading Loading @@ -2241,6 +2260,7 @@ static void getmidbands( Word16 j, max_psize, shift; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif Loading @@ -2248,6 +2268,7 @@ static void getmidbands( move16(); /* first half partition */ move16(); midband[0] = part[0]; move16(); psize[0] = add( part[0], 1 ); move16(); psize_inv[0] = getNormReciprocalWord16( psize[0] ); Loading Loading @@ -2401,8 +2422,10 @@ void AnalysisSTFT_fx( FOR( i = 0; i < hFdCngCom->fftlen; i++ ) { fftBuffer[i] = L_shr( fftBuffer[i], 11 ); move32(); } *fftBuffer_exp = WORD16_BITS + 11; move16(); /* Perform FFT */ RFFTN_fx( fftBuffer, hFdCngCom->fftSineTab_fx, hFdCngCom->fftlen, -1 ); Loading Loading @@ -2439,9 +2462,11 @@ void SynthesisSTFT( /* Perform IFFT */ scale = 0; move16(); BASOP_rfft( fftBuffer, hFdCngCom->fftlen, &scale, 1 ); fftBufferExp = add( fftBufferExp, scale ); hFdCngCom->fftBuffer_exp = fftBufferExp; move16(); fftBufferExp = add( fftBufferExp, hFdCngCom->fftlenShift ); Loading @@ -2466,6 +2491,7 @@ void SynthesisSTFT( FOR( i = 0; i < len; i++ ) { olapBuffer[i] = round_fx( L_shl( fftBuffer[i], fftBufferExp - 15 ) ); move16(); } } ELSE Loading Loading @@ -2685,6 +2711,7 @@ void mhvals( tmp2_m = BASOP_Util_Add_Mant32Exp( tmp2_m, tmp2_e, L_deposit_h( m_array[i] ), 0, &tmp2_e ); assert( tmp2_e == 0 ); *m = extract_h( tmp2_m ); move32(); } } Loading Loading @@ -2735,9 +2762,12 @@ void lpc_from_spectrum( Word32 *powspec = hFdCngCom->cngNoiseLevel; /*i : pointer to noise levels format Q5.27*/ Word16 powspec_exp = hFdCngCom->cngNoiseLevelExp; move16(); Word16 fftlen = hFdCngCom->fftlen; /*i : size of fft*/ Word16 *A = hFdCngCom->A_cng; /*o : lpc coefficients format Q3.12*/ move16(); Word16 lpcorder = M; move16(); scale = 0; move16(); Loading Loading @@ -2767,6 +2797,7 @@ void lpc_from_spectrum( *ptr = nf; move32(); *pti = L_deposit_l( 0 ); move32(); ptr += 2; pti += 2; } Loading @@ -2776,6 +2807,7 @@ void lpc_from_spectrum( *ptr = L_max( nf, L_shl( powspec[i - start], s1 ) ); move32(); *pti = L_deposit_l( 0 ); move32(); ptr += 2; pti += 2; } Loading @@ -2785,6 +2817,7 @@ void lpc_from_spectrum( *ptr = nf; move32(); *pti = L_deposit_l( 0 ); move32(); ptr += 2; pti += 2; } Loading Loading @@ -2960,6 +2993,7 @@ void FdCng_exc( Word16 i; *CNG_mode = -1; move16(); FOR( i = 0; i < L_frame / L_SUBFR; i++ ) { Loading lib_com/fft.c +36 −36 Original line number Diff line number Diff line Loading @@ -6513,21 +6513,21 @@ static void BASOP_fft8( move32(); im[s * 6] = L_add( s05, s07 ); move32(); re[s * 3] = L_add( s08, s14 ); re[i_mult( s, 3 )] = L_add( s08, s14 ); move32(); re[s * 7] = L_sub( s08, s14 ); re[i_mult( s, 7 )] = L_sub( s08, s14 ); move32(); im[s * 3] = L_add( s09, s15 ); im[i_mult( s, 3 )] = L_add( s09, s15 ); move32(); im[s * 7] = L_sub( s09, s15 ); im[i_mult( s, 7 )] = L_sub( s09, s15 ); move32(); re[s * 1] = L_add( s10, s12 ); move32(); re[s * 5] = L_sub( s10, s12 ); re[i_mult( s, 5 )] = L_sub( s10, s12 ); move32(); im[s * 1] = L_add( s11, s13 ); move32(); im[s * 5] = L_sub( s11, s13 ); im[i_mult( s, 5 )] = L_sub( s11, s13 ); move32(); return; Loading Loading @@ -6581,23 +6581,23 @@ static void BASOP_fftN2( IF( i == 0 ) { cplxMpy4_8_1( x02, x03, x[2 * i + 2 * 1 * dim1], x[2 * i + 2 * 1 * dim1 + 1] ); cplxMpy4_8_1( x04, x05, x[2 * i + 2 * 2 * dim1], x[2 * i + 2 * 2 * dim1 + 1] ); cplxMpy4_8_1( x06, x07, x[2 * i + 2 * 3 * dim1], x[2 * i + 2 * 3 * dim1 + 1] ); cplxMpy4_8_1( x08, x09, x[2 * i + 2 * 4 * dim1], x[2 * i + 2 * 4 * dim1 + 1] ); cplxMpy4_8_1( x10, x11, x[2 * i + 2 * 5 * dim1], x[2 * i + 2 * 5 * dim1 + 1] ); cplxMpy4_8_1( x12, x13, x[2 * i + 2 * 6 * dim1], x[2 * i + 2 * 6 * dim1 + 1] ); cplxMpy4_8_1( x14, x15, x[2 * i + 2 * 7 * dim1], x[2 * i + 2 * 7 * dim1 + 1] ); cplxMpy4_8_1( x02, x03, x[add( shl( i, 1 ), i_mult( 2 * 1, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 1, dim1 ) ), 1 )] ); cplxMpy4_8_1( x04, x05, x[add( shl( i, 1 ), i_mult( 2 * 2, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 2, dim1 ) ), 1 )] ); cplxMpy4_8_1( x06, x07, x[add( shl( i, 1 ), i_mult( 2 * 3, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 3, dim1 ) ), 1 )] ); cplxMpy4_8_1( x08, x09, x[add( shl( i, 1 ), i_mult( 2 * 4, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 4, dim1 ) ), 1 )] ); cplxMpy4_8_1( x10, x11, x[add( shl( i, 1 ), i_mult( 2 * 5, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 5, dim1 ) ), 1 )] ); cplxMpy4_8_1( x12, x13, x[add( shl( i, 1 ), i_mult( 2 * 6, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 6, dim1 ) ), 1 )] ); cplxMpy4_8_1( x14, x15, x[add( shl( i, 1 ), i_mult( 2 * 7, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 7, dim1 ) ), 1 )] ); } ELSE { cplxMpy4_8_0( x02, x03, x[2 * i + 2 * 1 * dim1], x[2 * i + 2 * 1 * dim1 + 1], W[sc * i + sc * 1 * dim1 - Woff], W[sc * i + sc * 1 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x04, x05, x[2 * i + 2 * 2 * dim1], x[2 * i + 2 * 2 * dim1 + 1], W[sc * i + sc * 2 * dim1 - Woff], W[sc * i + sc * 2 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x06, x07, x[2 * i + 2 * 3 * dim1], x[2 * i + 2 * 3 * dim1 + 1], W[sc * i + sc * 3 * dim1 - Woff], W[sc * i + sc * 3 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x08, x09, x[2 * i + 2 * 4 * dim1], x[2 * i + 2 * 4 * dim1 + 1], W[sc * i + sc * 4 * dim1 - Woff], W[sc * i + sc * 4 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x10, x11, x[2 * i + 2 * 5 * dim1], x[2 * i + 2 * 5 * dim1 + 1], W[sc * i + sc * 5 * dim1 - Woff], W[sc * i + sc * 5 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x12, x13, x[2 * i + 2 * 6 * dim1], x[2 * i + 2 * 6 * dim1 + 1], W[sc * i + sc * 6 * dim1 - Woff], W[sc * i + sc * 6 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x14, x15, x[2 * i + 2 * 7 * dim1], x[2 * i + 2 * 7 * dim1 + 1], W[sc * i + sc * 7 * dim1 - Woff], W[sc * i + sc * 7 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x02, x03, x[add( shl( i, 1 ), i_mult( 2 * 1, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 1, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 1, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 1, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x04, x05, x[add( shl( i, 1 ), i_mult( 2 * 2, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 2, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 2, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 2, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x06, x07, x[add( shl( i, 1 ), i_mult( 2 * 3, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 3, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 3, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 3, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x08, x09, x[add( shl( i, 1 ), i_mult( 2 * 4, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 4, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 4, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 4, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x10, x11, x[add( shl( i, 1 ), i_mult( 2 * 5, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 5, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 5, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 5, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x12, x13, x[add( shl( i, 1 ), i_mult( 2 * 6, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 6, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 6, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 6, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x14, x15, x[add( shl( i, 1 ), i_mult( 2 * 7, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 7, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 7, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 7, dim1 ) ) ), 1 ), Woff )] ); } t00 = L_shr( L_add( x00, x08 ), SCALEFACTORN2 - 1 ); t02 = L_shr( L_sub( x00, x08 ), SCALEFACTORN2 - 1 ); Loading Loading @@ -6639,37 +6639,37 @@ static void BASOP_fftN2( s13 = Mpy_32_16_1( L_sub( t03, t01 ), C81_FX ); s15 = Mpy_32_16_1( L_add( t01, t03 ), C82_FX ); re[sx * i + sx * 0 * dim1] = L_add( s00, s02 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 0, dim1 ) ) )] = L_add( s00, s02 ); move32(); im[sx * i + sx * 0 * dim1] = L_add( s01, s03 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 0, dim1 ) ) )] = L_add( s01, s03 ); move32(); re[sx * i + sx * 1 * dim1] = L_add( s10, s12 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 1, dim1 ) ) )] = L_add( s10, s12 ); move32(); im[sx * i + sx * 1 * dim1] = L_add( s11, s13 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 1, dim1 ) ) )] = L_add( s11, s13 ); move32(); re[sx * i + sx * 2 * dim1] = L_sub( s04, s06 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 2, dim1 ) ) )] = L_sub( s04, s06 ); move32(); im[sx * i + sx * 2 * dim1] = L_sub( s05, s07 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 2, dim1 ) ) )] = L_sub( s05, s07 ); move32(); re[sx * i + sx * 3 * dim1] = L_add( s08, s14 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 3, dim1 ) ) )] = L_add( s08, s14 ); move32(); im[sx * i + sx * 3 * dim1] = L_add( s09, s15 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 3, dim1 ) ) )] = L_add( s09, s15 ); move32(); re[sx * i + sx * 4 * dim1] = L_sub( s00, s02 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 4, dim1 ) ) )] = L_sub( s00, s02 ); move32(); im[sx * i + sx * 4 * dim1] = L_sub( s01, s03 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 4, dim1 ) ) )] = L_sub( s01, s03 ); move32(); re[sx * i + sx * 5 * dim1] = L_sub( s10, s12 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 5, dim1 ) ) )] = L_sub( s10, s12 ); move32(); im[sx * i + sx * 5 * dim1] = L_sub( s11, s13 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 5, dim1 ) ) )] = L_sub( s11, s13 ); move32(); re[sx * i + sx * 6 * dim1] = L_add( s04, s06 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 6, dim1 ) ) )] = L_add( s04, s06 ); move32(); im[sx * i + sx * 6 * dim1] = L_add( s05, s07 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 6, dim1 ) ) )] = L_add( s05, s07 ); move32(); re[sx * i + sx * 7 * dim1] = L_sub( s08, s14 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 7, dim1 ) ) )] = L_sub( s08, s14 ); move32(); im[sx * i + sx * 7 * dim1] = L_sub( s09, s15 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 7, dim1 ) ) )] = L_sub( s09, s15 ); move32(); } Loading lib_com/fft_evs.c +6 −0 Original line number Diff line number Diff line Loading @@ -555,12 +555,15 @@ void fft16( Word32 *re, Word32 *im, Word16 s, Word16 bScale ) FOR( i = 0; i < 16; i++ ) { inp_data[i] = CL_form( re[s * i], im[s * i] ); move64(); } fft16_with_cmplx_data( inp_data, bScale ); FOR( i = 0; i < 16; i++ ) { re[s * i] = CL_Extract_real( inp_data[i] ); move32(); im[s * i] = CL_Extract_imag( inp_data[i] ); move32(); } } } Loading Loading @@ -1927,6 +1930,7 @@ static void fftN2( cmplx s0, s1, s2, s3, s4, s5, s6, s7; i = 0; move16(); { y0 = CL_shr( x_cmplx[i + 0 * dim1], 1 ); y1 = CL_shr( x_cmplx[i + 1 * dim1], 1 ); Loading Loading @@ -2463,7 +2467,9 @@ void BASOP_rfft( Word32 *x, Word16 sizeOfFft, Word16 *scale, Word16 isign ) case 320: case 640: c1 = FFTC( 0x66666680 ); move16(); c2 = FFTC( 0x99999980 ); move16(); FOR( i = 0; i < sizeOfFft2; i++ ) { x[2 * i] = Mpy_32_xx( x[2 * i], c1 ); Loading lib_com/fft_fx_evs.c +77 −12 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
lib_com/fd_cng_com.c +49 −31 Original line number Diff line number Diff line Loading @@ -961,56 +961,63 @@ void SynthesisSTFT_fx( Word32 *timeDomainOutput, Word32 *olapBuffer, const Word16 *olapWin, const int16_t tcx_transition, const Word16 tcx_transition, HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ const int16_t element_mode, /* i : element mode */ const int16_t nchan_out /* i : number of output channels */ const Word16 element_mode, /* i : element mode */ const Word16 nchan_out /* i : number of output channels */ ) { int16_t i; Word16 i; Word32 buf_fx[M + 1 + 320], tmp_fx; /* Perform IFFT */ RFFTN_fx( fftBuffer, hFdCngCom->fftSineTab_fx, hFdCngCom->fftlen, 1 ); /* Handle overlap in P/S domain for stereo */ IF( ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT ) && nchan_out == 2 ) test(); test(); IF( ( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_DFT ) ) && EQ_16( nchan_out, 2 ) ) { mvl2l( olapBuffer + 3 * hFdCngCom->frameSize / 4 - ( M + 1 ), buf_fx, hFdCngCom->frameSize + M + 1 ); set_l( olapBuffer, 0, hFdCngCom->fftlen ); Copy32( olapBuffer + sub( i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ), ( M + 1 ) ), buf_fx, add( hFdCngCom->frameSize, M + 1 ) ); set32_fx( olapBuffer, 0, hFdCngCom->fftlen ); } ELSE { mvl2l( olapBuffer + hFdCngCom->frameSize, olapBuffer, hFdCngCom->frameSize ); set_l( olapBuffer + hFdCngCom->frameSize, 0, hFdCngCom->frameSize ); /*olapBuffer, fftBuffer, olapWin*/ Copy32( olapBuffer + hFdCngCom->frameSize, olapBuffer, hFdCngCom->frameSize ); set32_fx( olapBuffer + hFdCngCom->frameSize, 0, hFdCngCom->frameSize ); /*olapBuffer, fftBuffer, olapWin*/ } IF( tcx_transition ) { FOR( i = 0; i < 5 * hFdCngCom->frameSize / 4; i++ ) FOR( i = 0; i < i_mult( 5, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = fftBuffer[i]; move32(); } } ELSE { FOR( i = hFdCngCom->frameSize / 4; i < 3 * hFdCngCom->frameSize / 4; i++ ) FOR( i = hFdCngCom->frameSize / 4; i < i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = L_add( olapBuffer[i], Mpy_32_16_1( fftBuffer[i], olapWin[i - hFdCngCom->frameSize / 4] ) ); olapBuffer[i] = L_add( olapBuffer[i], Mpy_32_16_1( fftBuffer[i], olapWin[sub( i, shr( hFdCngCom->frameSize, 2 ) )] ) ); move32(); } FOR( ; i < 5 * hFdCngCom->frameSize / 4; i++ ) FOR( ; i < i_mult( 5, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = fftBuffer[i]; move32(); } } FOR( ; i < 7 * hFdCngCom->frameSize / 4; i++ ) FOR( ; i < i_mult( 7, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = Mpy_32_16_1( fftBuffer[i], olapWin[i - 3 * hFdCngCom->frameSize / 4] ); olapBuffer[i] = Mpy_32_16_1( fftBuffer[i], olapWin[sub( i, i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ) )] ); move32(); } FOR( ; i < hFdCngCom->fftlen; i++ ) { olapBuffer[i] = 0; move32(); } Word32 fftScale = 0; Loading @@ -1018,10 +1025,12 @@ void SynthesisSTFT_fx( { case 640: fftScale = FFT_SCALING_640; break; move32(); BREAK; case 512: fftScale = FFT_SCALING_512; break; move32(); BREAK; default: assert( !"Not supported FFT length!" ); } Loading @@ -1029,32 +1038,36 @@ void SynthesisSTFT_fx( // v_multc(olapBuffer + hFdCngCom->frameSize / 4, (float)(hFdCngCom->fftlen / 2), timeDomainOutput, hFdCngCom->frameSize); v_multc_fixed( olapBuffer + hFdCngCom->frameSize / 4, fftScale, timeDomainOutput, hFdCngCom->frameSize ); // Q_in - 9 /* Get excitation */ IF( ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT ) && nchan_out == 2 ) test(); test(); IF( ( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_DFT ) ) && EQ_16( nchan_out, 2 ) ) { FOR( i = 0; i < hFdCngCom->frameSize / 2; i++ ) { buf_fx[i + ( M + 1 )] = L_add( buf_fx[i + ( M + 1 )], olapBuffer[i + hFdCngCom->frameSize / 4] ); buf_fx[i + ( M + 1 )] = L_add( buf_fx[i + ( M + 1 )], olapBuffer[add( i, shr( hFdCngCom->frameSize, 2 ) )] ); move32(); } // v_multc(buf, (float)(hFdCngCom->fftlen / 2), buf, M + 1 + hFdCngCom->frameSize); v_multc_fixed( buf_fx, fftScale, buf_fx, M + 1 + hFdCngCom->frameSize ); v_multc_fixed( buf_fx, fftScale, buf_fx, add( M + 1, hFdCngCom->frameSize ) ); } ELSE { // v_multc(olapBuffer + hFdCngCom->frameSize / 4 - (M + 1), (float)(hFdCngCom->fftlen / 2), buf, M + 1 + hFdCngCom->frameSize); v_multc_fixed( olapBuffer + ( hFdCngCom->frameSize / 4 ) - ( M + 1 ), fftScale, buf_fx, M + 1 + hFdCngCom->frameSize ); v_multc_fixed( olapBuffer + sub( shr( hFdCngCom->frameSize, 2 ), ( M + 1 ) ), fftScale, buf_fx, add( M + 1, hFdCngCom->frameSize ) ); } tmp_fx = buf_fx[0]; move32(); // preemph(buf + 1, PREEMPH_FAC_FLT, M + hFdCngCom->frameSize, &tmp); preemph_ivas_fx( buf_fx + 1, PREEMPH_FAC, M + hFdCngCom->frameSize, &tmp_fx ); preemph_ivas_fx( buf_fx + 1, PREEMPH_FAC, add( M, hFdCngCom->frameSize ), &tmp_fx ); // residu(hFdCngCom->A_cng_flt, M, buf + 1 + M, hFdCngCom->exc_cng_flt, hFdCngCom->frameSize); // floatToFixed_arr( hFdCngCom->A_cng_flt, hFdCngCom->A_cng, Q13, M + 1 ); // residu_ivas_fx( hFdCngCom->A_cng, Q13, M, buf_fx + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); residu_ivas_fx( hFdCngCom->A_cng, ( 15 - norm_s( hFdCngCom->A_cng[0] - 1 ) ), M, buf_fx + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); residu_ivas_fx( hFdCngCom->A_cng, sub( 15, norm_s( hFdCngCom->A_cng[0] - 1 ) ), M, buf_fx + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); for ( i = 0; i < hFdCngCom->frameSize; i++ ) { hFdCngCom->exc_cng_flt[i] = fix_to_float( hFdCngCom->exc_cng_32fx[i], Q_in - 9 ); hFdCngCom->exc_cng_flt[i] = fix_to_float( hFdCngCom->exc_cng_32fx[i], sub( Q_in, 9 ) ); } return; Loading Loading @@ -1149,7 +1162,8 @@ void SynthesisSTFT_dirac_fx( FOR( i = shr( hFdCngCom->frameSize, 2 ); i < i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = L_add( olapBuffer[i], Mpy_32_16_1( fftBuffer[i], olapWin[i - hFdCngCom->frameSize / 4] ) ); olapBuffer[i] = L_add( olapBuffer[i], Mpy_32_16_1( fftBuffer[i], olapWin[sub( i, shr( hFdCngCom->frameSize, 2 ) )] ) ); move32(); } FOR( ; i < i_mult( 5, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { Loading Loading @@ -1186,14 +1200,15 @@ void SynthesisSTFT_dirac_fx( } /* Get time-domain signal */ v_multc_fixed( olapBuffer + hFdCngCom->frameSize / 4, fftScale, timeDomainOutput, samples_out ); // Q_in - 9 v_multc_fixed( olapBuffer + shr( hFdCngCom->frameSize, 2 ), fftScale, timeDomainOutput, samples_out ); // Q_in - 9 /* Get excitation */ v_multc_fixed( olapBuffer + ( hFdCngCom->frameSize / 4 ) - ( M + 1 ), fftScale, buf, M + 1 + hFdCngCom->frameSize ); v_multc_fixed( olapBuffer + sub( shr( hFdCngCom->frameSize, 2 ), ( M + 1 ) ), fftScale, buf, add( M + 1, hFdCngCom->frameSize ) ); tmp = buf[0]; move32(); preemph_ivas_fx( buf + 1, PREEMPH_FAC, M + hFdCngCom->frameSize, &tmp ); // residu_ivas_fx( hFdCngCom->A_cng, Q13, M, buf + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); residu_ivas_fx( hFdCngCom->A_cng, 15 - norm_s( hFdCngCom->A_cng[0] - 1 ), M, buf + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); residu_ivas_fx( hFdCngCom->A_cng, sub( 15, norm_s( hFdCngCom->A_cng[0] - 1 ) ), M, buf + 1 + M, hFdCngCom->exc_cng_32fx, hFdCngCom->frameSize ); /* update and window olapBuf if we have a output frame that is shorter than the default frame size...*/ IF( LT_16( samples_out, hFdCngCom->frameSize ) ) Loading @@ -1202,7 +1217,8 @@ void SynthesisSTFT_dirac_fx( } FOR( i = i_mult( 5, shr( hFdCngCom->frameSize, 2 ) ); i < i_mult( 7, shr( hFdCngCom->frameSize, 2 ) ); i++ ) { olapBuffer[i] = Mpy_32_16_1( olapBuffer[i], olapWin[i - 3 * hFdCngCom->frameSize / 4] ); olapBuffer[i] = Mpy_32_16_1( olapBuffer[i], olapWin[sub( i, i_mult( 3, shr( hFdCngCom->frameSize, 2 ) ) )] ); move32(); } return; Loading Loading @@ -1286,9 +1302,10 @@ Word32 rand_gauss_fx( temp = own_random( seed ); temp = L_add( temp, own_random( seed ) ); temp = L_add( temp, own_random( seed ) ); temp = L_shr( temp, 15 - q ); temp = L_shr( temp, sub( 15, q ) ); *x = temp; move32(); return temp; } Loading @@ -1311,6 +1328,7 @@ Word16 rand_gauss_fix( temp = L_add( temp, shr( own_random( seed ), Q2 ) ); *x = (Word16) temp; move32(); return (Word16) temp; } Loading
lib_com/fd_cng_com_fx.c +37 −3 Original line number Diff line number Diff line Loading @@ -395,10 +395,12 @@ void compress_range( if ( in_s != 0 ) { out[i] = extract_h( L_tmp ); move16(); } if ( out[i] == 0 ) { out[i] = 1; move16(); } } } Loading @@ -417,10 +419,12 @@ void compress_range( if ( in[i] != 0 ) { out[i] = extract_h( L_tmp ); move16(); } if ( out[i] == 0 ) { out[i] = 1; move16(); } } } Loading Loading @@ -523,7 +527,7 @@ void expand_range_var_exp( move32(); Word32 tmp_low_lim = L_shr( low_lim, maxOutExp ); IF( LT_32( out[i], tmp_low_lim ) ) if ( LT_32( out[i], tmp_low_lim ) ) { out[i] = tmp_low_lim; move32(); Loading Loading @@ -603,6 +607,7 @@ void minimum_statistics( Word16 msNoiseFloor16; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif Loading Loading @@ -765,7 +770,7 @@ void minimum_statistics( FOR( j = start; j < stop; j++ ) { /* Compute optimal smoothing parameter for PSD estimation */ test(); /* Compute optimal smoothing parameter for PSD estimation */ test(); IF( ( scalar == 0 ) || ( msNoiseFloor[j] == 0 ) ) { Loading Loading @@ -827,6 +832,7 @@ void minimum_statistics( /* Compute the PSD (smoothed periodogram) in each band */ msPsd[j] = round_fx( L_add( Mpy_32_16_1( msAlpha[j], msPsd[j] ), Mpy_32_16_1( L_sub( 2147483647l /*1.0 Q31*/, msAlpha[j] ), msPeriodog[j] ) ) ); move16(); } msPsdSum[cnt] = dotp_s_fx( msPsd + start, psize + start, current_len, CNG_HS ); move32(); Loading Loading @@ -1077,6 +1083,7 @@ void minimum_statistics( FOR( j = 0; j < len; j++ ) { msCurrentMinOut[j] = L_deposit_h( msPeriodog[j] ); move32(); } set32_fx( hFdCngCom->msAlphaCor, 2147483647l /*1.0 Q31*/, cnt ); set32_fx( msAlpha, 0l /*0.0 Q31*/, len ); Loading Loading @@ -1123,6 +1130,7 @@ void minimum_statistics( FOR( j = 0; j < len; j++ ) { msNoiseEst[j] = round_fx( L_mac( L_mult( 31130 /*0.95 Q15*/, msNoiseEst[j] ), 1638 /*0.05 Q15*/, msNoiseFloor[j] ) ); move16(); } } #ifdef IVAS_CODE_CNG_COM Loading Loading @@ -1221,6 +1229,7 @@ void minimum_statistics_fx( Word16 msNoiseFloor16; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif Loading Loading @@ -1379,7 +1388,7 @@ void minimum_statistics_fx( FOR( j = start; j < stop; j++ ) { /* Compute optimal smoothing parameter for PSD estimation */ test(); /* Compute optimal smoothing parameter for PSD estimation */ test(); IF( ( scalar == 0 ) || ( msNoiseFloor[j] == 0 ) ) { Loading Loading @@ -1441,6 +1450,7 @@ void minimum_statistics_fx( /* Compute the PSD (smoothed periodogram) in each band */ msPsd[j] = round_fx( L_add( Mpy_32_16_1( msAlpha[j], msPsd[j] ), Mpy_32_16_1( L_sub( 2147483647l /*1.0 Q31*/, msAlpha[j] ), msPeriodog[j] ) ) ); move16(); } msPsdSum[cnt] = dotp_s_fx( msPsd + start, psize + start, current_len, CNG_HS ); move32(); Loading Loading @@ -1691,6 +1701,7 @@ void minimum_statistics_fx( FOR( j = 0; j < len; j++ ) { msCurrentMinOut[j] = L_deposit_h( msPeriodog[j] ); move32(); } set32_fx( hFdCngCom->msAlphaCor, 2147483647l /*1.0 Q31*/, cnt ); set32_fx( msAlpha, 0l /*0.0 Q31*/, len ); Loading Loading @@ -1731,12 +1742,14 @@ void minimum_statistics_fx( ELSE { hFdCngCom->msFrCnt = add( hFdCngCom->msFrCnt, 1 ); move16(); } /* Smooth noise estimate during CNG phases */ FOR( j = 0; j < len; j++ ) { msNoiseEst[j] = round_fx( L_mac( L_mult( 31130 /*0.95 Q15*/, msNoiseEst[j] ), 1638 /*0.05 Q15*/, msNoiseFloor[j] ) ); move16(); } } if ( enc_dec == DEC && element_mode == IVAS_CPE_TD ) Loading Loading @@ -1804,6 +1817,7 @@ void apply_scale( { *scale = L_add( *scale, L_deposit_h( scaleTable[i].scale ) ); move32(); } } Loading Loading @@ -1837,6 +1851,7 @@ Word16 apply_scale_ind( { *scale = L_add( *scale, L_deposit_h( scaleTable[i].scale ) ); move32(); } return i; } Loading Loading @@ -1864,7 +1879,9 @@ void apply_scale_ivas_fx( assert( i < scaleTableSize ); *scale = L_add( *scale, L_deposit_h( scaleTable[i].scale ) ); move32(); *index = i; move16(); } #endif // IVAS_FLOAT_FIXED /*------------------------------------------------------------------- Loading Loading @@ -1961,6 +1978,7 @@ void scalebands( delta = 0; move16(); partpowLD64M1 = 0L; /* to avoid compilation warnings */ move32(); /* Interpolate the bin/band-wise levels from the partition levels */ IF( EQ_16( nband, npart ) ) Loading Loading @@ -2102,6 +2120,7 @@ void scalebands_fx( delta = 0; move16(); partpowLD64M1 = 0L; /* to avoid compilation warnings */ move32(); /* Interpolate the bin/band-wise levels from the partition levels */ IF( EQ_16( nband, npart ) ) Loading Loading @@ -2241,6 +2260,7 @@ static void getmidbands( Word16 j, max_psize, shift; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif Loading @@ -2248,6 +2268,7 @@ static void getmidbands( move16(); /* first half partition */ move16(); midband[0] = part[0]; move16(); psize[0] = add( part[0], 1 ); move16(); psize_inv[0] = getNormReciprocalWord16( psize[0] ); Loading Loading @@ -2401,8 +2422,10 @@ void AnalysisSTFT_fx( FOR( i = 0; i < hFdCngCom->fftlen; i++ ) { fftBuffer[i] = L_shr( fftBuffer[i], 11 ); move32(); } *fftBuffer_exp = WORD16_BITS + 11; move16(); /* Perform FFT */ RFFTN_fx( fftBuffer, hFdCngCom->fftSineTab_fx, hFdCngCom->fftlen, -1 ); Loading Loading @@ -2439,9 +2462,11 @@ void SynthesisSTFT( /* Perform IFFT */ scale = 0; move16(); BASOP_rfft( fftBuffer, hFdCngCom->fftlen, &scale, 1 ); fftBufferExp = add( fftBufferExp, scale ); hFdCngCom->fftBuffer_exp = fftBufferExp; move16(); fftBufferExp = add( fftBufferExp, hFdCngCom->fftlenShift ); Loading @@ -2466,6 +2491,7 @@ void SynthesisSTFT( FOR( i = 0; i < len; i++ ) { olapBuffer[i] = round_fx( L_shl( fftBuffer[i], fftBufferExp - 15 ) ); move16(); } } ELSE Loading Loading @@ -2685,6 +2711,7 @@ void mhvals( tmp2_m = BASOP_Util_Add_Mant32Exp( tmp2_m, tmp2_e, L_deposit_h( m_array[i] ), 0, &tmp2_e ); assert( tmp2_e == 0 ); *m = extract_h( tmp2_m ); move32(); } } Loading Loading @@ -2735,9 +2762,12 @@ void lpc_from_spectrum( Word32 *powspec = hFdCngCom->cngNoiseLevel; /*i : pointer to noise levels format Q5.27*/ Word16 powspec_exp = hFdCngCom->cngNoiseLevelExp; move16(); Word16 fftlen = hFdCngCom->fftlen; /*i : size of fft*/ Word16 *A = hFdCngCom->A_cng; /*o : lpc coefficients format Q3.12*/ move16(); Word16 lpcorder = M; move16(); scale = 0; move16(); Loading Loading @@ -2767,6 +2797,7 @@ void lpc_from_spectrum( *ptr = nf; move32(); *pti = L_deposit_l( 0 ); move32(); ptr += 2; pti += 2; } Loading @@ -2776,6 +2807,7 @@ void lpc_from_spectrum( *ptr = L_max( nf, L_shl( powspec[i - start], s1 ) ); move32(); *pti = L_deposit_l( 0 ); move32(); ptr += 2; pti += 2; } Loading @@ -2785,6 +2817,7 @@ void lpc_from_spectrum( *ptr = nf; move32(); *pti = L_deposit_l( 0 ); move32(); ptr += 2; pti += 2; } Loading Loading @@ -2960,6 +2993,7 @@ void FdCng_exc( Word16 i; *CNG_mode = -1; move16(); FOR( i = 0; i < L_frame / L_SUBFR; i++ ) { Loading
lib_com/fft.c +36 −36 Original line number Diff line number Diff line Loading @@ -6513,21 +6513,21 @@ static void BASOP_fft8( move32(); im[s * 6] = L_add( s05, s07 ); move32(); re[s * 3] = L_add( s08, s14 ); re[i_mult( s, 3 )] = L_add( s08, s14 ); move32(); re[s * 7] = L_sub( s08, s14 ); re[i_mult( s, 7 )] = L_sub( s08, s14 ); move32(); im[s * 3] = L_add( s09, s15 ); im[i_mult( s, 3 )] = L_add( s09, s15 ); move32(); im[s * 7] = L_sub( s09, s15 ); im[i_mult( s, 7 )] = L_sub( s09, s15 ); move32(); re[s * 1] = L_add( s10, s12 ); move32(); re[s * 5] = L_sub( s10, s12 ); re[i_mult( s, 5 )] = L_sub( s10, s12 ); move32(); im[s * 1] = L_add( s11, s13 ); move32(); im[s * 5] = L_sub( s11, s13 ); im[i_mult( s, 5 )] = L_sub( s11, s13 ); move32(); return; Loading Loading @@ -6581,23 +6581,23 @@ static void BASOP_fftN2( IF( i == 0 ) { cplxMpy4_8_1( x02, x03, x[2 * i + 2 * 1 * dim1], x[2 * i + 2 * 1 * dim1 + 1] ); cplxMpy4_8_1( x04, x05, x[2 * i + 2 * 2 * dim1], x[2 * i + 2 * 2 * dim1 + 1] ); cplxMpy4_8_1( x06, x07, x[2 * i + 2 * 3 * dim1], x[2 * i + 2 * 3 * dim1 + 1] ); cplxMpy4_8_1( x08, x09, x[2 * i + 2 * 4 * dim1], x[2 * i + 2 * 4 * dim1 + 1] ); cplxMpy4_8_1( x10, x11, x[2 * i + 2 * 5 * dim1], x[2 * i + 2 * 5 * dim1 + 1] ); cplxMpy4_8_1( x12, x13, x[2 * i + 2 * 6 * dim1], x[2 * i + 2 * 6 * dim1 + 1] ); cplxMpy4_8_1( x14, x15, x[2 * i + 2 * 7 * dim1], x[2 * i + 2 * 7 * dim1 + 1] ); cplxMpy4_8_1( x02, x03, x[add( shl( i, 1 ), i_mult( 2 * 1, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 1, dim1 ) ), 1 )] ); cplxMpy4_8_1( x04, x05, x[add( shl( i, 1 ), i_mult( 2 * 2, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 2, dim1 ) ), 1 )] ); cplxMpy4_8_1( x06, x07, x[add( shl( i, 1 ), i_mult( 2 * 3, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 3, dim1 ) ), 1 )] ); cplxMpy4_8_1( x08, x09, x[add( shl( i, 1 ), i_mult( 2 * 4, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 4, dim1 ) ), 1 )] ); cplxMpy4_8_1( x10, x11, x[add( shl( i, 1 ), i_mult( 2 * 5, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 5, dim1 ) ), 1 )] ); cplxMpy4_8_1( x12, x13, x[add( shl( i, 1 ), i_mult( 2 * 6, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 6, dim1 ) ), 1 )] ); cplxMpy4_8_1( x14, x15, x[add( shl( i, 1 ), i_mult( 2 * 7, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 7, dim1 ) ), 1 )] ); } ELSE { cplxMpy4_8_0( x02, x03, x[2 * i + 2 * 1 * dim1], x[2 * i + 2 * 1 * dim1 + 1], W[sc * i + sc * 1 * dim1 - Woff], W[sc * i + sc * 1 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x04, x05, x[2 * i + 2 * 2 * dim1], x[2 * i + 2 * 2 * dim1 + 1], W[sc * i + sc * 2 * dim1 - Woff], W[sc * i + sc * 2 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x06, x07, x[2 * i + 2 * 3 * dim1], x[2 * i + 2 * 3 * dim1 + 1], W[sc * i + sc * 3 * dim1 - Woff], W[sc * i + sc * 3 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x08, x09, x[2 * i + 2 * 4 * dim1], x[2 * i + 2 * 4 * dim1 + 1], W[sc * i + sc * 4 * dim1 - Woff], W[sc * i + sc * 4 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x10, x11, x[2 * i + 2 * 5 * dim1], x[2 * i + 2 * 5 * dim1 + 1], W[sc * i + sc * 5 * dim1 - Woff], W[sc * i + sc * 5 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x12, x13, x[2 * i + 2 * 6 * dim1], x[2 * i + 2 * 6 * dim1 + 1], W[sc * i + sc * 6 * dim1 - Woff], W[sc * i + sc * 6 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x14, x15, x[2 * i + 2 * 7 * dim1], x[2 * i + 2 * 7 * dim1 + 1], W[sc * i + sc * 7 * dim1 - Woff], W[sc * i + sc * 7 * dim1 + 1 - Woff] ); cplxMpy4_8_0( x02, x03, x[add( shl( i, 1 ), i_mult( 2 * 1, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 1, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 1, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 1, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x04, x05, x[add( shl( i, 1 ), i_mult( 2 * 2, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 2, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 2, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 2, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x06, x07, x[add( shl( i, 1 ), i_mult( 2 * 3, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 3, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 3, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 3, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x08, x09, x[add( shl( i, 1 ), i_mult( 2 * 4, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 4, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 4, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 4, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x10, x11, x[add( shl( i, 1 ), i_mult( 2 * 5, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 5, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 5, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 5, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x12, x13, x[add( shl( i, 1 ), i_mult( 2 * 6, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 6, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 6, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 6, dim1 ) ) ), 1 ), Woff )] ); cplxMpy4_8_0( x14, x15, x[add( shl( i, 1 ), i_mult( 2 * 7, dim1 ) )], x[add( add( shl( i, 1 ), i_mult( 2 * 7, dim1 ) ), 1 )], W[sub( add( i_mult( sc, i ), i_mult( sc, i_mult( 7, dim1 ) ) ), Woff )], W[sub( add( add( i_mult( sc, i ), i_mult( sc, i_mult( 7, dim1 ) ) ), 1 ), Woff )] ); } t00 = L_shr( L_add( x00, x08 ), SCALEFACTORN2 - 1 ); t02 = L_shr( L_sub( x00, x08 ), SCALEFACTORN2 - 1 ); Loading Loading @@ -6639,37 +6639,37 @@ static void BASOP_fftN2( s13 = Mpy_32_16_1( L_sub( t03, t01 ), C81_FX ); s15 = Mpy_32_16_1( L_add( t01, t03 ), C82_FX ); re[sx * i + sx * 0 * dim1] = L_add( s00, s02 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 0, dim1 ) ) )] = L_add( s00, s02 ); move32(); im[sx * i + sx * 0 * dim1] = L_add( s01, s03 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 0, dim1 ) ) )] = L_add( s01, s03 ); move32(); re[sx * i + sx * 1 * dim1] = L_add( s10, s12 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 1, dim1 ) ) )] = L_add( s10, s12 ); move32(); im[sx * i + sx * 1 * dim1] = L_add( s11, s13 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 1, dim1 ) ) )] = L_add( s11, s13 ); move32(); re[sx * i + sx * 2 * dim1] = L_sub( s04, s06 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 2, dim1 ) ) )] = L_sub( s04, s06 ); move32(); im[sx * i + sx * 2 * dim1] = L_sub( s05, s07 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 2, dim1 ) ) )] = L_sub( s05, s07 ); move32(); re[sx * i + sx * 3 * dim1] = L_add( s08, s14 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 3, dim1 ) ) )] = L_add( s08, s14 ); move32(); im[sx * i + sx * 3 * dim1] = L_add( s09, s15 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 3, dim1 ) ) )] = L_add( s09, s15 ); move32(); re[sx * i + sx * 4 * dim1] = L_sub( s00, s02 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 4, dim1 ) ) )] = L_sub( s00, s02 ); move32(); im[sx * i + sx * 4 * dim1] = L_sub( s01, s03 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 4, dim1 ) ) )] = L_sub( s01, s03 ); move32(); re[sx * i + sx * 5 * dim1] = L_sub( s10, s12 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 5, dim1 ) ) )] = L_sub( s10, s12 ); move32(); im[sx * i + sx * 5 * dim1] = L_sub( s11, s13 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 5, dim1 ) ) )] = L_sub( s11, s13 ); move32(); re[sx * i + sx * 6 * dim1] = L_add( s04, s06 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 6, dim1 ) ) )] = L_add( s04, s06 ); move32(); im[sx * i + sx * 6 * dim1] = L_add( s05, s07 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 6, dim1 ) ) )] = L_add( s05, s07 ); move32(); re[sx * i + sx * 7 * dim1] = L_sub( s08, s14 ); re[add( i_mult( sx, i ), i_mult( sx, i_mult( 7, dim1 ) ) )] = L_sub( s08, s14 ); move32(); im[sx * i + sx * 7 * dim1] = L_sub( s09, s15 ); im[add( i_mult( sx, i ), i_mult( sx, i_mult( 7, dim1 ) ) )] = L_sub( s09, s15 ); move32(); } Loading
lib_com/fft_evs.c +6 −0 Original line number Diff line number Diff line Loading @@ -555,12 +555,15 @@ void fft16( Word32 *re, Word32 *im, Word16 s, Word16 bScale ) FOR( i = 0; i < 16; i++ ) { inp_data[i] = CL_form( re[s * i], im[s * i] ); move64(); } fft16_with_cmplx_data( inp_data, bScale ); FOR( i = 0; i < 16; i++ ) { re[s * i] = CL_Extract_real( inp_data[i] ); move32(); im[s * i] = CL_Extract_imag( inp_data[i] ); move32(); } } } Loading Loading @@ -1927,6 +1930,7 @@ static void fftN2( cmplx s0, s1, s2, s3, s4, s5, s6, s7; i = 0; move16(); { y0 = CL_shr( x_cmplx[i + 0 * dim1], 1 ); y1 = CL_shr( x_cmplx[i + 1 * dim1], 1 ); Loading Loading @@ -2463,7 +2467,9 @@ void BASOP_rfft( Word32 *x, Word16 sizeOfFft, Word16 *scale, Word16 isign ) case 320: case 640: c1 = FFTC( 0x66666680 ); move16(); c2 = FFTC( 0x99999980 ); move16(); FOR( i = 0; i < sizeOfFft2; i++ ) { x[2 * i] = Mpy_32_xx( x[2 * i], c1 ); Loading
lib_com/fft_fx_evs.c +77 −12 File changed.Preview size limit exceeded, changes collapsed. Show changes