Commit 13204a21 authored by Manuel Jander's avatar Manuel Jander
Browse files

Merge remote-tracking branch 'origin' into 3gpp_issue_1348_fix

parents 6c3c58e6 e9c74df8
Loading
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -458,29 +458,35 @@ void stereo_mdct_core_enc_fx(
            {
                IF( NE_16( hStereoMdct->mdct_stereo_mode[n], SMDCT_DUAL_MONO ) )
                {
                    exp = shl( add( sts[ch]->hTcxEnc->spectrum_e[n], 1 ), 1 ); // 2*(sts[ch]->hTcxEnc->spectrum_e[n]+1)
                    /* power spectrum: MDCT^2 + MDST^2 */
                    W_tmp = W_mult_32_32( inv_spectrum_fx[ch][n][0], inv_spectrum_fx[ch][n][0] ); // exp: 2*sts[ch]->hTcxEnc->spectrum_e[n]
                    mdct = L_shr( inv_spectrum_fx[ch][n][0], 1 ); // exp: sts[ch]->hTcxEnc->spectrum_e[n]+1
                    W_tmp = W_mult_32_32( mdct, mdct );           // exp: 2*(sts[ch]->hTcxEnc->spectrum_e[n]+1) (exp)
                    norm = W_norm( W_tmp );
                    powerSpecMsInv_fx[ch][n][0] = W_extract_h( W_shl( W_tmp, norm ) ); // exp: 2*sts[ch]->hTcxEnc->spectrum_e[n]-norm
                    exp_powSpecInv[n][0] = sub( shl( sts[ch]->hTcxEnc->spectrum_e[n], 1 ), norm );
                    powerSpecMsInv_fx[ch][n][0] = W_extract_h( W_shl( W_tmp, norm ) ); // exp: 2*(sts[ch]->hTcxEnc->spectrum_e[n]+1)-norm (exp-norm)
                    exp_powSpecInv[n][0] = sub( exp, norm );
                    move32();
                    move16();

                    FOR( i = 1; i < L_subframeTCX - 1; i++ )
                    {
                        Word32 mdst_fx = L_sub( inv_spectrum_fx[ch][n][i + 1], inv_spectrum_fx[ch][n][i - 1] );                        // exp: sts[ch]->hTcxEnc->spectrum_e[n]
                        W_tmp = W_mac_32_32( W_mult_32_32( mdst_fx, mdst_fx ), inv_spectrum_fx[ch][n][i], inv_spectrum_fx[ch][n][i] ); // exp: 2*sts[ch]->hTcxEnc->spectrum_e[n]
                        /* float mdst = ( inv_spectrum[ch][n][i + 1] - inv_spectrum[ch][n][i - 1] );
                           powerSpecMsInv[ch][n][i] = mdst * mdst + inv_spectrum[ch][n][i] * inv_spectrum[ch][n][i]; */
                        mdst = L_sub( L_shr( inv_spectrum_fx[ch][n][i + 1], 1 ), L_shr( inv_spectrum_fx[ch][n][i - 1], 1 ) ); // exp: sts[ch]->hTcxEnc->spectrum_e[n]+1
                        mdct = L_shr( inv_spectrum_fx[ch][n][i], 1 );                                                         // exp: sts[ch]->hTcxEnc->spectrum_e[n]+1
                        W_tmp = W_mac_32_32( W_mult_32_32( mdst, mdst ), mdct, mdct );                                        // exp: 2*(sts[ch]->hTcxEnc->spectrum_e[n]+1) (exp)
                        norm = W_norm( W_tmp );
                        powerSpecMsInv_fx[ch][n][i] = W_extract_h( W_shl( W_tmp, norm ) ); // exp: 2*sts[ch]->hTcxEnc->spectrum_e[n]-norm
                        exp_powSpecInv[n][i] = sub( shl( sts[ch]->hTcxEnc->spectrum_e[n], 1 ), norm );
                        powerSpecMsInv_fx[ch][n][i] = W_extract_h( W_shl( W_tmp, norm ) ); // exp: 2*(sts[ch]->hTcxEnc->spectrum_e[n]+1)-norm (exp-norm)
                        exp_powSpecInv[n][i] = sub( exp, norm );
                        move32();
                        move16();
                    }

                    W_tmp = W_mult_32_32( inv_spectrum_fx[ch][n][L_subframeTCX - 1], inv_spectrum_fx[ch][n][L_subframeTCX - 1] ); // exp: 2*sts[ch]->hTcxEnc->spectrum_e[n]
                    mdct = L_shr( inv_spectrum_fx[ch][n][L_subframeTCX - 1], 1 ); // exp: sts[ch]->hTcxEnc->spectrum_e[n]+1
                    W_tmp = W_mult_32_32( mdct, mdct );                           // exp: 2*(sts[ch]->hTcxEnc->spectrum_e[n]+1) (exp)
                    norm = W_norm( W_tmp );
                    powerSpecMsInv_fx[ch][n][L_subframeTCX - 1] = W_extract_h( W_shl( W_tmp, norm ) ); // exp: 2*sts[ch]->hTcxEnc->spectrum_e[n]-norm
                    exp_powSpecInv[n][L_subframeTCX - 1] = sub( shl( sts[ch]->hTcxEnc->spectrum_e[n], 1 ), norm );
                    powerSpecMsInv_fx[ch][n][L_subframeTCX - 1] = W_extract_h( W_shl( W_tmp, norm ) ); // exp: 2*(sts[ch]->hTcxEnc->spectrum_e[n]+1)-norm (exp-norm)
                    exp_powSpecInv[n][L_subframeTCX - 1] = sub( exp, norm );
                    move32();
                    move16();
                }