Commit 027f716b authored by vaclav's avatar vaclav
Browse files

Merge branch '2425-remove-duplicated-functions-rc-encoder' into 'main'

Remove duplicated functions: RC encoder

Closes #2425

See merge request !2805
parents 41a83928 e6a77329
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 */
#define HARM_FD_BWE                                     /* VA: harmonize core-coder FD BWE function duplications */
+6 −3
Original line number Diff line number Diff line
@@ -4217,12 +4217,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                     */
@@ -4231,6 +4232,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                     */
@@ -4245,7 +4247,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                    */
@@ -4260,13 +4262,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  */
+12 −0
Original line number Diff line number Diff line
@@ -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 );
        }
    }
+9 −0
Original line number Diff line number Diff line
@@ -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;
+27 −3
Original line number Diff line number Diff line
@@ -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,6 +316,7 @@ 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       */
@@ -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*/