Commit 710fb09b authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Get_Transition function converted to fixed.

parent cec6b0a9
Loading
Loading
Loading
Loading
Loading
+60 −0
Original line number Diff line number Diff line
@@ -1032,6 +1032,66 @@ void interpolate_3_over_1_allpass(
}


void interpolate_3_over_1_allpass_32(
    const Word32 *input, /* i  : input signal            */
    const Word16 len,    /* i  : number of input samples */
    Word32 *out,         /* o  : output signal           */
    Word32 *mem          /* i/o: memory                  */
)
{
    Word16 i;
    Word32 Vu[2], Vm[2], Vl[2]; /* Outputs of three cascaded allpass stages (upper, middle, and lower) */
    Word32 *out1;
    Word32 mem_temp;
    const Word16 *filt_coeff = allpass_poles_3_ov_2;

    out1 = &out[0];

    FOR( i = 0; i < len; i++ )
    {
        /* Upper branch */
        Vu[0] = L_add_sat( mem[0], Mpy_32_16_1( L_sub( input[i], mem[1] ), filt_coeff[0] ) );
        Vu[1] = L_add_sat( mem[1], Mpy_32_16_1( L_sub( Vu[0], mem[2] ), filt_coeff[1] ) );
        mem[3] = L_add_sat( mem[2], Mpy_32_16_1( L_sub( Vu[1], mem[3] ), filt_coeff[2] ) );

        mem[1] = Vu[0];
        mem[2] = Vu[1];
        *out1++ = mem[3];

        /* Middle branch */
        Vm[0] = L_add_sat( mem[0], Mpy_32_16_1( L_sub( input[i], mem[4] ), filt_coeff[3] ) );
        Vm[1] = L_add_sat( mem[4], Mpy_32_16_1( L_sub( Vm[0], mem[5] ), filt_coeff[4] ) );
        mem[6] = L_add_sat( mem[5], Mpy_32_16_1( L_sub( Vm[1], mem[6] ), filt_coeff[5] ) );

        mem[4] = Vm[0];
        mem[5] = Vm[1];
        *out1++ = mem[6];

        /* Lower branch */
        Vl[0] = L_add_sat( mem[0], Mpy_32_16_1( L_sub( input[i], mem[7] ), filt_coeff[6] ) );
        Vl[1] = L_add_sat( mem[7], Mpy_32_16_1( L_sub( Vl[0], mem[8] ), filt_coeff[7] ) );
        mem[9] = L_add_sat( mem[8], Mpy_32_16_1( L_sub( Vl[1], mem[9] ), filt_coeff[8] ) );

        mem[0] = input[i];
        mem[7] = Vl[0];
        mem[8] = Vl[1];
        *out1++ = mem[9];
    }

    /*LPF*/
    FOR( i = 0; i < len * 3; i++ )
    {
        mem_temp = out[i];
        out[i] = L_sub_sat( Mpy_32_16_1( L_add_sat( mem[12], mem[11] ), 18768 ), Mpy_32_16_1( L_add_sat( mem_temp, mem[10] ), 2424 ) );
        mem[10] = mem[11];
        mem[11] = mem[12];
        mem[12] = mem_temp;
    }

    return;
}


