Loading lib_com/fft_fx.c +0 −143 Original line number Diff line number Diff line Loading @@ -7555,146 +7555,3 @@ void rfft_fx( return; } Word16 find_guarded_bits_fx( Word32 n ) { // return n <= 1 ? 0 : n <= 2 ? 1 // : n <= 4 ? 2 // : n <= 8 ? 3 // : n <= 16 ? 4 // : n <= 32 ? 5 // : n <= 64 ? 6 // : n <= 128 ? 7 // : n <= 256 ? 8 // : n <= 512 ? 9 // : n <= 1024 ? 10 // : n <= 2048 ? 11 // : n <= 4096 ? 12 // : n <= 8192 ? 13 // : n <= 16384 ? 14 // : 15; /*Word16 val = 0; move32(); test(); WHILE( GT_32( n, L_shl( 1, val ) ) && LT_32( val, 16 ) ) { val = add( val, 1 ); }*/ IF( LE_32( n, 1 ) ) { return 0; } ELSE { return sub( 31, norm_l( L_sub( n, 1 ) ) ); } } Word16 L_norm_arr( const Word32 *arr, Word16 size ) { Word16 q = 31; move16(); FOR( Word16 i = 0; i < size; i++ ) { Word16 q_tst; q_tst = norm_l( arr[i] ); if ( arr[i] != 0 ) { q = s_min( q, q_tst ); } } return q; } Word16 norm_arr( Word16 *arr, Word16 size ) { Word16 q = 15; Word16 exp = 0; move16(); move16(); FOR( Word16 i = 0; i < size; i++ ) { if ( arr[i] != 0 ) { exp = norm_s( arr[i] ); } if ( arr[i] != 0 ) { q = s_min( q, exp ); } } return q; } Word16 W_norm_arr( Word64 *arr, Word16 size ) { Word16 q = 63; Word16 exp = 0; move16(); move16(); FOR( Word16 i = 0; i < size; i++ ) { if ( arr[i] != 0 ) { exp = W_norm( arr[i] ); } if ( arr[i] != 0 ) { q = s_min( q, exp ); } } return q; } Word16 get_min_scalefactor( Word32 x, Word32 y ) { Word16 scf_y; Word16 scf = Q31; move16(); test(); if ( x == 0 && y == 0 ) { scf = 0; move16(); } if ( x != 0 ) { scf = norm_l( x ); } scf_y = norm_l( y ); if ( y != 0 ) { scf = s_min( scf_y, scf ); } return scf; } Flag is_zero_arr( Word32 *arr, Word16 size ) { FOR( Word16 i = 0; i < size; i++ ) IF( arr[i] != 0 ) { return 0; } return 1; } Flag is_zero_arr16( Word16 *arr, Word16 size ) { FOR( Word16 i = 0; i < size; i++ ) IF( arr[i] != 0 ) { return 0; } return 1; } lib_enc/ivas_stereo_mdct_core_enc_fx.c +83 −12 Original line number Diff line number Diff line Loading @@ -153,13 +153,8 @@ void stereo_mdct_core_enc_fx( Word32 *p_mdst_spectrum_long_fx[CPE_CHANNELS]; Word32 mdst_spectrum_long_fx[CPE_CHANNELS][N_MAX]; Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV]; #ifdef FIX_1464_NO_SINGLE_SPEC_Q Word16 pwrMdstMdct_e[CPE_CHANNELS][NB_DIV]; Word16 pwrMdstMdctInv_e[CPE_CHANNELS][NB_DIV]; Word16 inv_spectrum_e[CPE_CHANNELS][NB_DIV]; #else Word16 exp_powSpecMsInv[MCT_MAX_CHANNELS], q_spec, tmp_s; Word16 tmp_q_powSpecInv[N_MAX], *tmp_q_psi[2]; Word16 q_powSpecMsInv[MCT_MAX_CHANNELS], q_spec, tmp_s; Word16 tmp_q_powSpec[N_MAX], tmp_q_powSpecInv[N_MAX], *tmp_q_psi[2]; Word64 W_tmp; #endif Encoder_State *st, **sts; Loading Loading @@ -195,6 +190,8 @@ void stereo_mdct_core_enc_fx( #ifndef FIX_1464_NO_SINGLE_SPEC_Q set16_fx( tmp_q_powSpecInv, 63, N_MAX ); set16_fx( tmp_q_powSpec, 63, N_MAX ); set16_fx( q_powSpecMsInv, 31, MCT_MAX_CHANNELS ); tmp_q_psi[0] = tmp_q_powSpecInv; tmp_q_psi[1] = &tmp_q_powSpecInv[N_TCX10_MAX]; Loading Loading @@ -458,10 +455,8 @@ void stereo_mdct_core_enc_fx( /*--------------------------------------------------------------* * Power spectrum calculation *---------------------------------------------------------------*/ #ifndef FIX_1464_NO_SINGLE_SPEC_Q Word16 length, exp, shift1, shift2, norm; Word32 mdct, mdst; #endif FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Loading Loading @@ -645,7 +640,7 @@ void stereo_mdct_core_enc_fx( /* Aligning the Q-factors */ { Word16 q_temp = Q31; q_powSpecMsInv[ch] = Q31; move16(); FOR( n = 0; n < nSubframes; n++ ) { Loading @@ -661,7 +656,7 @@ void stereo_mdct_core_enc_fx( { FOR( i = 0; i < L_subframeTCX; i++ ) { powerSpecMsInv_fx[ch][n][i] = L_shr_sat( powerSpecMsInv_fx[ch][n][i], sub( tmp_q_psi[n][i], q_temp ) ); powerSpecMsInv_fx[ch][n][i] = L_shr_sat( powerSpecMsInv_fx[ch][n][i], sub( tmp_q_psi[n][i], q_powSpecMsInv[ch] ) ); move32(); } } Loading Loading @@ -735,7 +730,83 @@ void stereo_mdct_core_enc_fx( IF( ( NE_16( hStereoMdct->mdct_stereo_mode[n], hStereoMdct->IGFStereoMode[n] ) || EQ_16( hStereoMdct->mdct_stereo_mode[n], SMDCT_BW_MS ) ) && !hStereoMdct->isSBAStereoMode ) { IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS]; #ifdef FIX_1464_NO_SINGLE_SPEC_Q Word32 powerSpec_fx[CPE_CHANNELS][N_MAX], *p_powerSpec_fx[CPE_CHANNELS]; Word16 q_powSpec[CPE_CHANNELS]; p_powerSpec_fx[0] = powerSpec_fx[0]; p_powerSpec_fx[1] = powerSpec_fx[1]; { /* Copy powerSpec values from 64 bit buffer to 32 bit buffer */ FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Word16 n1, nsub = 1; length = sts[ch]->hTcxEnc->L_frameTCX; move16(); move16(); IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); nsub = NB_DIV; move16(); } IF( EQ_16( sts[ch]->last_core, ACELP_CORE ) ) { length = add( length, shr( length, 2 ) ); } exp = sub( exp_powerSpec64[ch][0], W_norm_arr( powerSpec64[ch], length ) ); IF( EQ_16( nsub, 2 ) ) { exp = s_max( exp, sub( exp_powerSpec64[ch][1], W_norm_arr( powerSpec64[ch] + length, length ) ) ); } FOR( n1 = 0; n1 < nsub; n1++ ) { shift1 = sub( sub( exp_powerSpec64[ch][n1], exp ), 32 ); FOR( i = 0; i < length; i++ ) { /* This doesn't result in saturation */ powerSpec_fx[ch][i + n1 * length] = W_shl_sat_l( powerSpec64[ch][i + n1 * length], shift1 ); // exp: exp move32(); } } set32_fx( powerSpec_fx[ch] + length, 0, sub( N_MAX, length ) ); q_powSpec[ch] = sub( 31, exp ); // exp: exp move16(); } } hIGFEnc[0] = sts[0]->hIGFEnc; hIGFEnc[1] = sts[1]->hIGFEnc; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { q_spec = sub( Q31, sts[ch]->hTcxEnc->spectrum_e[n] ); Word16 q_comm = s_min( sub( Q31, sts[ch]->hTcxEnc->spectrum_e[n] ), s_min( q_powSpec[ch], q_powSpecMsInv[ch] ) ); Word16 n_sb = NB_DIV; move16(); if ( EQ_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { n_sb = 1; move16(); } length = idiv1616( sts[ch]->hTcxEnc->L_frameTCX, n_sb ); /* Q0 */ IF( NE_16( q_spec, q_comm ) ) { Scale_sig32( sts[ch]->hTcxEnc->spectrum_fx[n], length, sub( q_comm, q_spec ) ); /* q_powSpec */ Scale_sig32( inv_spectrum_fx[ch][n], length, sub( q_comm, q_spec ) ); /* q_powSpec */ sts[ch]->hTcxEnc->spectrum_e[n] = sub( Q31, q_comm ); move16(); } IF( NE_16( q_powSpec[ch], q_comm ) ) { Scale_sig32( &p_powerSpec_fx[ch][0], L_subframeTCX, sub( q_comm, q_powSpec[ch] ) ); /* q_spec */ q_powSpec[ch] = q_comm; move16(); } IF( NE_16( q_powSpecMsInv[ch], q_comm ) ) { Scale_sig32( powerSpecMsInv_fx[ch][0], L_subframeTCX, sub( q_comm, q_powSpecMsInv[ch] ) ); /* q_spec */ q_powSpecMsInv[ch] = q_comm; move16(); } } hIGFEnc[0]->spec_be_igf_e = p_orig_spectrum_e[0]; move16(); hIGFEnc[1]->spec_be_igf_e = p_orig_spectrum_e[1]; Loading Loading
lib_com/fft_fx.c +0 −143 Original line number Diff line number Diff line Loading @@ -7555,146 +7555,3 @@ void rfft_fx( return; } Word16 find_guarded_bits_fx( Word32 n ) { // return n <= 1 ? 0 : n <= 2 ? 1 // : n <= 4 ? 2 // : n <= 8 ? 3 // : n <= 16 ? 4 // : n <= 32 ? 5 // : n <= 64 ? 6 // : n <= 128 ? 7 // : n <= 256 ? 8 // : n <= 512 ? 9 // : n <= 1024 ? 10 // : n <= 2048 ? 11 // : n <= 4096 ? 12 // : n <= 8192 ? 13 // : n <= 16384 ? 14 // : 15; /*Word16 val = 0; move32(); test(); WHILE( GT_32( n, L_shl( 1, val ) ) && LT_32( val, 16 ) ) { val = add( val, 1 ); }*/ IF( LE_32( n, 1 ) ) { return 0; } ELSE { return sub( 31, norm_l( L_sub( n, 1 ) ) ); } } Word16 L_norm_arr( const Word32 *arr, Word16 size ) { Word16 q = 31; move16(); FOR( Word16 i = 0; i < size; i++ ) { Word16 q_tst; q_tst = norm_l( arr[i] ); if ( arr[i] != 0 ) { q = s_min( q, q_tst ); } } return q; } Word16 norm_arr( Word16 *arr, Word16 size ) { Word16 q = 15; Word16 exp = 0; move16(); move16(); FOR( Word16 i = 0; i < size; i++ ) { if ( arr[i] != 0 ) { exp = norm_s( arr[i] ); } if ( arr[i] != 0 ) { q = s_min( q, exp ); } } return q; } Word16 W_norm_arr( Word64 *arr, Word16 size ) { Word16 q = 63; Word16 exp = 0; move16(); move16(); FOR( Word16 i = 0; i < size; i++ ) { if ( arr[i] != 0 ) { exp = W_norm( arr[i] ); } if ( arr[i] != 0 ) { q = s_min( q, exp ); } } return q; } Word16 get_min_scalefactor( Word32 x, Word32 y ) { Word16 scf_y; Word16 scf = Q31; move16(); test(); if ( x == 0 && y == 0 ) { scf = 0; move16(); } if ( x != 0 ) { scf = norm_l( x ); } scf_y = norm_l( y ); if ( y != 0 ) { scf = s_min( scf_y, scf ); } return scf; } Flag is_zero_arr( Word32 *arr, Word16 size ) { FOR( Word16 i = 0; i < size; i++ ) IF( arr[i] != 0 ) { return 0; } return 1; } Flag is_zero_arr16( Word16 *arr, Word16 size ) { FOR( Word16 i = 0; i < size; i++ ) IF( arr[i] != 0 ) { return 0; } return 1; }
lib_enc/ivas_stereo_mdct_core_enc_fx.c +83 −12 Original line number Diff line number Diff line Loading @@ -153,13 +153,8 @@ void stereo_mdct_core_enc_fx( Word32 *p_mdst_spectrum_long_fx[CPE_CHANNELS]; Word32 mdst_spectrum_long_fx[CPE_CHANNELS][N_MAX]; Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV]; #ifdef FIX_1464_NO_SINGLE_SPEC_Q Word16 pwrMdstMdct_e[CPE_CHANNELS][NB_DIV]; Word16 pwrMdstMdctInv_e[CPE_CHANNELS][NB_DIV]; Word16 inv_spectrum_e[CPE_CHANNELS][NB_DIV]; #else Word16 exp_powSpecMsInv[MCT_MAX_CHANNELS], q_spec, tmp_s; Word16 tmp_q_powSpecInv[N_MAX], *tmp_q_psi[2]; Word16 q_powSpecMsInv[MCT_MAX_CHANNELS], q_spec, tmp_s; Word16 tmp_q_powSpec[N_MAX], tmp_q_powSpecInv[N_MAX], *tmp_q_psi[2]; Word64 W_tmp; #endif Encoder_State *st, **sts; Loading Loading @@ -195,6 +190,8 @@ void stereo_mdct_core_enc_fx( #ifndef FIX_1464_NO_SINGLE_SPEC_Q set16_fx( tmp_q_powSpecInv, 63, N_MAX ); set16_fx( tmp_q_powSpec, 63, N_MAX ); set16_fx( q_powSpecMsInv, 31, MCT_MAX_CHANNELS ); tmp_q_psi[0] = tmp_q_powSpecInv; tmp_q_psi[1] = &tmp_q_powSpecInv[N_TCX10_MAX]; Loading Loading @@ -458,10 +455,8 @@ void stereo_mdct_core_enc_fx( /*--------------------------------------------------------------* * Power spectrum calculation *---------------------------------------------------------------*/ #ifndef FIX_1464_NO_SINGLE_SPEC_Q Word16 length, exp, shift1, shift2, norm; Word32 mdct, mdst; #endif FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Loading Loading @@ -645,7 +640,7 @@ void stereo_mdct_core_enc_fx( /* Aligning the Q-factors */ { Word16 q_temp = Q31; q_powSpecMsInv[ch] = Q31; move16(); FOR( n = 0; n < nSubframes; n++ ) { Loading @@ -661,7 +656,7 @@ void stereo_mdct_core_enc_fx( { FOR( i = 0; i < L_subframeTCX; i++ ) { powerSpecMsInv_fx[ch][n][i] = L_shr_sat( powerSpecMsInv_fx[ch][n][i], sub( tmp_q_psi[n][i], q_temp ) ); powerSpecMsInv_fx[ch][n][i] = L_shr_sat( powerSpecMsInv_fx[ch][n][i], sub( tmp_q_psi[n][i], q_powSpecMsInv[ch] ) ); move32(); } } Loading Loading @@ -735,7 +730,83 @@ void stereo_mdct_core_enc_fx( IF( ( NE_16( hStereoMdct->mdct_stereo_mode[n], hStereoMdct->IGFStereoMode[n] ) || EQ_16( hStereoMdct->mdct_stereo_mode[n], SMDCT_BW_MS ) ) && !hStereoMdct->isSBAStereoMode ) { IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS]; #ifdef FIX_1464_NO_SINGLE_SPEC_Q Word32 powerSpec_fx[CPE_CHANNELS][N_MAX], *p_powerSpec_fx[CPE_CHANNELS]; Word16 q_powSpec[CPE_CHANNELS]; p_powerSpec_fx[0] = powerSpec_fx[0]; p_powerSpec_fx[1] = powerSpec_fx[1]; { /* Copy powerSpec values from 64 bit buffer to 32 bit buffer */ FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { Word16 n1, nsub = 1; length = sts[ch]->hTcxEnc->L_frameTCX; move16(); move16(); IF( NE_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { length = shr( sts[ch]->hTcxEnc->L_frameTCX, 1 ); nsub = NB_DIV; move16(); } IF( EQ_16( sts[ch]->last_core, ACELP_CORE ) ) { length = add( length, shr( length, 2 ) ); } exp = sub( exp_powerSpec64[ch][0], W_norm_arr( powerSpec64[ch], length ) ); IF( EQ_16( nsub, 2 ) ) { exp = s_max( exp, sub( exp_powerSpec64[ch][1], W_norm_arr( powerSpec64[ch] + length, length ) ) ); } FOR( n1 = 0; n1 < nsub; n1++ ) { shift1 = sub( sub( exp_powerSpec64[ch][n1], exp ), 32 ); FOR( i = 0; i < length; i++ ) { /* This doesn't result in saturation */ powerSpec_fx[ch][i + n1 * length] = W_shl_sat_l( powerSpec64[ch][i + n1 * length], shift1 ); // exp: exp move32(); } } set32_fx( powerSpec_fx[ch] + length, 0, sub( N_MAX, length ) ); q_powSpec[ch] = sub( 31, exp ); // exp: exp move16(); } } hIGFEnc[0] = sts[0]->hIGFEnc; hIGFEnc[1] = sts[1]->hIGFEnc; FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { q_spec = sub( Q31, sts[ch]->hTcxEnc->spectrum_e[n] ); Word16 q_comm = s_min( sub( Q31, sts[ch]->hTcxEnc->spectrum_e[n] ), s_min( q_powSpec[ch], q_powSpecMsInv[ch] ) ); Word16 n_sb = NB_DIV; move16(); if ( EQ_16( sts[ch]->hTcxEnc->tcxMode, TCX_20 ) ) { n_sb = 1; move16(); } length = idiv1616( sts[ch]->hTcxEnc->L_frameTCX, n_sb ); /* Q0 */ IF( NE_16( q_spec, q_comm ) ) { Scale_sig32( sts[ch]->hTcxEnc->spectrum_fx[n], length, sub( q_comm, q_spec ) ); /* q_powSpec */ Scale_sig32( inv_spectrum_fx[ch][n], length, sub( q_comm, q_spec ) ); /* q_powSpec */ sts[ch]->hTcxEnc->spectrum_e[n] = sub( Q31, q_comm ); move16(); } IF( NE_16( q_powSpec[ch], q_comm ) ) { Scale_sig32( &p_powerSpec_fx[ch][0], L_subframeTCX, sub( q_comm, q_powSpec[ch] ) ); /* q_spec */ q_powSpec[ch] = q_comm; move16(); } IF( NE_16( q_powSpecMsInv[ch], q_comm ) ) { Scale_sig32( powerSpecMsInv_fx[ch][0], L_subframeTCX, sub( q_comm, q_powSpecMsInv[ch] ) ); /* q_spec */ q_powSpecMsInv[ch] = q_comm; move16(); } } hIGFEnc[0]->spec_be_igf_e = p_orig_spectrum_e[0]; move16(); hIGFEnc[1]->spec_be_igf_e = p_orig_spectrum_e[1]; Loading