Commit 450d9a61 authored by multrus's avatar multrus
Browse files

separate changes on MDCT core dec from branch cldfb_opt

parent 3ea8505d
Loading
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -1094,8 +1094,12 @@ void ivas_mct_dec_mct_fx(
void apply_MCT_dec_fx(
    MCT_DEC_HANDLE hMCT,                /* i/o: MCT decoder structure                   */
    Decoder_State **sts,                /* i/o: decoder state structure                 */
    Word32 *x[MCT_MAX_CHANNELS][NB_DIV], /* i/o: decoded and dequan. spect. input to MCT */
    Word16 q_x[MCT_MAX_CHANNELS] );
    Word32 *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */
#ifndef OPT_SBA_DEC_PATH
    ,
    Word16 q_x[MCT_MAX_CHANNELS]
#endif /* OPT_SBA_DEC_PATH */
);

void mctStereoIGF_dec_fx(
    MCT_DEC_HANDLE hMCT,                 /* i/o: MCT decoder structure           */
@@ -1129,9 +1133,13 @@ void stereo_decoder_tcx_fx(
    const Word16 mct_on,               /* i  : flag mct block (1) or stereo (0)        */
    const Word16 last_core_l,          /* i  : last core for left channel              */
    const Word16 last_core_r,          /* i  : last core for right channel             */
    const Word16 tmp_plc_upmix,        /* i  : indicates temp upmix for PLC decision   */
    const Word16 tmp_plc_upmix         /* i  : indicates temp upmix for PLC decision   */
#ifndef OPT_SBA_DEC_PATH
    ,
    Word16 *q_x_ch2,
    Word16 *q_x_ch1 );
    Word16 *q_x_ch1
#endif /* OPT_SBA_DEC_PATH */
);

