Commit 8b28a8da authored by Sandesh Venkatesh's avatar Sandesh Venkatesh Committed by Manuel Jander
Browse files

Precision improvements in mdct core enc

parent b0ea6085
Loading
Loading
Loading
Loading
+15 −17
Original line number Diff line number Diff line
@@ -1189,7 +1189,7 @@ void core_signal_analysis_high_bitrate_ivas_fx(

        IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
        {
            Word16 q_mdstWin, scale;
            Word16 scale;
            L_subframe = idiv1616( L_frameTCX, nSubframes ); /* Q0 */

            test();
@@ -1199,8 +1199,7 @@ void core_signal_analysis_high_bitrate_ivas_fx(
                scale = sub( norm_arr( mdstWin, L_frameTCX ), 1 );
                scale = s_min( 1, scale ); // restricting the Q to zero or less
                scale_sig( mdstWin, L_frameTCX, scale );
                q_mdstWin = add( -1, scale );
                move16();
                q_mdstWin = add( add( st->q_inp, -1 ), scale );
            }
            ELSE
            {
@@ -1211,8 +1210,7 @@ void core_signal_analysis_high_bitrate_ivas_fx(
                scale = sub( norm_arr( mdstWin, sig_len ), 1 );
                scale = s_min( 0, scale ); // restricting the Q to zero or less
                scale_sig( mdstWin, sig_len, scale );
                q_mdstWin = scale;
                move16();
                q_mdstWin = add( scale, st->q_inp );
            }

            IF( EQ_16( transform_type[frameno], TCX_5 ) )
@@ -1232,17 +1230,17 @@ void core_signal_analysis_high_bitrate_ivas_fx(
                    Word32 L_tmp;
                    FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */
                    {
                        L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16
                        L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im );                           // (Q16, Q15) -> Q16
                        L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) );                                                                         // q_mdstWin
                        L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp
                        L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im );                           // (Q16 + q_inp, Q15) -> Q16 + q_inp
                        L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) );                                                       // q_mdstWin
                        mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) );                                      // q_mdstWin
                        move32();
                    }
                    FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */
                    {
                        L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16
                        L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re );                                          // (Q16, Q15) -> Q16
                        L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) );                                                                         // q_mdstWin
                        L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp
                        L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re );                                          // (Q16 + q_inp, Q15) -> Q16 + q_inp
                        L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) );                                                       // q_mdstWin
                        mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) );                                      // q_mdstWin
                        move32();
                    }
@@ -1320,17 +1318,17 @@ void core_signal_analysis_high_bitrate_ivas_fx(
                        shift = sub( q_mdstWin, add( Q16, st->q_inp ) );
                        FOR( i = minWindowLen; i >= tmp; i-- ) /* outer left folding of shortened long ALDO slope */
                        {
                            L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16
                            L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im );                           // (Q16, Q15) -> Q16
                            L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) );                                                                         // q_mdstWin
                            L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp
                            L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i].v.im );                           // (Q16 + q_inp, Q15) -> Q16 + q_inp
                            L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) );                                                       // q_mdstWin
                            mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) );                                      // q_mdstWin
                            move32();
                        }
                        FOR( i = tmp - 1; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */
                        {
                            L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (Q0, Q15) -> Q16
                            L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re );                                          // (Q16, Q15) -> Q16
                            L_tmp = L_shl( L_tmp, sub( q_mdstWin, Q16 ) );                                                                         // q_mdstWin
                            L_tmp = L_mult( hTcxEnc->speech_TCX[-1 - i], st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] ); // (q_inp, Q15) -> Q16 + q_inp
                            L_tmp = Mpy_32_16_1( L_tmp, st->hTcxCfg->tcx_mdct_window_minimumFB[i].v.re );                                          // (Q16 + q_inp, Q15) -> Q16 + q_inp
                            L_tmp = L_shl( L_tmp, sub( q_mdstWin, add( Q16, st->q_inp ) ) );                                                       // q_mdstWin
                            mdstWin[left_overlap + i] = add( mdstWin[left_overlap + i], extract_l( L_tmp ) );                                      // q_mdstWin
                            move32();
                        }
+2 −2
Original line number Diff line number Diff line
@@ -430,9 +430,9 @@ static void kernel_switch_update_transforms_fx(
        Word32 factor;

        n = extract_l( Mpy_32_32( s, 603979776 /* N_ZERO_MDCT_NS / FRAME_SIZE_NS in Q31 */ ) );
        Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), -Q1 );                                                                   // Q0 -> Q-1
        Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( -Q1, q_speech ) );                                                  // q_speech -> Q-1
        wtda_ext_fx( tcxTimeSignal, windowedTimeSignal_16, extract_l( windowedTimeSignal[0] ), extract_l( windowedTimeSignal[1] ), s, kernelType ); // Q-2
        Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), Q1 );                                                                    // Q-1 -> Q0
        Scale_sig( &tcxTimeSignal[n - s], add( sub( shl( s, 1 ), n ), 1 ), sub( q_speech, -Q1 ) );                                                  // Q-1 -> q_speech
        Copy_Scale_sig_16_32_no_sat( windowedTimeSignal_16 /* Q(-2) */, windowedTimeSignal, s, Q16 );                                               // Q14
        scale_sig32( windowedTimeSignal, s, -Q8 /* guard bits */ );                                                                                 // Q6
        edxt_fx( windowedTimeSignal, sigR, s, kernelType, FALSE );