Loading lib_dec/ari_dec_fx.c +30 −6 Original line number Diff line number Diff line Loading @@ -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 -------------------------------------------------------------*/ Loading @@ -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 Loading Loading @@ -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 } Loading @@ -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 } Loading Loading @@ -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; } Loading Loading @@ -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; } lib_dec/arith_coder_dec_fx.c +35 −0 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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; Loading @@ -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 ) { Loading @@ -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 ); Loading @@ -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; Loading @@ -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(); Loading Loading
lib_dec/ari_dec_fx.c +30 −6 Original line number Diff line number Diff line Loading @@ -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 -------------------------------------------------------------*/ Loading @@ -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 Loading Loading @@ -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 } Loading @@ -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 } Loading Loading @@ -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; } Loading Loading @@ -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; }
lib_dec/arith_coder_dec_fx.c +35 −0 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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; Loading @@ -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 ) { Loading @@ -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 ); Loading @@ -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; Loading @@ -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(); Loading