Commit 3923f6f4 authored by vaclav's avatar vaclav
Browse files

HARM_CORE_SW, decoder step 3 (core_switching_pre_dec_fx) - move buffer old_syn_12k8_16k_fx[][]

parent 1c932cde
Loading
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -7805,8 +7805,7 @@ void bw_switching_pre_proc_fx(
    Decoder_State *st_fx,             /* i/o: decoder state structure                    */
    const Word32 last_element_brate,  /* i  : last element bitrate                       */
    const Word16 nchan_out,           /* i  : number of output channels                  */
    Word16 *old_syn_12k8_16k_fx16,
    Word32 *old_syn_12k8_16k_fx32
    const Word16 *old_syn_12k8_16k_fx /* i  : ACELP core synthesis at 12.8kHz or 16kHz Qx*/
#else
    const Word16 *old_syn_12k8_16k_fx,  /* i  : ACELP core synthesis at 12.8kHz or 16kHz        Qx*/
    Decoder_State *st_fx                /* i/o: decoder state structure     */
@@ -10386,7 +10385,11 @@ void ivas_swb_tbe_dec_fx(
    const Word32 *bwe_exc_extended_fx,    /* i  : bandwidth extended excitation : Q_exc             */
    Word16 Q_exc,
    const Word16 voice_factors_fx[], /* i  : voicing factors  : Q15                              */
#ifdef FIX_2290_COPY_OF_UNINIT_DATA
    const Word16 old_syn_12k8_16k_fx16[], /* i  : low band synthesis : old_syn_fx                     */
#else
    const Word32 old_syn_12k8_16k_fx[], /* i  : low band synthesis : old_syn_fx                     */
#endif
    Word16 *White_exc16k_fx, /* o  : shaped white excitation for the FB TBE : Q_white_exc*/
    Word32 *synth_fx,        /* o  : SHB synthesis/final synthesis  : Qx                 */
    Word16 *pitch_buf_fx,    /* i  : Q6                                                  */
+23 −23
Original line number Diff line number Diff line
@@ -189,8 +189,7 @@ void bw_switching_pre_proc_fx(
    Decoder_State *st_fx,             /* i/o: decoder state structure                     */
    const Word32 last_element_brate,  /* i  : last element bitrate                        */
    const Word16 nchan_out,           /* i  : number of output channels                   */
    Word16 *old_syn_12k8_16k_fx16,
    Word32 *old_syn_12k8_16k_fx32
    const Word16 *old_syn_12k8_16k_fx /* i  : ACELP core synthesis at 12.8kHz or 16kHz  Qx*/
#else
    const Word16 *old_syn_12k8_16k_fx,                                                                                   /* i  : ACELP core synthesis at 12.8kHz or 16kHz        Qx*/
    Decoder_State *st_fx                                                                                                 /* i/o: decoder state structure     */
@@ -218,7 +217,9 @@ void bw_switching_pre_proc_fx(
        {
            /* Calculate tilt of the ACELP core synthesis - needed in SWB BWE decoding */
            Word16 old_syn_12k8_16k_tmp_16fx[L_FRAME16k];
            Copy_Scale_sig_32_16( old_syn_12k8_16k_fx32, old_syn_12k8_16k_tmp_16fx, st_fx->L_frame, sub( -1, Q11 ) );
            Word32 old_syn_12k8_16k_tmp_32fx[L_FRAME16k];
            Copy_Scale_sig_16_32_DEPREC( old_syn_12k8_16k_fx, old_syn_12k8_16k_tmp_32fx, st_fx->L_frame, Q11 - ( -Q1 ) ); // Q(11 - (-1))
            Copy_Scale_sig_32_16( old_syn_12k8_16k_tmp_32fx, old_syn_12k8_16k_tmp_16fx, st_fx->L_frame, sub( -1, Q11 ) );
            st_fx->tilt_wb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_syn_12k8_16k_tmp_16fx, -1, st_fx->L_frame ), sub( Q11, 8 ) ) ); // Q24+(Q11-8) - 16
            move16();
        }
@@ -235,22 +236,14 @@ void bw_switching_pre_proc_fx(
         * Calculate tilt of the ACELP core synthesis
         *----------------------------------------------------------------------*/

#ifdef HARM_CORE_SW
        st_fx->tilt_wb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_syn_12k8_16k_fx16, -1, st_fx->L_frame ), 3 ) ); /* Q11 */
