Commit e6efc75d authored by Anjaneyulu Sana's avatar Anjaneyulu Sana
Browse files

LTV MLD Test Run for all MRs included

parent fd8bc4cd
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1536,6 +1536,7 @@ enum
#define SHB_OVERLAP_LEN                     ( L_FRAME16k - L_SHB_LAHEAD ) / ( NUM_SHB_SUBFR - 1 )
#define QUANT_DIST_INIT                     ( 10000000000.0f )      /* Quantiser search distance initialisation */
#define HIBND_ACB_L_FAC                     5 / 2                   /* SHB Interpolation Factor */
#define HIBND_ACB_L_FAC_Q1                  ( 5 )                   /* SHB Interpolation Factor Q1 */
#define NUM_HILBERTS                        2
#define HILBERT_ORDER1                      5
#define HILBERT_ORDER2                      4
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@
#define FIX_ISSUE_1214                          /* Ittiam: Fix for issue 1214: Energy leakage in IGF tiles for MDCT-stereo @64kbps SWB*/
#define FIX_881_HILBERT_FILTER                  /* VA: improve the precision of the Hilbert filter to remove 2kHz unwanted tone */
#define FIX_ISSUE_1245                          /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/
#define FIX_ISSUE_1291                          /* Ittiam: Wrong use of imult1616() in ACELP rescaling */
#define FIX_920_IGF_INIT_ERROR                  /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */
#define FIX_MINOR_SVD_WMOPS_MR1010X             /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */
#define SVD_WMOPS_OPT                           /* Ittiam : SVD related optimizations */
+5 −1
Original line number Diff line number Diff line
@@ -748,7 +748,11 @@ ivas_error acelp_core_dec_ivas_fx(
            IF( st->hMusicPF && st->hGSCDec )
            {
                Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame,
#ifdef FIX_ISSUE_1291
                             shr( imult1616( st->L_frame, HIBND_ACB_L_FAC_Q1 ), 1 ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE );
#else
                             imult1616( st->L_frame, HIBND_ACB_L_FAC ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE );
#endif
            }
            IF( st->hPFstat != NULL )
            {
@@ -799,7 +803,7 @@ ivas_error acelp_core_dec_ivas_fx(
            Copy( syn1_fx + st->L_frame - L_SYN_MEM_CLAS_ESTIM, st->mem_syn_clas_estim_fx, L_SYN_MEM_CLAS_ESTIM );

            /* save and delay synthesis to be used by SWB BWE */
            Copy_Scale_sig( syn1_fx, temp_buf_fx, st->L_frame, sub( -1, st->Q_syn ) ); // Q_syn
            Copy_Scale_sig( syn1_fx, temp_buf_fx, st->L_frame, sub( -1, st->Q_syn ) ); // Q_syn -> Q(-1)
            IF( st->hBWE_FD != NULL )
            {
#ifdef FIX_ISSUE_1290
+4 −0
Original line number Diff line number Diff line
@@ -1252,6 +1252,10 @@ void ivas_sba_dirac_stereo_dec_fx(
    move16();

#ifdef MSAN_FIX
    FOR( int i = 0; i < CPE_CHANNELS; i++ )
    {
        set32_fx( DFT[i], 0, STEREO_DFT_BUF_MAX );
    }
    Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/
#else
    Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), -( Q11 - hCPE->hStereoDft->q_dft ) );
+131 −0
Original line number Diff line number Diff line
@@ -792,3 +792,134 @@ void tcx_arith_encode_envelope_fx(
    *nf_seed = extract_l( L_tmp2 );
    move16();
}

void tcx_arith_encode_envelope_ivas_fx(
    Word32 spectrum[],          /* i/o: MDCT coefficients           Q31-e */
    Word16 *spectrum_e,         /* i/o: MDCT exponent               Q0 */
    Word16 signs[],             /* o: signs (spectrum[.]<0)         Q0 */
    const Word16 L_frame,       /* i: frame or MDCT length          Q0 */
    const Word16 L_spec,        /* i: frame or MDCT length          Q0 */
    Encoder_State *st,          /* i/o: coder state                 */
    const Word16 A_ind[],       /* i: quantised LPC coefficients    Q12 */
    Word16 target_bits,         /* i: number of available bits      Q0 */
    Word16 prm[],               /* o: bitstream parameters          Q0 */
    const Word8 use_hm,         /* i: use HM in current frame?      */
    Word16 prm_hm[],            /* o: HM parameter area             Q0 */
    const Word16 tcxltp_pitch,  /* i: TCX LTP pitch in FD, -1 if n/a  Q0*/
    Word16 *arith_bits,         /* o: bits used for ari. coding     Q0 */
    Word16 *signaling_bits,     /* o: bits used for signaling       Q0 */
    const Word16 low_complexity /* i: low-complexity flag           Q0 */
)
{
    Word32 env[N_MAX_ARI]; /* unscaled envelope (Q16) */
    Word16 *envelope;      /* scaled envelope (Q15-e) */
    Word16 envelope_e;
    Word16 exponents[N_MAX_ARI]; /* Q15 */
    Word16 L_spec_core;
    Word16 *q_spectrum;
    TCX_CONFIG_HANDLE hTcxCfg;
    Word16 scale, scale_e;
    Word16 k, kMax;
    Word16 deadzone;
    const Word8 *deadzone_flags;
    Word16 gamma_w, gamma_uw;
    Word16 hm_bits;
    Word32 L_tmp;
    Word16 tmp;
    TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;

    assert( L_spec <= N_MAX_ARI );

    hTcxCfg = st->hTcxCfg;
    deadzone = hTcxCfg->sq_rounding;
    move16();
    deadzone_flags = hTcxEnc->memQuantZeros;
    *signaling_bits = 0;
    move16();

    assert( st->enableTcxLpc );
    gamma_w = 32767 /*1.0f Q15*/;
    move16();
    gamma_uw = st->inv_gamma;
    move16();

    tcx_arith_render_envelope( A_ind, L_frame, L_spec, hTcxCfg->preemph_fac, gamma_w, gamma_uw, env );

    FOR( k = 0; k < L_spec; k++ )
    {
        signs[k] = extract_l( L_lshr( spectrum[k], 31 ) );
        move16();
        if ( spectrum[k] < 0 )
        {
            spectrum[k] = L_abs( spectrum[k] );
            move32();
        }
    }

    IF( use_hm != 0 )
    {
        tcx_hm_analyse_fx( spectrum, spectrum_e, L_spec, env, target_bits, hTcxCfg->coder_type, prm_hm, tcxltp_pitch, hTcxEnc->tcxltp_gain, &hm_bits );

        target_bits = sub( target_bits, hm_bits );
        *signaling_bits = add( *signaling_bits, hm_bits );
        move16();
    }
    ELSE
    {
        prm_hm[0] = 0; /* just to be sure */
        move16();
        hm_bits = 0;
        move16();
    }

    L_spec_core = L_spec;
    move16();
    if ( st->igf )
    {
        L_spec_core = s_min( L_spec_core, st->hIGFEnc->infoStartLine );
    }
    envelope = (Word16 *) env;

    tcx_arith_scale_envelope( L_spec, L_spec_core, env, target_bits, low_complexity, envelope, &envelope_e );

    tmp = sub( envelope_e, 1 + 15 );
    FOR( k = 0; k < L_spec; k++ )
    {
        exponents[k] = round_fx( expfp( envelope[k], tmp ) );
        move16();
    }

    scale = tcx_arith_rateloop( spectrum, *spectrum_e, L_spec, envelope, envelope_e, exponents, target_bits, deadzone, deadzone_flags, &( hTcxEnc->tcx_target_bits_fac ), &scale_e );

    /* Final quantization */
    kMax = tcx_arith_find_kMax( spectrum, *spectrum_e, L_spec, scale, scale_e, deadzone, deadzone_flags );

    q_spectrum = (Word16 *) env; /* Reuse buffer */

    L_tmp = L_mult( deadzone, 1 ); /* Q16 */
    tmp = add( sub( *spectrum_e, 15 ), scale_e );
    FOR( k = 0; k <= kMax; k++ )
    {
        /* quantise using dead-zone */
        q_spectrum[k] = extract_h( L_add( L_shl( Mpy_32_16_1( spectrum[k], scale ), tmp ), L_tmp ) );
        move16();
    }

    /* Final encoding */
    *arith_bits = tcx_arith_encode( q_spectrum, signs, kMax, L_spec, exponents, target_bits, prm );
    move16();

    /* Multiply back the signs */
    FOR( k = 0; k <= kMax; k++ )
    {
        if ( signs[k] != 0 )
            L_tmp = L_mult( q_spectrum[k], -( 1 << ( 30 - SPEC_EXP_DEC ) ) );
        if ( signs[k] == 0 )
            L_tmp = L_mult( q_spectrum[k], 1 << ( 30 - SPEC_EXP_DEC ) );
        spectrum[k] = L_tmp;
        move32();
    }
    *spectrum_e = SPEC_EXP_DEC;
    move16();
    set32_fx( spectrum + k, 0, sub( s_max( L_frame, L_spec ), k ) );
}
Loading