From 1fe9c21c7b2222a7063c0ade3571c8491b18ea48 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 19 Jul 2023 15:45:15 +0200 Subject: [PATCH 1/6] replaced << with BASOPs shl() funtion. to calm UBSAN down --- lib_com/lsf_tools.c | 26 ++++++- lib_com/options.h | 2 + lib_enc/lsf_msvq_ma_enc.c | 151 +++++++++++++++++++++----------------- 3 files changed, 108 insertions(+), 71 deletions(-) diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 2f22dafa61..fcabcf54b4 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -245,7 +245,7 @@ void isp2a( *-----------------------------------------------------------------*/ get_isppol( &isp[0], f1, nc ); - get_isppol( &isp[1], f2, (int16_t) ( nc - 1 ) ); + get_isppol( &isp[1], f2, ( int16_t )( nc - 1 ) ); /*-----------------------------------------------------------------* * Multiply F2(z) by (1 - z^-2) * @@ -2072,7 +2072,25 @@ 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() */ @@ -2161,7 +2179,7 @@ void msvq_dec( FOR( j = 0; j < n; ++j ) { move16(); - uq_ind[start + j] = add( uq_ind[start + j], (Word16) ( cb[i][Idx[i] * maxn + j] * 2.0f * 1.28f ) ); + uq_ind[start + j] = add( uq_ind[start + j], ( Word16 )( cb[i][Idx[i] * maxn + j] * 2.0f * 1.28f ) ); } } #undef WMC_TOOL_SKIP @@ -2428,7 +2446,7 @@ void a2isf( spec2isf( RealOut, ImagOut, 128, isf, old_isf ); - isf[lpcOrder - 1] = (Float32) ( acos( a[lpcOrder] ) * SCALE1_HALF ); + isf[lpcOrder - 1] = ( Float32 )( acos( a[lpcOrder] ) * SCALE1_HALF ); return; } @@ -2611,7 +2629,7 @@ void create_IDCT_N_Matrix( for ( c = 0; c < mat_cpy_size; c++ ) { - idx = (Word16) ( idx_ptr[c] ); + idx = ( Word16 )( idx_ptr[c] ); W16_val = absval_ptr[abs( idx )]; if ( idx < 0 ) diff --git a/lib_com/options.h b/lib_com/options.h index ad3554576e..7cb73b1e02 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -176,6 +176,8 @@ #define FIX_MEM_REALLOC_IND_LIST /* VA: issue 601: failure of the automatic memory re-allocation mechanism when ind_list[] buffer is depleted in MASA mode with 2 TC*/ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ +#define FIX_612_MSVQ_UBSAN_LEFTSHIFT /* Eri: Issue 612 : UBSAN: left shift of negative values in 1st stage of MSVQ */ + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 349fb4f60f..fc1893f405 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -148,7 +148,24 @@ int16_t msvq_stage1_dct_search( for ( c2 = 0; c2 < cols_per_segment[segm]; c2++ ) { #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 LOGIC( 1 ); SHIFT( 1 ); ADD( 1 ); /* in BASOP: s_and(for W8->W16), shl(), sub()*/ @@ -453,36 +470,85 @@ void msvq_enc( else /* non-DCT Stage #1 code below */ if ( !s ) /* means: m==1 */ + { + /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ + /* dist[0][0] */ + for ( j = 0; j < levels[s]; j++ ) { - /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ - /* dist[0][0] */ - for ( j = 0; j < levels[s]; j++ ) + en = 0.0f; + /* w,Tmp */ + /* Compute weighted codebook element and its energy */ + for ( c2 = 0; c2 < n; c2++ ) + { + Tmp[start + c2] = w[start + c2] * cbp[c2]; + en += cbp[c2] * Tmp[start + c2]; + } + cbp += maxn; /* pointer is incremented */ + + pTmp = &resid[0][0]; + /* Tmp */ + tmp = ( *pTmp++ ) * Tmp[0]; + for ( c2 = 1; c2 < N; c2++ ) { - en = 0.0f; - /* w,Tmp */ - /* Compute weighted codebook element and its energy */ - for ( c2 = 0; c2 < n; c2++ ) + tmp += ( *pTmp++ ) * Tmp[c2]; + } + tmp = en - 2.0f * tmp; + tmp += dist[0][0]; + if ( tmp < dist[1][p_max] ) + { + /* Replace worst */ + dist[1][p_max] = tmp; + indices[1][p_max * stages] = j; + parents[p_max] = 0; + + p_max = 0; + for ( c2 = 1; c2 < maxC; c2++ ) { - Tmp[start + c2] = w[start + c2] * cbp[c2]; - en += cbp[c2] * Tmp[start + c2]; + if ( dist[1][c2] > dist[1][p_max] ) + { + p_max = c2; + } } - cbp += maxn; /* pointer is incremented */ + } /* if (tmp <= dist[1][p_max]) */ + } /* for (j=0; j dist[1][p_max] ) - { - p_max = c2; - } - } - } /* if (tmp <= dist[1][p_max]) */ - } /* for(c=0; c Date: Wed, 19 Jul 2023 16:33:20 +0200 Subject: [PATCH 2/6] cleanup of debug code and clang-format application --- lib_com/lsf_tools.c | 28 ++----- lib_enc/lsf_msvq_ma_enc.c | 151 +++++++++++++++++--------------------- 2 files changed, 76 insertions(+), 103 deletions(-) diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index fcabcf54b4..1a2d018cdd 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -245,7 +245,7 @@ void isp2a( *-----------------------------------------------------------------*/ get_isppol( &isp[0], f1, nc ); - get_isppol( &isp[1], f2, ( int16_t )( nc - 1 ) ); + get_isppol( &isp[1], f2, (int16_t) ( nc - 1 ) ); /*-----------------------------------------------------------------* * Multiply F2(z) by (1 - z^-2) * @@ -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] ); + 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 ); @@ -2179,7 +2165,7 @@ void msvq_dec( FOR( j = 0; j < n; ++j ) { move16(); - uq_ind[start + j] = add( uq_ind[start + j], ( Word16 )( cb[i][Idx[i] * maxn + j] * 2.0f * 1.28f ) ); + uq_ind[start + j] = add( uq_ind[start + j], (Word16) ( cb[i][Idx[i] * maxn + j] * 2.0f * 1.28f ) ); } } #undef WMC_TOOL_SKIP @@ -2446,7 +2432,7 @@ void a2isf( spec2isf( RealOut, ImagOut, 128, isf, old_isf ); - isf[lpcOrder - 1] = ( Float32 )( acos( a[lpcOrder] ) * SCALE1_HALF ); + isf[lpcOrder - 1] = (Float32) ( acos( a[lpcOrder] ) * SCALE1_HALF ); return; } @@ -2629,7 +2615,7 @@ void create_IDCT_N_Matrix( for ( c = 0; c < mat_cpy_size; c++ ) { - idx = ( Word16 )( idx_ptr[c] ); + idx = (Word16) ( idx_ptr[c] ); W16_val = absval_ptr[abs( idx )]; if ( idx < 0 ) diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index fc1893f405..abd03ca899 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -149,23 +149,10 @@ 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 */ - + 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 +#endif LOGIC( 1 ); SHIFT( 1 ); ADD( 1 ); /* in BASOP: s_and(for W8->W16), shl(), sub()*/ @@ -470,85 +457,36 @@ void msvq_enc( else /* non-DCT Stage #1 code below */ if ( !s ) /* means: m==1 */ - { - /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ - /* dist[0][0] */ - for ( j = 0; j < levels[s]; j++ ) { - en = 0.0f; - /* w,Tmp */ - /* Compute weighted codebook element and its energy */ - for ( c2 = 0; c2 < n; c2++ ) - { - Tmp[start + c2] = w[start + c2] * cbp[c2]; - en += cbp[c2] * Tmp[start + c2]; - } - cbp += maxn; /* pointer is incremented */ - - pTmp = &resid[0][0]; - /* Tmp */ - tmp = ( *pTmp++ ) * Tmp[0]; - for ( c2 = 1; c2 < N; c2++ ) - { - tmp += ( *pTmp++ ) * Tmp[c2]; - } - tmp = en - 2.0f * tmp; - tmp += dist[0][0]; - if ( tmp < dist[1][p_max] ) + /* This loop is identical to the one below, except, that the inner loop over c=0..m is hardcoded to c=0, since m=1. */ + /* dist[0][0] */ + for ( j = 0; j < levels[s]; j++ ) { - /* Replace worst */ - dist[1][p_max] = tmp; - indices[1][p_max * stages] = j; - parents[p_max] = 0; - - p_max = 0; - for ( c2 = 1; c2 < maxC; c2++ ) + en = 0.0f; + /* w,Tmp */ + /* Compute weighted codebook element and its energy */ + for ( c2 = 0; c2 < n; c2++ ) { - if ( dist[1][c2] > dist[1][p_max] ) - { - p_max = c2; - } + Tmp[start + c2] = w[start + c2] * cbp[c2]; + en += cbp[c2] * Tmp[start + c2]; } - } /* if (tmp <= dist[1][p_max]) */ - } /* for (j=0; j dist[1][p_max] ) + { + p_max = c2; + } + } + } /* if (tmp <= dist[1][p_max]) */ + } /* for(c=0; c Date: Wed, 19 Jul 2023 17:03:36 +0200 Subject: [PATCH 3/6] added fix for #621, UBSAN complaint of offset addition to NULL ptr --- lib_com/options.h | 2 +- lib_enc/lsf_msvq_ma_enc.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2448a84269..6c541be09a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -184,7 +184,7 @@ #define FIX_581_CLANG_OFFSET_TO_NULL /* FhG: issue 581: fix CLANG error about applying an offset to a NULL pointer */ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ #define FIX_612_MSVQ_UBSAN_LEFTSHIFT /* Eri: Issue 612 : UBSAN: left shift of negative values in 1st stage of MSVQ */ - +#define FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET /* Eri: Issue 621 : UBSAN: applying non-zero offset 7200 to null pointer in lsf_msvq_ma_enc.c */ /* Fixes for bugs found during split rendering contribution development */ #define REND_STATIC_MEM_OPT /* Dlb: Static memory optimisation for external renderer */ diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index abd03ca899..a91928c048 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -559,7 +559,14 @@ void msvq_enc( { /* Subtract codebook entry from residual vector of parent node */ p1 = resid[0] + parents[c] * N; +#ifdef FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET + if (cb_stage != NULL ) + { + p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ + } +#else p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ +#endif if ( s == 0 && applyDCT_flag != 0 ) { p2 = (const float *) &( st1_syn_vec_ptr[c * FDCNG_VQ_MAX_LEN] ); /*ptr init of stage 1 */ -- GitLab From 40b51fdf5e76fd4a5a5ece1426602abd0305a2a2 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 19 Jul 2023 17:14:34 +0200 Subject: [PATCH 4/6] MSVQ compile time warning for p2 initilization fixed --- lib_enc/lsf_msvq_ma_enc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index a91928c048..c229d5bc4a 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -560,6 +560,7 @@ void msvq_enc( /* Subtract codebook entry from residual vector of parent node */ p1 = resid[0] + parents[c] * N; #ifdef FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET + p2 = NULL; if (cb_stage != NULL ) { p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ -- GitLab From 34137c8040d4cd7a0754b71d7202a0ef376b2b4a Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 19 Jul 2023 17:53:21 +0200 Subject: [PATCH 5/6] added editorial fix for issue #600 --- lib_com/options.h | 1 + lib_com/pvq_com.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 6c541be09a..62411edbdf 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -185,6 +185,7 @@ #define JBM_PARAMUPMIX /* Dlb: Issue 471: Integrate the Multichannel Parametric Upmix into the JBM path */ #define FIX_612_MSVQ_UBSAN_LEFTSHIFT /* Eri: Issue 612 : UBSAN: left shift of negative values in 1st stage of MSVQ */ #define FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET /* Eri: Issue 621 : UBSAN: applying non-zero offset 7200 to null pointer in lsf_msvq_ma_enc.c */ +#define FIX_600_CLEANUP_OF_MANUAL_INSTRUMENTATION /* Eri: Issue 600 : removed manual WMCtool instrumentation outside of WMC_TOOL_SKIP defines */ /* Fixes for bugs found during split rendering contribution development */ #define REND_STATIC_MEM_OPT /* Dlb: Static memory optimisation for external renderer */ diff --git a/lib_com/pvq_com.c b/lib_com/pvq_com.c index 133b7b62f7..6e7121751b 100644 --- a/lib_com/pvq_com.c +++ b/lib_com/pvq_com.c @@ -200,7 +200,9 @@ static void dsDiracPerQuanta( if ( t_quanta_o > sv[nsv >> 1] ) { dsIndex = nsv - dsIndex; /*single op*/ +#ifndef FIX_600_CLEANUP_OF_MANUAL_INSTRUMENTATION ADD( 1 ); +#endif } for ( i = frQuanta[0][td] - 1; i >= 0; i-- ) { -- GitLab From 2a60a6d6019f1257811574db7bd5c625bb690590 Mon Sep 17 00:00:00 2001 From: Jonas Sv Date: Wed, 19 Jul 2023 18:11:59 +0200 Subject: [PATCH 6/6] clang format --- lib_com/lsf_tools.c | 2 +- lib_com/pvq_com.c | 4 ++-- lib_enc/lsf_msvq_ma_enc.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 1a2d018cdd..42688ee145 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -2077,7 +2077,7 @@ void dec_FDCNG_MSVQ_stage1( #else dct_vec[col] = (float) ( ( (Word16) cbpW8[col] ) << dct_col_shift_tab[col] ); #endif - /* LOGIC( 1 ) , SHIFT( 1 ); + /* LOGIC( 1 ) , SHIFT( 1 ); in BASOP: s_and(for W8->W16), shl() */ } diff --git a/lib_com/pvq_com.c b/lib_com/pvq_com.c index 6e7121751b..d655dd7d4a 100644 --- a/lib_com/pvq_com.c +++ b/lib_com/pvq_com.c @@ -200,9 +200,9 @@ static void dsDiracPerQuanta( if ( t_quanta_o > sv[nsv >> 1] ) { dsIndex = nsv - dsIndex; /*single op*/ -#ifndef FIX_600_CLEANUP_OF_MANUAL_INSTRUMENTATION +#ifndef FIX_600_CLEANUP_OF_MANUAL_INSTRUMENTATION ADD( 1 ); -#endif +#endif } for ( i = frQuanta[0][td] - 1; i >= 0; i-- ) { diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index c229d5bc4a..cbc57a3b7b 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -559,15 +559,15 @@ void msvq_enc( { /* Subtract codebook entry from residual vector of parent node */ p1 = resid[0] + parents[c] * N; -#ifdef FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET +#ifdef FIX_621_MSVQ_UBSAN_NULL_PTR_OFFSET p2 = NULL; - if (cb_stage != NULL ) + if ( cb_stage != NULL ) { p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ } -#else - p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ -#endif +#else + p2 = cb_stage + ( indices[1][c * stages + s] ) * maxn; /* regular ptr init */ +#endif if ( s == 0 && applyDCT_flag != 0 ) { p2 = (const float *) &( st1_syn_vec_ptr[c * FDCNG_VQ_MAX_LEN] ); /*ptr init of stage 1 */ -- GitLab