Commit 42d4e1d1 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

SPAR MD dec DTX fix for 16_4 and 13_2 kbps

parent 4368f53e
Loading
Loading
Loading
Loading
Loading
+37 −21
Original line number Diff line number Diff line
@@ -1749,6 +1749,9 @@ static void ivas_spar_dec_parse_md_bs(
    int16_t planarCP;
    float quant[IVAS_SPAR_MAX_C_COEFF];
    int16_t do_repeat[IVAS_MAX_NUM_BANDS];
#ifdef FIX_501_TABLE_IDX_INIT
    int16_t bw_final, bw_fact;
#endif

    *dtx_vad = 1;
    *bands_bw = 1;
@@ -1821,17 +1824,33 @@ static void ivas_spar_dec_parse_md_bs(

        ivas_parse_parameter_bitstream_dtx( &hMdDec->spar_md, st0, *bands_bw, *nB, hMdDec->spar_md_cfg.num_dmx_chans_per_band, hMdDec->spar_md_cfg.num_decorr_per_band );


#ifdef FIX_501_TABLE_IDX_INIT
        if ( last_active_brate >= IVAS_24k4 )
        {
            bw_final = 1;
        }
        else
        {
            bw_final = 2;
        }
        bw_fact = *bands_bw / bw_final;
#endif
        for ( i = *nB - 1; i >= 0; i-- )
        {
#ifdef FIX_501_TABLE_IDX_INIT
            ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bw_fact * i];

            for ( b = bw_fact - 1; b >= 0; b-- )
            {
                idx = i * bw_fact + b;
#else
            ndec = hMdDec->spar_md_cfg.num_decorr_per_band[( *bands_bw ) * i];

            for ( b = *bands_bw - 1; b >= 0; b-- )
            {
                idx = i * *bands_bw + b;
#endif
                for ( j = 0; j < FOA_CHANNELS - 1; j++ )
                {
                    hMdDec->spar_md.band_coeffs[idx].pred_re[j] = hMdDec->spar_md.band_coeffs[i].pred_re[j];
@@ -1844,15 +1863,12 @@ static void ivas_spar_dec_parse_md_bs(
            }
        }

#ifdef FIX_501_TABLE_IDX_INIT
        *bands_bw = bw_final;
        *nB = num_bands / bw_final;
#else
        *nB = num_bands;
        *bands_bw = 1;
#ifdef FIX_501_TABLE_IDX_INIT
        }
        else
        {
            *bands_bw = 2;
            *nB = num_bands / *bands_bw;
        }
#endif

        return;