From bd125776954a4b8216a0acf8841ced0e44ff58d1 Mon Sep 17 00:00:00 2001 From: gerstack Date: Thu, 23 Apr 2026 17:32:14 +0200 Subject: [PATCH 01/22] replaced EVS arith decoder functions with IVAS versions --- lib_com/options.h | 2 + lib_com/options2.h | 26 ++++++ lib_dec/ACcontextMapping_dec_fx.c | 33 +++++++ lib_dec/ari_dec_fx.c | 23 ++++- lib_dec/igf_scf_dec_fx.c | 139 +++++++++++++++++++++++++++--- 5 files changed, 209 insertions(+), 14 deletions(-) create mode 100644 lib_com/options2.h diff --git a/lib_com/options.h b/lib_com/options.h index 33519e38f..eda43bf1f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -127,6 +127,8 @@ #define FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 /* Nokia: BASOP issue 2545: Fix LTV regression caused by issue 2529 fix */ #define FIX_FLOAT_1573_POSITION_UPDATE /* Eri: Float issue 1573: For static orientation and listener movement, the PoseUpdated flag is cleared and prevents 5 ms update rate. */ #define FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS /* FhG: BASOP issue 2521: Fix wrong porting for determination of first subframe length in ivas_sba_dirac_stereo_compute_td_stefi_nrgs() */ +//#define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplify processing in arithmetic decoding, symbol table lookup, all BE */ +//#define FIX_2402_INLINE_FCT_ARI_CODEC /* FhG: basop issue 2402: simplify processing in arithmetic decoding, inline mul_sbc_14bits, all BE */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_com/options2.h b/lib_com/options2.h new file mode 100644 index 000000000..eb693c5d0 --- /dev/null +++ b/lib_com/options2.h @@ -0,0 +1,26 @@ +//#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ + +/* +lib_dec/ari_dec_fx.c + void ari_start_decoding_14bits_fx( Decoder_State *st, Tastat *s ) + +lib_dec/ari_dec_fx.c + Word16 ari_start_decoding_14bits_prm_ivas_fx( const Word16 *ptr, Word16 bp, Tastat *s ) +lib_com/ivas_arith_fx.c: + void ivas_ari_start_decoding_14bits_ext_1_lfe( Decoder_State *st, Tastat *s, Word16 *extra_bits_read ) + +lib_dec/ari_dec_fx.c +Word16 ari_decode_14bits_s17_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq ) +ari_decode_14bits_ext_fx +lib_com/ivas_arith_fx.c +UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( Decoder_State *st, Tastat *s, const UWord16 *cum_freq, Word16 *extra_bits_read ) + + +*/ +/* + +#2 extra_bits_read +./testv/bitstreams/swb/stv32c_13200_32kHz.COD +Output synthesis file: ./output/decoded/stv32c_13200_32kHz.OUT +*/ +//#define DEBUGGING_2402 diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index a483972ff..27e33400f 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -5,6 +5,7 @@ #include #include #include "options.h" +#include "options2.h" #include "rom_com.h" #include "rom_dec.h" #include "basop_util.h" @@ -13,6 +14,9 @@ #include "ivas_prot_fx.h" #include "ivas_rom_com.h" +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#include "ivas_prot_fx.h" +#endif /*-------------------------------------------------------------------* * ACcontextMapping_decode2_no_mem_s17_LC() @@ -133,7 +137,18 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( } /* Start Decoding */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + Word16 extra_bits_read = 0; + ivas_ari_start_decoding_14bits_ext_1_lfe( st, &as, &extra_bits_read ); +#ifdef DEBUGGING_2402 + printf("ivas_ari_start\n"); +#endif +#else ari_start_decoding_14bits_fx( st, &as ); +#ifdef DEBUGGING_2402 + printf("ari_start\n"); +#endif +#endif overflow_bit_pos = st->next_bit_pos; move16(); @@ -182,8 +197,18 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( assert( tmp >= 0 && tmp < 4096 ); pki = ari_lookup_s17_LC[tmp]; move16(); +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + r = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &as, ari_pk_s17_LC_ext[pki], &extra_bits_read ); +#ifdef DEBUGGING_2402 + printf("r=%d, nbp=%d, ebr=%d\n", r, st->next_bit_pos, extra_bits_read); +#endif +#else r = ari_decode_14bits_s17_ext_fx( st, &as, ari_pk_s17_LC_ext[pki] ); +#ifdef DEBUGGING_2402 + printf("r=%d, nbp=%d, ebr=0\n", r, st->next_bit_pos ); +#endif +#endif IF( LT_16( r, VAL_ESC ) ) { BREAK; @@ -280,8 +305,13 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( } } +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + ivas_ari_done_decoding_14bits_ext_1_lfe( st, extra_bits_read ); +#endif /* Total number of decoded AC bits */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC get_next_indice_tmp_fx( st, -( cbitsnew - 2 ) ); +#endif /*detect overflow*/ IF( NE_16( k, lastnz ) ) @@ -290,6 +320,9 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( /* Set bitstream position to (start_bit_pos+nbbits-rest_bits) */ get_next_indice_tmp_fx( st, sub( ( sub( add( start_bit_pos, nbbits ), rest_bits ) ), st->next_bit_pos ) ); } +#ifdef DEBUGGING_2402 + printf("loop exit, nbp=%d\n", st->next_bit_pos ); +#endif /*Decode signs*/ if ( hm_cfg ) diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index c9912eba8..b165c2dc2 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -5,6 +5,7 @@ #include #include "assert.h" #include "options.h" +#include "options2.h" #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" @@ -24,6 +25,7 @@ Word32 ari_decode_overflow_fx( Tastat *s ) * \param[i/o] st * \param[o] s */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC void ari_start_decoding_14bits_fx( Decoder_State *st, Tastat *s ) @@ -39,6 +41,7 @@ void ari_start_decoding_14bits_fx( s->value = val; move32(); } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ Word16 ari_start_decoding_14bits_prm_fx( const Word16 *ptr, /* Q0 */ @@ -50,19 +53,19 @@ Word16 ari_start_decoding_14bits_prm_fx( const Word16 *p; val = L_deposit_l( 0 ); + s->low = val; + move32(); p = ptr + bp; /* Q0 */ FOR( i = 0; i < cbitsnew; i++ ) { val = L_shl( val, 1 ); - IF( *( p + i ) ) + if( *( p + i ) != 0 ) { val = L_add( val, 1 ); } } - s->low = L_deposit_l( 0 ); - move32(); s->high = L_add( ari_q4new, 1 ); move32(); s->value = val; @@ -71,6 +74,7 @@ Word16 ari_start_decoding_14bits_prm_fx( return add( bp, i ); } +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_lookup_s17_fx( Word32 cum, Word32 range, @@ -128,7 +132,9 @@ static Word16 ari_lookup_s17_fx( L_shr( 0, 0 ); /* pointer subtraction */ return extract_l( p - cum_freq ); } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_lookup_s27_fx( Word32 cum, Word32 range, @@ -227,7 +233,9 @@ static Word16 ari_lookup_s27_fx( return il; } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_lookup_bit_fx( Word32 cum, Word32 range, @@ -255,7 +263,9 @@ static Word16 ari_lookup_bit_fx( return symbol; } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_decode_14bits_ext_fx( Decoder_State *st, Tastat *s, @@ -321,28 +331,34 @@ static Word16 ari_decode_14bits_ext_fx( return symbol; } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ /** * \brief Only for 17 symbols with new extended Tables */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC Word16 ari_decode_14bits_s17_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq ) { return ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_s17_fx ); } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ /** * \brief Only for 27 symbols with new extended Tables */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC Word16 ari_decode_14bits_s27_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq ) { return ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_s27_fx ); } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ /** * \brief Only for decoding one bit with uniform probability: * the equivalent cum_freq table used is {16384, 8192, 0} */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s ) { static const UWord16 cum_freq[3] = { 16384, 8192, 0 }; @@ -351,6 +367,7 @@ Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s ) move16(); return ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_bit_fx ); } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index 71a4b1e77..f5dd3640d 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -7,10 +7,18 @@ #include #include #include "options.h" +#include "options2.h" #include "stl.h" #include "prot_fx.h" #include "stat_dec.h" #include "basop_util.h" +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + #define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + #include "ivas_prot_fx.h" +#endif +#ifdef DEBUGGING_2402 + #define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 +#endif /**********************************************************************/ /** initialization of an instance of this module @@ -66,6 +74,9 @@ static Word16 arith_decode_bits_fx( IGFSCFDEC_INSTANCE_HANDLE hPrivateData, /* i/o: instance handle */ Decoder_State *st, /* i/o: pointer to bitstream decoder state */ Word16 nBits /* i : number of bits to decode */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , Word16 *extra_bits_read +#endif ) { Word16 i; @@ -79,7 +90,15 @@ static Word16 arith_decode_bits_fx( { x = lshl( x, 1 ); /* decode one bit using the new raw AC function */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + static const UWord16 cum_freq[3] = { 16384, 8192, 0 }; + bit = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, cum_freq, extra_bits_read ); +#else bit = ari_decode_14bits_bit_ext_fx( st, &hPrivateData->acState ); +#endif +#ifdef DEBUGGING_2402 + printf("decode %d: nbp=%d ebr=%d\n", __LINE__, st->next_bit_pos, *extra_bits_read ); +#endif if ( bit != 0 ) { x = s_or( x, 1 ); @@ -94,6 +113,9 @@ static Word16 arith_decode_residual_fx( Decoder_State *st, /* i/o: pointer to decoder state */ const UWord16 *cumulativeFrequencyTable, /* i : cumulative frequency table to be used Q0 */ Word16 tableOffset /* i : offset used to align the table */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , Word16 *extra_bits_read +#endif ) { Word16 val; @@ -102,7 +124,14 @@ static Word16 arith_decode_residual_fx( move16(); /* decode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + val = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, cumulativeFrequencyTable, extra_bits_read ); // Q0 +#else val = ari_decode_14bits_s27_ext_fx( st, &hPrivateData->acState, cumulativeFrequencyTable ); // Q0 +#endif +#ifdef DEBUGGING_2402 + printf("decode %d: nbp=%d ebr=%d\n", __LINE__, st->next_bit_pos, *extra_bits_read ); +#endif /* meaning of the values of val: */ /* esc_{0} IGF_MIN_ENC_SEPARATE ... IGF_MAX_ENC_SEPARATE esc_{IGF_SYMBOLS_IN_TABLE - 1} */ @@ -119,15 +148,34 @@ static Word16 arith_decode_residual_fx( /* decode one of the tails of the distribution */ /* decode extra with 4 bits */ - extra = arith_decode_bits_fx( hPrivateData, st, 4 ); // Q0 + extra = arith_decode_bits_fx( hPrivateData, st, 4 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , extra_bits_read +#endif + ); // Q0 +#ifdef DEBUGGING_2402 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + printf("extra=%d, extra_bits_read=%d\n", extra, *extra_bits_read); +#else + printf("extra=%d, extra_bits_read=%d\n", extra, 0); +#endif +#endif IF( EQ_16( extra, 15 ) ) /* escape code 15 to indicate extra >= 15 */ { /* decode addtional extra with 6 bits */ - extra = arith_decode_bits_fx( hPrivateData, st, 6 ); // Q0 + extra = arith_decode_bits_fx( hPrivateData, st, 6 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , extra_bits_read +#endif + ); // Q0 IF( EQ_16( extra, 63 ) ) /* escape code 63 to indicate extra >= 63 */ { /* decode safety extra with 7 bits */ - extra = arith_decode_bits_fx( hPrivateData, st, 7 ); // Q0 + extra = arith_decode_bits_fx( hPrivateData, st, 7 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , extra_bits_read +#endif + ); // Q0 extra = add( 63, extra ); } extra = add( 15, extra ); // Q0 @@ -151,9 +199,19 @@ static Word16 arith_decode_residual_fx( static void arith_decode_flush_fx( Decoder_State *st /* i/o: pointer to decoder state */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , Word16 *extra_bits_read +#endif ) { +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + ivas_ari_done_decoding_14bits_ext_1_lfe( st, *extra_bits_read ); +#else +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + (void) extra_bits_read; /* remove warning */ +#endif get_next_indice_tmp_fx( st, -14 ); /* return back the least significant 14 bits to the bitstream */ +#endif return; } @@ -165,6 +223,9 @@ static void decode_sfe_vector_fx( Word16 *prev_x, /* i : previous vector */ Word16 *x, /* o : current vector to decode */ Word16 length /* i : number of elements to decode */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , Word16 *extra_bits_read +#endif ) { /* @@ -193,9 +254,17 @@ static void decode_sfe_vector_fx( /* (t == 0) && (f == 0) */ /* decode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ /* NOTE: the float equivalent uses a tmp variable + explicit cast here to avoid undefined behaviour here. This BASOP version does not need it as it already uses signed Word16 return value here. */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + res = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, (const UWord16 *) hPrivateData->cf_se00, extra_bits_read ); // Q0 +#else res = ari_decode_14bits_s27_ext_fx( st, &hPrivateData->acState, (const UWord16 *) hPrivateData->cf_se00 ); +#endif - pred = arith_decode_bits_fx( hPrivateData, st, 2 ); /* LSBs as 2 bit raw */ + pred = arith_decode_bits_fx( hPrivateData, st, 2 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , extra_bits_read +#endif + ); /* LSBs as 2 bit raw */ x[f] = add( shl( res, 2 ), pred ); // Q0 move16(); } @@ -205,7 +274,11 @@ static void decode_sfe_vector_fx( res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se01, - hPrivateData->cf_off_se01 ); + hPrivateData->cf_off_se01 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , extra_bits_read +#endif + ); x[f] = add( x[0], res ); // Q0 move16(); /* f - increment is 0, pred = b */ } @@ -221,7 +294,11 @@ static void decode_sfe_vector_fx( res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se02 + index1, - hPrivateData->cf_off_se02[index2] ); + hPrivateData->cf_off_se02[index2] +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , extra_bits_read +#endif + ); x[f] = add( x[prev_offset], res ); // Q0 move16(); /* pred = b */ } @@ -235,7 +312,11 @@ static void decode_sfe_vector_fx( res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se10, - hPrivateData->cf_off_se10 ); + hPrivateData->cf_off_se10 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , extra_bits_read +#endif + ); x[f] = add( prev_x[f], res ); // Q0 move16(); /* pred = a */ } @@ -259,7 +340,11 @@ static void decode_sfe_vector_fx( res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se11 + index1, - hPrivateData->cf_off_se11[index2] ); + hPrivateData->cf_off_se11[index2] +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , extra_bits_read +#endif + ); x[f] = add( pred, res ); // Q0 move16(); } @@ -317,7 +402,25 @@ void IGFSCFDecoderDecode( /* insert data */ hPublicData->bitsRead = st->next_bit_pos; move16(); +#ifdef DEBUGGING_2402 + static Word16 cnt123 = 0; +#endif +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + Word16 extra_bits_read = 0; +#endif +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC + ivas_ari_start_decoding_14bits_ext_1_lfe( st, &hPublicData->acState, &extra_bits_read ); +#ifdef DEBUGGING_2402 + printf("ivas_ari_start\n"); + printf("start %d\n", ++cnt123); +#endif +#else ari_start_decoding_14bits_fx( st, &hPublicData->acState ); /* start AC decoding */ +#ifdef DEBUGGING_2402 + printf("ari_start\n"); + printf("start %d\n", ++cnt123); +#endif +#endif /* check if coder needs a reset and do it if necessary */ IF( indepFlag != 0 ) @@ -326,9 +429,23 @@ void IGFSCFDecoderDecode( IGFSCFDecoderReset( hPublicData ); } - decode_sfe_vector_fx( hPublicData, st, hPublicData->t, hPublicData->prev, sfe, hPublicData->scfCountLongBlock[igfGridIdx] ); - - arith_decode_flush_fx( st ); /* finish AC decoding */ + decode_sfe_vector_fx( hPublicData, st, hPublicData->t, hPublicData->prev, sfe, hPublicData->scfCountLongBlock[igfGridIdx] +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , &extra_bits_read +#endif + ); + +#ifdef DEBUGGING_2402 + printf("finish nbp=%d ebr=%d\n", st->next_bit_pos, extra_bits_read ); +#endif + arith_decode_flush_fx( st +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 + , &extra_bits_read +#endif + ); /* finish AC decoding */ +#ifdef DEBUGGING_2402 + printf("finish2 nbp=%d ebr=%d\n", st->next_bit_pos, extra_bits_read ); +#endif /* advance history */ Copy( sfe, hPublicData->prev, hPublicData->scfCountLongBlock[igfGridIdx] ); -- GitLab From 9dd3c9be137b6b40dc32addda1ee8c69427f0472 Mon Sep 17 00:00:00 2001 From: gerstack Date: Fri, 24 Apr 2026 16:05:25 +0200 Subject: [PATCH 02/22] test version with a signed version of function 'UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( Decoder_State *st, Tastat *s, const UWord16 *cum_freq, Word16 *extra_bits_read ) --- lib_com/ivas_arith_fx.c | 84 +++++++++++++++++++++++++++++++++++++++++ lib_com/ivas_prot_fx.h | 10 +++++ lib_com/options2.h | 25 ++---------- 3 files changed, 97 insertions(+), 22 deletions(-) diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index aa261f69d..1df95115b 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -32,6 +32,7 @@ #include #include "options.h" +#include "options2.h" #include "wmc_auto.h" #include "prot_fx.h" #include "ivas_prot_fx.h" @@ -102,6 +103,8 @@ static UWord16 ivas_ari_get_symbol( * *-------------------------------------------------------------*/ +#ifndef FIX_2402_SIGNED_VERSION +xxx UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( Decoder_State *st, Tastat *s, @@ -180,6 +183,87 @@ UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( return symbol; } +#else /* FIX_2402_SIGNED_VERSION */ +Word16 ivas_ari_decode_14bits_bit_ext_1_lfe( + Decoder_State *st, + Tastat *s, + const UWord16 *cum_freq, + Word16 *extra_bits_read ) +{ + Word16 symbol; + Word32 low, high, range, value; + Word32 cum; + + /* read s->low,high,value sequentially */ + low = s->low; + high = s->high; + value = s->value; + + move32(); + move32(); + move32(); + + range = L_add( L_sub( high, low ), 1 ); + cum = L_sub( L_lshl( ( L_add( L_sub( value, low ), 1 ) ), stat_bitsnew ), 1 ); + + symbol = ivas_ari_get_symbol( cum_freq, range, cum ); + + high = L_sub( L_add( low, mul_sbc_14bits( range, cum_freq[symbol] ) ), 1 ); + low = L_add( low, mul_sbc_14bits( range, cum_freq[symbol + 1] ) ); + + FOR( ;; ) + { + IF( GE_32( high, ari_q2new ) ) + { + IF( GE_32( low, ari_q2new ) ) + { + value = L_sub( value, ari_q2new ); + low = L_sub( low, ari_q2new ); + high = L_sub( high, ari_q2new ); + } + ELSE + { + test(); + IF( GE_32( low, ari_q1new ) && LT_32( high, ari_q3new ) ) + { + value = L_sub( value, ari_q1new ); + low = L_sub( low, ari_q1new ); + high = L_sub( high, ari_q1new ); + } + ELSE + { + BREAK; + } + } + } + + low = L_add( low, low ); + high = L_add( high, UL_addNsD( high, 1 ) ); + + IF( GE_16( st->next_bit_pos, st->bits_frame ) ) + { + value = L_lshl( value, 1 ); + *extra_bits_read = add( *extra_bits_read, 1 ); + move16(); + } + ELSE + { + value = L_or( L_lshl( value, 1 ), get_next_indice_1_fx( st ) ); + } + } + + s->low = low; + s->high = high; + s->value = value; + + move32(); + move32(); + move32(); + + return symbol; +} + +#endif /* FIX_2402_SIGNED_VERSION */ /*--------------------------------------------------------------- * Function ivas_ari_done_decoding_14bits_ext_1_lfe() diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 02d720e2f..8e3a59d83 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -35,6 +35,7 @@ #include #include "options.h" +#include "options2.h" #include #include "typedef.h" #include "stat_enc.h" @@ -5310,12 +5311,21 @@ void ivas_ari_start_decoding_14bits_ext_1_lfe( Word16 *extra_bits_read ); +#ifndef FIX_2402_SIGNED_VERSION UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( Decoder_State *st, Tastat *s, const UWord16 *cum_freq, Word16 *extra_bits_read ); +#else +Word16 ivas_ari_decode_14bits_bit_ext_1_lfe( + Decoder_State *st, + Tastat *s, + const UWord16 *cum_freq, + Word16 *extra_bits_read +); +#endif void ivas_ari_done_decoding_14bits_ext_1_lfe( Decoder_State *st, diff --git a/lib_com/options2.h b/lib_com/options2.h index eb693c5d0..faea9df29 100644 --- a/lib_com/options2.h +++ b/lib_com/options2.h @@ -1,26 +1,7 @@ //#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ +//#define FIX_2402_REPL_EVS_ARI_CODEC_ENC +//#define FIX_2402_REPL_IVAS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ -/* -lib_dec/ari_dec_fx.c - void ari_start_decoding_14bits_fx( Decoder_State *st, Tastat *s ) +#define FIX_2402_SIGNED_VERSION /* FhG: basop issue 2402: */ -lib_dec/ari_dec_fx.c - Word16 ari_start_decoding_14bits_prm_ivas_fx( const Word16 *ptr, Word16 bp, Tastat *s ) -lib_com/ivas_arith_fx.c: - void ivas_ari_start_decoding_14bits_ext_1_lfe( Decoder_State *st, Tastat *s, Word16 *extra_bits_read ) - -lib_dec/ari_dec_fx.c -Word16 ari_decode_14bits_s17_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq ) -ari_decode_14bits_ext_fx -lib_com/ivas_arith_fx.c -UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( Decoder_State *st, Tastat *s, const UWord16 *cum_freq, Word16 *extra_bits_read ) - - -*/ -/* - -#2 extra_bits_read -./testv/bitstreams/swb/stv32c_13200_32kHz.COD -Output synthesis file: ./output/decoded/stv32c_13200_32kHz.OUT -*/ //#define DEBUGGING_2402 -- GitLab From 86899ac4ffb4ede26662b462e528a274164fcb43 Mon Sep 17 00:00:00 2001 From: gerstack Date: Fri, 24 Apr 2026 16:28:58 +0200 Subject: [PATCH 03/22] clang format --- lib_com/ivas_arith_fx.c | 11 ++-- lib_com/options2.h | 10 ++-- lib_dec/ACcontextMapping_dec_fx.c | 12 ++-- lib_dec/ari_dec_fx.c | 2 +- lib_dec/igf_scf_dec_fx.c | 94 ++++++++++++++++++------------- 5 files changed, 72 insertions(+), 57 deletions(-) diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index 1df95115b..5bd0dd478 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -105,11 +105,12 @@ static UWord16 ivas_ari_get_symbol( #ifndef FIX_2402_SIGNED_VERSION xxx -UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( - Decoder_State *st, - Tastat *s, - const UWord16 *cum_freq, - Word16 *extra_bits_read ) + UWord16 + ivas_ari_decode_14bits_bit_ext_1_lfe( + Decoder_State *st, + Tastat *s, + const UWord16 *cum_freq, + Word16 *extra_bits_read ) { UWord16 symbol; UWord32 low, high, range, value; diff --git a/lib_com/options2.h b/lib_com/options2.h index faea9df29..1d31f80e3 100644 --- a/lib_com/options2.h +++ b/lib_com/options2.h @@ -1,7 +1,7 @@ -//#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ -//#define FIX_2402_REPL_EVS_ARI_CODEC_ENC -//#define FIX_2402_REPL_IVAS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ +// #define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ +// #define FIX_2402_REPL_EVS_ARI_CODEC_ENC +// #define FIX_2402_REPL_IVAS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ -#define FIX_2402_SIGNED_VERSION /* FhG: basop issue 2402: */ +#define FIX_2402_SIGNED_VERSION /* FhG: basop issue 2402: */ -//#define DEBUGGING_2402 +// #define DEBUGGING_2402 diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index 27e33400f..dc6a5b9d4 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -139,14 +139,14 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( /* Start Decoding */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC Word16 extra_bits_read = 0; - ivas_ari_start_decoding_14bits_ext_1_lfe( st, &as, &extra_bits_read ); + ivas_ari_start_decoding_14bits_ext_1_lfe( st, &as, &extra_bits_read ); #ifdef DEBUGGING_2402 - printf("ivas_ari_start\n"); + printf( "ivas_ari_start\n" ); #endif #else ari_start_decoding_14bits_fx( st, &as ); #ifdef DEBUGGING_2402 - printf("ari_start\n"); + printf( "ari_start\n" ); #endif #endif @@ -200,13 +200,13 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC r = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &as, ari_pk_s17_LC_ext[pki], &extra_bits_read ); #ifdef DEBUGGING_2402 - printf("r=%d, nbp=%d, ebr=%d\n", r, st->next_bit_pos, extra_bits_read); + printf( "r=%d, nbp=%d, ebr=%d\n", r, st->next_bit_pos, extra_bits_read ); #endif #else r = ari_decode_14bits_s17_ext_fx( st, &as, ari_pk_s17_LC_ext[pki] ); #ifdef DEBUGGING_2402 - printf("r=%d, nbp=%d, ebr=0\n", r, st->next_bit_pos ); + printf( "r=%d, nbp=%d, ebr=0\n", r, st->next_bit_pos ); #endif #endif IF( LT_16( r, VAL_ESC ) ) @@ -321,7 +321,7 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( get_next_indice_tmp_fx( st, sub( ( sub( add( start_bit_pos, nbbits ), rest_bits ) ), st->next_bit_pos ) ); } #ifdef DEBUGGING_2402 - printf("loop exit, nbp=%d\n", st->next_bit_pos ); + printf( "loop exit, nbp=%d\n", st->next_bit_pos ); #endif /*Decode signs*/ diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 8241a753a..63201e22a 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -75,7 +75,7 @@ Word16 ari_start_decoding_14bits_prm_fx( FOR( i = 0; i < cbitsnew; i++ ) { val = L_shl( val, 1 ); - if( *( p + i ) != 0 ) + if ( *( p + i ) != 0 ) { val = L_add( val, 1 ); } diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index f5dd3640d..e976c57c5 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -13,11 +13,11 @@ #include "stat_dec.h" #include "basop_util.h" #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC - #define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - #include "ivas_prot_fx.h" +#define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 +#include "ivas_prot_fx.h" #endif #ifdef DEBUGGING_2402 - #define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 +#define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 #endif /**********************************************************************/ /** @@ -75,7 +75,8 @@ static Word16 arith_decode_bits_fx( Decoder_State *st, /* i/o: pointer to bitstream decoder state */ Word16 nBits /* i : number of bits to decode */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , Word16 *extra_bits_read + , + Word16 *extra_bits_read #endif ) { @@ -97,7 +98,7 @@ static Word16 arith_decode_bits_fx( bit = ari_decode_14bits_bit_ext_fx( st, &hPrivateData->acState ); #endif #ifdef DEBUGGING_2402 - printf("decode %d: nbp=%d ebr=%d\n", __LINE__, st->next_bit_pos, *extra_bits_read ); + printf( "decode %d: nbp=%d ebr=%d\n", __LINE__, st->next_bit_pos, *extra_bits_read ); #endif if ( bit != 0 ) { @@ -114,7 +115,8 @@ static Word16 arith_decode_residual_fx( const UWord16 *cumulativeFrequencyTable, /* i : cumulative frequency table to be used Q0 */ Word16 tableOffset /* i : offset used to align the table */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , Word16 *extra_bits_read + , + Word16 *extra_bits_read #endif ) { @@ -130,7 +132,7 @@ static Word16 arith_decode_residual_fx( val = ari_decode_14bits_s27_ext_fx( st, &hPrivateData->acState, cumulativeFrequencyTable ); // Q0 #endif #ifdef DEBUGGING_2402 - printf("decode %d: nbp=%d ebr=%d\n", __LINE__, st->next_bit_pos, *extra_bits_read ); + printf( "decode %d: nbp=%d ebr=%d\n", __LINE__, st->next_bit_pos, *extra_bits_read ); #endif /* meaning of the values of val: */ @@ -150,32 +152,35 @@ static Word16 arith_decode_residual_fx( /* decode extra with 4 bits */ extra = arith_decode_bits_fx( hPrivateData, st, 4 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , extra_bits_read + , + extra_bits_read #endif ); // Q0 #ifdef DEBUGGING_2402 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC - printf("extra=%d, extra_bits_read=%d\n", extra, *extra_bits_read); + printf( "extra=%d, extra_bits_read=%d\n", extra, *extra_bits_read ); #else - printf("extra=%d, extra_bits_read=%d\n", extra, 0); + printf( "extra=%d, extra_bits_read=%d\n", extra, 0 ); #endif #endif - IF( EQ_16( extra, 15 ) ) /* escape code 15 to indicate extra >= 15 */ + IF( EQ_16( extra, 15 ) ) /* escape code 15 to indicate extra >= 15 */ { /* decode addtional extra with 6 bits */ extra = arith_decode_bits_fx( hPrivateData, st, 6 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , extra_bits_read + , + extra_bits_read #endif - ); // Q0 - IF( EQ_16( extra, 63 ) ) /* escape code 63 to indicate extra >= 63 */ + ); // Q0 + IF( EQ_16( extra, 63 ) ) /* escape code 63 to indicate extra >= 63 */ { /* decode safety extra with 7 bits */ extra = arith_decode_bits_fx( hPrivateData, st, 7 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , extra_bits_read + , + extra_bits_read #endif - ); // Q0 + ); // Q0 extra = add( 63, extra ); } extra = add( 15, extra ); // Q0 @@ -200,7 +205,8 @@ static Word16 arith_decode_residual_fx( static void arith_decode_flush_fx( Decoder_State *st /* i/o: pointer to decoder state */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , Word16 *extra_bits_read + , + Word16 *extra_bits_read #endif ) { @@ -224,7 +230,8 @@ static void decode_sfe_vector_fx( Word16 *x, /* o : current vector to decode */ Word16 length /* i : number of elements to decode */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , Word16 *extra_bits_read + , + Word16 *extra_bits_read #endif ) { @@ -262,10 +269,11 @@ static void decode_sfe_vector_fx( pred = arith_decode_bits_fx( hPrivateData, st, 2 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , extra_bits_read + , + extra_bits_read #endif - ); /* LSBs as 2 bit raw */ - x[f] = add( shl( res, 2 ), pred ); // Q0 + ); /* LSBs as 2 bit raw */ + x[f] = add( shl( res, 2 ), pred ); // Q0 move16(); } ELSE IF( EQ_16( f, 1 ) ) @@ -276,9 +284,10 @@ static void decode_sfe_vector_fx( hPrivateData->cf_se01, hPrivateData->cf_off_se01 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , extra_bits_read + , + extra_bits_read #endif - ); + ); x[f] = add( x[0], res ); // Q0 move16(); /* f - increment is 0, pred = b */ } @@ -296,9 +305,10 @@ static void decode_sfe_vector_fx( hPrivateData->cf_se02 + index1, hPrivateData->cf_off_se02[index2] #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , extra_bits_read + , + extra_bits_read #endif - ); + ); x[f] = add( x[prev_offset], res ); // Q0 move16(); /* pred = b */ } @@ -314,9 +324,10 @@ static void decode_sfe_vector_fx( hPrivateData->cf_se10, hPrivateData->cf_off_se10 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , extra_bits_read + , + extra_bits_read #endif - ); + ); x[f] = add( prev_x[f], res ); // Q0 move16(); /* pred = a */ } @@ -342,9 +353,10 @@ static void decode_sfe_vector_fx( hPrivateData->cf_se11 + index1, hPrivateData->cf_off_se11[index2] #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , extra_bits_read + , + extra_bits_read #endif - ); + ); x[f] = add( pred, res ); // Q0 move16(); } @@ -409,16 +421,16 @@ void IGFSCFDecoderDecode( Word16 extra_bits_read = 0; #endif #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC - ivas_ari_start_decoding_14bits_ext_1_lfe( st, &hPublicData->acState, &extra_bits_read ); + ivas_ari_start_decoding_14bits_ext_1_lfe( st, &hPublicData->acState, &extra_bits_read ); #ifdef DEBUGGING_2402 - printf("ivas_ari_start\n"); - printf("start %d\n", ++cnt123); + printf( "ivas_ari_start\n" ); + printf( "start %d\n", ++cnt123 ); #endif #else ari_start_decoding_14bits_fx( st, &hPublicData->acState ); /* start AC decoding */ #ifdef DEBUGGING_2402 - printf("ari_start\n"); - printf("start %d\n", ++cnt123); + printf( "ari_start\n" ); + printf( "start %d\n", ++cnt123 ); #endif #endif @@ -431,20 +443,22 @@ void IGFSCFDecoderDecode( decode_sfe_vector_fx( hPublicData, st, hPublicData->t, hPublicData->prev, sfe, hPublicData->scfCountLongBlock[igfGridIdx] #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , &extra_bits_read + , + &extra_bits_read #endif - ); + ); #ifdef DEBUGGING_2402 - printf("finish nbp=%d ebr=%d\n", st->next_bit_pos, extra_bits_read ); + printf( "finish nbp=%d ebr=%d\n", st->next_bit_pos, extra_bits_read ); #endif arith_decode_flush_fx( st #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , &extra_bits_read + , + &extra_bits_read #endif - ); /* finish AC decoding */ + ); /* finish AC decoding */ #ifdef DEBUGGING_2402 - printf("finish2 nbp=%d ebr=%d\n", st->next_bit_pos, extra_bits_read ); + printf( "finish2 nbp=%d ebr=%d\n", st->next_bit_pos, extra_bits_read ); #endif /* advance history */ -- GitLab From 6d33d51f0f06f2efbb1968436ca0bfe1b6aadc53 Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 27 Apr 2026 09:50:20 +0200 Subject: [PATCH 04/22] test with assert(0) --- lib_com/ivas_arith_fx.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index 5bd0dd478..c37ed149c 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -104,13 +104,11 @@ static UWord16 ivas_ari_get_symbol( *-------------------------------------------------------------*/ #ifndef FIX_2402_SIGNED_VERSION -xxx - UWord16 - ivas_ari_decode_14bits_bit_ext_1_lfe( - Decoder_State *st, - Tastat *s, - const UWord16 *cum_freq, - Word16 *extra_bits_read ) +UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( + Decoder_State *st, + Tastat *s, + const UWord16 *cum_freq, + Word16 *extra_bits_read ) { UWord16 symbol; UWord32 low, high, range, value; @@ -148,6 +146,7 @@ xxx test(); IF( GE_32( low, ari_q1new ) && LT_32( high, ari_q3new ) ) { + assert(0); value = UL_subNsD( value, ari_q1new ); low = UL_subNsD( low, ari_q1new ); high = UL_subNsD( high, ari_q1new ); -- GitLab From 65ed469a0adf7dde028e17b22f03c5ef51b193ca Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 27 Apr 2026 10:09:31 +0200 Subject: [PATCH 05/22] clang format --- lib_com/ivas_arith_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index c37ed149c..a41db60df 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -146,7 +146,7 @@ UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( test(); IF( GE_32( low, ari_q1new ) && LT_32( high, ari_q3new ) ) { - assert(0); + assert( 0 ); value = UL_subNsD( value, ari_q1new ); low = UL_subNsD( low, ari_q1new ); high = UL_subNsD( high, ari_q1new ); -- GitLab From f207d2d2e33d357c7744678c86664f444e6ea161 Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 27 Apr 2026 10:32:39 +0200 Subject: [PATCH 06/22] test with assert(0) --- lib_com/ivas_arith_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index a41db60df..b0090ab23 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -146,7 +146,6 @@ UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( test(); IF( GE_32( low, ari_q1new ) && LT_32( high, ari_q3new ) ) { - assert( 0 ); value = UL_subNsD( value, ari_q1new ); low = UL_subNsD( low, ari_q1new ); high = UL_subNsD( high, ari_q1new ); @@ -226,6 +225,7 @@ Word16 ivas_ari_decode_14bits_bit_ext_1_lfe( test(); IF( GE_32( low, ari_q1new ) && LT_32( high, ari_q3new ) ) { + assert( 0 ); value = L_sub( value, ari_q1new ); low = L_sub( low, ari_q1new ); high = L_sub( high, ari_q1new ); -- GitLab From fb740d631a0f3d060bed2e21eefb3626415f9d45 Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 27 Apr 2026 14:59:32 +0200 Subject: [PATCH 07/22] removed assert(0) --- lib_com/ivas_arith_fx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index b0090ab23..78b5bd117 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -225,7 +225,6 @@ Word16 ivas_ari_decode_14bits_bit_ext_1_lfe( test(); IF( GE_32( low, ari_q1new ) && LT_32( high, ari_q3new ) ) { - assert( 0 ); value = L_sub( value, ari_q1new ); low = L_sub( low, ari_q1new ); high = L_sub( high, ari_q1new ); -- GitLab From ad53e4fefdc57cffb09967e5afdcf42997da2a49 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 28 Apr 2026 14:44:08 +0200 Subject: [PATCH 08/22] Activate FIX_2402_REPL_EVS_ARI_CODEC_DEC and remove options2.h --- lib_com/ivas_arith_fx.c | 1 - lib_com/ivas_prot_fx.h | 1 - lib_com/options.h | 3 +++ lib_com/options2.h | 7 ------- lib_dec/ACcontextMapping_dec_fx.c | 1 - lib_dec/ari_dec_fx.c | 1 - lib_dec/igf_scf_dec_fx.c | 1 - 7 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 lib_com/options2.h diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c index 78b5bd117..c9eba0ec3 100644 --- a/lib_com/ivas_arith_fx.c +++ b/lib_com/ivas_arith_fx.c @@ -32,7 +32,6 @@ #include #include "options.h" -#include "options2.h" #include "wmc_auto.h" #include "prot_fx.h" #include "ivas_prot_fx.h" diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 13937e735..abb3725c6 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -35,7 +35,6 @@ #include #include "options.h" -#include "options2.h" #include #include "typedef.h" #include "stat_enc.h" diff --git a/lib_com/options.h b/lib_com/options.h index dc3f3b583..69cfcc190 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -97,6 +97,9 @@ #define FIX_BASOP_2530_IVAS_DECISION_MAT /* VA: Fix ambiguous usage of extract_l() */ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_INLINE_FCT_ARI_CODEC /* FhG: basop issue 2402: simplify processing in arithmetic decoding, inline mul_sbc_14bits, all BE */ +#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ +#define FIX_2402_REPL_IVAS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ +#define FIX_2402_SIGNED_VERSION /* FhG: basop issue 2402: use signed operator instead of unsigned, better match for hardware */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2546_HARMONIZE_TCX_SCALAR /* FhG: Fix issue 2546 Harmonize function tcx_scalar_quantization_rateloop*/ #define FIX_BASOP_2532_cx_e /* FhG: Fix issue 2532 about additional exponent variable*/ diff --git a/lib_com/options2.h b/lib_com/options2.h deleted file mode 100644 index 1d31f80e3..000000000 --- a/lib_com/options2.h +++ /dev/null @@ -1,7 +0,0 @@ -// #define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ -// #define FIX_2402_REPL_EVS_ARI_CODEC_ENC -// #define FIX_2402_REPL_IVAS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ - -#define FIX_2402_SIGNED_VERSION /* FhG: basop issue 2402: */ - -// #define DEBUGGING_2402 diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index dc6a5b9d4..8537a4247 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -5,7 +5,6 @@ #include #include #include "options.h" -#include "options2.h" #include "rom_com.h" #include "rom_dec.h" #include "basop_util.h" diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 63201e22a..171eef29c 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -5,7 +5,6 @@ #include #include "assert.h" #include "options.h" -#include "options2.h" #include "cnst.h" #include "rom_com.h" #include "prot_fx.h" diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index e976c57c5..b823c1f82 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -7,7 +7,6 @@ #include #include #include "options.h" -#include "options2.h" #include "stl.h" #include "prot_fx.h" #include "stat_dec.h" -- GitLab From 27f9e45bb94777900b58a4ffd1ebbd1b2404f1ef Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 28 Apr 2026 14:53:13 +0200 Subject: [PATCH 09/22] Cleanup, remove DEBUGGING_2402 and place all switches into options.h --- lib_com/options.h | 4 ++-- lib_dec/ACcontextMapping_dec_fx.c | 16 -------------- lib_dec/igf_scf_dec_fx.c | 36 +------------------------------ 3 files changed, 3 insertions(+), 53 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c953b3b0a..8992c9ff9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -97,8 +97,8 @@ #define FIX_BASOP_2530_IVAS_DECISION_MAT /* VA: Fix ambiguous usage of extract_l() */ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_INLINE_FCT_ARI_CODEC /* FhG: basop issue 2402: simplify processing in arithmetic decoding, inline mul_sbc_14bits, all BE */ -#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ -#define FIX_2402_REPL_IVAS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ +#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder in core coder */ +#define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder in IGF SCF coder */ #define FIX_2402_SIGNED_VERSION /* FhG: basop issue 2402: use signed operator instead of unsigned, better match for hardware */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2546_HARMONIZE_TCX_SCALAR /* FhG: Fix issue 2546 Harmonize function tcx_scalar_quantization_rateloop*/ diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index 8537a4247..5b11b8602 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -139,14 +139,8 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC Word16 extra_bits_read = 0; ivas_ari_start_decoding_14bits_ext_1_lfe( st, &as, &extra_bits_read ); -#ifdef DEBUGGING_2402 - printf( "ivas_ari_start\n" ); -#endif #else ari_start_decoding_14bits_fx( st, &as ); -#ifdef DEBUGGING_2402 - printf( "ari_start\n" ); -#endif #endif overflow_bit_pos = st->next_bit_pos; @@ -198,15 +192,8 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( move16(); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC r = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &as, ari_pk_s17_LC_ext[pki], &extra_bits_read ); -#ifdef DEBUGGING_2402 - printf( "r=%d, nbp=%d, ebr=%d\n", r, st->next_bit_pos, extra_bits_read ); -#endif #else r = ari_decode_14bits_s17_ext_fx( st, &as, ari_pk_s17_LC_ext[pki] ); - -#ifdef DEBUGGING_2402 - printf( "r=%d, nbp=%d, ebr=0\n", r, st->next_bit_pos ); -#endif #endif IF( LT_16( r, VAL_ESC ) ) { @@ -319,9 +306,6 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( /* Set bitstream position to (start_bit_pos+nbbits-rest_bits) */ get_next_indice_tmp_fx( st, sub( ( sub( add( start_bit_pos, nbbits ), rest_bits ) ), st->next_bit_pos ) ); } -#ifdef DEBUGGING_2402 - printf( "loop exit, nbp=%d\n", st->next_bit_pos ); -#endif /*Decode signs*/ if ( hm_cfg ) diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index b823c1f82..cc41c9323 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -12,12 +12,8 @@ #include "stat_dec.h" #include "basop_util.h" #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC -#define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 #include "ivas_prot_fx.h" #endif -#ifdef DEBUGGING_2402 -#define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 -#endif /**********************************************************************/ /** initialization of an instance of this module @@ -95,9 +91,6 @@ static Word16 arith_decode_bits_fx( bit = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, cum_freq, extra_bits_read ); #else bit = ari_decode_14bits_bit_ext_fx( st, &hPrivateData->acState ); -#endif -#ifdef DEBUGGING_2402 - printf( "decode %d: nbp=%d ebr=%d\n", __LINE__, st->next_bit_pos, *extra_bits_read ); #endif if ( bit != 0 ) { @@ -130,9 +123,6 @@ static Word16 arith_decode_residual_fx( #else val = ari_decode_14bits_s27_ext_fx( st, &hPrivateData->acState, cumulativeFrequencyTable ); // Q0 #endif -#ifdef DEBUGGING_2402 - printf( "decode %d: nbp=%d ebr=%d\n", __LINE__, st->next_bit_pos, *extra_bits_read ); -#endif /* meaning of the values of val: */ /* esc_{0} IGF_MIN_ENC_SEPARATE ... IGF_MAX_ENC_SEPARATE esc_{IGF_SYMBOLS_IN_TABLE - 1} */ @@ -154,14 +144,7 @@ static Word16 arith_decode_residual_fx( , extra_bits_read #endif - ); // Q0 -#ifdef DEBUGGING_2402 -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC - printf( "extra=%d, extra_bits_read=%d\n", extra, *extra_bits_read ); -#else - printf( "extra=%d, extra_bits_read=%d\n", extra, 0 ); -#endif -#endif + ); // Q0 IF( EQ_16( extra, 15 ) ) /* escape code 15 to indicate extra >= 15 */ { /* decode addtional extra with 6 bits */ @@ -413,24 +396,13 @@ void IGFSCFDecoderDecode( /* insert data */ hPublicData->bitsRead = st->next_bit_pos; move16(); -#ifdef DEBUGGING_2402 - static Word16 cnt123 = 0; -#endif #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 Word16 extra_bits_read = 0; #endif #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC ivas_ari_start_decoding_14bits_ext_1_lfe( st, &hPublicData->acState, &extra_bits_read ); -#ifdef DEBUGGING_2402 - printf( "ivas_ari_start\n" ); - printf( "start %d\n", ++cnt123 ); -#endif #else ari_start_decoding_14bits_fx( st, &hPublicData->acState ); /* start AC decoding */ -#ifdef DEBUGGING_2402 - printf( "ari_start\n" ); - printf( "start %d\n", ++cnt123 ); -#endif #endif /* check if coder needs a reset and do it if necessary */ @@ -447,18 +419,12 @@ void IGFSCFDecoderDecode( #endif ); -#ifdef DEBUGGING_2402 - printf( "finish nbp=%d ebr=%d\n", st->next_bit_pos, extra_bits_read ); -#endif arith_decode_flush_fx( st #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 , &extra_bits_read #endif ); /* finish AC decoding */ -#ifdef DEBUGGING_2402 - printf( "finish2 nbp=%d ebr=%d\n", st->next_bit_pos, extra_bits_read ); -#endif /* advance history */ Copy( sfe, hPublicData->prev, hPublicData->scfCountLongBlock[igfGridIdx] ); -- GitLab From 5f0508b82de01e97fd47d50ab386acd6155c1356 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Tue, 28 Apr 2026 15:20:06 +0200 Subject: [PATCH 10/22] Remove unnecessary differences to main. --- lib_dec/ari_dec_fx.c | 10 ++++ lib_dec/igf_scf_dec_fx.c | 121 +++++++++++++++++++++------------------ 2 files changed, 76 insertions(+), 55 deletions(-) diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 171eef29c..560706fad 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -66,19 +66,29 @@ Word16 ari_start_decoding_14bits_prm_fx( const Word16 *p; val = L_deposit_l( 0 ); +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC s->low = val; move32(); +#endif p = ptr + bp; /* Q0 */ FOR( i = 0; i < cbitsnew; i++ ) { val = L_shl( val, 1 ); +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC if ( *( p + i ) != 0 ) +#else + IF( *( p + i ) ) +#endif { val = L_add( val, 1 ); } } +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC + s->low = L_deposit_l( 0 ); + move32(); +#endif s->high = L_add( ari_q4new, 1 ); move32(); s->value = val; diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index cc41c9323..96a2a820d 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -68,10 +68,11 @@ static Word16 quant_ctx_fx( static Word16 arith_decode_bits_fx( IGFSCFDEC_INSTANCE_HANDLE hPrivateData, /* i/o: instance handle */ Decoder_State *st, /* i/o: pointer to bitstream decoder state */ - Word16 nBits /* i : number of bits to decode */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , + Word16 nBits, /* i : number of bits to decode */ Word16 *extra_bits_read +#else + Word16 nBits /* i : number of bits to decode */ #endif ) { @@ -105,10 +106,11 @@ static Word16 arith_decode_residual_fx( IGFSCFDEC_INSTANCE_HANDLE hPrivateData, /* i/o: instance handle */ Decoder_State *st, /* i/o: pointer to decoder state */ const UWord16 *cumulativeFrequencyTable, /* i : cumulative frequency table to be used Q0 */ - Word16 tableOffset /* i : offset used to align the table */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , + Word16 tableOffset, /* i : offset used to align the table */ Word16 *extra_bits_read +#else + Word16 tableOffset /* i : offset used to align the table */ #endif ) { @@ -139,30 +141,27 @@ static Word16 arith_decode_residual_fx( /* decode one of the tails of the distribution */ /* decode extra with 4 bits */ - extra = arith_decode_bits_fx( hPrivateData, st, 4 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - extra_bits_read + extra = arith_decode_bits_fx( hPrivateData, st, 4, extra_bits_read ); // Q0 +#else + extra = arith_decode_bits_fx( hPrivateData, st, 4 ); // Q0 #endif - ); // Q0 IF( EQ_16( extra, 15 ) ) /* escape code 15 to indicate extra >= 15 */ { /* decode addtional extra with 6 bits */ - extra = arith_decode_bits_fx( hPrivateData, st, 6 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - extra_bits_read + extra = arith_decode_bits_fx( hPrivateData, st, 6, extra_bits_read ); // Q0 +#else + extra = arith_decode_bits_fx( hPrivateData, st, 6 ); // Q0 #endif - ); // Q0 IF( EQ_16( extra, 63 ) ) /* escape code 63 to indicate extra >= 63 */ { /* decode safety extra with 7 bits */ - extra = arith_decode_bits_fx( hPrivateData, st, 7 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - extra_bits_read + extra = arith_decode_bits_fx( hPrivateData, st, 7, extra_bits_read ); // Q0 +#else + extra = arith_decode_bits_fx( hPrivateData, st, 7 ); // Q0 #endif - ); // Q0 extra = add( 63, extra ); } extra = add( 15, extra ); // Q0 @@ -185,10 +184,11 @@ static Word16 arith_decode_residual_fx( } static void arith_decode_flush_fx( - Decoder_State *st /* i/o: pointer to decoder state */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , + Decoder_State *st, /* i/o: pointer to decoder state */ Word16 *extra_bits_read +#else + Decoder_State *st /* i/o: pointer to decoder state */ #endif ) { @@ -210,10 +210,11 @@ static void decode_sfe_vector_fx( Word16 t, /* i : counter reset to 0 at each independent block */ Word16 *prev_x, /* i : previous vector */ Word16 *x, /* o : current vector to decode */ - Word16 length /* i : number of elements to decode */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , + Word16 length, /* i : number of elements to decode */ Word16 *extra_bits_read +#else + Word16 length /* i : number of elements to decode */ #endif ) { @@ -249,27 +250,30 @@ static void decode_sfe_vector_fx( res = ari_decode_14bits_s27_ext_fx( st, &hPrivateData->acState, (const UWord16 *) hPrivateData->cf_se00 ); #endif - pred = arith_decode_bits_fx( hPrivateData, st, 2 #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - extra_bits_read + pred = arith_decode_bits_fx( hPrivateData, st, 2, extra_bits_read ); /* LSBs as 2 bit raw */ + x[f] = add( shl( res, 2 ), pred ); // Q0 +#else + pred = arith_decode_bits_fx( hPrivateData, st, 2 ); /* LSBs as 2 bit raw */ + x[f] = add( shl( res, 2 ), pred ); // Q0 #endif - ); /* LSBs as 2 bit raw */ - x[f] = add( shl( res, 2 ), pred ); // Q0 move16(); } ELSE IF( EQ_16( f, 1 ) ) { /* (t == 0) && (f == 1) */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se01, - hPrivateData->cf_off_se01 -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - extra_bits_read + hPrivateData->cf_off_se01, + extra_bits_read ); +#else + res = arith_decode_residual_fx( hPrivateData, + st, + hPrivateData->cf_se01, + hPrivateData->cf_off_se01 ); #endif - ); x[f] = add( x[0], res ); // Q0 move16(); /* f - increment is 0, pred = b */ } @@ -282,15 +286,18 @@ static void decode_sfe_vector_fx( index1 = L_mac0( ( IGF_SYMBOLS_IN_TABLE + 1 ) * IGF_CTX_OFFSET, ( IGF_SYMBOLS_IN_TABLE + 1 ), ctx ); /* index2 is IGF_CTX_OFFSET + ctx */ index2 = L_mac0( IGF_CTX_OFFSET, 1, ctx ); +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se02 + index1, - hPrivateData->cf_off_se02[index2] -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - extra_bits_read + hPrivateData->cf_off_se02[index2], + extra_bits_read ); +#else + res = arith_decode_residual_fx( hPrivateData, + st, + hPrivateData->cf_se02 + index1, + hPrivateData->cf_off_se02[index2] ); #endif - ); x[f] = add( x[prev_offset], res ); // Q0 move16(); /* pred = b */ } @@ -301,15 +308,18 @@ static void decode_sfe_vector_fx( IF( f == 0 ) { /* (t == 1) && (f == 0) */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se10, - hPrivateData->cf_off_se10 -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - extra_bits_read + hPrivateData->cf_off_se10, + extra_bits_read ); +#else + res = arith_decode_residual_fx( hPrivateData, + st, + hPrivateData->cf_se10, + hPrivateData->cf_off_se10 ); #endif - ); x[f] = add( prev_x[f], res ); // Q0 move16(); /* pred = a */ } @@ -330,15 +340,18 @@ static void decode_sfe_vector_fx( /* index2 is IGF_CTX_COUNT * (IGF_CTX_OFFSET + ctx_t) + (IGF_CTX_OFFSET + ctx_f) */ index2 = L_mac0( ( IGF_CTX_COUNT + 1 ) * IGF_CTX_OFFSET, IGF_CTX_COUNT, ctx_t ); index2 = L_mac0( index2, 1, ctx_f ); +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se11 + index1, - hPrivateData->cf_off_se11[index2] -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - extra_bits_read + hPrivateData->cf_off_se11[index2], + extra_bits_read ); +#else + res = arith_decode_residual_fx( hPrivateData, + st, + hPrivateData->cf_se11 + index1, + hPrivateData->cf_off_se11[index2] ); #endif - ); x[f] = add( pred, res ); // Q0 move16(); } @@ -412,19 +425,17 @@ void IGFSCFDecoderDecode( IGFSCFDecoderReset( hPublicData ); } - decode_sfe_vector_fx( hPublicData, st, hPublicData->t, hPublicData->prev, sfe, hPublicData->scfCountLongBlock[igfGridIdx] #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - &extra_bits_read -#endif - ); + decode_sfe_vector_fx( hPublicData, st, hPublicData->t, hPublicData->prev, sfe, hPublicData->scfCountLongBlock[igfGridIdx], + &extra_bits_read ); - arith_decode_flush_fx( st -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - , - &extra_bits_read + arith_decode_flush_fx( st, + &extra_bits_read ); /* finish AC decoding */ +#else + decode_sfe_vector_fx( hPublicData, st, hPublicData->t, hPublicData->prev, sfe, hPublicData->scfCountLongBlock[igfGridIdx] ); + + arith_decode_flush_fx( st ); /* finish AC decoding */ #endif - ); /* finish AC decoding */ /* advance history */ Copy( sfe, hPublicData->prev, hPublicData->scfCountLongBlock[igfGridIdx] ); -- GitLab From 1f8c7615d4dbf4ff47cdea7f65fe487fbe63ebfc Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 29 Apr 2026 16:07:50 +0200 Subject: [PATCH 11/22] Make FIX_2402_REPL_EVS_ARI_CODEC_DEC2 independently switchable and disable FIX_2402_REPL_EVS_ARI_CODEC_DEC2. --- lib_com/options.h | 2 +- lib_dec/ari_dec_fx.c | 12 ++++++------ lib_dec/igf_scf_dec_fx.c | 11 ++++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ea3594b87..cd3e690c7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -98,7 +98,7 @@ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_INLINE_FCT_ARI_CODEC /* FhG: basop issue 2402: simplify processing in arithmetic decoding, inline mul_sbc_14bits, all BE */ #define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder in core coder */ -#define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder in IGF SCF coder */ +// #define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder in IGF SCF coder */ #define FIX_2402_SIGNED_VERSION /* FhG: basop issue 2402: use signed operator instead of unsigned, better match for hardware */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2546_HARMONIZE_TCX_SCALAR /* FhG: Fix issue 2546 Harmonize function tcx_scalar_quantization_rateloop*/ diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 560706fad..00c18ee34 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -38,7 +38,7 @@ Word32 ari_decode_overflow_fx( Tastat *s ) * \param[i/o] st * \param[o] s */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) void ari_start_decoding_14bits_fx( Decoder_State *st, Tastat *s ) @@ -187,7 +187,7 @@ static Word16 ari_lookup_s17_fx( } #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) static Word16 ari_lookup_s27_fx( Word32 cum, Word32 range, @@ -324,7 +324,7 @@ static Word16 ari_lookup_s27_fx( } #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) static Word16 ari_lookup_bit_fx( Word32 cum, Word32 range, @@ -360,7 +360,7 @@ static Word16 ari_lookup_bit_fx( } #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) static Word16 ari_decode_14bits_ext_fx( Decoder_State *st, Tastat *s, @@ -446,7 +446,7 @@ Word16 ari_decode_14bits_s17_ext_fx( Decoder_State *st, Tastat *s, UWord16 const /** * \brief Only for 27 symbols with new extended Tables */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) Word16 ari_decode_14bits_s27_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq ) { return ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_s27_fx ); @@ -457,7 +457,7 @@ Word16 ari_decode_14bits_s27_ext_fx( Decoder_State *st, Tastat *s, UWord16 const * \brief Only for decoding one bit with uniform probability: * the equivalent cum_freq table used is {16384, 8192, 0} */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s ) { static const UWord16 cum_freq[3] = { 16384, 8192, 0 }; diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index 96a2a820d..dc9878f0c 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -87,7 +87,7 @@ static Word16 arith_decode_bits_fx( { x = lshl( x, 1 ); /* decode one bit using the new raw AC function */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 static const UWord16 cum_freq[3] = { 16384, 8192, 0 }; bit = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, cum_freq, extra_bits_read ); #else @@ -120,7 +120,7 @@ static Word16 arith_decode_residual_fx( move16(); /* decode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 val = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, cumulativeFrequencyTable, extra_bits_read ); // Q0 #else val = ari_decode_14bits_s27_ext_fx( st, &hPrivateData->acState, cumulativeFrequencyTable ); // Q0 @@ -192,7 +192,7 @@ static void arith_decode_flush_fx( #endif ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ivas_ari_done_decoding_14bits_ext_1_lfe( st, *extra_bits_read ); #else #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 @@ -244,7 +244,7 @@ static void decode_sfe_vector_fx( /* (t == 0) && (f == 0) */ /* decode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ /* NOTE: the float equivalent uses a tmp variable + explicit cast here to avoid undefined behaviour here. This BASOP version does not need it as it already uses signed Word16 return value here. */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 res = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, (const UWord16 *) hPrivateData->cf_se00, extra_bits_read ); // Q0 #else res = ari_decode_14bits_s27_ext_fx( st, &hPrivateData->acState, (const UWord16 *) hPrivateData->cf_se00 ); @@ -411,8 +411,9 @@ void IGFSCFDecoderDecode( move16(); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 Word16 extra_bits_read = 0; + move16(); #endif -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ivas_ari_start_decoding_14bits_ext_1_lfe( st, &hPublicData->acState, &extra_bits_read ); #else ari_start_decoding_14bits_fx( st, &hPublicData->acState ); /* start AC decoding */ -- GitLab From 9330bc1d38df1d06ef7b5c2fd14c64f21bf222b2 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 29 Apr 2026 16:10:58 +0200 Subject: [PATCH 12/22] clang format --- lib_dec/ari_dec_fx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 00c18ee34..c0d361858 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -38,7 +38,7 @@ Word32 ari_decode_overflow_fx( Tastat *s ) * \param[i/o] st * \param[o] s */ -#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) +#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) void ari_start_decoding_14bits_fx( Decoder_State *st, Tastat *s ) @@ -187,7 +187,7 @@ static Word16 ari_lookup_s17_fx( } #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) +#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) static Word16 ari_lookup_s27_fx( Word32 cum, Word32 range, @@ -324,7 +324,7 @@ static Word16 ari_lookup_s27_fx( } #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) +#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) static Word16 ari_lookup_bit_fx( Word32 cum, Word32 range, @@ -360,7 +360,7 @@ static Word16 ari_lookup_bit_fx( } #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) +#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) static Word16 ari_decode_14bits_ext_fx( Decoder_State *st, Tastat *s, @@ -446,7 +446,7 @@ Word16 ari_decode_14bits_s17_ext_fx( Decoder_State *st, Tastat *s, UWord16 const /** * \brief Only for 27 symbols with new extended Tables */ -#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) +#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) Word16 ari_decode_14bits_s27_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq ) { return ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_s27_fx ); @@ -457,7 +457,7 @@ Word16 ari_decode_14bits_s27_ext_fx( Decoder_State *st, Tastat *s, UWord16 const * \brief Only for decoding one bit with uniform probability: * the equivalent cum_freq table used is {16384, 8192, 0} */ -#if !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC) || !defined(FIX_2402_REPL_EVS_ARI_CODEC_DEC2) +#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s ) { static const UWord16 cum_freq[3] = { 16384, 8192, 0 }; -- GitLab From d5bcf8ae0fa1e0a06d8b8246ba2810859b8eb7b0 Mon Sep 17 00:00:00 2001 From: gerstack Date: Wed, 29 Apr 2026 18:16:07 +0200 Subject: [PATCH 13/22] harmonized ari_lookup_sign_fx() and ari_lookup_pow_fx() --- lib_com/options.h | 5 +++-- lib_dec/ari_dec_fx.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index cd3e690c7..1f60ab1d3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -97,8 +97,9 @@ #define FIX_BASOP_2530_IVAS_DECISION_MAT /* VA: Fix ambiguous usage of extract_l() */ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_INLINE_FCT_ARI_CODEC /* FhG: basop issue 2402: simplify processing in arithmetic decoding, inline mul_sbc_14bits, all BE */ -#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder in core coder */ -// #define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder in IGF SCF coder */ +#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ +//#define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ +#define FIX_2402_REPL_EVS_ARI_CODEC_DEC3 /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ #define FIX_2402_SIGNED_VERSION /* FhG: basop issue 2402: use signed operator instead of unsigned, better match for hardware */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2546_HARMONIZE_TCX_SCALAR /* FhG: Fix issue 2546 Harmonize function tcx_scalar_quantization_rateloop*/ diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index c0d361858..9a0f3d738 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -468,6 +468,7 @@ Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s ) } #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { Word32 cum, range; @@ -561,7 +562,9 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) return symbol; } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 static Word16 ari_lookup_sign_fx( Tastat *s, Word16 base ) { Word32 cum, range; @@ -590,7 +593,9 @@ static Word16 ari_lookup_sign_fx( Tastat *s, Word16 base ) return symbol; } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 static Word16 ari_decode_14bits_notbl_fx( Word16 *ptr, /* Q0 */ Word16 bp, @@ -658,6 +663,7 @@ static Word16 ari_decode_14bits_notbl_fx( return bp; } +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ /*------------------------------------------------------------------------ * Function: ari_decode_14bits_pow_fx @@ -672,7 +678,11 @@ static Word16 ari_decode_14bits_notbl_fx( Word16 ari_decode_14bits_pow_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s, Word16 base ) { /* There are two versions to call: pow_ivas or pow_fx (default) */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 + return ari_decode_14bits_pow_ivas( ptr, bp, bits, res, s, base ); +#else return ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, base, ari_lookup_pow_fx ); +#endif } /*------------------------------------------------------------------------ @@ -682,7 +692,11 @@ Word16 ari_decode_14bits_pow_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *re *-------------------------------------------------------------------------*/ Word16 ari_decode_14bits_sign_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s ) { +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 + return ari_decode_14bits_sign_ivas( ptr, bp, bits, res, s ); +#else return ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, 0, ari_lookup_sign_fx ); +#endif } /*--------------------------------------------------------------- -- GitLab From 9dbb2bf6176276bff36f20ecf7848851156f5c37 Mon Sep 17 00:00:00 2001 From: gerstack Date: Wed, 29 Apr 2026 19:00:44 +0200 Subject: [PATCH 14/22] harmonized ari_lookup_sign_fx() and ari_lookup_pow_fx(), correction: also changed ari_start_decode() function --- lib_dec/arith_coder_dec_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index 3ac4963c0..2baf44e56 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -31,7 +31,11 @@ static Word16 tcx_arith_decode_fx( Word64 W_tmp; move32(); +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 + bp = ari_start_decoding_14bits_prm_ivas_fx( prm, 0, &as ); +#else bp = ari_start_decoding_14bits_prm_fx( prm, 0, &as ); +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ tmp = sub( envelope_e, 1 + 15 ); W_tmp = 0; -- GitLab From d2caaa9c551a9f88c8583eadb7c90e266196df7c Mon Sep 17 00:00:00 2001 From: gerstack Date: Thu, 30 Apr 2026 10:41:53 +0200 Subject: [PATCH 15/22] added function ari_decode_overflow_ivas_fx() --- lib_com/prot_fx.h | 3 +++ lib_dec/ari_dec_fx.c | 5 +++++ lib_dec/arith_coder_dec_fx.c | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 347c72941..7476160b1 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -7565,6 +7565,9 @@ void IGFSCFDecoderDecode( Word32 ari_decode_overflow_fx( Tastat *s ); +Word32 ari_decode_overflow_ivas_fx( + Tastat *s ); + void ari_start_decoding_14bits_fx( Decoder_State *st, Tastat *s ); diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 9a0f3d738..52ff317d1 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -32,6 +32,11 @@ Word32 ari_decode_overflow_fx( Tastat *s ) #endif } +Word32 ari_decode_overflow_ivas_fx( Tastat *s ) +{ + return ( L_sub( s->high, s->low ) <= 0 ); +} + /** * \brief Start ArCo decoding * diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index 2baf44e56..fc557433e 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -52,7 +52,11 @@ static Word16 tcx_arith_decode_fx( exp_k = round_fx( expfp( envelope[k], tmp ) ); } /* decode line magnitude */ +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 + bp = ari_decode_14bits_pow_ivas( prm, bp, target_bits, &q, &as, exp_k ); +#else bp = ari_decode_14bits_pow_fx( prm, bp, target_bits, &q, &as, exp_k ); +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ IF( q == 0 ) { @@ -61,7 +65,11 @@ static Word16 tcx_arith_decode_fx( } IF( q != 0 ) /* line is non-zero, decode sign */ { +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 + bp = ari_decode_14bits_sign_ivas( prm, bp, target_bits, &s, &as ); +#else bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as ); +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ W_tmp = W_mac_16_16( W_tmp, q, k ); @@ -72,7 +80,11 @@ static Word16 tcx_arith_decode_fx( move32(); } +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 + IF( ari_decode_overflow_ivas_fx( &as ) ) +#else IF( ari_decode_overflow_fx( &as ) ) +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ { if ( LT_16( bp, target_bits ) ) /* safety check in case of bit errors */ { -- GitLab From b2e4298aaf1b663a61ac7ba3cc973a0d09230057 Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 4 May 2026 11:51:55 +0200 Subject: [PATCH 16/22] correction: 14bits_sign returns 1 and 2 in IVAS code, EVS expects 0 and 1 --- lib_dec/ari_dec_fx.c | 36 ++++++++++++++++++++++++++++++------ lib_dec/arith_coder_dec_fx.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 52ff317d1..9f3ac2db7 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -9,6 +9,14 @@ #include "rom_com.h" #include "prot_fx.h" +//#define FIX_2402_DEBUGGING + +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#define HIGH(as) ((as).high+1) +#else +#define HIGH(as) ((as).high) +#endif + /*--------------------------------------------------------------- * Ari decode 14 bits routines -------------------------------------------------------------*/ @@ -25,17 +33,15 @@ static Word32 L_msui_32_16( Word32 cum, Word32 range, Word16 cum_freq ) Word32 ari_decode_overflow_fx( Tastat *s ) { -#ifdef FIX_2402_SIMPLIFY_ARI_CODEC - return ( L_sub( s->high, s->low ) <= 0 ); -#else return ( L_sub( L_sub( s->high, 1 ), s->low ) <= 0 ); -#endif } +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC Word32 ari_decode_overflow_ivas_fx( Tastat *s ) { return ( L_sub( s->high, s->low ) <= 0 ); } +#endif /** * \brief Start ArCo decoding @@ -686,7 +692,12 @@ Word16 ari_decode_14bits_pow_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *re #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 return ari_decode_14bits_pow_ivas( ptr, bp, bits, res, s, base ); #else - return ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, base, ari_lookup_pow_fx ); + Word16 ret = ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, base, ari_lookup_pow_fx ); +#ifdef FIX_2402_DEBUGGING + printf("decode_14bits_pow() symb= %d\n", + *res); +#endif + return ret; #endif } @@ -700,7 +711,12 @@ Word16 ari_decode_14bits_sign_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *r #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 return ari_decode_14bits_sign_ivas( ptr, bp, bits, res, s ); #else - return ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, 0, ari_lookup_sign_fx ); + Word16 ret = ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, 0, ari_lookup_sign_fx ); +#ifdef FIX_2402_DEBUGGING + printf("decode_14bits_sign() symb= %d\n", + *res); +#endif + return ret; #endif } @@ -888,6 +904,10 @@ Word16 ari_decode_14bits_pow_ivas( *res = symbol; move16(); +#ifdef FIX_2402_DEBUGGING + printf("decode_14bits_pow() symb= %d\n", + symbol); +#endif return bp; } @@ -988,6 +1008,10 @@ Word16 ari_decode_14bits_sign_ivas( *res = symbol; move16(); +#ifdef FIX_2402_DEBUGGING + printf("decode_14bits_sign() symb= %d\n", + symbol - 1); +#endif return bp; } diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index fc557433e..f6cdd2702 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -11,6 +11,14 @@ #include "basop_util.h" #include "basop_proto_func.h" +//#define FIX_2402_DEBUGGING + +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#define HIGH(as) ((as).high+1) +#else +#define HIGH(as) ((as).high) +#endif + /* Returns: number of bits consumed */ static Word16 tcx_arith_decode_fx( Word16 L_frame, /* i : number of spectral lines Q0 */ @@ -36,6 +44,10 @@ static Word16 tcx_arith_decode_fx( #else bp = ari_start_decoding_14bits_prm_fx( prm, 0, &as ); #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#ifdef FIX_2402_DEBUGGING + printf("start_dec_14bits_prm() as.h,l,v= %d,%d,%d\n", + HIGH(as), as.low, as.value); +#endif tmp = sub( envelope_e, 1 + 15 ); W_tmp = 0; @@ -57,6 +69,10 @@ static Word16 tcx_arith_decode_fx( #else bp = ari_decode_14bits_pow_fx( prm, bp, target_bits, &q, &as, exp_k ); #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#ifdef FIX_2402_DEBUGGING + printf("14bits_pow_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH(as), as.low, as.value, bp); +#endif IF( q == 0 ) { @@ -67,9 +83,14 @@ static Word16 tcx_arith_decode_fx( { #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 bp = ari_decode_14bits_sign_ivas( prm, bp, target_bits, &s, &as ); + s -= 1; /* ivas returns 1 or 2, evs expects 0 or 1 */ #else bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as ); #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#ifdef FIX_2402_DEBUGGING + printf("14bits_sign_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH(as), as.low, as.value, bp); +#endif W_tmp = W_mac_16_16( W_tmp, q, k ); @@ -80,12 +101,20 @@ static Word16 tcx_arith_decode_fx( move32(); } +#ifdef FIX_2402_DEBUGGING + printf("before overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH(as), as.low, as.value, bp); +#endif #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 IF( ari_decode_overflow_ivas_fx( &as ) ) #else IF( ari_decode_overflow_fx( &as ) ) #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ { +#ifdef FIX_2402_DEBUGGING + printf("after overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH(as), as.low, as.value, bp); +#endif if ( LT_16( bp, target_bits ) ) /* safety check in case of bit errors */ { bp = -1; @@ -93,6 +122,12 @@ static Word16 tcx_arith_decode_fx( } BREAK; /* no bits left, so exit loop */ } + else { +#ifdef FIX_2402_DEBUGGING + printf("after/else overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH(as), as.low, as.value, bp); +#endif + } } *q_spectrum_e = SPEC_EXP_DEC; move16(); -- GitLab From 93f60a44e488f3b07c274629cdeaf21677fc1120 Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 4 May 2026 12:03:17 +0200 Subject: [PATCH 17/22] clang format --- lib_dec/ari_dec_fx.c | 22 +++++++++++----------- lib_dec/arith_coder_dec_fx.c | 33 +++++++++++++++++---------------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 9f3ac2db7..286f3e4c1 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -9,12 +9,12 @@ #include "rom_com.h" #include "prot_fx.h" -//#define FIX_2402_DEBUGGING +// #define FIX_2402_DEBUGGING #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 -#define HIGH(as) ((as).high+1) +#define HIGH( as ) ( ( as ).high + 1 ) #else -#define HIGH(as) ((as).high) +#define HIGH( as ) ( ( as ).high ) #endif /*--------------------------------------------------------------- @@ -694,8 +694,8 @@ Word16 ari_decode_14bits_pow_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *re #else Word16 ret = ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, base, ari_lookup_pow_fx ); #ifdef FIX_2402_DEBUGGING - printf("decode_14bits_pow() symb= %d\n", - *res); + printf( "decode_14bits_pow() symb= %d\n", + *res ); #endif return ret; #endif @@ -713,8 +713,8 @@ Word16 ari_decode_14bits_sign_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *r #else Word16 ret = ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, 0, ari_lookup_sign_fx ); #ifdef FIX_2402_DEBUGGING - printf("decode_14bits_sign() symb= %d\n", - *res); + printf( "decode_14bits_sign() symb= %d\n", + *res ); #endif return ret; #endif @@ -905,8 +905,8 @@ Word16 ari_decode_14bits_pow_ivas( *res = symbol; move16(); #ifdef FIX_2402_DEBUGGING - printf("decode_14bits_pow() symb= %d\n", - symbol); + printf( "decode_14bits_pow() symb= %d\n", + symbol ); #endif return bp; } @@ -1009,8 +1009,8 @@ Word16 ari_decode_14bits_sign_ivas( *res = symbol; move16(); #ifdef FIX_2402_DEBUGGING - printf("decode_14bits_sign() symb= %d\n", - symbol - 1); + printf( "decode_14bits_sign() symb= %d\n", + symbol - 1 ); #endif return bp; diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index f6cdd2702..ce52a3381 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -11,12 +11,12 @@ #include "basop_util.h" #include "basop_proto_func.h" -//#define FIX_2402_DEBUGGING +// #define FIX_2402_DEBUGGING #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 -#define HIGH(as) ((as).high+1) +#define HIGH( as ) ( ( as ).high + 1 ) #else -#define HIGH(as) ((as).high) +#define HIGH( as ) ( ( as ).high ) #endif /* Returns: number of bits consumed */ @@ -45,8 +45,8 @@ static Word16 tcx_arith_decode_fx( bp = ari_start_decoding_14bits_prm_fx( prm, 0, &as ); #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ #ifdef FIX_2402_DEBUGGING - printf("start_dec_14bits_prm() as.h,l,v= %d,%d,%d\n", - HIGH(as), as.low, as.value); + printf( "start_dec_14bits_prm() as.h,l,v= %d,%d,%d\n", + HIGH( as ), as.low, as.value ); #endif tmp = sub( envelope_e, 1 + 15 ); @@ -70,8 +70,8 @@ static Word16 tcx_arith_decode_fx( bp = ari_decode_14bits_pow_fx( prm, bp, target_bits, &q, &as, exp_k ); #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ #ifdef FIX_2402_DEBUGGING - printf("14bits_pow_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH(as), as.low, as.value, bp); + printf( "14bits_pow_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH( as ), as.low, as.value, bp ); #endif IF( q == 0 ) @@ -88,8 +88,8 @@ static Word16 tcx_arith_decode_fx( bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as ); #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ #ifdef FIX_2402_DEBUGGING - printf("14bits_sign_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH(as), as.low, as.value, bp); + printf( "14bits_sign_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH( as ), as.low, as.value, bp ); #endif W_tmp = W_mac_16_16( W_tmp, q, k ); @@ -102,8 +102,8 @@ static Word16 tcx_arith_decode_fx( } #ifdef FIX_2402_DEBUGGING - printf("before overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH(as), as.low, as.value, bp); + printf( "before overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH( as ), as.low, as.value, bp ); #endif #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 IF( ari_decode_overflow_ivas_fx( &as ) ) @@ -112,8 +112,8 @@ static Word16 tcx_arith_decode_fx( #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ { #ifdef FIX_2402_DEBUGGING - printf("after overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH(as), as.low, as.value, bp); + printf( "after overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH( as ), as.low, as.value, bp ); #endif if ( LT_16( bp, target_bits ) ) /* safety check in case of bit errors */ { @@ -122,10 +122,11 @@ static Word16 tcx_arith_decode_fx( } BREAK; /* no bits left, so exit loop */ } - else { + else + { #ifdef FIX_2402_DEBUGGING - printf("after/else overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH(as), as.low, as.value, bp); + printf( "after/else overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", + HIGH( as ), as.low, as.value, bp ); #endif } } -- GitLab From 58aaaf8b413b193701560bbf99d32db171893144 Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 4 May 2026 13:55:06 +0200 Subject: [PATCH 18/22] removed debugging code, cleanup --- lib_com/options.h | 4 +- lib_dec/ari_dec_fx.c | 58 +++---------------- lib_dec/arith_coder_dec_fx.c | 24 +++----- lib_dec/igf_scf_dec_fx.c | 105 ----------------------------------- 4 files changed, 18 insertions(+), 173 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0f8330813..924f6d6b3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,9 +95,7 @@ #define SIMPLIFY_CORE_ENC /* VA: basop issue 2430: Simplify ivas_core_enc_fx() */ #define FIX_2402_SIMPLIFY_ARI_CODEC /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */ #define FIX_2402_INLINE_FCT_ARI_CODEC /* FhG: basop issue 2402: simplify processing in arithmetic decoding, inline mul_sbc_14bits, all BE */ -#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ -//#define FIX_2402_REPL_EVS_ARI_CODEC_DEC2 /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ -#define FIX_2402_REPL_EVS_ARI_CODEC_DEC3 /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder */ +#define FIX_2402_REPL_EVS_ARI_CODEC_DEC /* FhG: basop issue 2402: replace EVS arith decoder with IVAS arith decoder, except functions in igf_scf_dec_fx.c */ #define FIX_2402_SIGNED_VERSION /* FhG: basop issue 2402: use signed operator instead of unsigned, better match for hardware */ #define FIX_2402_REPL_EVS_ARI_CODEC_ENC /* FhG: basop issue 2402: replace EVS arith encoder with IVAS arith encoder */ #define FIX_BASOP_2551_HARM_SCALAR_QUAN /* FhG: issue 2551: Harmonize function pair tcx_scalar_quantization_fx*/ diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 286f3e4c1..7a2b7eccb 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -11,12 +11,6 @@ // #define FIX_2402_DEBUGGING -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 -#define HIGH( as ) ( ( as ).high + 1 ) -#else -#define HIGH( as ) ( ( as ).high ) -#endif - /*--------------------------------------------------------------- * Ari decode 14 bits routines -------------------------------------------------------------*/ @@ -49,7 +43,6 @@ Word32 ari_decode_overflow_ivas_fx( Tastat *s ) * \param[i/o] st * \param[o] s */ -#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) void ari_start_decoding_14bits_fx( Decoder_State *st, Tastat *s ) @@ -65,7 +58,6 @@ void ari_start_decoding_14bits_fx( s->value = val; move32(); } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ Word16 ari_start_decoding_14bits_prm_fx( const Word16 *ptr, /* Q0 */ @@ -198,7 +190,6 @@ static Word16 ari_lookup_s17_fx( } #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) static Word16 ari_lookup_s27_fx( Word32 cum, Word32 range, @@ -333,9 +324,7 @@ static Word16 ari_lookup_s27_fx( return extract_l( p - cum_freq ); #endif } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) static Word16 ari_lookup_bit_fx( Word32 cum, Word32 range, @@ -369,9 +358,7 @@ static Word16 ari_lookup_bit_fx( #endif return symbol; } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) static Word16 ari_decode_14bits_ext_fx( Decoder_State *st, Tastat *s, @@ -441,7 +428,6 @@ static Word16 ari_decode_14bits_ext_fx( return symbol; } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ /** @@ -457,18 +443,15 @@ Word16 ari_decode_14bits_s17_ext_fx( Decoder_State *st, Tastat *s, UWord16 const /** * \brief Only for 27 symbols with new extended Tables */ -#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) Word16 ari_decode_14bits_s27_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq ) { return ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_s27_fx ); } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ /** * \brief Only for decoding one bit with uniform probability: * the equivalent cum_freq table used is {16384, 8192, 0} */ -#if !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC ) || !defined( FIX_2402_REPL_EVS_ARI_CODEC_DEC2 ) Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s ) { static const UWord16 cum_freq[3] = { 16384, 8192, 0 }; @@ -477,9 +460,8 @@ Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s ) move16(); return ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_bit_fx ); } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { Word32 cum, range; @@ -573,9 +555,9 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) return symbol; } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_lookup_sign_fx( Tastat *s, Word16 base ) { Word32 cum, range; @@ -604,9 +586,9 @@ static Word16 ari_lookup_sign_fx( Tastat *s, Word16 base ) return symbol; } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_decode_14bits_notbl_fx( Word16 *ptr, /* Q0 */ Word16 bp, @@ -674,7 +656,7 @@ static Word16 ari_decode_14bits_notbl_fx( return bp; } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ /*------------------------------------------------------------------------ * Function: ari_decode_14bits_pow_fx @@ -689,16 +671,7 @@ static Word16 ari_decode_14bits_notbl_fx( Word16 ari_decode_14bits_pow_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s, Word16 base ) { /* There are two versions to call: pow_ivas or pow_fx (default) */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 - return ari_decode_14bits_pow_ivas( ptr, bp, bits, res, s, base ); -#else - Word16 ret = ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, base, ari_lookup_pow_fx ); -#ifdef FIX_2402_DEBUGGING - printf( "decode_14bits_pow() symb= %d\n", - *res ); -#endif - return ret; -#endif + return ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, base, ari_lookup_pow_fx ); } /*------------------------------------------------------------------------ @@ -708,15 +681,10 @@ Word16 ari_decode_14bits_pow_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *re *-------------------------------------------------------------------------*/ Word16 ari_decode_14bits_sign_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC return ari_decode_14bits_sign_ivas( ptr, bp, bits, res, s ); #else - Word16 ret = ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, 0, ari_lookup_sign_fx ); -#ifdef FIX_2402_DEBUGGING - printf( "decode_14bits_sign() symb= %d\n", - *res ); -#endif - return ret; + return ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, 0, ari_lookup_sign_fx ); #endif } @@ -904,10 +872,6 @@ Word16 ari_decode_14bits_pow_ivas( *res = symbol; move16(); -#ifdef FIX_2402_DEBUGGING - printf( "decode_14bits_pow() symb= %d\n", - symbol ); -#endif return bp; } @@ -1008,10 +972,6 @@ Word16 ari_decode_14bits_sign_ivas( *res = symbol; move16(); -#ifdef FIX_2402_DEBUGGING - printf( "decode_14bits_sign() symb= %d\n", - symbol - 1 ); -#endif return bp; } diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index ce52a3381..a86cd6d5c 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -11,14 +11,6 @@ #include "basop_util.h" #include "basop_proto_func.h" -// #define FIX_2402_DEBUGGING - -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 -#define HIGH( as ) ( ( as ).high + 1 ) -#else -#define HIGH( as ) ( ( as ).high ) -#endif - /* Returns: number of bits consumed */ static Word16 tcx_arith_decode_fx( Word16 L_frame, /* i : number of spectral lines Q0 */ @@ -39,11 +31,11 @@ static Word16 tcx_arith_decode_fx( Word64 W_tmp; move32(); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC bp = ari_start_decoding_14bits_prm_ivas_fx( prm, 0, &as ); #else bp = ari_start_decoding_14bits_prm_fx( prm, 0, &as ); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ #ifdef FIX_2402_DEBUGGING printf( "start_dec_14bits_prm() as.h,l,v= %d,%d,%d\n", HIGH( as ), as.low, as.value ); @@ -64,11 +56,11 @@ static Word16 tcx_arith_decode_fx( exp_k = round_fx( expfp( envelope[k], tmp ) ); } /* decode line magnitude */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC bp = ari_decode_14bits_pow_ivas( prm, bp, target_bits, &q, &as, exp_k ); #else bp = ari_decode_14bits_pow_fx( prm, bp, target_bits, &q, &as, exp_k ); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ #ifdef FIX_2402_DEBUGGING printf( "14bits_pow_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", HIGH( as ), as.low, as.value, bp ); @@ -81,12 +73,12 @@ static Word16 tcx_arith_decode_fx( } IF( q != 0 ) /* line is non-zero, decode sign */ { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC bp = ari_decode_14bits_sign_ivas( prm, bp, target_bits, &s, &as ); s -= 1; /* ivas returns 1 or 2, evs expects 0 or 1 */ #else bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as ); -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ #ifdef FIX_2402_DEBUGGING printf( "14bits_sign_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", HIGH( as ), as.low, as.value, bp ); @@ -105,11 +97,11 @@ static Word16 tcx_arith_decode_fx( printf( "before overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", HIGH( as ), as.low, as.value, bp ); #endif -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC3 +#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC IF( ari_decode_overflow_ivas_fx( &as ) ) #else IF( ari_decode_overflow_fx( &as ) ) -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC3 */ +#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ { #ifdef FIX_2402_DEBUGGING printf( "after overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index dc9878f0c..fbec73e72 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -68,12 +68,7 @@ static Word16 quant_ctx_fx( static Word16 arith_decode_bits_fx( IGFSCFDEC_INSTANCE_HANDLE hPrivateData, /* i/o: instance handle */ Decoder_State *st, /* i/o: pointer to bitstream decoder state */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - Word16 nBits, /* i : number of bits to decode */ - Word16 *extra_bits_read -#else Word16 nBits /* i : number of bits to decode */ -#endif ) { Word16 i; @@ -87,12 +82,7 @@ static Word16 arith_decode_bits_fx( { x = lshl( x, 1 ); /* decode one bit using the new raw AC function */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - static const UWord16 cum_freq[3] = { 16384, 8192, 0 }; - bit = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, cum_freq, extra_bits_read ); -#else bit = ari_decode_14bits_bit_ext_fx( st, &hPrivateData->acState ); -#endif if ( bit != 0 ) { x = s_or( x, 1 ); @@ -106,12 +96,7 @@ static Word16 arith_decode_residual_fx( IGFSCFDEC_INSTANCE_HANDLE hPrivateData, /* i/o: instance handle */ Decoder_State *st, /* i/o: pointer to decoder state */ const UWord16 *cumulativeFrequencyTable, /* i : cumulative frequency table to be used Q0 */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - Word16 tableOffset, /* i : offset used to align the table */ - Word16 *extra_bits_read -#else Word16 tableOffset /* i : offset used to align the table */ -#endif ) { Word16 val; @@ -120,11 +105,7 @@ static Word16 arith_decode_residual_fx( move16(); /* decode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - val = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, cumulativeFrequencyTable, extra_bits_read ); // Q0 -#else val = ari_decode_14bits_s27_ext_fx( st, &hPrivateData->acState, cumulativeFrequencyTable ); // Q0 -#endif /* meaning of the values of val: */ /* esc_{0} IGF_MIN_ENC_SEPARATE ... IGF_MAX_ENC_SEPARATE esc_{IGF_SYMBOLS_IN_TABLE - 1} */ @@ -141,27 +122,15 @@ static Word16 arith_decode_residual_fx( /* decode one of the tails of the distribution */ /* decode extra with 4 bits */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - extra = arith_decode_bits_fx( hPrivateData, st, 4, extra_bits_read ); // Q0 -#else extra = arith_decode_bits_fx( hPrivateData, st, 4 ); // Q0 -#endif IF( EQ_16( extra, 15 ) ) /* escape code 15 to indicate extra >= 15 */ { /* decode addtional extra with 6 bits */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - extra = arith_decode_bits_fx( hPrivateData, st, 6, extra_bits_read ); // Q0 -#else extra = arith_decode_bits_fx( hPrivateData, st, 6 ); // Q0 -#endif IF( EQ_16( extra, 63 ) ) /* escape code 63 to indicate extra >= 63 */ { /* decode safety extra with 7 bits */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - extra = arith_decode_bits_fx( hPrivateData, st, 7, extra_bits_read ); // Q0 -#else extra = arith_decode_bits_fx( hPrivateData, st, 7 ); // Q0 -#endif extra = add( 63, extra ); } extra = add( 15, extra ); // Q0 @@ -184,22 +153,10 @@ static Word16 arith_decode_residual_fx( } static void arith_decode_flush_fx( -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - Decoder_State *st, /* i/o: pointer to decoder state */ - Word16 *extra_bits_read -#else Decoder_State *st /* i/o: pointer to decoder state */ -#endif ) { -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - ivas_ari_done_decoding_14bits_ext_1_lfe( st, *extra_bits_read ); -#else -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - (void) extra_bits_read; /* remove warning */ -#endif get_next_indice_tmp_fx( st, -14 ); /* return back the least significant 14 bits to the bitstream */ -#endif return; } @@ -210,12 +167,7 @@ static void decode_sfe_vector_fx( Word16 t, /* i : counter reset to 0 at each independent block */ Word16 *prev_x, /* i : previous vector */ Word16 *x, /* o : current vector to decode */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - Word16 length, /* i : number of elements to decode */ - Word16 *extra_bits_read -#else Word16 length /* i : number of elements to decode */ -#endif ) { /* @@ -244,36 +196,19 @@ static void decode_sfe_vector_fx( /* (t == 0) && (f == 0) */ /* decode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ /* NOTE: the float equivalent uses a tmp variable + explicit cast here to avoid undefined behaviour here. This BASOP version does not need it as it already uses signed Word16 return value here. */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - res = ivas_ari_decode_14bits_bit_ext_1_lfe( st, &hPrivateData->acState, (const UWord16 *) hPrivateData->cf_se00, extra_bits_read ); // Q0 -#else res = ari_decode_14bits_s27_ext_fx( st, &hPrivateData->acState, (const UWord16 *) hPrivateData->cf_se00 ); -#endif -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - pred = arith_decode_bits_fx( hPrivateData, st, 2, extra_bits_read ); /* LSBs as 2 bit raw */ - x[f] = add( shl( res, 2 ), pred ); // Q0 -#else pred = arith_decode_bits_fx( hPrivateData, st, 2 ); /* LSBs as 2 bit raw */ x[f] = add( shl( res, 2 ), pred ); // Q0 -#endif move16(); } ELSE IF( EQ_16( f, 1 ) ) { /* (t == 0) && (f == 1) */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - res = arith_decode_residual_fx( hPrivateData, - st, - hPrivateData->cf_se01, - hPrivateData->cf_off_se01, - extra_bits_read ); -#else res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se01, hPrivateData->cf_off_se01 ); -#endif x[f] = add( x[0], res ); // Q0 move16(); /* f - increment is 0, pred = b */ } @@ -286,18 +221,10 @@ static void decode_sfe_vector_fx( index1 = L_mac0( ( IGF_SYMBOLS_IN_TABLE + 1 ) * IGF_CTX_OFFSET, ( IGF_SYMBOLS_IN_TABLE + 1 ), ctx ); /* index2 is IGF_CTX_OFFSET + ctx */ index2 = L_mac0( IGF_CTX_OFFSET, 1, ctx ); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - res = arith_decode_residual_fx( hPrivateData, - st, - hPrivateData->cf_se02 + index1, - hPrivateData->cf_off_se02[index2], - extra_bits_read ); -#else res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se02 + index1, hPrivateData->cf_off_se02[index2] ); -#endif x[f] = add( x[prev_offset], res ); // Q0 move16(); /* pred = b */ } @@ -308,18 +235,10 @@ static void decode_sfe_vector_fx( IF( f == 0 ) { /* (t == 1) && (f == 0) */ -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - res = arith_decode_residual_fx( hPrivateData, - st, - hPrivateData->cf_se10, - hPrivateData->cf_off_se10, - extra_bits_read ); -#else res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se10, hPrivateData->cf_off_se10 ); -#endif x[f] = add( prev_x[f], res ); // Q0 move16(); /* pred = a */ } @@ -340,18 +259,10 @@ static void decode_sfe_vector_fx( /* index2 is IGF_CTX_COUNT * (IGF_CTX_OFFSET + ctx_t) + (IGF_CTX_OFFSET + ctx_f) */ index2 = L_mac0( ( IGF_CTX_COUNT + 1 ) * IGF_CTX_OFFSET, IGF_CTX_COUNT, ctx_t ); index2 = L_mac0( index2, 1, ctx_f ); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - res = arith_decode_residual_fx( hPrivateData, - st, - hPrivateData->cf_se11 + index1, - hPrivateData->cf_off_se11[index2], - extra_bits_read ); -#else res = arith_decode_residual_fx( hPrivateData, st, hPrivateData->cf_se11 + index1, hPrivateData->cf_off_se11[index2] ); -#endif x[f] = add( pred, res ); // Q0 move16(); } @@ -409,15 +320,7 @@ void IGFSCFDecoderDecode( /* insert data */ hPublicData->bitsRead = st->next_bit_pos; move16(); -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - Word16 extra_bits_read = 0; - move16(); -#endif -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - ivas_ari_start_decoding_14bits_ext_1_lfe( st, &hPublicData->acState, &extra_bits_read ); -#else ari_start_decoding_14bits_fx( st, &hPublicData->acState ); /* start AC decoding */ -#endif /* check if coder needs a reset and do it if necessary */ IF( indepFlag != 0 ) @@ -426,17 +329,9 @@ void IGFSCFDecoderDecode( IGFSCFDecoderReset( hPublicData ); } -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC2 - decode_sfe_vector_fx( hPublicData, st, hPublicData->t, hPublicData->prev, sfe, hPublicData->scfCountLongBlock[igfGridIdx], - &extra_bits_read ); - - arith_decode_flush_fx( st, - &extra_bits_read ); /* finish AC decoding */ -#else decode_sfe_vector_fx( hPublicData, st, hPublicData->t, hPublicData->prev, sfe, hPublicData->scfCountLongBlock[igfGridIdx] ); arith_decode_flush_fx( st ); /* finish AC decoding */ -#endif /* advance history */ Copy( sfe, hPublicData->prev, hPublicData->scfCountLongBlock[igfGridIdx] ); -- GitLab From e40c771806808a8d6e550113523679a7c0e0b340 Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 4 May 2026 13:58:45 +0200 Subject: [PATCH 19/22] clang format --- lib_dec/igf_scf_dec_fx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index fbec73e72..660f43ada 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -68,7 +68,7 @@ static Word16 quant_ctx_fx( static Word16 arith_decode_bits_fx( IGFSCFDEC_INSTANCE_HANDLE hPrivateData, /* i/o: instance handle */ Decoder_State *st, /* i/o: pointer to bitstream decoder state */ - Word16 nBits /* i : number of bits to decode */ + Word16 nBits /* i : number of bits to decode */ ) { Word16 i; @@ -96,7 +96,7 @@ static Word16 arith_decode_residual_fx( IGFSCFDEC_INSTANCE_HANDLE hPrivateData, /* i/o: instance handle */ Decoder_State *st, /* i/o: pointer to decoder state */ const UWord16 *cumulativeFrequencyTable, /* i : cumulative frequency table to be used Q0 */ - Word16 tableOffset /* i : offset used to align the table */ + Word16 tableOffset /* i : offset used to align the table */ ) { Word16 val; @@ -123,11 +123,11 @@ static Word16 arith_decode_residual_fx( /* decode one of the tails of the distribution */ /* decode extra with 4 bits */ extra = arith_decode_bits_fx( hPrivateData, st, 4 ); // Q0 - IF( EQ_16( extra, 15 ) ) /* escape code 15 to indicate extra >= 15 */ + IF( EQ_16( extra, 15 ) ) /* escape code 15 to indicate extra >= 15 */ { /* decode addtional extra with 6 bits */ extra = arith_decode_bits_fx( hPrivateData, st, 6 ); // Q0 - IF( EQ_16( extra, 63 ) ) /* escape code 63 to indicate extra >= 63 */ + IF( EQ_16( extra, 63 ) ) /* escape code 63 to indicate extra >= 63 */ { /* decode safety extra with 7 bits */ extra = arith_decode_bits_fx( hPrivateData, st, 7 ); // Q0 @@ -167,7 +167,7 @@ static void decode_sfe_vector_fx( Word16 t, /* i : counter reset to 0 at each independent block */ Word16 *prev_x, /* i : previous vector */ Word16 *x, /* o : current vector to decode */ - Word16 length /* i : number of elements to decode */ + Word16 length /* i : number of elements to decode */ ) { /* -- GitLab From 73c015f424aa2b73bb2bc454aca78f5024a62838 Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 4 May 2026 14:17:34 +0200 Subject: [PATCH 20/22] removed macros to enable functions that were not needed previously --- lib_dec/ari_dec_fx.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 7a2b7eccb..482e97833 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -461,7 +461,6 @@ Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s ) return ari_decode_14bits_ext_fx( st, s, cum_freq, ari_lookup_bit_fx ); } -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { Word32 cum, range; @@ -555,9 +554,7 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) return symbol; } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_lookup_sign_fx( Tastat *s, Word16 base ) { Word32 cum, range; @@ -586,9 +583,7 @@ static Word16 ari_lookup_sign_fx( Tastat *s, Word16 base ) return symbol; } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifndef FIX_2402_REPL_EVS_ARI_CODEC_DEC static Word16 ari_decode_14bits_notbl_fx( Word16 *ptr, /* Q0 */ Word16 bp, @@ -656,7 +651,6 @@ static Word16 ari_decode_14bits_notbl_fx( return bp; } -#endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ /*------------------------------------------------------------------------ * Function: ari_decode_14bits_pow_fx -- GitLab From 500ada74f269845f60a519b54d8da79e1f3247bc Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 4 May 2026 15:03:31 +0200 Subject: [PATCH 21/22] removed DEBUGGING code --- lib_dec/ari_dec_fx.c | 2 -- lib_dec/arith_coder_dec_fx.c | 26 +------------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index 482e97833..68b8b79d4 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -9,8 +9,6 @@ #include "rom_com.h" #include "prot_fx.h" -// #define FIX_2402_DEBUGGING - /*--------------------------------------------------------------- * Ari decode 14 bits routines -------------------------------------------------------------*/ diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index a86cd6d5c..2cfbf7ee9 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -36,10 +36,6 @@ static Word16 tcx_arith_decode_fx( #else bp = ari_start_decoding_14bits_prm_fx( prm, 0, &as ); #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifdef FIX_2402_DEBUGGING - printf( "start_dec_14bits_prm() as.h,l,v= %d,%d,%d\n", - HIGH( as ), as.low, as.value ); -#endif tmp = sub( envelope_e, 1 + 15 ); W_tmp = 0; @@ -61,10 +57,6 @@ static Word16 tcx_arith_decode_fx( #else bp = ari_decode_14bits_pow_fx( prm, bp, target_bits, &q, &as, exp_k ); #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifdef FIX_2402_DEBUGGING - printf( "14bits_pow_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH( as ), as.low, as.value, bp ); -#endif IF( q == 0 ) { @@ -75,14 +67,10 @@ static Word16 tcx_arith_decode_fx( { #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC bp = ari_decode_14bits_sign_ivas( prm, bp, target_bits, &s, &as ); - s -= 1; /* ivas returns 1 or 2, evs expects 0 or 1 */ + s = sub( s, 1 ); /* ivas returns 1 or 2, evs expects 0 or 1 */ #else bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as ); #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ -#ifdef FIX_2402_DEBUGGING - printf( "14bits_sign_ivas() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH( as ), as.low, as.value, bp ); -#endif W_tmp = W_mac_16_16( W_tmp, q, k ); @@ -93,20 +81,12 @@ static Word16 tcx_arith_decode_fx( move32(); } -#ifdef FIX_2402_DEBUGGING - printf( "before overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH( as ), as.low, as.value, bp ); -#endif #ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC IF( ari_decode_overflow_ivas_fx( &as ) ) #else IF( ari_decode_overflow_fx( &as ) ) #endif /* FIX_2402_REPL_EVS_ARI_CODEC_DEC */ { -#ifdef FIX_2402_DEBUGGING - printf( "after overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH( as ), as.low, as.value, bp ); -#endif if ( LT_16( bp, target_bits ) ) /* safety check in case of bit errors */ { bp = -1; @@ -116,10 +96,6 @@ static Word16 tcx_arith_decode_fx( } else { -#ifdef FIX_2402_DEBUGGING - printf( "after/else overflow_() as.h,l,v= %d,%d,%d, bp=%d\n", - HIGH( as ), as.low, as.value, bp ); -#endif } } *q_spectrum_e = SPEC_EXP_DEC; -- GitLab From dff601f58cfbccb2ff5db0bdeacc97d72fa1a337 Mon Sep 17 00:00:00 2001 From: gerstack Date: Mon, 4 May 2026 15:15:00 +0200 Subject: [PATCH 22/22] additional clean-up --- lib_dec/arith_coder_dec_fx.c | 3 --- lib_dec/igf_scf_dec_fx.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index 2cfbf7ee9..b7d2636ac 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -94,9 +94,6 @@ static Word16 tcx_arith_decode_fx( } BREAK; /* no bits left, so exit loop */ } - else - { - } } *q_spectrum_e = SPEC_EXP_DEC; move16(); diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index 660f43ada..71a4b1e77 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -11,9 +11,6 @@ #include "prot_fx.h" #include "stat_dec.h" #include "basop_util.h" -#ifdef FIX_2402_REPL_EVS_ARI_CODEC_DEC -#include "ivas_prot_fx.h" -#endif /**********************************************************************/ /** initialization of an instance of this module -- GitLab