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

harmonize classification functions + simplifications

parent 93e3d619
Loading
Loading
Loading
Loading
Loading
+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 −4
Original line number Diff line number Diff line
@@ -1590,7 +1590,7 @@ void ivas_hq_core_dec_fx(
    const Word16 core_switching_flag,                           /* i  : ACELP->HQ switching frame flag          */
    Word32 *output_32_fx                                        /* o  : synthesis @internal_Fs, Q11             */
);
#endif

/* o  : Consumed bits  Q0 */
Word16 ivas_hq_classifier_dec_fx(                          
    Decoder_State *st_fx,                                       /* i/o: decoder state structure                 */
@@ -1600,7 +1600,6 @@ Word16 ivas_hq_classifier_dec_fx(
    Word16 *hqswb_clas                                          /* o  : HQ class                             Q0 */
);

#ifndef HARM_HQ_CORE
void ivas_hq_hr_dec_fx(
    Decoder_State *st_fx,                                       /* i/o: decoder state structure fx              */
    Word32 *t_audio_q,                                          /* o  : transform-domain coefficients       Q12 */
@@ -1627,7 +1626,7 @@ void ivas_hq_configure_fx(
    Word16 *sfm_start,                                          /* o  : Subband start coefficients           Q0 */
    Word16 *sfm_end                                             /* o  : Subband end coefficients             Q0 */
);
#endif

void ivas_hq_bit_allocation_fx(
    const Word32 core_brate,                                    /* i  : Core bit-rate                       Q0  */
    const Word16 length,                                        /* i  : Frame length                        Q0  */
@@ -1644,7 +1643,6 @@ void ivas_hq_bit_allocation_fx(
    const Word16 num_env_bands                                  /* i  : Number sub bands to be encoded for HQ_GEN Q0  */
);

#ifndef HARM_HQ_CORE
/* o  : Number of assigned gain bits */
Word16 ivas_assign_gain_bits_fx(                           
    const Word16 core,                                          /* i  : HQ core                                 */
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@
#define FIX_2431_AVOID_CALLOC                           /* VA: basp issue 2431: avoid use of calloc() */
#define FIX_2424_REMOVE_GAUSS_L2_ENC                    /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */
#define HARM_HQ_CORE                                    /* harmonize HQ core functions */
#define HARM_HQ_CORE_KEEP_EVS_BE                  // hack to keep EVS BE
#define HARM_HQ_CORE_KEEP_BE                            /* hack to keep all BE after HQ core functions harmonization; pending resolving issues #2450, #2451, #2452 */


/* #################### End BE switches ################################## */
+4 −3
Original line number Diff line number Diff line
@@ -5010,7 +5010,7 @@ void ivas_hq_ecu_fx(
                                                                   ( ph_ecu_HqVoicing || ( ( ( GT_16( hHQ_core->env_stab_plc_fx, 16384 ) /* 0.5 in Q15 */ ) && ( LT_16( corr, 19661 ) /* 0.6 in Q15 */ ) ) || ( LT_16( hHQ_core->env_stab_plc_fx, 16384 ) /* 0.5 in Q15 */ && ( GT_16( corr, 27853 ) /* 0.85 in Q15 */ ) ) ) ) ) ) ||
                         ( LT_32( st_fx->total_brate, 48000 ) && ( ( ph_ecu_HqVoicing || GT_16( corr, 27853 ) /* 0.85 in Q15 */ ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) );

#ifdef HARM_HQ_CORE_KEEP_EVS_BE
#ifdef HARM_HQ_CORE_KEEP_BE
    IF( st_fx->element_mode == EVS_MONO )
    {
        test();
@@ -5028,7 +5028,8 @@ void ivas_hq_ecu_fx(
        test();
        test();
        test();
        evs_mode_selection = ( GE_32( st_fx->total_brate, 48000 ) && ( GE_16( output_frame, L_FRAME16k ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) && ( NE_16( ph_ecu_HqVoicing, 0 ) || ( ( ( NE_16( st_fx->hHQ_core->env_stab_plc_fx, 0 ) ) && ( LT_16( corr, 19661 ) ) ) || ( !( NE_16( st_fx->hHQ_core->env_stab_plc_fx, 0 ) ) && ( GT_16( corr, 27853 ) ) ) ) ) ) ) ||
        evs_mode_selection = ( GE_32( st_fx->total_brate, 48000 ) && ( GE_16( output_frame, L_FRAME16k ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) &&
                                                                       ( NE_16( ph_ecu_HqVoicing, 0 ) || ( ( ( NE_16( hHQ_core->env_stab_plc_fx, 0 ) ) && ( LT_16( corr, 19661 ) ) ) || ( !( NE_16( hHQ_core->env_stab_plc_fx, 0 ) ) && ( GT_16( corr, 27853 ) ) ) ) ) ) ) ||
                             ( LT_32( st_fx->total_brate, 48000 ) && ( ( ph_ecu_HqVoicing || GT_16( corr, 27853 ) ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) );
    }
#endif
@@ -5044,7 +5045,7 @@ void ivas_hq_ecu_fx(
        ( ( st_fx->element_mode != EVS_MONO ) && evs_mode_selection && ivas_mode_selection ) )
    {
#ifdef HARM_HQ_CORE
        fec_alg_fx( fec_alg_input, prevsynth_LP, &st_fx->hHQ_core->ni_seed_forfec, ecu_rec, output_frame, N, decimatefactor, ph_ecu_HqVoicing, gapsynth, st_fx->element_mode, st_fx->hHQ_core->old_out_fx, st_fx->hHQ_core->Q_old_wtda );
        fec_alg_fx( fec_alg_input, prevsynth_LP, &hHQ_core->ni_seed_forfec, ecu_rec, output_frame, N, decimatefactor, ph_ecu_HqVoicing, gapsynth, st_fx->element_mode, hHQ_core->old_out_fx, hHQ_core->Q_old_wtda );
#else
        ivas_fec_alg_fx( fec_alg_input, prevsynth_LP, &st_fx->hHQ_core->ni_seed_forfec, ecu_rec, output_frame, N, decimatefactor, ph_ecu_HqVoicing, gapsynth, st_fx->element_mode, st_fx->hHQ_core->old_out_fx, st_fx->hHQ_core->Q_old_wtda );
#endif
+13 −6
Original line number Diff line number Diff line
@@ -12,7 +12,12 @@
 * HQ mode selector (decision_matrix)
 *--------------------------------------------------------------------------*/

#ifdef HARM_HQ_CORE
/* o  : Consumed bits Q0 */
Word16 hq_classifier_dec_fx(
#else
Word16 ivas_hq_classifier_dec_fx( /* o  : Consumed bits                   Q0 */
#endif
    Decoder_State *st_fx,    /* i/o: decoder state structure */
    const Word32 core_brate, /* i  : Core bit rate                   Q0 */
    const Word16 length,     /* i  : Frame length                    Q0 */
@@ -80,6 +85,7 @@ Word16 ivas_hq_classifier_dec_fx( /* o : Consumed bits

    return bits;
}
#ifndef HARM_HQ_CORE

Word16 hq_classifier_dec_fx(                          /* o  : Consumed bits                   Q0 */
                             Decoder_State *st_fx,    /* i/o: decoder state structure */
@@ -150,3 +156,4 @@ Word16 hq_classifier_dec_fx( /* o : Consumed bits

    return bits;
}
#endif
Loading