Commit 0b782e03 authored by vaclav's avatar vaclav
Browse files

more HARM_HQ_CORE

parent 558ffd67
Loading
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -43,7 +43,19 @@
#include "ivas_prot_fx.h"


#ifdef HARM_HQ_CORE
/*--------------------------------------------------------------------------*
 * fill_spectrum()
 *
 * Apply spectral filling by
 * - filling zero-bit bands below BWE region
 * - applying BWE above transition frequency
 *--------------------------------------------------------------------------*/

void fill_spectrum_fx(
#else
void ivas_fill_spectrum_fx(
#endif
    Word16 *coeff,                    /* i/o: normalized MLT spectrum / nf spectrum                Q12 */
    Word32 *L_coeff_out,              /* i/o: Noisefilled MLT spectrum                             Q12 */
    const Word16 *R,                  /* i  : number of pulses per band                            Q0  */
@@ -173,7 +185,6 @@ void ivas_fill_spectrum_fx(
        move16();
    }


    /*----------------------------------------------------------------*
     * Build noise-fill codebook
     *----------------------------------------------------------------*/
@@ -250,10 +261,15 @@ void ivas_fill_spectrum_fx(
    /*----------------------------------------------------------------*
     * Harmonic BWE, HVQ BWE and HQ SWB BWE
     *----------------------------------------------------------------*/

    test();
    IF( EQ_16( HQ_mode, HQ_HARMONIC ) )
    {
#ifdef HARM_HQ_CORE
        harm_bwe_fx( coeff_fine, coeff, num_sfm, sfm_start, sfm_end, last_sfm, R, prev_hq_mode, norm, noise_level, prev_noise_level, bwe_seed, L_coeff_out, element_mode );
#else
        ivas_harm_bwe_fx( coeff_fine, coeff, num_sfm, sfm_start, sfm_end, last_sfm, R, prev_hq_mode, norm, noise_level, prev_noise_level, bwe_seed, L_coeff_out, element_mode );
#endif
    }
    ELSE IF( EQ_16( HQ_mode, HQ_HVQ ) )
    {
@@ -262,12 +278,17 @@ void ivas_fill_spectrum_fx(
    }
    ELSE IF( EQ_16( HQ_mode, HQ_GEN_SWB ) || EQ_16( HQ_mode, HQ_GEN_FB ) )
    {
#ifdef HARM_HQ_CORE
        hq_bwe_fx( element_mode, HQ_mode, L_coeff_out1, hq_generic_fenv, L_coeff_out, hq_generic_offset, prev_L_swb_norm, hq_generic_exc_clas, sfm_end, num_sfm, num_env_bands, R );
#else
        hq_bwe_ivas_fx( HQ_mode, L_coeff_out1, hq_generic_fenv, L_coeff_out, hq_generic_offset, prev_L_swb_norm, hq_generic_exc_clas, sfm_end, num_sfm, num_env_bands, R );
#endif
    }

    /*----------------------------------------------------------------*
     * HQ WB BWE refinements
     *----------------------------------------------------------------*/

    test();
    IF( EQ_16( length, L_FRAME16k ) && LE_32( L_core_brate, HQ_32k ) )
    {
@@ -304,7 +325,7 @@ void ivas_fill_spectrum_fx(

    return;
}

#ifndef HARM_HQ_CORE
void fill_spectrum_fx(
    Word16 *coeff,                    /* i/o: normalized MLT spectrum / nf spectrum                Q12 */
    Word32 *L_coeff_out,              /* i/o: Noisefilled MLT spectrum                             Q12 */
@@ -564,3 +585,4 @@ void fill_spectrum_fx(

    return;
}
#endif
+33 −1
Original line number Diff line number Diff line
@@ -808,7 +808,11 @@ void apply_nf_gain_fx(
 * HQ Harmonic BWE
 *--------------------------------------------------------------------------*/

#ifdef HARM_HQ_CORE
void harm_bwe_fx(
#else
void ivas_harm_bwe_fx(
#endif
    const Word16 *coeff_fine,  /* i  : fine structure for BWE                  Q12*/
    const Word16 *coeff,       /* i  : coded/noisefilled normalized spectrum   Q12*/
    const Word16 num_sfm,      /* i  : Number of subbands                      Q0*/
@@ -968,9 +972,11 @@ void ivas_harm_bwe_fx(
    {
        set32_fx( &coeff_out[800], 0, 160 );
    }

    return;
}

#ifndef HARM_HQ_CORE
void harm_bwe_fx(
    const Word16 *coeff_fine,  /* i  : fine structure for BWE                  Q12*/
    const Word16 *coeff,       /* i  : coded/noisefilled normalized spectrum   Q12*/
@@ -1133,6 +1139,7 @@ void harm_bwe_fx(
    }
    return;
}
#endif

/*--------------------------------------------------------------------------*
 * HVQ_bwe_fx()
@@ -1486,11 +1493,13 @@ void hvq_bwe_fx(
    return;
}


/*-------------------------------------------------------------------*
 * hvq_concat_bands_fx()
 *
 * Compute the band limits for concatenated bands for PVQ target signal in HVQ
 *--------------------------------------------------------------------------*/

void hvq_concat_bands_fx(
    const Word16 pvq_bands,  /* i  : Number of bands in concatenated PVQ target  Q0*/
    const Word16 *sel_bnds,  /* i  : Array of selected high bands                Q0*/
@@ -1582,6 +1591,8 @@ void noise_mix_fx(
            move32();
        }
    }

    return;
}


@@ -1590,6 +1601,7 @@ void noise_mix_fx(
 *
 * Prepare HQ GENERIC HF fine structure
 *--------------------------------------------------------------------------*/

void hq_generic_fine_fx(
    Word16 *coeff,           /* i  : coded/noisefilled normalized spectrum   Q12*/
    const Word16 last_sfm,   /* i  : Last coded band                         Q0*/
@@ -1627,11 +1639,13 @@ void hq_generic_fine_fx(
    return;
}


/*--------------------------------------------------------------------------*
 * overlap_hq_bwe_fx()
 *
 * Overlapping at the boundary between HQ core and BWE
 *--------------------------------------------------------------------------*/

static void overlap_hq_bwe_fx(
    const Word32 *hq_swb_overlap_buf,  /* i  : spectrum from HQ core   Q12*/
    Word32 *coeff_out,                 /* i/o: spectrum from BWE, overlapped output  Q12*/
@@ -1679,14 +1693,17 @@ static void overlap_hq_bwe_fx(
            }
        }
    }

    return;
}


/*--------------------------------------------------------------------------*
 * map_hq_generic_fenv_norm()
 *
 * mapping high frequency envelope to high band norm
 *--------------------------------------------------------------------------*/

void map_hq_generic_fenv_norm_fx(
    const Word16 hqswb_clas,       /*Q0*/
    const Word16 *hq_generic_fenv, /* Q1, frequency-domain BWE envelope */
@@ -2050,6 +2067,7 @@ Word16 calc_nor_delta_hf_fx(
        /* updating bit allocation */
        update_rsubband_fx( nb_sfm, Rsubband, add_bits_denv );
    }

    return add_bits_denv;
}

@@ -2059,6 +2077,7 @@ Word16 calc_nor_delta_hf_fx(
 *
 * HQ GENERIC
 *--------------------------------------------------------------------------*/
#ifndef HARM_HQ_CORE
void hq_bwe_fx(
    const Word16 HQ_mode,             /* i  : HQ mode                                     Q0*/
    Word32 *coeff_out1,               /* i/o: BWE input & temporary buffer                Q12*/
@@ -2082,14 +2101,24 @@ void hq_bwe_fx(

    Copy32( &coeff_out[n_swb_overlap_offset], hq_swb_overlap_buf_fx, sub( add( n_swb_overlap, sfm_end[( num_sfm - 1 )] ), sfm_end[( num_env_bands - 1 )] ) ); /*Q12*/

#ifdef HARM_HQ_CORE
    hq_generic_decoding_fx( EVS_MONO, HQ_mode, coeff_out1, hq_generic_fenv, coeff_out, hq_generic_offset, prev_L_swb_norm, hq_generic_exc_clas, R );
#else
    hq_generic_decoding_fx( HQ_mode, coeff_out1, hq_generic_fenv, coeff_out, hq_generic_offset, prev_L_swb_norm, hq_generic_exc_clas, R );
#endif

    overlap_hq_bwe_fx( hq_swb_overlap_buf_fx, coeff_out, n_swb_overlap_offset, n_swb_overlap, R, num_env_bands, num_sfm, sfm_end );

    return;
}
#endif

#ifdef HARM_HQ_CORE
void hq_bwe_fx(
    const Word16 element_mode, /* i  : element mode                                 */
#else
void hq_bwe_ivas_fx(
#endif
    const Word16 HQ_mode,             /* i  : HQ mode                                     Q0*/
    Word32 *coeff_out1,               /* i/o: BWE input & temporary buffer                Q12*/
    const Word16 *hq_generic_fenv,    /* i  : SWB frequency envelopes                     Q1*/
@@ -2109,10 +2138,13 @@ void hq_bwe_ivas_fx(
    n_swb_overlap_offset = add( swb_bwe_subband[0], hq_generic_offset );
    n_swb_overlap = sub( sfm_end[( num_env_bands - 1 )], n_swb_overlap_offset ); /*Q0*/


    Copy32( &coeff_out[n_swb_overlap_offset], hq_swb_overlap_buf_fx, sub( add( n_swb_overlap, sfm_end[( num_sfm - 1 )] ), sfm_end[( num_env_bands - 1 )] ) ); /*Q12*/

#ifdef HARM_HQ_CORE
    hq_generic_decoding_fx( element_mode, HQ_mode, coeff_out1, hq_generic_fenv, coeff_out, hq_generic_offset, prev_L_swb_norm, hq_generic_exc_clas, R );
#else
    hq_generic_decoding_ivas_fx( HQ_mode, coeff_out1, hq_generic_fenv, coeff_out, hq_generic_offset, prev_L_swb_norm, hq_generic_exc_clas, R );
#endif

    overlap_hq_bwe_fx( hq_swb_overlap_buf_fx, coeff_out, n_swb_overlap_offset, n_swb_overlap, R, num_env_bands, num_sfm, sfm_end );

+6 −4
Original line number Diff line number Diff line
@@ -1708,7 +1708,7 @@ void ivas_hq_ecu_fx(
    const Word16 output_frame,                                  /* i   : frame length                               */
    Decoder_State *st_fx                                        /* i/o: decoder state structure                     */
);
#endif

void ivas_fill_spectrum_fx(
    Word16 *coeff,                                              /* i/o: normalized MLT spectrum / nf spectrum                Q12 */
    Word32 *L_coeff_out,                                        /* i/o: Noisefilled MLT spectrum                             Q12 */
@@ -1748,12 +1748,13 @@ void ivas_fill_spectrum_fx(
    const Word16 num_env_bands,
    const Word16 element_mode 
);

#endif
void ivas_de_interleave_spectrum_fx(
    Word32 *coefs,                                              /* i/o: input and output coefficients   Q12 */
    const Word16 length                                         /* i  : length of spectrum              Q0  */
);

#ifndef HARM_HQ_CORE
void ivas_harm_bwe_fx(
    const Word16 *coeff_fine,                                   /* i  : fine structure for BWE                  */
    const Word16 *coeff,                                        /* i  : coded/noisefilled normalized spectrum   */
@@ -1770,7 +1771,8 @@ void ivas_harm_bwe_fx(
    Word32 *coeff_out,                                          /* o  : coded/noisefilled spectrum              */
    const Word16 element_mode                                   /* i  : IVAS element mode                       */
);

#endif
#ifndef HARM_HQ_CORE
void ivas_hq_pred_hb_bws_fx(
    Decoder_State *st_fx,                                       /* i/o: decoder state structure                 */
    const Word16 *ynrm,                                         /* i  : norm quantization index vector          */
@@ -1778,7 +1780,7 @@ void ivas_hq_pred_hb_bws_fx(
    const Word16 hqswb_clas,                                    /* i  : HQ SWB class                            */
    const Word16 *SWB_fenv                                      /* i  : SWB frequency envelopes             Q1  */
);

#endif
void synchro_synthesis_fx(
    const Word32 ivas_total_brate,                              /* i  : IVAS total bitrate                  */
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure               */
+14 −3
Original line number Diff line number Diff line
@@ -286,6 +286,7 @@ void calc_normal_length_fx_32(
    Word16 *prev_L_swb_norm /*i/o : last normalize length  : Q0  */
);

#ifndef HARM_HQ_CORE
void hq_generic_decoding_fx(
    const Word16 HQ_mode,             /* i  : HQ mode                                     */
    Word32 *coeff_out1_fx,            /* i/o: BWE i   & temporary buffer                  */
@@ -295,7 +296,7 @@ void hq_generic_decoding_fx(
    Word16 *prev_L_swb_norm,          /* i/o: last normalize length                       */
    const Word16 hq_generic_exc_clas, /* i  : bwe excitation class                        */
    const Word16 *R );

#endif
Word16 WB_BWE_gain_pred_fx(
    Word16 *WB_fenv,             /* o  : WB frequency envelopes               */
    const Word16 *core_dec_freq, /* i  : Frequency domain core decoded signal */
@@ -397,6 +398,9 @@ void time_reduce_pre_echo_fx(
    Word16 Q_synth );

void hq_generic_decoding_fx(
#ifdef HARM_HQ_CORE
    const Word16 element_mode, /* i  : element mode                                       */
#endif
    const Word16 HQ_mode,             /* i  : HQ mode                                     */
    Word32 *coeff_out1_fx,            /* i/o: BWE i   & temporary buffer                  */
    const Word16 *hq_generic_fenv_fx, /* i  : SWB frequency envelopes                     */
@@ -406,6 +410,7 @@ void hq_generic_decoding_fx(
    const Word16 hq_generic_exc_clas, /* i  : bwe excitation class                        */
    const Word16 *R );

#ifndef HARM_HQ_CORE
void hq_generic_decoding_ivas_fx(
    const Word16 HQ_mode,             /* i  : HQ mode                                     */
    Word32 *coeff_out1_fx,            /* i/o: BWE i   & temporary buffer                  */
@@ -415,7 +420,7 @@ void hq_generic_decoding_ivas_fx(
    Word16 *prev_L_swb_norm,          /* i/o: last normalize length                       */
    const Word16 hq_generic_exc_clas, /* i  : bwe excitation class                        */
    const Word16 *R );

#endif
void save_old_syn_fx(
    const Word16 L_frame,     /* i  : frame length                */
    const Word16 syn[],       /* i  : ACELP synthesis             */
@@ -682,6 +687,7 @@ Word16 calc_nor_delta_hf_ivas_fx(
    const Word16 core_sfm       /* i  : index of the end band for core */
);

#ifndef HARM_HQ_CORE
void hq_bwe_fx(
    const Word16 HQ_mode,             /* i  : HQ mode                                     */
    Word32 *coeff_out1,               /* i/o: BWE i   & temporary buffer                  */
@@ -694,8 +700,13 @@ void hq_bwe_fx(
    const Word16 num_sfm,
    const Word16 num_env_bands,
    const Word16 *R );

#endif
#ifdef HARM_HQ_CORE
void hq_bwe_fx(
    const Word16 element_mode, /* i  : element mode                                */
#else
void hq_bwe_ivas_fx(
#endif
    const Word16 HQ_mode,             /* i  : HQ mode                                     */
    Word32 *coeff_out1,               /* i/o: BWE i   & temporary buffer                  */
    const Word16 *hq_generic_fenv,    /* i  : SWB frequency envelopes                     */
+27 −5
Original line number Diff line number Diff line
@@ -2146,6 +2146,7 @@ void time_envelop_shaping_ivas_fx(
/* RETURN ARGUMENTS :                                                       */
/*   _ None                                                                 */
/*--------------------------------------------------------------------------*/

void time_reduce_pre_echo_fx(
    const Word16 *synth,   /* i  : ACELP core synthesis    Q_syn*/
    Word16 *error,         /* i/o: SHB BWE synthesis          Q0*/
@@ -2435,6 +2436,7 @@ void calc_normal_length_fx_32(
 * calc_norm_envelop_fx_32()
 *
 *-------------------------------------------------------------------*/

void calc_norm_envelop_fx_32(
    const Word32 SWB_signal_fx[], /* i  : SWB spectrum           : Q12 */
    Word32 *envelope_fx,          /* o  : normalized envelope    : Q16 */
@@ -2488,11 +2490,16 @@ void calc_norm_envelop_fx_32(
    return;
}


/*-------------------------------------------------------------------*
 * hq_generic_decoding_fx()
 *
 *-------------------------------------------------------------------*/

void hq_generic_decoding_fx(
#ifdef HARM_HQ_CORE
    const Word16 element_mode, /* i  : element mode                                       */
#endif
    const Word16 HQ_mode,             /* i  : HQ mode                                      : Q0  */
    Word32 *coeff_out1_fx,            /* i/o: BWE input & temporary buffer                 : Q12 */
    const Word16 *hq_generic_fenv_fx, /* i  : SWB frequency envelopes                      : Q1  */
@@ -2800,14 +2807,28 @@ void hq_generic_decoding_fx(
        }
    }


    L_tmp1 = L_deposit_l( 0 );
    L_tmp2 = L_deposit_l( 0 );
#ifdef HARM_HQ_CORE
    IF( element_mode == EVS_MONO )
    {
#endif
        FOR( i = 0; i < 5; ++i )
        {
            L_tmp1 = L_add( L_tmp1, L_abs( coeff_out_fx[HQ_GENERIC_HIGH1 + hq_generic_offset + i] ) );
            L_tmp2 = L_add( L_tmp2, L_abs( coeff_out_fx[HQ_GENERIC_HIGH1 - 2 + hq_generic_offset - i] ) );
        }
#ifdef HARM_HQ_CORE
    }
    ELSE
    {
        FOR( i = 0; i < 5; ++i )
        {
            L_tmp1 = L_add( L_tmp1, L_shr( L_abs( coeff_out_fx[HQ_GENERIC_HIGH1 + hq_generic_offset + i] ), 3 ) );     // adding guard bits
            L_tmp2 = L_add( L_tmp2, L_shr( L_abs( coeff_out_fx[HQ_GENERIC_HIGH1 - 2 + hq_generic_offset - i] ), 3 ) ); // adding guard bits
        }
    }
#endif

    pit1_fx = &coeff_out_fx[HQ_GENERIC_HIGH1 + hq_generic_offset];
    L_tmp1 = L_max( L_tmp1, 1 );
@@ -3040,6 +3061,7 @@ void hq_generic_decoding_fx(
    return;
}

#ifndef HARM_HQ_CORE
void hq_generic_decoding_ivas_fx(
    const Word16 HQ_mode,             /* i  : HQ mode                                      : Q0  */
    Word32 *coeff_out1_fx,            /* i/o: BWE input & temporary buffer                 : Q12 */
@@ -3587,7 +3609,7 @@ void hq_generic_decoding_ivas_fx(

    return;
}

#endif

/*-------------------------------------------------------------------*
 * save_old_syn()
Loading