Loading lib_com/options.h +4 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,10 @@ // #define FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI /* FhG: fix and undef behaviour bug in the harmonic TCX model arithmetic coder */ #define FIX_983_DISC_ISM_DIGEST_NUM_OBJS /* FhG: issue #983: the discrete ISM digest function uses the wrong number of objects */ #define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ Loading lib_dec/pvq_core_dec.c +24 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ static void pvq_decode_band( } set_s( g_part_s, -32768, Np ); if ( Np > 1 ) { decode_energies( st, hPVQ, Np, dim_part, bits_part, g_part_s, band_bits_tot, bits_left, sfmsize, strict_bits ); Loading @@ -113,10 +114,23 @@ static void pvq_decode_band( for ( j = 0; j < Np; j++ ) { g_part[j] = -( (float) g_part_s[j] ) / 32768; #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* note: here g_part needs to be become exactly 1.0(float) thus in BASOP Word16 g_part_s is in the negative Q15 domain */ #endif #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* aligned to BASOP to avoid USAN undefined negation warning for -(-32768) */ g_part_s[j] = negate( g_part_s[j] ); #else g_part_s[j] = -g_part_s[j]; #endif } srt_vec_ind( g_part_s, sg_part, idx_sort, Np ); for ( j = 0; j < Np; j++ ) { js = idx_sort[Np - 1 - j]; Loading Loading @@ -415,11 +429,16 @@ static void densitySymbolIndexDecode( #undef WMC_TOOL_SKIP res_c = res - c; if ( c == 0 ) { tot = res * ( res + 1 ) + 1; dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( ( res + 1 ) * ( res + 1 ) - dec_freq ) ) + res + 1; #else alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( res + 1 ) * ( res + 1 ) - dec_freq ) + res + 1; #endif sym_freq = 2 * ( res - alpha ) + 1; cum_freq = alpha * ( 2 * ( res + 1 ) - alpha ); } Loading @@ -437,7 +456,12 @@ static void densitySymbolIndexDecode( dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); if ( dec_freq < tot - ( res + 1 ) - ( res - ( c + 1 ) ) * ( res - c ) * c + c + 1 ) { #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) ( res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) ) / ( 2 * res_c ); #else alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) / ( 2 * res_c ); #endif sym_freq = 2 * alpha * res_c + 1; cum_freq = alpha * ( ( alpha - 1 ) * res_c + 1 ); } Loading lib_enc/pvq_core_enc.c +5 −0 Original line number Diff line number Diff line Loading @@ -124,7 +124,12 @@ static void pvq_encode_band( for ( j = 0; j < Np; j++ ) { g_part[j] = -( (float) g_part_s[j] ) / 32768; #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* aligned to BASOP to avoid USAN undefined negation warning with -(-32768) */ g_part_s[j] = negate( g_part_s[j] ); #else g_part_s[j] = -g_part_s[j]; #endif } srt_vec_ind( g_part_s, sg_part, idx_sort, Np ); Loading scripts/ubsan.supp +0 −2 Original line number Diff line number Diff line Loading @@ -30,8 +30,6 @@ implicit-signed-integer-truncation:dec_tcx.c implicit-signed-integer-truncation:hdecnrm.c implicit-signed-integer-truncation:lib_dec.c implicit-signed-integer-truncation:longarith.c implicit-signed-integer-truncation:pvq_core_dec.c implicit-signed-integer-truncation:pvq_core_enc.c implicit-signed-integer-truncation:tcq_position_arith.c implicit-signed-integer-truncation:tools.c shift-base:basop32.c Loading Loading
lib_com/options.h +4 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,10 @@ // #define FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI /* FhG: fix and undef behaviour bug in the harmonic TCX model arithmetic coder */ #define FIX_983_DISC_ISM_DIGEST_NUM_OBJS /* FhG: issue #983: the discrete ISM digest function uses the wrong number of objects */ #define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ Loading
lib_dec/pvq_core_dec.c +24 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ static void pvq_decode_band( } set_s( g_part_s, -32768, Np ); if ( Np > 1 ) { decode_energies( st, hPVQ, Np, dim_part, bits_part, g_part_s, band_bits_tot, bits_left, sfmsize, strict_bits ); Loading @@ -113,10 +114,23 @@ static void pvq_decode_band( for ( j = 0; j < Np; j++ ) { g_part[j] = -( (float) g_part_s[j] ) / 32768; #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* note: here g_part needs to be become exactly 1.0(float) thus in BASOP Word16 g_part_s is in the negative Q15 domain */ #endif #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* aligned to BASOP to avoid USAN undefined negation warning for -(-32768) */ g_part_s[j] = negate( g_part_s[j] ); #else g_part_s[j] = -g_part_s[j]; #endif } srt_vec_ind( g_part_s, sg_part, idx_sort, Np ); for ( j = 0; j < Np; j++ ) { js = idx_sort[Np - 1 - j]; Loading Loading @@ -415,11 +429,16 @@ static void densitySymbolIndexDecode( #undef WMC_TOOL_SKIP res_c = res - c; if ( c == 0 ) { tot = res * ( res + 1 ) + 1; dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( ( res + 1 ) * ( res + 1 ) - dec_freq ) ) + res + 1; #else alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( res + 1 ) * ( res + 1 ) - dec_freq ) + res + 1; #endif sym_freq = 2 * ( res - alpha ) + 1; cum_freq = alpha * ( 2 * ( res + 1 ) - alpha ); } Loading @@ -437,7 +456,12 @@ static void densitySymbolIndexDecode( dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); if ( dec_freq < tot - ( res + 1 ) - ( res - ( c + 1 ) ) * ( res - c ) * c + c + 1 ) { #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) ( res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) ) / ( 2 * res_c ); #else alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) / ( 2 * res_c ); #endif sym_freq = 2 * alpha * res_c + 1; cum_freq = alpha * ( ( alpha - 1 ) * res_c + 1 ); } Loading
lib_enc/pvq_core_enc.c +5 −0 Original line number Diff line number Diff line Loading @@ -124,7 +124,12 @@ static void pvq_encode_band( for ( j = 0; j < Np; j++ ) { g_part[j] = -( (float) g_part_s[j] ) / 32768; #ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* aligned to BASOP to avoid USAN undefined negation warning with -(-32768) */ g_part_s[j] = negate( g_part_s[j] ); #else g_part_s[j] = -g_part_s[j]; #endif } srt_vec_ind( g_part_s, sg_part, idx_sort, Np ); Loading
scripts/ubsan.supp +0 −2 Original line number Diff line number Diff line Loading @@ -30,8 +30,6 @@ implicit-signed-integer-truncation:dec_tcx.c implicit-signed-integer-truncation:hdecnrm.c implicit-signed-integer-truncation:lib_dec.c implicit-signed-integer-truncation:longarith.c implicit-signed-integer-truncation:pvq_core_dec.c implicit-signed-integer-truncation:pvq_core_enc.c implicit-signed-integer-truncation:tcq_position_arith.c implicit-signed-integer-truncation:tools.c shift-base:basop32.c Loading