Commit c07131a7 authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into basop-2364-harmonization-of-mult_harm

parents e4f6113a 7b81f265
Loading
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ void Comp_and_apply_gain_fx(

    return;
}
#ifndef FIX_2338_HARM_GSC_GAIN_COMP


void Comp_and_apply_gain_ivas_fx(
@@ -238,6 +239,7 @@ void Comp_and_apply_gain_ivas_fx(

    return;
}
#endif


/*========================================================================*/
@@ -258,7 +260,6 @@ void Comp_and_apply_gain_ivas_fx(
/* _ (Word32*) etmp14    : Energy band 14                  Q_exc_diff*2+1 */
/* _ (Word32*) etmp15    : Energy band 15                  Q_exc_diff*2+1 */
/*------------------------------------------------------------------------*/

/*------------------------------------------------------------------------*/
/* RETURN ARGUMENTS :                                                     */
/* _ None                                                                 */
@@ -285,6 +286,7 @@ static Word16 Comp_band_log_ener(
    return tmp16;
}


void Ener_per_band_comp_fx(
    const Word16 exc_diff_fx[], /* i  : target signal                     Q_exc_diff     */
    Word16 y_gain4_fx[],        /* o  : Energy per band to quantize       Q12            */
@@ -403,6 +405,7 @@ static void GSC_gain_adj(
    /* Gain adjustment to fit ACELP generic inactive coding gain at low rate */
    Word16 Gain_off, i;
    Word16 Fac_div;

    Fac_div = 102;
    move16();

@@ -540,6 +543,7 @@ Word16 gsc_gaindec_fx(
            idx_g_fx = (Word16) get_next_indice_fx( st_fx, 7 );
            VDQ_vec_fx( y_gainQ_fx + 6, Mean_dic_NB_fx + 6, Gain_dic3_NBHR_fx, idx_g_fx, 4 );
        }

        test();
        IF( LE_32( core_brate_fx, ACELP_9k60 ) && ( coder_type == INACTIVE ) )
        {
@@ -576,7 +580,9 @@ Word16 gsc_gaindec_fx(
             *--------------------------------------------------------------------------------------*/

            idx_g_fx = (Word16) get_next_indice_fx( st_fx, 5 );

            VDQ_vec_fx( y_gainQ_fx, YGain_mean_LR_fx, YGain_dic1_LR_fx, idx_g_fx, 3 );

            IF( !( coder_type == INACTIVE && st_fx->tdm_LRTD_flag == 0 && EQ_16( st_fx->idchan, 1 ) ) || GT_32( st_fx->core_brate, GSC_LRES_GAINQ_LIMIT ) )
            {
                idx_g_fx = (Word16) get_next_indice_fx( st_fx, 5 );
@@ -600,7 +606,9 @@ Word16 gsc_gaindec_fx(
                move16();
                y_gainQ_fx[11] = 0;
                move16();

                ifft_rel_fx( y_gainQ_fx + 8, 8, 3 );

                FOR( i = 8; i < 16; i++ )
                {
                    y_gainQ_fx[i] = round_fx( L_shl( L_mult( y_gainQ_fx[i], 23101 ), 1 ) ); /*Q12 */
+4 −2
Original line number Diff line number Diff line
@@ -1364,9 +1364,10 @@ void highband_exc_dct_in_ivas_fx(
            move16();
        }
    }

#ifndef FIX_2338_HARM_GSC_GAIN_COMP
    IF( EQ_16( element_mode, EVS_MONO ) )
    {
#endif
        Comp_and_apply_gain_fx( exc_diffQ, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 0, Qexc_diffQ, *Q_exc );

        IF( exc_wo_nf != NULL )
@@ -1374,6 +1375,7 @@ void highband_exc_dct_in_ivas_fx(
            Comp_and_apply_gain_fx( exc_wo_nf, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 1, Qexc_diffQ, *Q_exc );
            Vr_add( exc_dct_in, exc_wo_nf, exc_wo_nf, L_frame );
        }
#ifndef FIX_2338_HARM_GSC_GAIN_COMP
    }
    ELSE
    {
@@ -1404,7 +1406,7 @@ void highband_exc_dct_in_ivas_fx(
            Scale_sig( exc_dct_in, L_frame, sub( *Q_exc, Q_old ) );
        }
    }

#endif
    /*--------------------------------------------------------------------------------------*
     * add the correction layer to the LF bins,
     * and add the quantized pulses or the noise for the higher part of the spectrum
+7 −0
Original line number Diff line number Diff line
@@ -101,12 +101,16 @@
#define FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND  /* Nokia: basop issue 2332: Uses predefined memory sizes instead computing wrong */
#define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK           /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */
#define HARM_COREDECODER_FUNCTIONS                      /* VA: basop issue 2347: Remove various duplicated code in core-decoder  */
#define FIX_BASOP_2358_SCALING_OOB                      /* Eri: Basip issue 2358: Clang-18 reports OOB access where scaling is applied to L_FRAME48k instead of output_frame */
#define FIX_BASOP_2351_EXTREND_SCALE                    /* FhG: basop issue 2351: Only scale initialized samples in renderer, related to 2326 */
#define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE           /* FhG: Fix issue 2331: Uninitialized variable */
#define FIX_2362_TOTAL_BRATE_CALCULATION                /* FhG: basop issue 2362: fix calculation of st->total_brate in ivas_cpe_enc_fx() */
#define FIX_2330_CLANG_18_WARNINGS_REND                 /* FhG: Fix renderer warnings */
#define FIX_BASOP_2350_HARM_0B_BWE                      /* VA: basop issue 2350: harmonization of the 0b BWE */
#define FIX_BASOP_2350_HARM_0B_BWE_2                    /* VA: basop issue 2350: Simplify calling of hf_synth_fx() */
#define FIX_2349_HARM_FIND_UV                           /* VA: basop issue 2349: harmonization of find_uv() function */
#define FIX_2364_HARM_MULT_HARM                         /* VA: basop issue 2364 : harmonizing multi_harm_fx function */
#define FIX_2370_UNUSED_BUFFERS_CORE_ENC                /* VA: basop issue 2370: remove temporary input buffers in core-encoder  */

/* #################### End BE switches ################################## */

@@ -117,6 +121,9 @@
#define FIX_2320_OOB_SCE_SWITCHING                      /* VA: basop issue 2320: Correct the length of the buffer to be scaled in SCE/CPE switching */
#define FIX_2302_LSF_CDBK_THRESHOLD                     /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision  */
#define FIX_1500_ISM_MD_DTX                             /* VA: float issue 1500: fix ISM elevation metadata smoothing in DTX */
#define FIX_2348_REPLACE_FEC_ENC                        /* VA: basop issue 2348: replace FEC_encode_ivas_fx with FEC_encode_fx  */
#define FIX_2338_HARM_GSC_GAIN_COMP                     /* VA: basop issue 2338: harmonization of band gain computation for both EVS and IVAS */
#define FIX_BASOP_2317_UNINIT_VALUE_IN_STEREO_CNG       /* Eri: Basop issue 2317: Uninitialized value read in case of DTX and BW switching   */

/* ##################### End NON-BE switches ########################### */

+4 −3
Original line number Diff line number Diff line
@@ -1711,7 +1711,7 @@ void Comp_and_apply_gain_fx(
    const Word16 ReUseGain,  /* i  : Reuse the gain in Ener_per_bd_yQ     */
    Word16 Qexc_diff,
    Word16 Q_exc );
#ifndef FIX_2338_HARM_GSC_GAIN_COMP
void Comp_and_apply_gain_ivas_fx(
    Word16 exc_diffQ[],      /* i/o: Quantized excitation                  */
    Word16 Ener_per_bd_iQ[], /* i  : Target ener per band              Q13 */
@@ -1720,7 +1720,7 @@ void Comp_and_apply_gain_ivas_fx(
    const Word16 ReUseGain,  /* i  : Reuse the gain in Ener_per_bd_yQ      */
    Word16 Qexc_diff,
    Word16 *Q_exc );
#endif
void pre_echo_att_fx(
    Word32 *Last_frame_ener_fx,      /* i/o: Energy of the last frame         2*Q_new+1*/
    Word16 *exc_fx,                  /* i/o: Excitation of the current frame  Q_new*/
@@ -10671,6 +10671,7 @@ Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx(
    Word16 *dist_ptr_e                /* i/o: exp for updated  MSE vector for stage1 */
);
#ifndef FIX_2348_REPLACE_FEC_ENC
void FEC_encode_ivas_fx(
    BSTR_ENC_HANDLE hBstr,        /* i/o: encoder bitstream handle                                   */
    const ACELP_config acelp_cfg, /* i/o: configuration of the ACELP                                 */
@@ -10684,7 +10685,7 @@ void FEC_encode_ivas_fx(
    const Word32 total_brate,     /* i  : total codec bitrate                                     Q0*/
    const Word16 Q_synth          /* i  : input scaling                                             */
);
#endif
ivas_error IGF_Reconfig_fx(
    IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder  */
    const Word16 igf,                 /* i  : IGF on/off                      */
+19 −2
Original line number Diff line number Diff line
@@ -74,7 +74,9 @@ ivas_error acelp_core_dec_fx(
    const Word16 read_sid_info           /* i  : read SID info flag                          */
)
{
#ifndef FIX_BASOP_2350_HARM_0B_BWE_2
    Word32 synth_fx[960], save_hb_synth_fx[960] /*, bwe_exc_extended_fx[L_FRAME32k + NL_BUFF_OFFSET]*/;
#endif
    Word16 old_exc_fx[L_EXC_DEC], *exc_fx;                                           /* excitation signal buffer              */
    Word16 syn_tmp_fx[L_FRAME16k + L_SUBFR], *psyn_fx;                               /* synthesis signal buffer               */
    Word16 output_frame;                                                             /* frame length at output sampling freq. */
@@ -1896,6 +1898,9 @@ ivas_error acelp_core_dec_fx(
                              st->stab_fac_fx, &st->stab_fac_smooth_fx, st->coder_type, st->Q_syn, bpf_error_signal_16fx );
        }

#ifdef FIX_BASOP_2350_HARM_0B_BWE_2
        Word32 synth_fx[L_FRAME48k];
#endif
        Word32 syn_tmp_32_fx[L_FRAME16k + L_SUBFR], *syn_32_fx;
        set32_fx( syn_tmp_32_fx, 0, L_FRAME16k + L_SUBFR );
        syn_32_fx = syn_tmp_32_fx + L_SUBFR;
@@ -2049,7 +2054,11 @@ ivas_error acelp_core_dec_fx(
                    }
                }

                cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, sub( Q11, Q_real ), -10, st->cldfbSynHB );
                cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*tmp buffer for save_hb_synth_fx[] */, -1, sub( Q11, Q_real ), -10, st->cldfbSynHB );

#ifdef FIX_BASOP_2350_HARM_0B_BWE_2
                Copy_Scale_sig_32_16( synth_fx, save_hb_synth_fx16, output_frame, 0 ); // Q0
#endif

                /* restore lowband */
                FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
@@ -2197,6 +2206,9 @@ ivas_error acelp_core_dec_fx(
            Copy( psyn_fx, output_fx, st->L_frame ); /*Q_syn*/
        }

#ifdef FIX_BASOP_2350_HARM_0B_BWE_2
        Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q_syn2
#endif
        st->Q_syn2 = 0;
        move16();
    }
@@ -2217,6 +2229,9 @@ ivas_error acelp_core_dec_fx(
        IF( ( EQ_16( st->L_frame, L_FRAME ) && ( st->bwidth != NB ) && GE_16( output_frame, L_FRAME16k ) &&
              ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) || ( EQ_16( st->extl, WB_BWE ) && st->extl_brate == 0 && NE_16( st->coder_type, AUDIO ) ) ) ) )
        {
#ifdef FIX_BASOP_2350_HARM_0B_BWE_2
            hf_synth_fx( st->hBWE_zero, st->element_mode, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 );
#else
            IF( EQ_16( st->element_mode, EVS_MONO ) )
            {
#ifndef FIX_BASOP_2350_HARM_0B_BWE
@@ -2235,6 +2250,7 @@ ivas_error acelp_core_dec_fx(
#endif
                Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, output_frame, 0 );
            }
#endif
        }
        ELSE
        {
@@ -2352,6 +2368,7 @@ ivas_error acelp_core_dec_fx(
        }
    }

#ifndef FIX_BASOP_2350_HARM_0B_BWE_2
    IF( NE_16( st->element_mode, EVS_MONO ) )
    {
        IF( save_hb_synth_fx16 != NULL )
@@ -2360,7 +2377,7 @@ ivas_error acelp_core_dec_fx(
        }
        Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q_syn2
    }

#endif
    pop_wmops();
    return error;
}
Loading