Loading lib_com/lsf_tools.c +7 −21 Original line number Diff line number Diff line Loading @@ -2073,26 +2073,12 @@ void dec_FDCNG_MSVQ_stage1( for ( col = 0; col < cdk1_ivas_cols_per_segment[segm_ind]; col++ ) { #ifdef FIX_612_MSVQ_UBSAN_LEFTSHIFT #if 0 if ( cbpW8[col] <= -127 && dct_col_shift_tab[col]==4 ) { float tmp_old = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); /*ANSI-C does not support left shift of negative numbers */ float tmp_new1 = (float) ( ( Word16 )( ( (UWord16) cbpW8[col] ) << dct_col_shift_tab[col] ) ); /* cast to unsigned, shift, cast back */ float tmp_new2 = (float) shl( (Word16) cbpW8[col], dct_col_shift_tab[col] ); /* use the BASOP shl() function */ float tmp_new3 = (float) ( ((Word16)cbpW8[col]) * ( (Word16)1U << dct_col_shift_tab[col] ) ); /* simulate BASOP shl(), by using integer multiplication */ printf( "\n Syn: cbpW8=%03d, shift=%d, old=%6.0f, new1=%6.0f, new2=%6.0f new3=%6.0f ", cbpW8[col], dct_col_shift_tab[col], tmp_old, tmp_new1, tmp_new2, tmp_new3 ); tmp_old = tmp_new1; } #endif dct_vec[col] = (float) shl( (Word16) cbpW8[col], dct_col_shift_tab[col] ); #else dct_vec[col] = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); #endif /* LOGIC( 1 ); SHIFT( 1 ); ADD( 1 ); in BASOP: s_and(for W8->W16), shl(), sub() /* LOGIC( 1 ) , SHIFT( 1 ); in BASOP: s_and(for W8->W16), shl() */ } dctT2_N_apply_matrix( (const float *) dct_vec, idct_vec, cdk1_ivas_cols_per_segment[segm_ind], n, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, idcttype ); Loading lib_enc/lsf_msvq_ma_enc.c +69 −82 Original line number Diff line number Diff line Loading @@ -149,20 +149,7 @@ int16_t msvq_stage1_dct_search( { #define WMC_TOOL_SKIP #ifdef FIX_612_MSVQ_UBSAN_LEFTSHIFT #if 0 if ( cbpW8[c2] <= -127 && dct_col_shift_tab[c2]==4 ) { float tmp_old = (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* UBSAN:: ANSI-C does not support left shift of negative numbers */ float tmp_new1 = (float) ( ( Word16 )( ( (UWord16) cbpW8[c2] ) << dct_col_shift_tab[c2] ) ); /* cast to unsigned ans see happens */ float tmp_new2 = (float) shl( (Word16) cbpW8[c2], dct_col_shift_tab[c2] ); /* use the BASOP shl() function */ float tmp_new3 = (float) ( ((Word16)cbpW8[c2]) * ((Word16)1U << dct_col_shift_tab[c2] ) ); /* simulate BASOP shl(), by using integer multiplication */ printf( "\n Search: cbpW8=%03d,shift=%d old=%6.0f, new1=%6.0f new2=%6.0f new3=%6.0f ", cbpW8[c2], dct_col_shift_tab[c2], tmp_old, tmp_new1, tmp_new2, tmp_new3 ); tmp_old = tmp_new1; } #endif tmp = dct_target[c2] - (float) shl( (Word16) cbpW8[c2], dct_col_shift_tab[c2] ); /* note: BASOP shift left defined for signed integers */ #else tmp = dct_target[c2] - (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* Word8 storage MSE inner loop */ #endif Loading Loading
lib_com/lsf_tools.c +7 −21 Original line number Diff line number Diff line Loading @@ -2073,26 +2073,12 @@ void dec_FDCNG_MSVQ_stage1( for ( col = 0; col < cdk1_ivas_cols_per_segment[segm_ind]; col++ ) { #ifdef FIX_612_MSVQ_UBSAN_LEFTSHIFT #if 0 if ( cbpW8[col] <= -127 && dct_col_shift_tab[col]==4 ) { float tmp_old = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); /*ANSI-C does not support left shift of negative numbers */ float tmp_new1 = (float) ( ( Word16 )( ( (UWord16) cbpW8[col] ) << dct_col_shift_tab[col] ) ); /* cast to unsigned, shift, cast back */ float tmp_new2 = (float) shl( (Word16) cbpW8[col], dct_col_shift_tab[col] ); /* use the BASOP shl() function */ float tmp_new3 = (float) ( ((Word16)cbpW8[col]) * ( (Word16)1U << dct_col_shift_tab[col] ) ); /* simulate BASOP shl(), by using integer multiplication */ printf( "\n Syn: cbpW8=%03d, shift=%d, old=%6.0f, new1=%6.0f, new2=%6.0f new3=%6.0f ", cbpW8[col], dct_col_shift_tab[col], tmp_old, tmp_new1, tmp_new2, tmp_new3 ); tmp_old = tmp_new1; } #endif dct_vec[col] = (float) shl( (Word16) cbpW8[col], dct_col_shift_tab[col] ); #else dct_vec[col] = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); #endif /* LOGIC( 1 ); SHIFT( 1 ); ADD( 1 ); in BASOP: s_and(for W8->W16), shl(), sub() /* LOGIC( 1 ) , SHIFT( 1 ); in BASOP: s_and(for W8->W16), shl() */ } dctT2_N_apply_matrix( (const float *) dct_vec, idct_vec, cdk1_ivas_cols_per_segment[segm_ind], n, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, idcttype ); Loading
lib_enc/lsf_msvq_ma_enc.c +69 −82 Original line number Diff line number Diff line Loading @@ -149,20 +149,7 @@ int16_t msvq_stage1_dct_search( { #define WMC_TOOL_SKIP #ifdef FIX_612_MSVQ_UBSAN_LEFTSHIFT #if 0 if ( cbpW8[c2] <= -127 && dct_col_shift_tab[c2]==4 ) { float tmp_old = (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* UBSAN:: ANSI-C does not support left shift of negative numbers */ float tmp_new1 = (float) ( ( Word16 )( ( (UWord16) cbpW8[c2] ) << dct_col_shift_tab[c2] ) ); /* cast to unsigned ans see happens */ float tmp_new2 = (float) shl( (Word16) cbpW8[c2], dct_col_shift_tab[c2] ); /* use the BASOP shl() function */ float tmp_new3 = (float) ( ((Word16)cbpW8[c2]) * ((Word16)1U << dct_col_shift_tab[c2] ) ); /* simulate BASOP shl(), by using integer multiplication */ printf( "\n Search: cbpW8=%03d,shift=%d old=%6.0f, new1=%6.0f new2=%6.0f new3=%6.0f ", cbpW8[c2], dct_col_shift_tab[c2], tmp_old, tmp_new1, tmp_new2, tmp_new3 ); tmp_old = tmp_new1; } #endif tmp = dct_target[c2] - (float) shl( (Word16) cbpW8[c2], dct_col_shift_tab[c2] ); /* note: BASOP shift left defined for signed integers */ #else tmp = dct_target[c2] - (float) ( ( (Word16) cbpW8[c2] ) << dct_col_shift_tab[c2] ); /* Word8 storage MSE inner loop */ #endif Loading