Commit 795fb29d authored by norvell's avatar norvell
Browse files

Merge branch 'ericsson/harmonize-duplicated-code' into 'main'

Add BASOP/Float alignment under HQ_ALIGN_DUPLICATED_CODE

See merge request !2864
parents 0e9941c4 0955267f
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2791,6 +2791,7 @@ void DoRTFTn_fx_ivas(
    return;
}

#ifndef HQ_ALIGN_DUPLICATED_CODE
void fft3_fx_ivas(
    const Word32 X[], // Qx
    Word32 Y[],       // Qx
@@ -3287,7 +3288,7 @@ void ifft3_fx_ivas(

    return;
}

#endif

static void rfft_post(
    const Word16 *sine_table, // Q15
+24 −0
Original line number Diff line number Diff line
@@ -2640,7 +2640,22 @@ void enforce_zero_for_min_envelope_fx(
    return;
}

#ifdef HQ_ALIGN_DUPLICATED_CODE
/*--------------------------------------------------------------------------*
 * apply_envelope()
 *
 * Apply spectral envelope without envelope adjustments and noisefill
 *--------------------------------------------------------------------------*/

void apply_envelope_enc_fx(
    const Word16 *coeff,     /* i  : Normalized spectrum                    Q12 */
    const Word16 *norm,      /* i  : Envelope                               Q0  */
    const Word16 num_sfm,    /* i  : Total number of bands                  Q0  */
    const Word16 *sfm_start, /* i  : Sub band start indices                 Q0  */
    const Word16 *sfm_end,   /* i  : Sub band end indices                   Q0  */
    Word32 *coeff_out        /* o  : scaled spectrum                        Q12 */
)
#else
/*--------------------------------------------------------------------------*
 * apply_envelope()
 *
@@ -2655,6 +2670,7 @@ void apply_envelope_enc_ivas_fx(
    const Word16 *sfm_end,   /* i  : Sub band end indices                   Q0  */
    Word32 *coeff_out        /* o  : coded/noisefilled spectrum             Q12 */
)
#endif
{
    Word16 i;
    Word16 sfm;
@@ -2680,11 +2696,19 @@ void apply_envelope_enc_ivas_fx(
}


#ifdef HQ_ALIGN_DUPLICATED_CODE
/*--------------------------------------------------------------------------*
 * apply_envelope_fx()
 *
 * Apply spectral envelope with envelope adjustments
 *--------------------------------------------------------------------------*/
#else
/*--------------------------------------------------------------------------*
 * apply_envelope()
 *
 * Apply spectral envelope with envelope adjustments
 *--------------------------------------------------------------------------*/
#endif

void apply_envelope_fx(
    const Word16 *coeff,     /* i/o: Coded/noisefilled normalized spectrum  Q12 */
+3 −2
Original line number Diff line number Diff line
@@ -2722,14 +2722,15 @@ void ivas_param_mc_metadata_open_fx(
    HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC                  /* o  : handle for the Parametric MC parameter coding state */
);

#ifndef HQ_ALIGN_DUPLICATED_CODE
Word16 mdct_classifier_ivas_fx(
    Encoder_State *st,                                          /* i/o: Encoder state variable                  */
    const Word16 *fft_buff,                                     /* i  : FFT spectrum from fft_rel               */
    const Word32 enerBuffer[],                                  /* i  : energy buffer                           */
    Word16 enerBuffer_exp,                                      /* i: enenrgy buffer exponent                   */
    Word16 enerBuffer_exp,                                      /* i  : energy buffer exponent                  */
    const Word32 brate                                          /* i  : current brate, IVAS: nominal bitrate, EVS: st->total_brate */
);

#endif

/*----------------------------------------------------------------------------------*
 * Range Coder prototypes
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@
#define HARM_2456_APPLY_SCALE                           /* FhG basop issue 2456: Harmonize apply_scale_ind(), apply_scale_ivas_fx() */
#define HARM_2454_TCX_RES_Q_SPEC                        /* FhG: harmonization of tcx_res_Q_spec_fx() and tcx_res_Q_spec_ivas_fx() */
#define FIX_FLOAT_1535_ARI_RES_Q_CLEANUP                /* FhG: remove dead code from tcx_ari_res_Q_spec() */
#define HQ_ALIGN_DUPLICATED_CODE                        /* Eri: Align duplicated code */
#define FIX_2467_RENAME_GSC_FUNCTION                    /* VA: basop issue 2467: Removal of unused function/table and renaming of _ivas_fx versions to default ones. */
#define HARMONIZE_FUNC                                  /* VA: basop issue 2460: Remove duplicated code: various functions */

+39 −1
Original line number Diff line number Diff line
@@ -735,6 +735,16 @@ void enforce_zero_for_min_envelope_fx(
    const Word16 *sfm_end    /* i  : Sub band end indices               Q0  */
);

#ifdef HQ_ALIGN_DUPLICATED_CODE
void apply_envelope_enc_fx(
    const Word16 *coeff,     /* i  : Normalized spectrum                    Q12 */
    const Word16 *norm,      /* i  : Envelope                               Q0  */
    const Word16 num_sfm,    /* i  : Total number of bands                  Q0  */
    const Word16 *sfm_start, /* i  : Sub band start indices                 Q0  */
    const Word16 *sfm_end,   /* i  : Sub band end indices                   Q0  */
    Word32 *coeff_out        /* o  : scaled spectrum                        Q12 */
);
#else
void apply_envelope_enc_ivas_fx(
    const Word16 *coeff,     /* i/o: Coded/noisefilled normalized spectrum  Q12 */
    const Word16 *norm,      /* i  : Envelope                               Q0  */
@@ -743,6 +753,7 @@ void apply_envelope_enc_ivas_fx(
    const Word16 *sfm_end,   /* i  : Sub band end indices                   Q0  */
    Word32 *coeff_out        /* o  : coded/noisefilled spectrum             Q12 */
);
#endif

void apply_envelope_fx(
    const Word16 *coeff,     /* i  : Coded/noisefilled normalized spectrum      Q12 */
@@ -4285,7 +4296,7 @@ void ifft3_fx(
    const Word16[],
    Word16[],
    const Word16 );

#ifndef HQ_ALIGN_DUPLICATED_CODE
void fft3_fx_ivas(
    const Word32 X[],
    Word32 Y[],
@@ -4294,6 +4305,7 @@ void ifft3_fx_ivas(
    const Word32 X[],
    Word32 Y[],
    const Word16 n );
#endif

void r_fft_fx_lc(
    const Word16 *phs_tbl,  /* i  : Table of phase            */
@@ -7601,6 +7613,31 @@ void stat_noise_uv_dec_fx(
    const Word16 uc_two_stage_flag /* i  : flag indicating two-stage UC                               */
);

#ifdef HQ_ALIGN_DUPLICATED_CODE
void stat_noise_uv_mod_fx(
    const Word16 element_mode, /* i  : element mode                                       */
    const Word16 coder_type,   /* i  : Coder type                                         */
    Word16 noisiness,          /* i  : noisiness parameter                            Q=0 */
    const Word16 *lsp_old,     /* i  : old LSP vector at 4th sfr                      Q=15*/
    const Word16 *lsp_new,     /* i  : LSP vector at 4th sfr                          Q=15*/
    const Word16 *lsp_mid,     /* i  : LSP vector at 2nd sfr                          Q=15*/
    Word16 *Aq,                /* o  : A(z)   quantized for the 4 subframes           Q=12*/
    Word16 *exc2,              /* i/o: excitation buffer                           Q=Q_exc*/
    Word16 *Q_exc,             /* i  : Q of exc2 excitation buffer [11..-1] expected      */
    const Word16 bfi,          /* i  : Bad frame indicator                                */
    Word32 *ge_sm,             /* i/o: smoothed excitation gain      Q=Q_stat_noise_ge (6)*/
    Word16 *uv_count,          /* i/o: unvoiced counter                                   */
    Word16 *act_count,         /* i/o: activation counter                                 */
    Word16 lspold_s[],         /* i/o: old LSP                                        Q=15*/
    Word16 *noimix_seed,       /* i/o: mixture seed                                 Q0    */
    Word16 *st_min_alpha,      /* i/o: minimum alpha                                  Q=15*/
    Word16 *exc_pe,            /* i/o: scale Q_stat_noise                   Q=Q_stat_noise*/
    const Word32 bitrate,      /* i  : core bitrate                                       */
    const Word16 bwidth_fx,    /* i  : i   bandwidth                                      */
    Word16 *Q_stat_noise,      /* i/o: noise scaling                                      */
    Word16 *Q_stat_noise_ge    /* i/o: noise scaling                                      */
);
#else
void stat_noise_uv_mod_fx(
    const Word16 coder_type, /* i  : Coder type                                   */
    Word16 noisiness,        /* i  : noisiness parameter                          Q0 */
@@ -7646,6 +7683,7 @@ void stat_noise_uv_mod_ivas_fx(
    Word16 *Q_stat_noise,    /* i/o: noise scaling                                      */
    Word16 *Q_stat_noise_ge  /* i/o: noise scaling                                      */
);
#endif

Word16 FEC_SinOnset_fx(
    Word16 *exc,          /* i/o : exc vector to modify                                           */
Loading