Commit 39990911 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

TCX IGF stereo mono integration.

parent 8bbe5705
Loading
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -382,6 +382,7 @@ void decoder_tcx_IGF_mono_fx(
    Decoder_State *st,                                         /* i/o: coder memory state                      */
    Word32 x_fx[],                                             /* o  : de-quatized coefficients                */
    Word16 *x_e,                                               /* o  : de-quatized coefficients exponent       */
    Word16 *x_len,                                             /* o  : de-quatized coefficients length         */
    const Word16 L_frame,                                      /* i  : frame length                            */
    const Word16 left_rect,                                    /* i  : left part is rectangular                */
    const Word16 bfi,                                          /* i  : bad frame indicator                     */
@@ -392,7 +393,9 @@ void decoder_tcx_IGF_stereo_fx(
    Decoder_State **sts,                     /* i/o: coder memory states                    */
    STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo structure                  */
    Word16 ms_mask[NB_DIV][MAX_SFB],         /* i  : bandwise MS mask                       */
    float *x[CPE_CHANNELS][NB_DIV],          /* o  : de-quatized coefficients               */
    Word32 *x_fx[CPE_CHANNELS][NB_DIV],      /* i/o: de-quatized coefficients               */
    Word16 x_e[CPE_CHANNELS][NB_DIV],        /* i/o: de-quatized coefficients exponents     */
    Word16 x_len[CPE_CHANNELS][NB_DIV],      /* o  : length of de-quantized coefficients    */
    const Word16 L_frame,                    /* i  : frame length                           */
    const Word16 left_rect,                  /* i  : left part is rectangular               */
    const Word16 k,                          /* i  : Subframe index                         */
+18 −19
Original line number Diff line number Diff line
@@ -2480,6 +2480,7 @@ void decoder_tcx_IGF_mono_fx(
    Decoder_State *st,      /* i/o: coder memory state                 */
    Word32 x_fx[],          /* o  : de-quatized coefficients           */
    Word16 *x_e,            /* o  : de-quatized coefficients exponent  */
    Word16 *x_len,          /* o  : de-quatized coefficients length    */
    const Word16 L_frame,   /* i  : frame length                       */
    const Word16 left_rect, /* i  : left part is rectangular           */
    const Word16 bfi,       /* i  : bad frame indicator                */
@@ -2533,6 +2534,9 @@ void decoder_tcx_IGF_mono_fx(

        IGFDecApplyMono_ivas( st->hIGFDec, x_fx, x_e, igfGridIdx, bfi, st->element_mode );

        *x_len = st->hIGFDec->igfData.igfInfo.grid[igfGridIdx].stopLine;
        move16();

    }

    return;
@@ -2543,7 +2547,9 @@ void decoder_tcx_IGF_stereo_fx(
    Decoder_State **sts,                     /* i/o: coder memory states                    */
    STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo structure                  */
    Word16 ms_mask[NB_DIV][MAX_SFB],         /* i  : bandwise MS mask                       */
    float *x[CPE_CHANNELS][NB_DIV],          /* o  : de-quatized coefficients               */
    Word32 *x_fx[CPE_CHANNELS][NB_DIV],      /* i/o: de-quatized coefficients               */
    Word16 x_e[CPE_CHANNELS][NB_DIV],        /* i/o: de-quatized coefficients exponents     */
    Word16 x_len[CPE_CHANNELS][NB_DIV],      /* o  : length of de-quantized coefficients    */
    const Word16 L_frame,                    /* i  : frame length                           */
    const Word16 left_rect,                  /* i  : left part is rectangular               */
    const Word16 k,                          /* i  : Subframe index                         */
@@ -2657,19 +2663,12 @@ void decoder_tcx_IGF_stereo_fx(
            move16();
        }

        Word32 x_fx[NB_DIV][N_MAX];
        Word16 x_e[NB_DIV];
        Word16 stop1, stop2;

        stop1 = sts[0]->hIGFDec->igfData.igfInfo.grid[igfGridIdx].stopLine;
        stop2 = sts[1]->hIGFDec->igfData.igfInfo.grid[igfGridIdx].stopLine;
        f2me_buf(x[0][k], x_fx[0], &x_e[0], stop1);
        f2me_buf(x[1][k], x_fx[1], &x_e[1], stop2);
        IGFDecApplyStereo( sts[0]->hIGFDec, sts[1]->hIGFDec, x_fx[0][k], &x_e[0][k], x_fx[1][k], &x_e[1][k], igfGridIdx, coreMsMask, restrict_hopsize, bfi, MCT_flag );

        IGFDecApplyStereo( sts[0]->hIGFDec, sts[1]->hIGFDec, x_fx[0], &x_e[0], x_fx[1], &x_e[1], igfGridIdx, coreMsMask, restrict_hopsize, bfi, MCT_flag );

        me2f_buf(x_fx[0], x_e[0], x[0][k], stop1);
        me2f_buf(x_fx[1], x_e[1], x[1][k], stop2);
        x_len[0][k] = sts[0]->hIGFDec->igfData.igfInfo.grid[igfGridIdx].stopLine;
        move16();
        x_len[1][k] = sts[1]->hIGFDec->igfData.igfInfo.grid[igfGridIdx].stopLine;
        move16();
    }

    return;
+0 −130
Original line number Diff line number Diff line
@@ -293,108 +293,6 @@ static void IGF_replaceTCXNoise_2_new_ivas( Word32 *in, /**< in
    }
}

/**********************************************************************/ /*
replaces TCX noise with noise band ratio (for IVAS)
**************************************************************************/
static void IGF_replaceTCXNoise_2_new_ivas_with_shift( Word32 *in,                  /**< in/out: | MDCT spectrum                */
                                            Word16 *in_e,           /**< in:     | MDCT spectrum exp            */
                                            const Word16 *TCXNoise,      /**< in: Q0  | tcx noise indicator vector   */
                                            const Word16 start,          /**< in: Q0  | start MDCT subband index     */
                                            const Word16 stop,           /**< in: Q0  | stop MDCT subband index      */
                                            Word32 totalNoiseNrg,        /**< in:     | measured noise energy        */
                                            Word16 totalNoiseNrg_e,      /**< in:     | measured noise energy exp    */
                                            const Word16 n_noise_bands,  /**< in:     | number of noise bands in src */
                                            Word16 *nfSeed               /**< in:     | random generator noise seed  */
)
{
    Word16 sb;
    Word16 g;
    Word16 val;
    Word32 rE;
    Word32 L_tmp;
    Word16 n_noise_bands_tile;
    Word16 noise_band_ratio;
    Word16 in_e_arr[IGF_START_MX + MAX_IGF_SFB_LEN];
    assert(LE_16(stop, IGF_START_MX + MAX_IGF_SFB_LEN));

    n_noise_bands_tile = 0;
    move16();
    val = 0;
    move16();
    rE = 0;
    move32();

    set16_fx(in_e_arr + start, *in_e, stop - start);

    FOR( sb = start; sb < stop; sb++ )
    {
        IF ( TCXNoise[sb] )
        {
            val = Random( nfSeed );
            move16();
            in[sb] = L_deposit_l( val );
            move32();
            in_e_arr[sb] = 31;
            val = shr( val, 5 );
            rE = L_mac( rE, val, val );
            n_noise_bands_tile = add( n_noise_bands_tile, 1 );
        }
    }


    IF( n_noise_bands_tile != 0 )
    {
        noise_band_ratio = div_s( n_noise_bands_tile, n_noise_bands ); // Q15

        /* make sure that rE is never 0 */
        if ( rE == 0 )
        {
            rE = L_add( totalNoiseNrg, 0 ); /* save move32() -> use L_add(x, 0) = x; */
        }

        /* if totalNoiseNrg == 0, then rE must be at least 0x00010000, otherwise division by 0 will occur */
        if ( totalNoiseNrg == 0 )
        {
            rE = L_max( rE, 0x00010000 );
        }

        Word16 tmp, tmp_e;
        L_tmp = Mpy_32_16_1( totalNoiseNrg, noise_band_ratio );
        tmp = BASOP_Util_Divide3232_Scale( L_tmp, rE, &tmp_e );
        tmp_e = add( tmp_e, sub( totalNoiseNrg_e, 40 ) );
        g = Sqrt16( tmp, &tmp_e );

        FOR( sb = start; sb < stop; sb++ )
        {
            Word16 nrm = norm_l(in[sb]);
            in[sb] = L_shl(in[sb], nrm);
            in_e_arr[sb] = sub(in_e_arr[sb], nrm);
            IF ( TCXNoise[sb] )
            {
                //Word16 nrm = norm_l( in[sb] );
                //in[sb] = L_shl( in[sb], nrm );                           // exp: 31 - nrm
                //in_e_arr[sb] = sub(in_e_arr[sb], nrm);
                in[sb] = Mpy_32_16_1( in[sb], g );                       // exp: 31 - nrm + tmp_e
                in_e_arr[sb] = add(in_e_arr[sb], tmp_e);
                //in[sb] = L_shr( in[sb], sub( in_e, 31 - nrm + tmp_e ) ); // Making the exponent same as original
                move32();
            }
        }
    }

    Word16 max_e = MIN16B;
    FOR(sb = start; sb < stop; sb++)
    {
        max_e = s_max(max_e, in_e_arr[sb]);
    }
    FOR(sb = start; sb < stop; sb++)
    {
        in[sb] = L_shr(in[sb], sub(max_e, in_e_arr[sb]));
        move32();
    }
    *in_e = max_e;
    move16();
}

/**********************************************************************/ /*
replaces TCX noise with noise band ratio (for IVAS)
@@ -3706,10 +3604,6 @@ void IGFDecApplyStereo(
    set16_fx( hIGFDecL->flag_sparse, 0, v_len );
    set16_fx( hIGFDecR->flag_sparse, 0, v_len );

    /* TODO: remove float code */
    set_f( hIGFDecL->virtualSpec_float, 0.f, v_len );
    set_f( hIGFDecR->virtualSpec_float, 0.f, v_len );

    set32_fx( hIGFDecL->virtualSpec_fx, 0, v_len );
    set32_fx( hIGFDecR->virtualSpec_fx, 0, v_len );

@@ -3751,12 +3645,6 @@ void IGFDecApplyStereo(
    hPrivateDataR->totalNoiseNrg_off_exp = 0;
    move16();

    /* TODO: remove float code: */
    hPrivateDataL->totalNoiseNrg_float = 0.f;
    hPrivateDataL->totalNoiseNrg_off_float = 0.f;
    hPrivateDataR->totalNoiseNrg_float = 0.f;
    hPrivateDataR->totalNoiseNrg_off_float = 0.f;

    /* concealment counter */
    IF ( bfi )
    {
@@ -3923,20 +3811,6 @@ void IGFDecApplyStereo(
            me2f_buf(igf_specL_fx + start, igf_specL_e[i], igf_specL + start, stop - start);
            me2f_buf(igf_specR_fx + start, igf_specR_e[i], igf_specR + start, stop - start);
        }
        //for (int l = hGrid->minSrcSubband; l < hGrid->stopLine; l++)
        //{
        //    igf_specL[l] = me2f(igf_specL_fx[l], igf_specL_e_arr[l]);
        //    igf_specR[l] = me2f(igf_specR_fx[l], igf_specR_e_arr[l]);
        //}
        hPrivateDataL->totalNoiseNrg_float = me2f(hPrivateDataL->totalNoiseNrg, hPrivateDataL->totalNoiseNrg_exp);
        hPrivateDataR->totalNoiseNrg_float = me2f(hPrivateDataR->totalNoiseNrg, hPrivateDataR->totalNoiseNrg_exp);
        hPrivateDataL->totalNoiseNrg_off_float = me2f(hPrivateDataL->totalNoiseNrg_off, hPrivateDataL->totalNoiseNrg_off_exp);
        hPrivateDataR->totalNoiseNrg_off_float = me2f(hPrivateDataR->totalNoiseNrg_off, hPrivateDataR->totalNoiseNrg_off_exp);

        //IGF_calc_flt( hPrivateDataL, igfGridIdx, spectrumL, igf_specL );
        //IGF_calc_flt( hPrivateDataR, igfGridIdx, spectrumR, igf_specR );
        //IGF_appl_flt( hPrivateDataL, igfGridIdx, spectrumL, igf_specL, hIGFDecL->virtualSpec_float, hIGFDecL->flag_sparse, bfi_apply_damping );
        //IGF_appl_flt( hPrivateDataR, igfGridIdx, spectrumR, igf_specR, hIGFDecR->virtualSpec_float, hIGFDecR->flag_sparse, bfi_apply_damping );

        IGF_calc_ivas( hPrivateDataL,
            igfGridIdx,
@@ -3975,15 +3849,11 @@ void IGFDecApplyStereo(
    /* reset TCX noise indicator vector */
    IF( EQ_16( igfGridIdx, IGF_GRID_LB_SHORT ) )
    {
        set_c( (int8_t *) ( hIGFDecL->infoTCXNoise ), 0, IGF_START_MX / 2 );
        set_c( (int8_t *) ( hIGFDecR->infoTCXNoise ), 0, IGF_START_MX / 2 );
        set16_fx( hIGFDecL->infoTCXNoise_evs, 0, IGF_START_MX / 2 );
        set16_fx( hIGFDecR->infoTCXNoise_evs, 0, IGF_START_MX / 2 );
    }
    ELSE
    {
        set_c( (int8_t *) ( hIGFDecL->infoTCXNoise ), 0, IGF_START_MX );
        set_c( (int8_t *) ( hIGFDecR->infoTCXNoise ), 0, IGF_START_MX );
        set16_fx( hIGFDecL->infoTCXNoise_evs, 0, IGF_START_MX );
        set16_fx( hIGFDecR->infoTCXNoise_evs, 0, IGF_START_MX );
    }
+10 −3
Original line number Diff line number Diff line
@@ -255,7 +255,13 @@ void ivas_mct_core_dec(

                    // Float to fixed
                    Word32 x_fx[N_MAX];
                    Word16 x_e, stop;
                    Word16 x_e;
                    Word16 x_len;

#if 1
                    // NOTE: The folloing code is to pre-calculate "stop", which is the length of x that will get
                    // updated inside the function decoder_tcx_IGF_mono_fx. Can remove this later.
                    Word16 stop;
                    Word16 tmp_igfGridIdx = IGF_GRID_LB_SHORT;
                    IF(NE_16(L_frame, shr(st->L_frame, 1)) && st->tcxonly)
                    {
@@ -266,14 +272,15 @@ void ivas_mct_core_dec(
                    {
                        f2me_buf(x[ch][k], x_fx, &x_e, stop);
                    }
#endif

                    /* mono or dual mono IGF decoding */
                    decoder_tcx_IGF_mono_fx( st, x_fx, &x_e, L_frame, left_rect, bfi, k );
                    decoder_tcx_IGF_mono_fx( st, x_fx, &x_e, &x_len, L_frame, left_rect, bfi, k );

                    IF(st->igf)
                    {
                        // Fixed to float
                        me2f_buf(x_fx, x_e, x[ch][k], stop);
                        me2f_buf(x_fx, x_e, x[ch][k], x_len);
                        me2f_buf(st->hIGFDec->virtualSpec, st->hIGFDec->virtualSpec_e, st->hIGFDec->virtualSpec_float, (N_MAX_TCX - IGF_START_MN));
                        // 16bit to u8bit
                        FOR(Word16 l = 0; l < IGF_START_MX; l++)
+54 −104
Original line number Diff line number Diff line
@@ -266,10 +266,13 @@ void mctStereoIGF_dec_fx(
    Word16 L_frame[CPE_CHANNELS];
    Word16 L_frameTCX[CPE_CHANNELS];
    Word32 *p_x[CPE_CHANNELS][NB_DIV];
    Word16 p_x_e[CPE_CHANNELS][NB_DIV];
    Word16 p_x_len[CPE_CHANNELS][NB_DIV];
    Word16 singleChEle[MCT_MAX_CHANNELS];
    Word16 tmp_e;
    Word16 L_frame_nSubframe, L_frameTCX_nSubframe, tmp;


    set16_fx( singleChEle, 1, ( hMCT->nchan_out_woLFE ) );

    FOR( b = 0; b < hMCT->currBlockDataCnt; b++ )
@@ -294,20 +297,9 @@ void mctStereoIGF_dec_fx(
        singleChEle[hMCT->hBlockData[b]->ch2] = 0;
        move16();

#ifndef IVAS_FLOAT_FIX_TBD
        Float32 *p_x_flt[CPE_CHANNELS][NB_DIV];

        FOR( k = 0; k < CPE_CHANNELS; k++ )
        {
            p_x_flt[k][0] = malloc( L_FRAME48k * sizeof( Float32 ) );
            p_x_flt[k][1] = p_x_flt[k][0] + L_FRAME48k / 2;
        }
        FOR( k = 0; k < CPE_CHANNELS; k++ )
        {
            fixedToFloat_arrL( x[ch1][k], p_x_flt[0][k], Q12, L_FRAME48k / 2 );
            fixedToFloat_arrL( x[ch2][k], p_x_flt[1][k], Q12, L_FRAME48k / 2 );
        }
#endif
        // Using input Q-factor as 12
        set16_fx( p_x_e[0], 31 - Q12, CPE_CHANNELS );
        set16_fx( p_x_e[1], 31 - Q12, CPE_CHANNELS );

        FOR( k = 0; k < nSubframes; k++ )
        {
@@ -331,16 +323,24 @@ void mctStereoIGF_dec_fx(
                /* stereo IGF decoding */
                assert( ( EQ_16( sts[0]->core, sts[1]->core ) ) || ( EQ_16( hMCT->hBlockData[b]->hStereoMdct->mdct_stereo_mode[0], SMDCT_DUAL_MONO ) ) );

#ifdef IVAS_FLOAT_FIX_TBD
                decoder_tcx_IGF_stereo( sts, hMCT->hBlockData[b]->hStereoMdct, hMCT->hBlockData[b]->mask, p_x, L_frame[0], left_rect[0], k, bfi, 1 /* MCT_flag */ );
#else
                decoder_tcx_IGF_stereo_fx( sts, hMCT->hBlockData[b]->hStereoMdct, hMCT->hBlockData[b]->mask, p_x_flt, L_frame[0], left_rect[0], k, bfi, 1 /* MCT_flag */ );
#endif
                decoder_tcx_IGF_stereo_fx( sts, hMCT->hBlockData[b]->hStereoMdct, hMCT->hBlockData[b]->mask, p_x, p_x_e, p_x_len, L_frame[0], left_rect[0], k, bfi, 1 /* MCT_flag */ );

                // Shifting output with variable exponent back to Q12
                FOR( Word16 i = 0; i < p_x_len[0][k]; i++ )
                {
                    p_x[0][k][i] = L_shr( p_x[0][k][i], 31 - Q12 - p_x_e[0][k] );
                }
                FOR( Word16 i = 0; i < p_x_len[1][k]; i++ )
                {
                    p_x[1][k][i] = L_shr( p_x[1][k][i], 31 - Q12 - p_x_e[1][k] );
                }
            }
            ELSE
            {
                FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
                {
                    Word16 x_e, x_len;

                    st = sts[ch];
                    test();
                    IF( bfi && EQ_16( st->core, ACELP_CORE ) ) /*no igf processing needed*/
@@ -359,60 +359,33 @@ void mctStereoIGF_dec_fx(
                    init_tcx_info_fx( st, L_frame_nSubframe, L_frameTCX_nSubframe, k, bfi, &tcx_offset[ch], &tcx_offsetFB[ch], &L_frame[ch], &L_frameTCX[ch], &left_rect[ch], &L_spec[ch] );

                    /* mono or dual mono IGF decoding */
#ifdef IVAS_FLOAT_FIX_TBD
                    decoder_tcx_IGF_mono( st, x[p_ch[ch]][k], L_frame[ch], left_rect[ch], bfi, k );
#else
                    Float32 *x_flt = malloc( ( L_FRAME48k / 2 ) * sizeof( Float32 ) );

                    fixedToFloat_arrL( x[p_ch[ch]][k], x_flt, Q12, L_FRAME48k / 2 );
                    x_e = 31 - Q12; // input q-factor of x[p_ch[ch]][k] is Q12
                    move16();

                    // Float to fixed
                    Word32 x_fx[N_MAX];
                    Word16 x_e, stop;
                    Word16 tmp_igfGridIdx = IGF_GRID_LB_SHORT;
                    IF(NE_16(L_frame[ch], shr(st->L_frame, 1)) && st->tcxonly)
                    {
                        tmp_igfGridIdx = (EQ_16(st->last_core, ACELP_CORE) || (left_rect[ch] && bfi)) ? IGF_GRID_LB_TRAN : IGF_GRID_LB_NORM;
                    }
                    stop = st->hIGFDec->igfData.igfInfo.grid[tmp_igfGridIdx].stopLine;
                    IF(st->igf)
                    decoder_tcx_IGF_mono_fx( st, x[p_ch[ch]][k], &x_e, &x_len, L_frame[ch], left_rect[ch], bfi, k );

                    FOR( Word16 i = 0; i < x_len; i++ )
                    {
                        f2me_buf(x_flt, x_fx, &x_e, stop);
                        // Converting from variable exponent to Fixed q-factor (Q12)
                        x[p_ch[ch]][k][i] = L_shr( x[p_ch[ch]][k][i], sub( 31 - Q12, x_e ) );
                        move32();
                    }

                    decoder_tcx_IGF_mono_fx( st, x_fx, &x_e, L_frame[ch], left_rect[ch], bfi, k );

                    IF( st->igf )
                    {
                        // Fixed to float
                        me2f_buf(x_fx, x_e, x_flt, stop);
                        // TODO: remove this float to fixed conversion later.
                        me2f_buf( st->hIGFDec->virtualSpec, st->hIGFDec->virtualSpec_e, st->hIGFDec->virtualSpec_float, ( N_MAX_TCX - IGF_START_MN ) );
                        // 16bit to u8bit
                        FOR(Word16 l = 0; l < IGF_START_MX; l++)
                        {
                            st->hIGFDec->infoTCXNoise[l] = (uint8_t)st->hIGFDec->infoTCXNoise_evs[l];
                        }
                    }

                    floatToFixed_arrL( x_flt, x[p_ch[ch]][k], Q12, L_FRAME48k / 2 );

                    free( x_flt );
#endif
                }
            }
        }
#ifndef IVAS_FLOAT_FIX_TBD
        FOR( k = 0; k < CPE_CHANNELS; k++ )
            // TODO: Converting 16bit noise info to u8bit. can remove this later.
            FOR( Word16 i = 0; i < IGF_START_MX; i++ )
            {
            floatToFixed_arrL( p_x_flt[0][k], x[ch1][k], Q12, L_FRAME48k / 2 );
            floatToFixed_arrL( p_x_flt[1][k], x[ch2][k], Q12, L_FRAME48k / 2 );
                sts[0]->hIGFDec->infoTCXNoise[i] = (uint8_t) sts[0]->hIGFDec->infoTCXNoise_evs[i];
                sts[1]->hIGFDec->infoTCXNoise[i] = (uint8_t) sts[1]->hIGFDec->infoTCXNoise_evs[i];
            }

        FOR( k = 0; k < CPE_CHANNELS; k++ )
        {
            free( p_x_flt[k][0] );
        }
#endif
    }

    IF( NE_16( sum16_fx( singleChEle, ( hMCT->nchan_out_woLFE ) ), 0 ) )
@@ -434,18 +407,10 @@ void mctStereoIGF_dec_fx(
                nSubframes = ( EQ_16( st->core, TCX_10_CORE ) ) ? NB_DIV : 1;
                move16();

#ifndef IVAS_FLOAT_FIX_TBD
                Float32 *x_flt[NB_DIV];
                //x_flt[0] = malloc( ( L_FRAME48k ) * sizeof( Float32 ) );
                x_flt[0] = malloc( ( 2*N_MAX ) * sizeof( Float32 ) );
                x_flt[1] = x_flt[0] + L_FRAME48k / 2;

                fixedToFloat_arrL( x[ch][0], x_flt[0], Q12, L_FRAME48k / 2 );
                fixedToFloat_arrL( x[ch][1], x_flt[1], Q12, L_FRAME48k / 2 );

#endif
                FOR( k = 0; k < nSubframes; k++ )
                {
                    Word16 x_e, x_len;

                    tmp = BASOP_Util_Divide1616_Scale( st->hTcxCfg->tcx_coded_lines, nSubframes, &tmp_e );
                    L_spec[0] = shr( tmp, add( 15, negate( tmp_e ) ) );

@@ -458,43 +423,28 @@ void mctStereoIGF_dec_fx(
                    init_tcx_info_fx( st, L_frame_nSubframe, L_frameTCX_nSubframe, k, bfi, &tcx_offset[0], &tcx_offsetFB[0], &L_frame[0], &L_frameTCX[0], &left_rect[0], &L_spec[0] );

                    /* mono or dual mono IGF decoding */
#ifdef IVAS_FLOAT_FIX_TBD
                    decoder_tcx_IGF_mono( st, x[ch][k], L_frame[0], left_rect[0], bfi, k );
#else
                    // Float to fixed
                    Word32 x_fx[N_MAX];
                    Word16 x_e, stop;
                    Word16 tmp_igfGridIdx = IGF_GRID_LB_SHORT;
                    IF(NE_16(L_frame[0], shr(st->L_frame, 1)) && st->tcxonly)
                    {
                        tmp_igfGridIdx = (EQ_16(st->last_core, ACELP_CORE) || (left_rect[0] && bfi)) ? IGF_GRID_LB_TRAN : IGF_GRID_LB_NORM;
                    }
                    stop = st->hIGFDec->igfData.igfInfo.grid[tmp_igfGridIdx].stopLine;
                    IF(st->igf)
                    x_e = 31 - Q12; // Input Q-factor is Q12.
                    move16();

                    decoder_tcx_IGF_mono_fx( st, x[ch][k], &x_e, &x_len, L_frame[0], left_rect[0], bfi, k );

                    FOR( Word16 i = 0; i < x_len; i++ )
                    {
                        f2me_buf(x_flt[k], x_fx, &x_e, stop);
                        // Converting from variable exponent to Fixed q-factor (Q12)
                        x[ch][k][i] = L_shr( x[ch][k][i], sub( 31 - Q12, x_e ) );
                    }
                    decoder_tcx_IGF_mono_fx( st, x_fx, &x_e, L_frame[0], left_rect[0], bfi, k );

                    IF( st->igf )
                    {
                        // Fixed to float
                        me2f_buf(x_fx, x_e, x_flt[k], stop);
                        // TODO: Fixed to float. Remove this later.
                        me2f_buf( st->hIGFDec->virtualSpec, st->hIGFDec->virtualSpec_e, st->hIGFDec->virtualSpec_float, ( N_MAX_TCX - IGF_START_MN ) );
                        // 16bit to u8bit
                        // TODO: 16bit to u8bit. Remove this later.
                        FOR( Word16 l = 0; l < IGF_START_MX; l++ )
                        {
                            st->hIGFDec->infoTCXNoise[l] = (uint8_t) st->hIGFDec->infoTCXNoise_evs[l];
                        }
                    }
#endif
                }
#ifndef IVAS_FLOAT_FIX_TBD
                floatToFixed_arrL( x_flt[0], x[ch][0], Q12, L_FRAME48k / 2 );
                floatToFixed_arrL( x_flt[1], x[ch][1], Q12, L_FRAME48k / 2 );

                free( x_flt[0] );
#endif
            }
        }
    }
Loading