/*-------------------------------------------------------------------*
 * retro_interp4_5()
 *
+26 −1
Original line number Diff line number Diff line
@@ -2642,7 +2642,15 @@ void flip_and_downmix_generic(
    float mem3_ext[2 * HILBERT_ORDER2], /* i/o: memory                                  */
    int16_t *phase_state                /* i/o: Phase state in case frequency isn't multiple of 50 Hz */
);
void flip_and_downmix_generic_fx_32(
  Word32 input[],                         /* i : input spectrum Qx*/
  Word32 output[],                        /* o : output spectrum Qx*/
  const Word16 length,                    /* i : length of spectra */
  Word32 mem1_ext[HILBERT_ORDER1],        /* i/o: memory Qx*/
  Word32 mem2_ext[2 * HILBERT_ORDER2],      /* i/o: memory Qx*/
  Word32 mem3_ext[2 * HILBERT_ORDER2],      /* i/o: memory Qx*/
  Word16* phase_state                     /* i/o: Phase state in case frequency isn't multiple of 50 Hz */
);
void non_linearity(
    const float input[],          /* i  : input signal                            */
    float output[],               /* i  : output signal                           */
@@ -2731,12 +2739,29 @@ void GenTransition(
    const int32_t total_brate   /* i  : total bitrate                           */
);
void GenTransition_fixed(
  TD_BWE_DEC_HANDLE hBWE_TD,  /* i/o: TD BWE data handle                      */
  Word32 *outputHB_fx,            /* o  : synthesized HB transitions signal       */
  const int32_t output_Fs,    /* i  : output sampling rate                    */
  const int16_t element_mode, /* i  : element mode                            */
  const int16_t L_frame,      /* i  : ACELP frame length                      */
  const int16_t rf_flag,      /* i  : RF flag                                 */
  const int32_t total_brate   /* i  : total bitrate                           */
);
void GenTransition_WB(
    TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle                      */
    float *outputHB,           /* o  : synthesized HB transitions signal       */
    const int32_t output_Fs    /* i  : output sampling rate                    */
);
void GenTransition_WB_fixed(
  TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle                      */
  Word32 *outputHB_fx,           /* o  : synthesized HB transitions signal       */
  const int32_t output_Fs    /* i  : output sampling rate                    */
);
void td_bwe_dec_init(
    TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle                      */
    const int16_t extl,        /* i  : BWE extension layer                     */
+6 −0
Original line number Diff line number Diff line
@@ -8723,6 +8723,12 @@ void interpolate_3_over_2_allpass_32(
  Word32 *mem          /* i/o: memory                  */
);

void interpolate_3_over_1_allpass_32(
  const Word32 *input, /* i  : input signal            */
  const int16_t len,  /* i  : number of input samples */
  Word32 *out,         /* o  : output signal           */
  Word32 *mem          /* i/o: memory                  */
);
void Decimate_allpass_steep_fx32(
  const Word32 *in, /* i  : input array of size N                   */
  Word32 *mem,      /* i/o: memory                                  */
+1 −1
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ void flip_and_downmix_generic_fx_32(
                          tmpi2_I,            /* o: Imag. component of HB */
                          length,             /* i: length of the spectra */
                          1);                 /* i: HB transform stage */

    Copy32(tmp + length, mem1_ext, HILBERT_ORDER1);
    Copy32( mem2_ext+HILBERT_ORDER2, tmp_R, HILBERT_ORDER2 );
    Copy32( mem3_ext+HILBERT_ORDER2, tmp_I, HILBERT_ORDER2 );

+98 −2
Original line number Diff line number Diff line
@@ -851,14 +851,110 @@ ivas_error ivas_core_dec(

        if ( st->last_core == ACELP_CORE && ( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE ) && st->hBWE_TD != NULL )
        {
            //Delete from here
            Word32 hb_synth_fx[CPE_CHANNELS][L_FRAME48k];
            FOR( int ch_ind = 0; ch_ind < n_channels; ch_ind++ )
            {
                FOR( int ind = 0; ind < L_FRAME48k; ind++ )
                {
                    hb_synth_fx[ch_ind][ind] = (Word32) ( hb_synth[ch_ind][ind] * ( 1 << 11 ) );
                }
            }
            if ( st->hBWE_TD != NULL )
            {
                for ( int i = 0; i < L_SHB_LAHEAD; i++ )
                {
                    st->hBWE_TD->syn_overlap_fx_32[i] = st->hBWE_TD->syn_overlap[i] * ( 1 << 11 );
                }
                for ( int i = 0; i < INTERP_3_2_MEM_LEN; i++ )
                {
                    st->hBWE_TD->int_3_over_2_tbemem_dec_fx_32[i] = st->hBWE_TD->int_3_over_2_tbemem_dec[i] * ( 1 << 11 );
                }
                for ( int i = 0; i < HILBERT_MEM_SIZE; i++ )
                {
                    st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx[i] = st->hBWE_TD->genSHBsynth_Hilbert_Mem[i] * ( 1 << 11 );
                }
                for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP; i++ )
                {
                    st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32[i] = st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local[i] * ( 1 << 11 );
                }
                for ( int i = 0; i < L_SHB_TRANSITION_LENGTH; i++ )
                {
                    st->hBWE_TD->old_tbe_synth_fx_32[i] = st->hBWE_TD->old_tbe_synth[i] * ( 1 << 11 );
                }
                for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP + 1; i++ )
                {
                    st->hBWE_TD->mem_resamp_HB_32k_fx_32[i] = st->hBWE_TD->mem_resamp_HB_32k[i] * ( 1 << 11 );
                }
                for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP + 1; i++ )
                {
                    st->hBWE_TD->state_lsyn_filt_dwn_shb_fx_32[i] = st->hBWE_TD->state_lsyn_filt_dwn_shb[i] * ( 1 << 11 );
                    st->hBWE_TD->state_lsyn_filt_shb_fx_32[i] = st->hBWE_TD->state_lsyn_filt_shb[i] * ( 1 << 11 );
                }
                for ( int i = 0; i < INTERP_3_1_MEM_LEN; i++ )
                {
                    st->hBWE_TD->mem_resamp_HB_fx_32[i] = st->hBWE_TD->mem_resamp_HB[i] * ( 1 << 11 );
                }
            }
            //Delete till here


            if ( ( st->bwidth == SWB || st->bwidth == FB ) && ( st->last_extl == SWB_TBE || st->last_extl == FB_TBE ) )
            {
                GenTransition( st->hBWE_TD, hb_synth[n], output_Fs, st->element_mode, st->L_frame, st->rf_flag, st->total_brate );
                GenTransition_fixed( st->hBWE_TD, &hb_synth_fx[n], output_Fs, st->element_mode, st->L_frame, st->rf_flag, st->total_brate );
            }
            else if ( st->bwidth == WB && st->last_extl == WB_TBE )
            {
                GenTransition_WB( st->hBWE_TD, hb_synth[n], output_Fs );
                GenTransition_WB_fixed( st->hBWE_TD, &hb_synth_fx[n], output_Fs );

                move16();
            } 

            // Delete from here
            FOR( int ch_ind = 0; ch_ind < n_channels; ch_ind++ )
            {
                FOR( int ind = 0; ind < L_FRAME48k; ind++ )
                {
                    hb_synth[ch_ind][ind] = ( (float) hb_synth_fx[ch_ind][ind] / ( 1 << 11 ) );
                }
            }
            if ( st->hBWE_TD != NULL )
            {
                for ( int i = 0; i < L_SHB_LAHEAD; i++ )
                {
                    st->hBWE_TD->syn_overlap[i] = (float) st->hBWE_TD->syn_overlap_fx_32[i] / ( 1 << 11 );
                }
                for ( int i = 0; i < INTERP_3_2_MEM_LEN; i++ )
                {
                    st->hBWE_TD->int_3_over_2_tbemem_dec[i] = (float) st->hBWE_TD->int_3_over_2_tbemem_dec_fx_32[i] / ( 1 << 11 );
                }
                for ( int i = 0; i < HILBERT_MEM_SIZE; i++ )
                {
                    st->hBWE_TD->genSHBsynth_Hilbert_Mem[i] = (float) st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx[i] / ( 1 << 11 );
                }
                for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP; i++ )
                {
                    st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local[i] = (float) st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32[i] / ( 1 << 11 );
                }
                for ( int i = 0; i < L_SHB_TRANSITION_LENGTH; i++ )
                {
                    st->hBWE_TD->old_tbe_synth[i] = (float) st->hBWE_TD->old_tbe_synth_fx_32[i] / ( 1 << 11 );
                }
                for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP + 1; i++ )
                {
                    st->hBWE_TD->mem_resamp_HB_32k[i] = (float) st->hBWE_TD->mem_resamp_HB_32k_fx_32[i] / ( 1 << 11 );
                }
                for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP + 1; i++ )
                {
                    st->hBWE_TD->state_lsyn_filt_dwn_shb[i] = (float) st->hBWE_TD->state_lsyn_filt_dwn_shb_fx_32[i] / ( 1 << 11 );
                    st->hBWE_TD->state_lsyn_filt_shb[i] = (float) st->hBWE_TD->state_lsyn_filt_shb_fx_32[i] / ( 1 << 11 );
                }
                for ( int i = 0; i < INTERP_3_1_MEM_LEN; i++ )
                {
                    st->hBWE_TD->mem_resamp_HB[i] = (float) st->hBWE_TD->mem_resamp_HB_fx_32[i] / ( 1 << 11 );
                }
            }
            // Delete till here
        }

        /*---------------------------------------------------------------------*
Loading