Loading lib_com/ivas_arith_fx.c +84 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <stdint.h> #include "options.h" #include "options2.h" #include "wmc_auto.h" #include "prot_fx.h" #include "ivas_prot_fx.h" Loading Loading @@ -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, Loading Loading @@ -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() Loading lib_com/ivas_prot_fx.h +10 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ #include <stdint.h> #include "options.h" #include "options2.h" #include <stdio.h> #include "typedef.h" #include "stat_enc.h" Loading Loading @@ -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, Loading lib_com/options2.h +3 −22 Original line number Diff line number Diff line //#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 Loading
lib_com/ivas_arith_fx.c +84 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <stdint.h> #include "options.h" #include "options2.h" #include "wmc_auto.h" #include "prot_fx.h" #include "ivas_prot_fx.h" Loading Loading @@ -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, Loading Loading @@ -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() Loading
lib_com/ivas_prot_fx.h +10 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ #include <stdint.h> #include "options.h" #include "options2.h" #include <stdio.h> #include "typedef.h" #include "stat_enc.h" Loading Loading @@ -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, Loading
lib_com/options2.h +3 −22 Original line number Diff line number Diff line //#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