Commit 9d4b8adb authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for 3GPP issue 1254: BASOP encoder OSBA 256 kbps: broken signal envelope

Link #1254
parent d119249b
Loading
Loading
Loading
Loading
Loading
+9 −28
Original line number Diff line number Diff line
@@ -997,7 +997,7 @@ void mctStereoIGF_enc_fx(
    Word32 *p_powerSpec_fx[NB_DIV];

    Word16 b, nSubframes, L_subframeTCX;
    Word16 p_ch[2], n, ch, ch1, ch2, s = 31;
    Word16 p_ch[2], n, ch, ch1, ch2;
    Word16 q_pSI_ch[2];
    Word16 q_pS_ch[2];
    Encoder_State *p_st[NB_DIV];
@@ -1072,39 +1072,20 @@ void mctStereoIGF_enc_fx(
            IF( NE_16( hMCT->hBlockData[b]->hStereoMdct->mdct_stereo_mode[n], hMCT->hBlockData[b]->hStereoMdct->IGFStereoMode[n] ) ||
                EQ_16( hMCT->hBlockData[b]->hStereoMdct->mdct_stereo_mode[n], SMDCT_BW_MS ) )
            {
                Word16 exp_powerSpec_tmp[CPE_CHANNELS];
                Word16 exp_p_inv_spectrum[CPE_CHANNELS];
                FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
                {
                    s = s_min( s, sub( 31, p_st[ch]->hTcxEnc->spectrum_e[n] ) );
                    s = s_min( s, q_pS_ch[ch] );
                    s = s_min( s, q_pSI_ch[ch] );
                }
                Word16 exp_powerSpec_fx[CPE_CHANNELS], exp_powerSpecMsInv_fx[CPE_CHANNELS], exp_inv_spectrum_fx[CPE_CHANNELS];

                FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
                {
                    scale_sig32( p_st[ch]->hTcxEnc->spectrum_fx[0], N_MAX, sub( s, sub( 31, p_st[ch]->hTcxEnc->spectrum_e[0] ) ) );
                    scale_sig32( p_inv_spectrum_fx[ch][0], L_FRAME48k, sub( s, sub( 31, p_st[ch]->hTcxEnc->spectrum_e[0] ) ) );
                    p_st[ch]->hTcxEnc->spectrum_e[0] = sub( 31, s );
                    p_st[ch]->hTcxEnc->spectrum_e[1] = sub( 31, s );
                    move16();
                    exp_powerSpec_fx[ch] = sub( Q31, q_pS_ch[ch] );
                    exp_powerSpecMsInv_fx[ch] = sub( Q31, q_pSI_ch[ch] );
                    exp_inv_spectrum_fx[ch] = p_st[ch]->hTcxEnc->spectrum_e[n];
                    move16();

                    scale_sig32( p_powerSpecMsInv_fx[ch][0], L_FRAME48k, sub( s, q_pSI_ch[ch] ) );
                    scale_sig32( &p_powerSpec_fx[ch][0], sts[ch]->hTcxEnc->L_frameTCX, sub( s, q_pS_ch[ch] ) );
                    q_powerSpec[ch1] = s;
                    q_powerSpec[ch2] = s;
                    move16();
                    move16();
                }
                exp_powerSpec_tmp[0] = p_st[0]->hTcxEnc->spectrum_e[0];
                exp_powerSpec_tmp[1] = p_st[1]->hTcxEnc->spectrum_e[0];
                exp_p_inv_spectrum[0] = exp_p_inv_spectrum[1] = p_st[0]->hTcxEnc->spectrum_e[0];
                move16();
                move16();
                move16();
                move16();
                ProcessStereoIGF_fx( hMCT->hBlockData[b]->hStereoMdct, p_st, hMCT->hBlockData[b]->mask, p_orig_spectrum_fx, q_origSpec, q_origSpec, p_powerSpec_fx, exp_powerSpec_tmp,
                                     p_powerSpecMsInv_fx, exp_powerSpec_tmp, p_inv_spectrum_fx, exp_p_inv_spectrum, n, sp_aud_decision0[ch1], p_st[0]->total_brate, 1 );

                ProcessStereoIGF_fx( hMCT->hBlockData[b]->hStereoMdct, p_st, hMCT->hBlockData[b]->mask, p_orig_spectrum_fx, q_origSpec, q_origSpec, p_powerSpec_fx, exp_powerSpec_fx,
                                     p_powerSpecMsInv_fx, exp_powerSpecMsInv_fx, p_inv_spectrum_fx, exp_inv_spectrum_fx, n, sp_aud_decision0[ch1], p_st[0]->total_brate, 1 );
            }
            ELSE
            {