#else
        st_fx->tilt_wb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_syn_12k8_16k_fx, -1, st_fx->L_frame ), 3 ) ); /* Q11 */
#endif
        move16();

        /*-------------------------------------------------------------------------------*
         * Calculate frequency energy of 0~3.2kHz and 3.2~6.4kHz the ACELP core synthesis
         *-------------------------------------------------------------------------------*/

#ifdef HARM_CORE_SW
        edct_16fx( old_syn_12k8_16k_fx16, syn_dct_fx, L_FRAME, 6, st_fx->element_mode );
#else
        edct_16fx( old_syn_12k8_16k_fx, syn_dct_fx, L_FRAME, 6, st_fx->element_mode );
#endif

        L_tmp = L_deposit_l( 0 );
        FOR( i = 0; i < L_FRAME / 2; i++ )
@@ -341,6 +334,7 @@ void bw_switching_pre_proc_fx(
        st_fx->prev_fractive = 0;
        move16();
    }

    return;
}

@@ -2280,10 +2274,15 @@ ivas_error core_switching_pre_dec_ivas_fx(
            Scale_sig( st->hPFstat->mem_pf_in, L_SUBFR, st->Q_syn );    /* Post_filter mem  ,Q_syn*/
            Scale_sig( st->hPFstat->mem_res2, DECMEM_RES2, st->Q_syn ); /* NB post_filter mem , Q_syn*/
            Scale_sig( st->hPFstat->mem_stp, L_SUBFR, st->Q_syn );      /* Post_filter mem  ,Q_syn*/
#ifndef HARM_CORE_SW
            set16_fx( hBPF->pst_old_syn_fx, 0, NBPSF_PIT_MAX ); /* BPF mem*/
#endif
        }
        IF( hBPF != NULL )
        {
#ifdef HARM_CORE_SW
            set16_fx( hBPF->pst_old_syn_fx, 0, NBPSF_PIT_MAX ); /* BPF mem*/
#endif
            hBPF->pst_lp_ener_fx = round_fx( L_shl( Mpy_32_16_1( st->lp_error_ener, 0x6054 ), 2 + 8 ) ); /* convert from 15Q16, log2 -> 7Q8 10*log10  */
            hBPF->pst_mem_deemp_err_fx = 0;
            move16();
@@ -2512,6 +2511,7 @@ ivas_error core_switching_pre_dec_ivas_fx(
                    Copy_Scale_sig_32_16( syn_Overl_fx, hTcxDec->syn_Overl, 320, 15 );
                    Copy_Scale_sig_32_16( fer_samples_fx, hHQ_core->fer_samples_fx, 960, 9 );
                }
            }

            test();
            test();
@@ -2522,7 +2522,6 @@ ivas_error core_switching_pre_dec_ivas_fx(
                set16_fx( hHQ_core->fer_samples_fx + delay_comp + output_frame / 2, 0, sub( shr( output_frame, 1 ), delay_comp ) );
            }
        }
        }

        st->use_acelp_preq = 0;
        st->reset_mem_AR = 0;
