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

Added missing scaling, removed unnecessary scaling and minor bug fix

parent b7b42e14
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -901,7 +901,7 @@ void acelp_fast_fx(
                move16();
            }

            Copy( y_tmp, y, L_subfr ); // q_H
            Copy_Scale_sig( y_tmp, y, L_subfr, sub( 9, q_H ) ); // y in Q9
            skip_track_max = skip_track[q];
            move16();
        }
+4 −3
Original line number Diff line number Diff line
@@ -1264,9 +1264,10 @@ static void IGF_CalculateStereoEnvelope_fx(
                    move16();
                    move16();

                    BASOP_Util_Add_MantExp( hPrivateData->SFM_sb_fx[sfb], tmp_sb_e, negate( hPrivateData->SFM_tb_fx[sfb] ), tmp_tb_e, &diffSFM_fx ); /*stores the resultant exponent for diffSFM_fx*/
                    diffSFM_fx = sub( hPrivateData->SFM_sb_fx[sfb], hPrivateData->SFM_tb_fx[sfb] ); /*Q13*/

                    IF( diffSFM_fx > 0 && LT_32( hPrivateData->SFM_tb_fx[sfb], L_shr( 3277 /*0.1 Q15*/, tmp_tb_e ) ) ) /* check whether target SFB is more tonal than source SFB */
                    test();
                    IF( diffSFM_fx > 0 && LT_16( hPrivateData->SFM_tb_fx[sfb], 819 /*0.1 Q13*/ ) ) /* check whether target SFB is more tonal than source SFB */
                    {
                        Word16 currDampingFactor_fx, dampingFactor_fx, alpha_fx;
                        Word16 threshold_e, threshold_fx, alpha_e, currDampingFactor_e, dampingFactor_e;
@@ -1391,7 +1392,7 @@ static void IGF_CalculateStereoEnvelope_fx(
                            {
                                // currDampingFactor += 0.1f * ( ( 10 + adap ) - tonalToNoise );
                                Word32 temp2 = BASOP_Util_Add_Mant32Exp( L_add( L_shl( 10, sub( 15, adap_e ) ) /*exp:adap_e*/, adap ), add( adap_e, 16 ), L_negate( tonalToNoise ), tonalToNoise_e, &tmp_e ); /* resultant exp is tmp_e*/
                                currDampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor_fx, currDampingFactor_e, extract_l( Mult_32_32( 3277 /*0.1f Q15*/, temp2 ) ), tmp_e, &currDampingFactor_fx ); /*stores resultant exp for currDampingFactor_fx*/
                                currDampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor_fx, currDampingFactor_e, extract_l( Mult_32_16( temp2, 3277 /*0.1f Q15*/ ) ), tmp_e, &currDampingFactor_fx ); /*stores resultant exp for currDampingFactor_fx*/
                            }
                        }

+8 −4
Original line number Diff line number Diff line
@@ -1628,11 +1628,15 @@ void ivas_mdct_core_whitening_enc_fx(
                        Scale_sig32( mdst_spectrum_fx[0][n], tcx5SizeFB, scale );   // q_com
                        Scale_sig32( mdst_spectrum_fx[1][n], tcx5SizeFB, scale );   // q_com

                        offset2 = sub( idiv1616( hTcxEnc0->L_frameTCX, nSubframes ), offset1 );
                        IF( offset2 > 0 )
                        {
                            Scale_sig32( hTcxEnc0->spectrum_fx[n] + offset1, offset2, scale ); // q_com
                            Scale_sig32( hTcxEnc1->spectrum_fx[n] + offset1, offset2, scale ); // q_com
                            Scale_sig32( mdst_spectrum_fx[0][n] + offset1, offset2, scale );   // q_com
                            Scale_sig32( mdst_spectrum_fx[1][n] + offset1, offset2, scale );   // q_com
                        }
                    }
                    mdst_spectrum_e[0][n] = sub( Q31, q_com );
                    hTcxEnc0->spectrum_e[n] = sub( Q31, q_com );
                    mdst_spectrum_e[1][n] = sub( Q31, q_com );