Loading lib_com/ari_fx.c +7 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ #include "prot_fx.h" #include "cnst.h" #ifndef FIX_2402_SIMPLIFY_ARI_CODEC /** * \brief 31x16 Bit multiply (x*y) * Loading @@ -26,6 +28,7 @@ Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y ) return z; } #endif /*--------------------------------------------------------------- Ari 14 bits common routines Loading @@ -39,6 +42,9 @@ Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y ) * * \return r*c */ #ifndef FIX_2402_INLINE_FCT_ARI_CODEC /* Note: moved to proto_fx.h */ Word32 mul_sbc_14bits( Word32 r, /* Q0 */ Word16 c /* Q0 */ Loading @@ -57,3 +63,4 @@ Word32 mul_sbc_14bits( return ( ret ); } #endif lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ #define HARMONIZE_2499_CONFIGUREFDCNGDEC /* FhG: basop issue 2499: harmonoize configureFdCngDec */ #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_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*/ #define HARMONIZE_2543_SQ_gain /* FhG: Harmonize SQ_gain */ Loading lib_com/prot_fx.h +52 −0 Original line number Diff line number Diff line Loading @@ -5172,15 +5172,51 @@ Word16 IGFCommonFuncsIGFGetCFTables_fx( const Word16 **cf_off_se11 /* o : offsets for CF tables above */ ); #ifndef FIX_2402_SIMPLIFY_ARI_CODEC Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y ); #endif #ifndef FIX_2402_INLINE_FCT_ARI_CODEC Word32 mul_sbc_14bits( Word32 r, /* Q0 */ Word16 c /* Q0 */ ); #else /** * \brief Integer Multiply * * \param[i] r * \param[i] c * * \return r*c */ static inline Word32 mul_sbc_14bits( Word32 r, /* Q0 */ Word16 c /* Q0 */ ); static inline Word32 mul_sbc_14bits( Word32 r, /* Q0 */ Word16 c /* Q0 */ ) { /* Note: moved from ari_fx.c to allow inlining */ Word32 ret; /* temp = (((int32) r)*((int32) c))>>stat_bitsnew; */ assert( stat_bitsnew == 14 ); ret = Mpy_32_16_1( L_shl( r, 15 - stat_bitsnew ), c ); /*assert( (((int) r)*((int) c))>>stat_bitsnew == ret);*/ return ( ret ); } #endif void ham_cos_window( Word16 *fh, Loading Loading @@ -8615,7 +8651,11 @@ void ivas_mdct_core_reconstruct_fx( Word16 q_x, Word16 e_sig[CPE_CHANNELS] ); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC void ari_start_encoding_14bits_fx( #else void ari_start_encoding_14bits_ivas_fx( #endif Tastat *s ); void tcx_scalar_quantization_ivas_fx( Loading Loading @@ -9628,7 +9668,11 @@ void IGFSaveSpectrumForITF_ivas_fx( const Word32 *pITFSpectrum, /* i : MDCT spectrum */ Word16 exp_pITFSpectrum ); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_ext_fx( #else Word16 ari_encode_14bits_ext_ivas_fx( #endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Tastat *s, Loading @@ -9636,7 +9680,11 @@ Word16 ari_encode_14bits_ext_ivas_fx( UWord16 const *cum_freq /* Q0 */ ); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_sign_fx( #else Word16 ari_encode_14bits_sign_ivas_fx( #endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Word32 bits, /* Q0 */ Loading @@ -9644,7 +9692,11 @@ Word16 ari_encode_14bits_sign_ivas_fx( Word16 sign /* Q0 */ ); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_done_encoding_14bits_fx( #else Word16 ari_done_encoding_14bits_ivas_fx( #endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Tastat *s ); Loading lib_dec/ari_dec_fx.c +110 −3 Original line number Diff line number Diff line Loading @@ -13,9 +13,23 @@ * Ari decode 14 bits routines -------------------------------------------------------------*/ #ifdef FIX_2402_SIMPLIFY_ARI_CODEC static Word32 L_msui_32_16( Word32 cum, Word32 range, Word16 cum_freq ) { /* WMOPS counting is done using L_sub, similar to other MSU operations */ /* Note: range*cum_freq do never exceed signed 32-bit, when multiplied */ /* Note: No overflow or saturation feature required. */ return L_sub( cum, range * cum_freq ); } #endif 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 } /** Loading Loading @@ -77,9 +91,11 @@ static Word16 ari_lookup_s17_fx( UWord16 const *cum_freq /* Q0 */ ) { Word32 tmp; const UWord16 *p; #ifndef FIX_2402_SIMPLIFY_ARI_CODEC Word32 tmp; Word16 range_l, range_h; #endif p = cum_freq; Loading @@ -88,6 +104,7 @@ static Word16 ari_lookup_s17_fx( /* tmp_p = p+8; if (tmp_p[0]*range>cum) p = tmp_p; */ /* max value in p[x] is 16384 => 14 bits */ #ifndef FIX_2402_SIMPLIFY_ARI_CODEC range_l = extract_l( L_and( range, 0x7FFF ) ); range_h = extract_l( L_shr( range, 15 ) ); Loading Loading @@ -122,6 +139,33 @@ static Word16 ari_lookup_s17_fx( p = p + 1; } } #else if ( L_msui_32_16( cum, range, p[8] ) < 0 ) { p = p + 8; move16(); } if ( L_msui_32_16( cum, range, p[4] ) < 0 ) { p = p + 4; move16(); } if ( L_msui_32_16( cum, range, p[2] ) < 0 ) { p = p + 2; move16(); } if ( L_msui_32_16( cum, range, p[1] ) < 0 ) { p = p + 1; move16(); IF( EQ_32( (Word32) ( &cum_freq[15] - p ), 0 ) && ( L_msui_32_16( cum, range, p[1] ) < 0 ) ) { p = p + 1; move16(); } } #endif /* return extract_l(L_shr(L_sub((Word32)p,(Word32)cum_freq),1)); */ L_sub( 0, 0 ); Loading @@ -135,6 +179,7 @@ static Word16 ari_lookup_s27_fx( UWord16 const *cum_freq /* Q0 */ ) { #ifndef FIX_2402_SIMPLIFY_ARI_CODEC Word32 tmp; Word16 range_l, range_h; Word16 il, ih, im; Loading Loading @@ -226,6 +271,41 @@ static Word16 ari_lookup_s27_fx( } return il; #else const UWord16 *p = cum_freq; if ( L_msui_32_16( cum, range, p[11] ) < 0 ) { p = p + 11; move16(); } if ( L_msui_32_16( cum, range, p[8] ) < 0 ) { p = p + 8; move16(); } if ( L_msui_32_16( cum, range, p[4] ) < 0 ) { p = p + 4; move16(); } if ( L_msui_32_16( cum, range, p[2] ) < 0 ) { p = p + 2; move16(); } if ( L_msui_32_16( cum, range, p[1] ) < 0 ) { p = p + 1; move16(); } /* return extract_l(L_shr(L_sub((Word32)p,(Word32)cum_freq),1)); */ L_sub( 0, 0 ); L_shr( 0, 0 ); /* pointer subtraction */ return extract_l( p - cum_freq ); #endif } static Word16 ari_lookup_bit_fx( Loading @@ -234,11 +314,12 @@ static Word16 ari_lookup_bit_fx( UWord16 const *cum_freq /* Q0 */ ) { Word16 symbol = 0; /* initialize just to avoid compiler warning */ Word16 symbol = 0; move16(); (void) cum_freq; #ifndef FIX_2402_SIMPLIFY_ARI_CODEC range = L_shl( range, 13 ); /* L_multi31x16_X2(range_h, range_l, 8192) */ cum = L_sub( range, cum ); Loading @@ -252,7 +333,12 @@ static Word16 ari_lookup_bit_fx( symbol = 0; move16(); } #else if ( L_msui_32_16( cum, range, 8192 ) < 0 ) { symbol = add( symbol, 1 ); /* symbol = 1 */ } #endif return symbol; } Loading Loading @@ -280,11 +366,15 @@ static Word16 ari_decode_14bits_ext_fx( range = L_sub( high, low ); cum = L_add( L_shl( L_sub( value, low ), stat_bitsnew ), sub( shl( 1, stat_bitsnew ), 1 ) ); #ifndef FIX_2402_SIMPLIFY_ARI_CODEC if ( cum < 0 ) { cum = 0x7fffffff; move32(); } #else assert( cum >= 0 ); #endif symbol = lookup_fn( cum, range, cum_freq ); Loading Loading @@ -356,7 +446,9 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { Word32 cum, range; Word16 symbol; #ifndef FIX_2402_SIMPLIFY_ARI_CODEC Word16 range_h, range_l; #endif Word16 pows[12]; /* "base" to the power of 2, 4, 8,... 2^12 */ Word16 lowlim, highlim, testval; Word16 k; Loading @@ -364,8 +456,10 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) range = L_sub( s->high, s->low ); cum = L_add( L_shl( L_sub( s->value, s->low ), stat_bitsnew ), ( ( 1 << stat_bitsnew ) - 1 ) ); #ifndef FIX_2402_SIMPLIFY_ARI_CODEC range_h = extract_l( L_shr( range, 15 ) ); range_l = extract_l( L_and( range, 0x7FFF ) ); #endif symbol = 0; move16(); Loading @@ -374,7 +468,11 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) move16(); /* search for the interval where "cum" fits */ #ifdef FIX_2402_SIMPLIFY_ARI_CODEC IF( L_msui_32_16( cum, range, lowlim ) < 0 ) /* below pow-1 */ #else IF( GT_32( L_multi31x16_X2( range_h, range_l, lowlim ), cum ) ) /* below pow-1 */ #endif { pows[0] = base; move16(); Loading @@ -389,7 +487,11 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) move16(); testval = mult_r( pows[k], base ); #ifdef FIX_2402_SIMPLIFY_ARI_CODEC IF( L_msui_32_16( cum, range, shr( testval, 1 ) ) >= 0 ) #else IF( LE_32( L_multi31x16_X2( range_h, range_l, shr( testval, 1 ) ), cum ) ) /* found! big range is [lowlim,testval], (now narrow it down) */ #endif { lowlim = testval; move16(); Loading @@ -405,7 +507,11 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { testval = mult_r( highlim, pows[k + 1] ); #ifdef FIX_2402_SIMPLIFY_ARI_CODEC IF( L_msui_32_16( cum, range, shr( testval, 1 ) ) >= 0 ) #else IF( LE_32( L_multi31x16_X2( range_h, range_l, shr( testval, 1 ) ), cum ) ) #endif { lowlim = testval; move16(); Loading Loading @@ -539,6 +645,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) */ return ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, base, ari_lookup_pow_fx ); } Loading lib_enc/ACcontextMapping_enc_fx.c +12 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,11 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( CONTEXT_HM_CONFIG *hm_cfg ) { Word16 ptr[BITBUFSIZE]; #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Tastat as, as_overflow; #else TastatEnc as, as_overflow; #endif Word16 bp, bp_overflow; Word16 a1, b1, a1_i, b1_i, k; Word16 t, pki, lev1; Loading Loading @@ -219,7 +223,6 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( pki = ari_lookup_s17_LC[tmp]; /* Q0 */ move16(); bp = ari_encode_14bits_ext_fx( ptr, bp, &as, VAL_ESC, ari_pk_s17_LC_ext[pki] ); /* Q0 */ *lsbs_bits2-- = s_and( a1, 1 ); move16(); *lsbs_bits2-- = s_and( b1, 1 ); Loading @@ -241,7 +244,11 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( bp = ari_encode_14bits_ext_fx( ptr, bp, &as, add( a1, shl( b1, A_THRES_SHIFT ) ), ari_pk_s17_LC_ext[pki] ); /* Q0 */ /* Check bit budget */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC IF( GT_16( add( add( add( bp, extract_l( as.bits_to_follow ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) #else IF( GT_16( add( add( add( bp, extract_l( as.value ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) #endif { ari_copy_states_fx( &as_overflow, &as ); bp = bp_overflow; /* Q0 */ Loading Loading @@ -271,7 +278,11 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( move16(); bp = ari_encode_14bits_ext_fx( ptr, bp, &as, 0, ari_pk_s17_LC_ext[pki] ); /* Q0 */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC IF( GT_16( add( add( add( bp, extract_l( as.bits_to_follow ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) #else IF( GT_16( add( add( add( bp, extract_l( as.value ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) #endif { ari_copy_states_fx( &as_overflow, &as ); bp = bp_overflow; /* Q0 */ Loading Loading
lib_com/ari_fx.c +7 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ #include "prot_fx.h" #include "cnst.h" #ifndef FIX_2402_SIMPLIFY_ARI_CODEC /** * \brief 31x16 Bit multiply (x*y) * Loading @@ -26,6 +28,7 @@ Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y ) return z; } #endif /*--------------------------------------------------------------- Ari 14 bits common routines Loading @@ -39,6 +42,9 @@ Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y ) * * \return r*c */ #ifndef FIX_2402_INLINE_FCT_ARI_CODEC /* Note: moved to proto_fx.h */ Word32 mul_sbc_14bits( Word32 r, /* Q0 */ Word16 c /* Q0 */ Loading @@ -57,3 +63,4 @@ Word32 mul_sbc_14bits( return ( ret ); } #endif
lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ #define HARMONIZE_2499_CONFIGUREFDCNGDEC /* FhG: basop issue 2499: harmonoize configureFdCngDec */ #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_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*/ #define HARMONIZE_2543_SQ_gain /* FhG: Harmonize SQ_gain */ Loading
lib_com/prot_fx.h +52 −0 Original line number Diff line number Diff line Loading @@ -5172,15 +5172,51 @@ Word16 IGFCommonFuncsIGFGetCFTables_fx( const Word16 **cf_off_se11 /* o : offsets for CF tables above */ ); #ifndef FIX_2402_SIMPLIFY_ARI_CODEC Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y ); #endif #ifndef FIX_2402_INLINE_FCT_ARI_CODEC Word32 mul_sbc_14bits( Word32 r, /* Q0 */ Word16 c /* Q0 */ ); #else /** * \brief Integer Multiply * * \param[i] r * \param[i] c * * \return r*c */ static inline Word32 mul_sbc_14bits( Word32 r, /* Q0 */ Word16 c /* Q0 */ ); static inline Word32 mul_sbc_14bits( Word32 r, /* Q0 */ Word16 c /* Q0 */ ) { /* Note: moved from ari_fx.c to allow inlining */ Word32 ret; /* temp = (((int32) r)*((int32) c))>>stat_bitsnew; */ assert( stat_bitsnew == 14 ); ret = Mpy_32_16_1( L_shl( r, 15 - stat_bitsnew ), c ); /*assert( (((int) r)*((int) c))>>stat_bitsnew == ret);*/ return ( ret ); } #endif void ham_cos_window( Word16 *fh, Loading Loading @@ -8615,7 +8651,11 @@ void ivas_mdct_core_reconstruct_fx( Word16 q_x, Word16 e_sig[CPE_CHANNELS] ); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC void ari_start_encoding_14bits_fx( #else void ari_start_encoding_14bits_ivas_fx( #endif Tastat *s ); void tcx_scalar_quantization_ivas_fx( Loading Loading @@ -9628,7 +9668,11 @@ void IGFSaveSpectrumForITF_ivas_fx( const Word32 *pITFSpectrum, /* i : MDCT spectrum */ Word16 exp_pITFSpectrum ); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_ext_fx( #else Word16 ari_encode_14bits_ext_ivas_fx( #endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Tastat *s, Loading @@ -9636,7 +9680,11 @@ Word16 ari_encode_14bits_ext_ivas_fx( UWord16 const *cum_freq /* Q0 */ ); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_encode_14bits_sign_fx( #else Word16 ari_encode_14bits_sign_ivas_fx( #endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Word32 bits, /* Q0 */ Loading @@ -9644,7 +9692,11 @@ Word16 ari_encode_14bits_sign_ivas_fx( Word16 sign /* Q0 */ ); #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Word16 ari_done_encoding_14bits_fx( #else Word16 ari_done_encoding_14bits_ivas_fx( #endif Word16 *ptr, /* Q0 */ Word16 bp, /* Q0 */ Tastat *s ); Loading
lib_dec/ari_dec_fx.c +110 −3 Original line number Diff line number Diff line Loading @@ -13,9 +13,23 @@ * Ari decode 14 bits routines -------------------------------------------------------------*/ #ifdef FIX_2402_SIMPLIFY_ARI_CODEC static Word32 L_msui_32_16( Word32 cum, Word32 range, Word16 cum_freq ) { /* WMOPS counting is done using L_sub, similar to other MSU operations */ /* Note: range*cum_freq do never exceed signed 32-bit, when multiplied */ /* Note: No overflow or saturation feature required. */ return L_sub( cum, range * cum_freq ); } #endif 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 } /** Loading Loading @@ -77,9 +91,11 @@ static Word16 ari_lookup_s17_fx( UWord16 const *cum_freq /* Q0 */ ) { Word32 tmp; const UWord16 *p; #ifndef FIX_2402_SIMPLIFY_ARI_CODEC Word32 tmp; Word16 range_l, range_h; #endif p = cum_freq; Loading @@ -88,6 +104,7 @@ static Word16 ari_lookup_s17_fx( /* tmp_p = p+8; if (tmp_p[0]*range>cum) p = tmp_p; */ /* max value in p[x] is 16384 => 14 bits */ #ifndef FIX_2402_SIMPLIFY_ARI_CODEC range_l = extract_l( L_and( range, 0x7FFF ) ); range_h = extract_l( L_shr( range, 15 ) ); Loading Loading @@ -122,6 +139,33 @@ static Word16 ari_lookup_s17_fx( p = p + 1; } } #else if ( L_msui_32_16( cum, range, p[8] ) < 0 ) { p = p + 8; move16(); } if ( L_msui_32_16( cum, range, p[4] ) < 0 ) { p = p + 4; move16(); } if ( L_msui_32_16( cum, range, p[2] ) < 0 ) { p = p + 2; move16(); } if ( L_msui_32_16( cum, range, p[1] ) < 0 ) { p = p + 1; move16(); IF( EQ_32( (Word32) ( &cum_freq[15] - p ), 0 ) && ( L_msui_32_16( cum, range, p[1] ) < 0 ) ) { p = p + 1; move16(); } } #endif /* return extract_l(L_shr(L_sub((Word32)p,(Word32)cum_freq),1)); */ L_sub( 0, 0 ); Loading @@ -135,6 +179,7 @@ static Word16 ari_lookup_s27_fx( UWord16 const *cum_freq /* Q0 */ ) { #ifndef FIX_2402_SIMPLIFY_ARI_CODEC Word32 tmp; Word16 range_l, range_h; Word16 il, ih, im; Loading Loading @@ -226,6 +271,41 @@ static Word16 ari_lookup_s27_fx( } return il; #else const UWord16 *p = cum_freq; if ( L_msui_32_16( cum, range, p[11] ) < 0 ) { p = p + 11; move16(); } if ( L_msui_32_16( cum, range, p[8] ) < 0 ) { p = p + 8; move16(); } if ( L_msui_32_16( cum, range, p[4] ) < 0 ) { p = p + 4; move16(); } if ( L_msui_32_16( cum, range, p[2] ) < 0 ) { p = p + 2; move16(); } if ( L_msui_32_16( cum, range, p[1] ) < 0 ) { p = p + 1; move16(); } /* return extract_l(L_shr(L_sub((Word32)p,(Word32)cum_freq),1)); */ L_sub( 0, 0 ); L_shr( 0, 0 ); /* pointer subtraction */ return extract_l( p - cum_freq ); #endif } static Word16 ari_lookup_bit_fx( Loading @@ -234,11 +314,12 @@ static Word16 ari_lookup_bit_fx( UWord16 const *cum_freq /* Q0 */ ) { Word16 symbol = 0; /* initialize just to avoid compiler warning */ Word16 symbol = 0; move16(); (void) cum_freq; #ifndef FIX_2402_SIMPLIFY_ARI_CODEC range = L_shl( range, 13 ); /* L_multi31x16_X2(range_h, range_l, 8192) */ cum = L_sub( range, cum ); Loading @@ -252,7 +333,12 @@ static Word16 ari_lookup_bit_fx( symbol = 0; move16(); } #else if ( L_msui_32_16( cum, range, 8192 ) < 0 ) { symbol = add( symbol, 1 ); /* symbol = 1 */ } #endif return symbol; } Loading Loading @@ -280,11 +366,15 @@ static Word16 ari_decode_14bits_ext_fx( range = L_sub( high, low ); cum = L_add( L_shl( L_sub( value, low ), stat_bitsnew ), sub( shl( 1, stat_bitsnew ), 1 ) ); #ifndef FIX_2402_SIMPLIFY_ARI_CODEC if ( cum < 0 ) { cum = 0x7fffffff; move32(); } #else assert( cum >= 0 ); #endif symbol = lookup_fn( cum, range, cum_freq ); Loading Loading @@ -356,7 +446,9 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { Word32 cum, range; Word16 symbol; #ifndef FIX_2402_SIMPLIFY_ARI_CODEC Word16 range_h, range_l; #endif Word16 pows[12]; /* "base" to the power of 2, 4, 8,... 2^12 */ Word16 lowlim, highlim, testval; Word16 k; Loading @@ -364,8 +456,10 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) range = L_sub( s->high, s->low ); cum = L_add( L_shl( L_sub( s->value, s->low ), stat_bitsnew ), ( ( 1 << stat_bitsnew ) - 1 ) ); #ifndef FIX_2402_SIMPLIFY_ARI_CODEC range_h = extract_l( L_shr( range, 15 ) ); range_l = extract_l( L_and( range, 0x7FFF ) ); #endif symbol = 0; move16(); Loading @@ -374,7 +468,11 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) move16(); /* search for the interval where "cum" fits */ #ifdef FIX_2402_SIMPLIFY_ARI_CODEC IF( L_msui_32_16( cum, range, lowlim ) < 0 ) /* below pow-1 */ #else IF( GT_32( L_multi31x16_X2( range_h, range_l, lowlim ), cum ) ) /* below pow-1 */ #endif { pows[0] = base; move16(); Loading @@ -389,7 +487,11 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) move16(); testval = mult_r( pows[k], base ); #ifdef FIX_2402_SIMPLIFY_ARI_CODEC IF( L_msui_32_16( cum, range, shr( testval, 1 ) ) >= 0 ) #else IF( LE_32( L_multi31x16_X2( range_h, range_l, shr( testval, 1 ) ), cum ) ) /* found! big range is [lowlim,testval], (now narrow it down) */ #endif { lowlim = testval; move16(); Loading @@ -405,7 +507,11 @@ static Word16 ari_lookup_pow_fx( Tastat *s, Word16 base ) { testval = mult_r( highlim, pows[k + 1] ); #ifdef FIX_2402_SIMPLIFY_ARI_CODEC IF( L_msui_32_16( cum, range, shr( testval, 1 ) ) >= 0 ) #else IF( LE_32( L_multi31x16_X2( range_h, range_l, shr( testval, 1 ) ), cum ) ) #endif { lowlim = testval; move16(); Loading Loading @@ -539,6 +645,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) */ return ari_decode_14bits_notbl_fx( ptr, bp, bits, res, s, base, ari_lookup_pow_fx ); } Loading
lib_enc/ACcontextMapping_enc_fx.c +12 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,11 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( CONTEXT_HM_CONFIG *hm_cfg ) { Word16 ptr[BITBUFSIZE]; #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC Tastat as, as_overflow; #else TastatEnc as, as_overflow; #endif Word16 bp, bp_overflow; Word16 a1, b1, a1_i, b1_i, k; Word16 t, pki, lev1; Loading Loading @@ -219,7 +223,6 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( pki = ari_lookup_s17_LC[tmp]; /* Q0 */ move16(); bp = ari_encode_14bits_ext_fx( ptr, bp, &as, VAL_ESC, ari_pk_s17_LC_ext[pki] ); /* Q0 */ *lsbs_bits2-- = s_and( a1, 1 ); move16(); *lsbs_bits2-- = s_and( b1, 1 ); Loading @@ -241,7 +244,11 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( bp = ari_encode_14bits_ext_fx( ptr, bp, &as, add( a1, shl( b1, A_THRES_SHIFT ) ), ari_pk_s17_LC_ext[pki] ); /* Q0 */ /* Check bit budget */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC IF( GT_16( add( add( add( bp, extract_l( as.bits_to_follow ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) #else IF( GT_16( add( add( add( bp, extract_l( as.value ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) #endif { ari_copy_states_fx( &as_overflow, &as ); bp = bp_overflow; /* Q0 */ Loading Loading @@ -271,7 +278,11 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( move16(); bp = ari_encode_14bits_ext_fx( ptr, bp, &as, 0, ari_pk_s17_LC_ext[pki] ); /* Q0 */ #ifdef FIX_2402_REPL_EVS_ARI_CODEC_ENC IF( GT_16( add( add( add( bp, extract_l( as.bits_to_follow ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) #else IF( GT_16( add( add( add( bp, extract_l( as.value ) ), nbbits_signs ), nbbits_lsbs ), nbbits_m2 ) ) #endif { ari_copy_states_fx( &as_overflow, &as ); bp = bp_overflow; /* Q0 */ Loading