@@ -2934,6 +2933,7 @@ ivas_error core_switching_pre_dec_ivas_fx(
            set16_fx( hHQ_core->old_out_fx, 0, output_frame );
            set16_fx( hHQ_core->old_out_LB_fx, 0, L_FRAME16k );
            hHQ_core->Q_old_wtda_LB = Q15;
            move16();
            hHQ_core->Q_old_wtda = Q15;
            move16();
#else
+1 −1
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ ivas_error evs_dec_fx(
         *---------------------------------------------------------------------*/

#ifdef HARM_CORE_SW
        bw_switching_pre_proc_fx( st_fx, -1, 1, old_syn_12k8_16k_fx, NULL );
        bw_switching_pre_proc_fx( st_fx, -1, 1, old_syn_12k8_16k_fx );
#else
        bw_switching_pre_proc_fx( old_syn_12k8_16k_fx, st_fx );
#endif
+7 −8
Original line number Diff line number Diff line
@@ -82,9 +82,10 @@ ivas_error ivas_core_dec_fx(

    Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]; // Q6
#ifdef HARM_CORE_SW
    Word16 old_syn_12k8_16k_fx_16[CPE_CHANNELS][L_FRAME16k];
#endif
    Word16 old_syn_12k8_16k_fx[CPE_CHANNELS][L_FRAME16k];
#else
    Word32 old_syn_12k8_16k_fx[CPE_CHANNELS][L_FRAME16k];
#endif

    Word16 unbits[CPE_CHANNELS];
    Word16 sid_bw[CPE_CHANNELS];
@@ -543,7 +544,7 @@ ivas_error ivas_core_dec_fx(
            move16();

#ifdef HARM_CORE_SW
            IF( NE_32( ( error = acelp_core_dec_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16[n], sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
            IF( NE_32( ( error = acelp_core_dec_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
#else
            IF( NE_32( ( error = acelp_core_dec_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
#endif
@@ -579,17 +580,15 @@ ivas_error ivas_core_dec_fx(
                hSCE->q_save_hb_synth_fx = Q11;
                move16();
            }
#ifndef HARM_CORE_SW
#ifdef FIX_2290_COPY_OF_UNINIT_DATA
            IF( st->hBWE_FD != NULL )
            {
#ifdef HARM_CORE_SW
                Copy_Scale_sig_16_32_DEPREC( old_syn_12k8_16k_fx_16[n], old_syn_12k8_16k_fx[n], st->L_frame, Q11 - ( -Q1 ) ); // Q(11 - (-1))
#else
                Copy_Scale_sig_16_32_DEPREC( old_syn_12k8_16k_fx_16, old_syn_12k8_16k_fx[n], st->L_frame, Q11 - ( -Q1 ) ); // Q(11 - (-1))
#endif
            }
#else
            Copy_Scale_sig_16_32_DEPREC( old_syn_12k8_16k_fx_16, old_syn_12k8_16k_fx[n], L_FRAME16k, Q11 - ( -Q1 ) ); // Q(11 - (-1))
#endif
#endif
        }

@@ -962,7 +961,7 @@ ivas_error ivas_core_dec_fx(
         *---------------------------------------------------------------------*/

#ifdef HARM_CORE_SW
        bw_switching_pre_proc_fx( st, last_element_brate, nchan_out, old_syn_12k8_16k_fx_16[n], old_syn_12k8_16k_fx[n] );
        bw_switching_pre_proc_fx( st, last_element_brate, nchan_out, old_syn_12k8_16k_fx[n] );
#else
        ivas_bw_switching_pre_proc_fx( st, last_element_brate, nchan_out, old_syn_12k8_16k_fx[n], old_syn_fx, q_audio );
#endif
+13 −4
Original line number Diff line number Diff line
@@ -5474,7 +5474,11 @@ void ivas_swb_tbe_dec_fx(
    const Word32 *bwe_exc_extended_fx,    /* i  : bandwidth extended excitation : Q_exc             */
    Word16 Q_exc,
    const Word16 voice_factors_fx[], /* i  : voicing factors  : Q15                              */
#ifdef FIX_2290_COPY_OF_UNINIT_DATA
    const Word16 old_syn_12k8_16k_fx16[], /* i  : low band synthesis : old_syn_fx                     */
#else
    const Word32 old_syn_12k8_16k_fx[], /* i  : low band synthesis : old_syn_fx                     */
#endif
    Word16 *White_exc16k_fx, /* o  : shaped white excitation for the FB TBE : Q_white_exc*/
    Word32 *synth_fx,        /* o  : SHB synthesis/final synthesis  : Qx                 */
    Word16 *pitch_buf_fx,    /* i  : Q6                                                  */
@@ -5545,6 +5549,11 @@ void ivas_swb_tbe_dec_fx(

    hBWE_TD = st->hBWE_TD;

#ifdef FIX_2290_COPY_OF_UNINIT_DATA
    Word32 old_syn_12k8_16k_fx[L_FRAME16k];
    Copy_Scale_sig_16_32_DEPREC( old_syn_12k8_16k_fx16, old_syn_12k8_16k_fx, st->L_frame, Q11 - ( -Q1 ) ); // Q(11 - (-1))
#endif

    /* initializations */
    GainFrame_fx = 0;
    move32();