diff --git a/lib_com/options.h b/lib_com/options.h index 72cb319f05130aed0e4e24e318c2ef8c71368c43..2013cab1336efb53ff98d046796aba3c1349cfd5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -97,6 +97,7 @@ #define FIX_FLOAT_1522_LTV_MSAN_QMETADATA_ENC_EC3 /* Nokia: float issue 1522: fix uninit MSAN in EC3 of qmetadata encoding */ #define OPT_2416_ACELP_FAST /* VA: basop issue 2426, optimisation of acelp_fast_fx ( reduc. compl. by 0.35 wmops ) */ #define FIX_2410_HARM_MODIF_FS /* VA: basop issue 2410: Remove duplicated modif_Fs */ +#define FIX_2425_REMOVE_RC_DUPLICATES /* VA: basop issue 2425: Remove duplicated RC encoder functions */ #define HARM_LEV_DURBIN /* VA: basop issue 2423: harmonize levinson-Durbin algorithm */ #define HARMONIZE_TBE2 /* VA: basop issue 2399: Remove duplicated code: TBE, step 2 */ diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index ec0447a82a4f5f767f1d6ad600bffda3cf424ee5..6a126a71ca28615047ce21b969203a934bdd6884 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -4225,12 +4225,13 @@ void rc_enc_finish_fx( PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ ); +#ifndef FIX_2425_REMOVE_RC_DUPLICATES void rc_enc_finish_ivas_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ ); - +#endif void rc_encode_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -4239,6 +4240,7 @@ void rc_encode_fx( UWord32 tot /* i : Total cumulative frequency Q0*/ ); +#ifndef FIX_2425_REMOVE_RC_DUPLICATES void rc_encode_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -4253,7 +4255,7 @@ void rc_enc_uniform_ivas_fx( UWord32 value, /* i : Value to encode Q0*/ UWord32 tot /* i : Maximum value Q0*/ ); - +#endif void rc_enc_uniform_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -4268,13 +4270,14 @@ void rc_enc_bits_fx( Word16 bits /* i : Number of bits used Q0*/ ); +#ifndef FIX_2425_REMOVE_RC_DUPLICATES void rc_enc_bits_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ UWord32 value, /* i : Value to encode Q0*/ Word16 bits /* i : Number of bits used Q0*/ ); - +#endif void re8_compute_base_index_fx( const Word16 *x, /* i : Elemen of Q2, Q3 or Q4 */ const Word16 ka, /* i : Identifier of the absolute leader related to x */ diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index 47da82beca7737f0cbbbe73051dd5085ebae862e..67e9adb29d055c27174475b4156390b22d0dd0e8 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -351,7 +351,11 @@ void pvq_encode_frame_ivas_fx( } } +#ifdef FIX_2425_REMOVE_RC_DUPLICATES + rc_enc_finish_fx( hBstr, hPVQ ); +#else rc_enc_finish_ivas_fx( hBstr, hPVQ ); +#endif return; } @@ -977,7 +981,11 @@ static void densityIndexSymbolEncode_ivas_fx( } } +#ifdef FIX_2425_REMOVE_RC_DUPLICATES + rc_encode_fx( hBstr, hPVQ, cum_freq, sym_freq, tot ); +#else rc_encode_ivas_fx( hBstr, hPVQ, cum_freq, sym_freq, tot ); +#endif } return; @@ -1146,7 +1154,11 @@ static Word16 calc_pvq_splits_ivas_fx( /* o : Number of tmp = 1; move16(); } +#ifdef FIX_2425_REMOVE_RC_DUPLICATES + rc_enc_bits_fx( hBstr, hPVQ, tmp, 1 ); +#else rc_enc_bits_ivas_fx( hBstr, hPVQ, tmp, 1 ); +#endif Np = add( Np, tmp ); } } diff --git a/lib_enc/pvq_encode_fx.c b/lib_enc/pvq_encode_fx.c index 840455f72b43aecaffd5ed16ba30ce915f9812cc..d96f4943970cf185409c09d51772edfa7b8d79dd 100644 --- a/lib_enc/pvq_encode_fx.c +++ b/lib_enc/pvq_encode_fx.c @@ -365,10 +365,19 @@ void pvq_encode_ivas_fx( entry = mpvq_encode_vec_fx( y, dim, pulses ); /* send the short codeword(s) to the range encoder */ +#ifdef FIX_2425_REMOVE_RC_DUPLICATES + rc_enc_bits_fx( hBstr, hPVQ, UL_deposit_l( entry.lead_sign_ind ), 1 ); /* 0 or 1 */ +#else rc_enc_bits_ivas_fx( hBstr, hPVQ, UL_deposit_l( entry.lead_sign_ind ), 1 ); /* 0 or 1 */ +#endif + IF( NE_16( dim, 1 ) ) { +#ifdef FIX_2425_REMOVE_RC_DUPLICATES + rc_enc_uniform_fx( hBstr, hPVQ, entry.index, entry.size ); +#else rc_enc_uniform_ivas_fx( hBstr, hPVQ, entry.index, entry.size ); +#endif } return; diff --git a/lib_enc/range_enc_fx.c b/lib_enc/range_enc_fx.c index 0c465575b09842b81cfaf5c986d242b4738aec2c..52886cd55f725c5eba50e8dc0b9ddab98d4c5628 100644 --- a/lib_enc/range_enc_fx.c +++ b/lib_enc/range_enc_fx.c @@ -11,10 +11,16 @@ #include "prot_fx_enc.h" /* Function prototypes */ +/*-------------------------------------------------------------------* + * Local funtions declarations + *-------------------------------------------------------------------*/ + static void rc_enc_shift_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ ); static void rc_enc_write_fx( BSTR_ENC_HANDLE hBstr, Word16 byte, Word16 bits ); +#ifndef FIX_2425_REMOVE_RC_DUPLICATES static void rc_enc_shift_ivas_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ ); static void rc_enc_write_ivas_fx( BSTR_ENC_HANDLE hBstr, Word16 byte, Word16 bits ); +#endif /*-------------------------------------------------------------------* * rc_enc_init() @@ -51,6 +57,7 @@ void rc_enc_init_fx( * * Encode symbol with range coder *-------------------------------------------------------------------*/ +#ifndef FIX_2425_REMOVE_RC_DUPLICATES void rc_encode_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -89,6 +96,8 @@ void rc_encode_ivas_fx( return; } +#endif + void rc_encode_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -131,10 +140,11 @@ void rc_encode_fx( * * Finalize range coder *-------------------------------------------------------------------*/ + +#ifndef FIX_2425_REMOVE_RC_DUPLICATES void rc_enc_finish_ivas_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ - ) { UWord32 val, mask, high; @@ -215,6 +225,8 @@ void rc_enc_finish_ivas_fx( return; } +#endif + void rc_enc_finish_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ @@ -304,9 +316,10 @@ void rc_enc_finish_fx( * * Shift a byte out to bitstream *-------------------------------------------------------------------*/ +#ifndef FIX_2425_REMOVE_RC_DUPLICATES static void rc_enc_shift_ivas_fx( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ + PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ ) { test(); @@ -338,6 +351,8 @@ static void rc_enc_shift_ivas_fx( move32(); return; } +#endif + static void rc_enc_shift_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */ @@ -376,6 +391,7 @@ static void rc_enc_shift_fx( * * *-------------------------------------------------------------------*/ +#ifndef FIX_2425_REMOVE_RC_DUPLICATES void rc_enc_bits_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -409,6 +425,8 @@ void rc_enc_bits_ivas_fx( return; } +#endif + void rc_enc_bits_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -445,6 +463,7 @@ void rc_enc_bits_fx( * * Encode with uniform distribution *-------------------------------------------------------------------*/ +#ifndef FIX_2425_REMOVE_RC_DUPLICATES void rc_enc_uniform_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -469,6 +488,8 @@ void rc_enc_uniform_ivas_fx( return; } +#endif + void rc_enc_uniform_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */ @@ -499,6 +520,7 @@ void rc_enc_uniform_fx( * * Write a byte to bitstream *-------------------------------------------------------------------*/ +#ifndef FIX_2425_REMOVE_RC_DUPLICATES static void rc_enc_write_ivas_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 byte, /* i : Byte to write Q0*/ @@ -509,6 +531,8 @@ static void rc_enc_write_ivas_fx( return; } +#endif + static void rc_enc_write_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ Word16 byte, /* i : Byte to write Q0*/