From 4a39e3c4b0fba5aee1b45025ca3e58bdad1440c6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 6 Feb 2026 18:36:55 +0100 Subject: [PATCH] FIX_2425_REMOVE_RC_DUPLICATES --- lib_com/options.h | 1 + lib_enc/prot_fx_enc.h | 9 ++++++--- lib_enc/pvq_core_enc_fx.c | 12 ++++++++++++ lib_enc/pvq_encode_fx.c | 9 +++++++++ lib_enc/range_enc_fx.c | 30 +++++++++++++++++++++++++++--- 5 files changed, 55 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 61a3c10cc..30fc4a8b1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -94,6 +94,7 @@ #define FIX_2404_HARM_SIGNAL_CLAS /* VA: basop-2404, harmonize signal_clas and signa_ivas_clas */ #define HARMONIZE_ACELP_ENC /* VA: basop issue 2400: Remove duplicated main ACELP encoder function */ #define FIX_2392_MSAN_DESTROY_DEC /* VA: basop issue 2392: fix MSAN in ivas_destroy_dec_fx() */ +#define FIX_2425_REMOVE_RC_DUPLICATES /* VA: basop issue 2425: Remove duplicated RC encoder functions */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 4310137b0..23752e9a9 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -4212,12 +4212,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 */ @@ -4226,6 +4227,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 */ @@ -4240,7 +4242,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 */ @@ -4255,13 +4257,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 47da82bec..67e9adb29 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 840455f72..d96f49439 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 0c465575b..52886cd55 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*/ -- GitLab