Commit 085f39d2 authored by multrus's avatar multrus
Browse files

Merge branch 'main' into basop-2440-osba-br-switching-decoding-large-diffs-between-float-and-basop

parents a053fa16 3b8868f2
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -166,7 +166,9 @@ void initFdCngCom(

    set16_fx( hFdCngCom->coherence_fx, 16384 /* 0.5 in Q15 */, MDCT_ST_DTX_NUM_COHERENCE_BANDS );

#ifndef FIX_BASOP_2262_OLAP_BUFFER_SYNTH_SWITCHING
    set32_fx( hFdCngCom->olapBufferSynth_fx, 0, FFTLEN );
#endif
    set32_fx( hFdCngCom->olapBufferSynth2_fx, 0, FFTLEN );
    set32_fx( hFdCngCom->exc_cng_32fx, 0, L_FRAME16k );
    set16_fx( hFdCngCom->exc_cng, 0, L_FRAME16k );
+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
+32 −9
Original line number Diff line number Diff line
@@ -14,7 +14,11 @@
 *
 * HQ core encoder
 *--------------------------------------------------------------------------*/

static void subband_gain_bits_fx(
#ifdef HARM_HQ_CORE
    const Word16 element_mode, /* i  : element mode               */
#endif
    const Word16 *Rk,     /* i  : bit allocation per band Q3 */
    const Word16 N,       /* i  : number of bands         */
    Word16 *bits,         /* o  : gain bits per band      */
@@ -30,7 +34,17 @@ static void subband_gain_bits_fx(
    FOR( i = 0; i < N; i++ )
    {
        /*bps = (short)(Rk[i]*((word16)min(32767, ceil(32767.0f/sfmsize[i]);  inexact C-integer division approx. */
#ifdef HARM_HQ_CORE
        if ( element_mode > EVS_MONO )
        {
            bps = extract_l( L_shr( L_mult0( Rk[i], fg_inv_tbl_fx[sfmsize[i] >> 3] ), 18 ) ); /* 3+15 */
        }
        ELSE
#endif
        {
            bps = extract_l( L_shr( L_mult0( Rk[i], inv_tbl_fx[sfmsize[i]] ), 18 ) ); /* 3+15 */
        }

        if ( EQ_32( L_shl( L_mult0( sfmsize[i], add( bps, 1 ) ), 3 ), Rk[i] ) )
        {
            bps = add( bps, 1 );
@@ -60,7 +74,11 @@ static void subband_gain_bits_fx(
 * Assign gain adjustment bits and update bit budget
 *--------------------------------------------------------------------------*/

Word16 assign_gain_bits_fx(                           /* o  : Number of assigned gain bits          */
/* o  : Number of assigned gain bits */
Word16 assign_gain_bits_fx(
#ifdef HARM_HQ_CORE
    const Word16 element_mode, /* i  : element mode                          */
#endif
    const Word16 core,        /* i  : HQ core                               */
    const Word16 BANDS,       /* i  : Number of bands                       */
    const Word16 *band_width, /* i  : Sub band bandwidth                    */
@@ -75,7 +93,11 @@ Word16 assign_gain_bits_fx( /* o : Number of assigned
    /* Allocate gain bits for every subband used, based on bit rate and bandwidth */
    IF( EQ_16( core, HQ_CORE ) )
    {
#ifdef HARM_HQ_CORE
        subband_gain_bits_fx( element_mode, Rk, BANDS, gain_bits_array, band_width );
#else
        subband_gain_bits_fx( Rk, BANDS, gain_bits_array, band_width );
#endif
    }
    ELSE
    {
@@ -101,7 +123,7 @@ Word16 assign_gain_bits_fx( /* o : Number of assigned

    return gain_bits_tot;
}

#ifndef HARM_HQ_CORE
static void ivas_subband_gain_bits_fx(
    const Word16 *Rk,     /* i  : bit allocation per band Q3 */
    const Word16 N,       /* i  : number of bands         */
@@ -183,3 +205,4 @@ Word16 ivas_assign_gain_bits_fx( /* o : Number of ass

    return gain_bits_tot;
}
#endif
+56 −49
Original line number Diff line number Diff line
@@ -14,7 +14,11 @@
 * Assign bits for HQ fine structure coding with PVQ
 *--------------------------------------------------------------------------*/

#ifdef HARM_HQ_CORE
void hq_bit_allocation_fx(
#else
void ivas_hq_bit_allocation_fx(
#endif
    const Word32 core_brate,   /* i  : Core bit-rate                    Q0  */
    const Word16 length,       /* i  : Frame length                     Q0  */
    const Word16 hqswb_clas,   /* i  : HQ class                         Q0  */
@@ -39,8 +43,6 @@ void ivas_hq_bit_allocation_fx(
    Word16 E_hb_mean;
    Word16 E_max;
    Word16 i_max;
    /* Temp */

    Word16 sfm_limit = nb_sfm;
    move16();

@@ -164,8 +166,10 @@ void ivas_hq_bit_allocation_fx(
            }

            avrg_wnorm = shr( avrg_wnorm, 3 );
            FOR( i = 0; i < 4; i++ ){
                IF( LT_16( wnorm[i], avrg_wnorm ) ){
            FOR( i = 0; i < 4; i++ )
            {
                if ( LT_16( wnorm[i], avrg_wnorm ) )
                {
                    wnorm[i] = avrg_wnorm;
                    move16();
                }
@@ -227,6 +231,8 @@ move16();

    return;
}
#ifndef HARM_HQ_CORE

void hq_bit_allocation_fx(
    const Word32 core_brate,   /* i  : Core bit-rate                    Q0  */
    const Word16 length,       /* i  : Frame length                     Q0  */
@@ -441,3 +447,4 @@ void hq_bit_allocation_fx(

    return;
}
#endif
+2 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 *
 * Configuration routine for HQ mode
 *--------------------------------------------------------------------------*/

#ifndef HARM_HQ_CORE
void ivas_hq_configure_fx(
    const Word16 length,       /* i  : Frame length                      Q0 */
    const Word16 hqswb_clas,   /* i  : HQ SWB class                      Q0 */
@@ -539,6 +539,7 @@ void hq_configure_evs_fx(

    return;
}
#endif

void hq_configure_fx(
    const Word16 length,       /* i  : Frame length                      Q0 */
Loading