Skip to content

Strange use of W_shl_sat_l - error in STL2024 specification

The 64-bit operator W_shl_sat_l() is described in STL2024 with quite some minor typos and also with one significant error:

W_shl_sat_l(W_1, var1) arithmetically shifts left the 64-bit W_v1 by v1 positions with lower 32-bit saturation and returns the 32 LSB of 64-bit result. If v1 is negative, the result is shifted to right by (-var1) positions and sign extended. After shift operation, returns the 32 MSB of 64-bit result.

Correction: "v1" should be "var1", and "W_v1" should be "W_1". If var1 is negative, ... returns the 32 MSB LSB of 64-bit result.

There is source code using this operator:

A) lib_dec/ivas_stereo_switching_dec_fx.c:

c_c_fx = W_extract_l( W_shl_sat_l( c_c_fx, extract_l( sub( 31, c_c_fx_q ) ) ) );

Both extract operators are somehow wrong (bad parameter format) and useless (doing nothing); Better:

c_c_fx = W_shl_sat_l( c_c_fx, sub( 31, c_c_fx_q ) );

B) Code that doesn't use W_shl_sat_l: lib_enc/ivas_enc_cov_handler_fx.c:

pV_re[k] = W_extract_l( W_shl_nosat( pV_re_64bit[k], q_shift_tmp ) );

better:

pV_re[k] = W_shl_sat_l( pV_re_64bit[k], q_shift_tmp );

and

cov_real[i][j][k] = W_extract_l( W_shl_nosat( cov_real_64bit[i][j][k], q_shift_tmp ) );

better:

cov_real[i][j][k] = W_shl_sat_l( cov_real_64bit[i][j][k], q_shift_tmp );

C) Similar codes:

lib_dec/ivas_dirac_dec_fx.c:

iDiv_and_mod_32( W_extract_l( W_shl_nosat( tmp_fx, 16 ) ), hSpatParamRendCom->subframe_nbslots[sf_idx], &quo, &rem, 0 );

lib_enc/analy_sp_fx.c:

band[i] = W_extract_h( W_shl_nosat( band_ener, sub( Q16, shift ) ) );

lib_enc/ivas_enc_cov_handler_fx.c:

bb_var[ch] = W_extract_l( W_shl_nosat( bb_var_64bit[ch], sub( q_shift, 32 ) ) );

All proposed changes should be bit-exact, saturation never needed, ensured by norm operations before.

Edited by multrus