void v_multc_acc_32_16(
    const Word32 x[], /* i  : Input vector                                     */
+2 −0
Original line number Diff line number Diff line
@@ -106,4 +106,6 @@

#define FIX_1713_EXP                            /* VA: proposed correction to exp in ic-BWE*/

#define OPT_SBA_DEC_PATH

#endif
+70 −1
Original line number Diff line number Diff line
@@ -198,7 +198,10 @@ void ivas_mct_core_dec(
    Word16 tcx_offset;
    Word16 tcx_offsetFB;
    Word16 left_rect;
    Word16 L_spec, scale, tmp1, tmp2;
    Word16 L_spec;
#ifndef OPT_SBA_DEC_PATH
    Word16 scale, tmp1, tmp2;
#endif /* OPT_SBA_DEC_PATH */
#ifdef DEBUG_MCT
    float nrg[MCT_MAX_CHANNELS];
#endif
@@ -218,11 +221,18 @@ void ivas_mct_core_dec(
    move16();
    FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ )
    {
#ifndef OPT_SBA_DEC_PATH
        FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
        {
            sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
            i = add( i, 1 );
        }
#else  /* OPT_SBA_DEC_PATH */
        FOR( ch = 0; ch < CPE_CHANNELS; ( ch++, i++ ) )
        {
            sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
        }
#endif /* OPT_SBA_DEC_PATH */
    }

    i = 0;
@@ -268,7 +278,61 @@ void ivas_mct_core_dec(
                {
                    CONTINUE;
                }
#ifdef OPT_SBA_DEC_PATH
                IF( EQ_16( st->core, TCX_10_CORE ) )
                {
                    Word16 L_frame_2 = shr( st->L_frame, 1 );
                    Word16 L_frameTCX_2 = shr( st->hTcxDec->L_frameTCX, 1 );
                    nSubframes = NB_DIV; // assuming NB_DIV is 2. Below logic needs to be modified if NB_DIV changes.
                    move16();
                    FOR( k = 0; k < nSubframes; k++ )
                    {
                        L_spec = shr( st->hTcxCfg->tcx_coded_lines, 1 );
                        move32();

                        init_tcx_info_fx( st, L_frame_2, L_frameTCX_2, k, bfi, &tcx_offset, &tcx_offsetFB, &L_frame, &L_frameTCX, &left_rect, &L_spec );

                        Word16 x_e, x_len;
                        /* mono or dual mono IGF decoding */
                        x_e = sub( 31, q_x[ch] );
                        decoder_tcx_IGF_mono_fx( st, x_fx[ch][k], &x_e, &x_len, L_frame, left_rect, bfi, k );
                        q_x[ch] = sub( 31 - 12, x_e ); // Shift to bring x to Q12
                        move16();
                        FOR( i = 0; i < x_len; i++ )
                        {
                            x_fx[ch][k][i] = L_shr( x_fx[ch][k][i], q_x[ch] );
                            move32();
                        }
                        q_x[ch] = Q12;
                        move16();
                    }
                }
                ELSE
                {
                    nSubframes = 1;
                    move16();
                    {
                        L_spec = st->hTcxCfg->tcx_coded_lines;
                        move32();

                        init_tcx_info_fx( st, st->L_frame, st->hTcxDec->L_frameTCX, 0, bfi, &tcx_offset, &tcx_offsetFB, &L_frame, &L_frameTCX, &left_rect, &L_spec );

                        Word16 x_e, x_len;
                        /* mono or dual mono IGF decoding */
                        x_e = sub( 31, q_x[ch] );
                        decoder_tcx_IGF_mono_fx( st, x_fx[ch][0], &x_e, &x_len, L_frame, left_rect, bfi, 0 );
                        q_x[ch] = sub( 31 - 12, x_e ); // Shift to bring x to Q12
                        move16();
                        FOR( i = 0; i < x_len; i++ )
                        {
                            x_fx[ch][0][i] = L_shr( x_fx[ch][0][i], q_x[ch] );
                            move32();
                        }
                        q_x[ch] = Q12;
                        move16();
                    }
                }
#else  /* OPT_SBA_DEC_PATH */
                IF( EQ_16( st->core, TCX_10_CORE ) )
                {
                    nSubframes = NB_DIV;
@@ -304,6 +368,7 @@ void ivas_mct_core_dec(
                    q_x[ch] = Q12;
                    move16();
                }
#endif /* OPT_SBA_DEC_PATH */
            }
        }
        ELSE
@@ -318,6 +383,9 @@ void ivas_mct_core_dec(
         * MCT processing
         *--------------------------------------------------------------------------------*/

#ifdef OPT_SBA_DEC_PATH
        apply_MCT_dec_fx( hMCT, sts, x_fx );
#else  /* OPT_SBA_DEC_PATH */
        apply_MCT_dec_fx( hMCT, sts, x_fx, q_x );
        FOR( ch = 0; ch < nChannels; ch++ )
        {
@@ -331,6 +399,7 @@ void ivas_mct_core_dec(
            q_x[ch] = Q12;
            move16();
        }
#endif /* OPT_SBA_DEC_PATH */
    }

    pop_wmops();
+27 −6
Original line number Diff line number Diff line
@@ -165,8 +165,12 @@ void ivas_mct_dec_mct_fx(
static void applyGlobalILD_fx(
    Decoder_State **sts,
    MCT_DEC_HANDLE hMCT,
    Word32 *x[MCT_MAX_CHANNELS][NB_DIV],
    Word16 q_x[MCT_MAX_CHANNELS] )
    Word32 *x[MCT_MAX_CHANNELS][NB_DIV]
#ifndef OPT_SBA_DEC_PATH
    ,
    Word16 q_x[MCT_MAX_CHANNELS]
#endif /* OPT_SBA_DEC_PATH */
)
{
    Word16 ch, k;
    Word16 nSubframes, L_subframeTCX;
@@ -207,9 +211,14 @@ static void applyGlobalILD_fx(
            FOR( k = 0; k < nSubframes; k++ )
            {
                v_multc_fixed( x[ch][k], qratio, x[ch][k], L_subframeTCX ); // Qx - 5 + q_qratio
#ifdef OPT_SBA_DEC_PATH
                scale_sig32( x[ch][k], L_subframeTCX, sub( 5, q_qratio ) );
#endif /* OPT_SBA_DEC_PATH */
            }
#ifndef OPT_SBA_DEC_PATH
            q_x[ch] = add( sub( q_x[ch], 5 ), q_qratio );
            move16();
#endif /* OPT_SBA_DEC_PATH */
        }
        ELSE
        {
@@ -230,8 +239,12 @@ static void applyGlobalILD_fx(
void apply_MCT_dec_fx(
    MCT_DEC_HANDLE hMCT,                /* i/o: MCT decoder structure                   */
    Decoder_State **sts,                /* i/o: decoder state structure                 */
    Word32 *x[MCT_MAX_CHANNELS][NB_DIV], /* i/o: decoded and dequan. spect. input to MCT */
    Word16 q_x[MCT_MAX_CHANNELS] )
    Word32 *x[MCT_MAX_CHANNELS][NB_DIV] /* i/o: decoded and dequan. spect. input to MCT */
#ifndef OPT_SBA_DEC_PATH
    ,
    Word16 q_x[MCT_MAX_CHANNELS]
#endif /* OPT_SBA_DEC_PATH */
)
{
    Word16 pair;
    MCT_DEC_BLOCK_DATA_HANDLE hBlock;
@@ -240,10 +253,18 @@ void apply_MCT_dec_fx(
    {
        hBlock = hMCT->hBlockData[pair];

#ifndef OPT_SBA_DEC_PATH
        stereo_decoder_tcx_fx( hBlock->hStereoMdct, hBlock->mask, &x[hBlock->ch2][0], &x[hBlock->ch1][0], &x[hBlock->ch2][0], hBlock->hStereoMdct->mdct_stereo_mode, sts[hBlock->ch1]->core, sts[hBlock->ch2]->core, sts[0]->igf, sts[0]->hTcxDec->L_frameTCX, sts[1]->hTcxDec->L_frameTCX, 1, TCX_20_CORE, TCX_20_CORE, 0, &q_x[hBlock->ch2], &q_x[hBlock->ch1] );
#else  /* OPT_SBA_DEC_PATH */
        stereo_decoder_tcx_fx( hBlock->hStereoMdct, hBlock->mask, &x[hBlock->ch2][0], &x[hBlock->ch1][0], &x[hBlock->ch2][0], hBlock->hStereoMdct->mdct_stereo_mode, sts[hBlock->ch1]->core, sts[hBlock->ch2]->core, sts[0]->igf, sts[0]->hTcxDec->L_frameTCX, sts[1]->hTcxDec->L_frameTCX, 1, TCX_20_CORE, TCX_20_CORE, 0 );
#endif /* OPT_SBA_DEC_PATH */
    }

#ifndef OPT_SBA_DEC_PATH
    applyGlobalILD_fx( sts, hMCT, x, q_x );
#else  /* OPT_SBA_DEC_PATH */
    applyGlobalILD_fx( sts, hMCT, x );
#endif /* OPT_SBA_DEC_PATH */

    return;
}
+4 −0
Original line number Diff line number Diff line
@@ -737,7 +737,11 @@ void ivas_mdct_core_invQ_fx(
        q_r = sub( 30, sts[1]->hTonalMDCTConc->lastBlockData.spectralData_exp );

        /* both input in same Q */
#ifndef OPT_SBA_DEC_PATH
        stereo_decoder_tcx_fx( hCPE->hStereoMdct, ms_mask, x_0[1], &spectralData_tmp[0], &spectralData_tmp[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 1, &q_r, &q_l );
#else  /* OPT_SBA_DEC_PATH */
        stereo_decoder_tcx_fx( hCPE->hStereoMdct, ms_mask, x_0[1], &spectralData_tmp[0], &spectralData_tmp[1], &hCPE->hStereoMdct->mdct_stereo_mode[0], sts[0]->core, sts[1]->core, sts[0]->igf, L_frameTCX[0], L_frameTCX[1], 0, sts[0]->last_core, sts[1]->last_core, 1 );
#endif /* OPT_SBA_DEC_PATH */

        Copy_Scale_sig_32_16( spectralData_tmp[0], sts[0]->hTonalMDCTConc->lastBlockData.spectralData, L_frameTCX[0], -15 ); // q_l - 15
        Copy_Scale_sig_32_16( spectralData_tmp[1], sts[1]->hTonalMDCTConc->lastBlockData.spectralData, L_frameTCX[1], -15 ); // q_r - 15
Loading