Commit cf227f68 authored by kulgod's avatar kulgod
Browse files

corrected length for min hdrm

parent 519add0e
Loading
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -1566,9 +1566,9 @@ void ivas_mdct_core_whitening_enc_fx(
                    exp_max = s_max( exp_max, mdst_spectrum_e[1][n] );

                    // calculate the headroom available
                    exp_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], length ), L_norm_arr( hTcxEnc0->spectrum_fx[n], length ) );
                    exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[0][n], length ) );
                    exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[1][n], length ) );
                    exp_com = s_min( L_norm_arr( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) ), L_norm_arr( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) ) );
                    exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) ) );
                    exp_com = s_min( exp_com, L_norm_arr( mdst_spectrum_fx[1][n], shr( hTcxEnc0->L_frameTCX, shift ) ) );

                    q_com = sub( s_min( Q31, add( sub( Q31, exp_max ), exp_com ) ), 6 ); // 6 guarded bits
                    q_com = s_max( q_com, 9 );
@@ -1663,10 +1663,10 @@ void ivas_mdct_core_whitening_enc_fx(
                    q_com = sub( s_min( Q31, add( sub( Q31, exp_max ), exp_com ) ), 6 );
                    exp_com = sub( Q31, q_com );

                    Scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( hTcxEnc0->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e
                    Scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( hTcxEnc1->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e
                    Scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[0][n], exp_com ) );     // mdst_spectrum_e
                    Scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[1][n], exp_com ) );     // mdst_spectrum_e
                    scale_sig32( hTcxEnc0->spectrum_fx[n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( hTcxEnc0->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e
                    scale_sig32( hTcxEnc1->spectrum_fx[n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( hTcxEnc1->spectrum_e[n], exp_com ) ); // hTcxEnc0->spectrum_e
                    scale_sig32( mdst_spectrum_fx[0][n], shr( hTcxEnc0->L_frameTCX, shift ) /* hTcxEnc0->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[0][n], exp_com ) );     // mdst_spectrum_e
                    scale_sig32( mdst_spectrum_fx[1][n], shr( hTcxEnc1->L_frameTCX, shift ) /* hTcxEnc1->L_frameTCX/nSubframes */, sub( mdst_spectrum_e[1][n], exp_com ) );     // mdst_spectrum_e

                    Word16 q_com_orig = q_com;
                    move16();