Commit 895c9c79 authored by Manuel Jander's avatar Manuel Jander
Browse files

Merge remote-tracking branch 'origin' into...

Merge remote-tracking branch 'origin' into 2206-assert-in-stereo_switching_enc_fx-for-omasa-rate-switching-input-new-stv
parents 715da1d7 fc410247
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@
#define FIX_2362_TOTAL_BRATE_CALCULATION                /* FhG: basop issue 2362: fix calculation of st->total_brate in ivas_cpe_enc_fx() */
#define FIX_2330_CLANG_18_WARNINGS_REND                 /* FhG: Fix renderer warnings */
#define FIX_BASOP_2350_HARM_0B_BWE                      /* VA: basop issue 2350: harmonization of the 0b BWE */
#define FIX_2349_HARM_FIND_UV                           /* VA: basop issue 2349: harmonization of find_uv() function */

/* #################### End BE switches ################################## */

@@ -117,6 +118,7 @@
#define FIX_2320_OOB_SCE_SWITCHING                      /* VA: basop issue 2320: Correct the length of the buffer to be scaled in SCE/CPE switching */
#define FIX_2302_LSF_CDBK_THRESHOLD                     /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision  */
#define FIX_1500_ISM_MD_DTX                             /* VA: float issue 1500: fix ISM elevation metadata smoothing in DTX */
#define FIX_2348_REPLACE_FEC_ENC                        /* VA: basop issue 2348: replace FEC_encode_ivas_fx with FEC_encode_fx  */

/* ##################### End NON-BE switches ########################### */

+2 −1
Original line number Diff line number Diff line
@@ -10680,6 +10680,7 @@ Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx(
    Word16 *dist_ptr_e                /* i/o: exp for updated  MSE vector for stage1 */
);
#ifndef FIX_2348_REPLACE_FEC_ENC
void FEC_encode_ivas_fx(
    BSTR_ENC_HANDLE hBstr,        /* i/o: encoder bitstream handle                                   */
    const ACELP_config acelp_cfg, /* i/o: configuration of the ACELP                                 */
@@ -10693,7 +10694,7 @@ void FEC_encode_ivas_fx(
    const Word32 total_brate,     /* i  : total codec bitrate                                     Q0*/
    const Word16 Q_synth          /* i  : input scaling                                             */
);
#endif
ivas_error IGF_Reconfig_fx(
    IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder  */
    const Word16 igf,                 /* i  : IGF on/off                      */
+27 −23
Original line number Diff line number Diff line
@@ -194,18 +194,12 @@ static void hf_synthesis_fx(
        L_tmp = Isqrt_lc( L_tmp, &exp1 );
        scale = round_fx( L_tmp ); /* Q18 when Q_exc=-1, HF_exc in Q-3 */

        /* moved after the else */
        /* exp2 = sub( hBWE_zero->memExp1, exp1 );
           hBWE_zero->memExp1 = exp1;
           move16(); */
        /*-----------------------------------------------------------------*
         * calculate energy scaling factor to respect tilt of synth12k8
         * (tilt: 1=voiced, -1=unvoiced)
         *-----------------------------------------------------------------*/

        hp400_12k8_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx );
        /* i: mem_hp400 in Q_syn */
        /* i: synth in Q_syn */
        /* o: synth in Q_syn-3 */

        L_tmp = L_mac( 1L, synth[0], synth[0] ); /* 2*(Q_syn-3)+1 */
        FOR( i = 1; i < L_SUBFR; i++ )
@@ -235,6 +229,7 @@ static void hf_synthesis_fx(
        /*-----------------------------------------------------------------*
         * modify energy of white noise according to synthesis tilt
         *-----------------------------------------------------------------*/

        /* tmp = 1.0 - fac */
        tmp = add_sat( 1, sub( 32767 /* 1 in Q15 */, tmp ) );
        test();
@@ -325,10 +320,12 @@ static void hf_synthesis_fx(
        Q_tmp = sub( Q_tmp, exp1 );
    }
#endif

    /*-----------------------------------------------------------------*
     * modify HF excitation according to both calculated scaling factors
     * high pass filtering (0.94ms of delay)
     *-----------------------------------------------------------------*/

    exp2 = sub( hBWE_zero->memExp1, exp1 );
    hBWE_zero->memExp1 = exp1;
    move16();
@@ -342,15 +339,9 @@ static void hf_synthesis_fx(
     * synthesis of noise: 4.8kHz..5.6kHz --> 6kHz..7kHz
     *-----------------------------------------------------------------*/

    /*weight_a( Aq, Ap, 0.6f, M );*/
    weight_a_lc_fx( Aq, Ap, Gamma_19661_Tbl_fx, M );
    /* o: Ap in Q14 */

    Syn_filt_s( 0, Ap, M, HF_exc, HF_syn, L_SUBFR16k, hBWE_zero->mem_syn_hf_fx, 1 );
    /* i: Ap in Q14 */
    /* i: HF_exc in Q0 */
    /* o: HF_syn in Q0 */
    /* i/o: mem_syn_hf in Q0 */

    Scale_sig( HF_syn, L_SUBFR16k, ( add( Q_syn, exp1 ) ) ); /* bring HF_syn to (Q_syn+exp1) */

@@ -389,10 +380,12 @@ static void hf_synthesis_fx(
    {
        Copy( HF_syn, upsampled_HF_syn, L_SUBFR16k ); /* Q_syn */
    }

    Vr_add( synth16k, upsampled_HF_syn, synth16k, output_subfr );

    return;
}

#ifndef FIX_BASOP_2350_HARM_0B_BWE
void hf_synth_ivas_fx(
    ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters      */
@@ -610,6 +603,7 @@ static void hf_synthesis_ivas_fx(
 * dB loss:   -60dB  -45dB  -13dB   -3dB   0dB   -3dB  -13dB  -45dB
 * (gain=4.0)
 *-------------------------------------------------------------------*/

static void filt_6k_7k_scale_fx(
    Word16 signal[], /* i/o: signal                 Qx*/
    Word16 lg,       /* i  : length of input        Q0*/
@@ -641,9 +635,13 @@ static void filt_6k_7k_scale_fx(
        signal[i] = round_fx_sat( L_tmp ); /* Q0 */
        move16();
    }

    Copy( x + lg, mem, L_FIR - 1 ); /* Qx - 2 */

    return;
}


/*-------------------------------------------------------------------*
 * hf_synth_amr_wb_init()
 *
@@ -680,7 +678,7 @@ void hf_synth_amr_wb_init_fx(
    move16();
    hAmrwb_IO->OptCrit_old_fx = 32768;
    move32(); /*1.0f in Q15*/
    ;

    return;
}

@@ -691,6 +689,7 @@ void hf_synth_amr_wb_init_fx(
 * reset of HF synthesis filters
 * - needed in switching scenarios
 *-------------------------------------------------------------------*/

void hf_synth_amr_wb_reset_fx(
    ZERO_BWE_DEC_HANDLE hBWE_zero, /* o  : zero BWE decoder handle */
    AMRWB_IO_DEC_HANDLE hAmrwb_IO  /* i/o: AMR-WB IO data handle   */
@@ -736,6 +735,7 @@ void hf_synth_amr_wb_reset_fx(
    return;
}


/*-------------------------------------------------------------------*
 * hf_synth_amr_wb()
 *
@@ -985,7 +985,6 @@ void hf_synth_amr_wb_fx(
    tmp = sub( 18022 /* 1.1f in Q14 */, tmp );                            /*Q14 */
    fmerit_w = round_fx( L_shl( L_mult( fmerit_w, tmp ), 1 ) );           /*Q: 14+14+1+1-16 = 14 */


    L_tmp = L_deposit_l( fmerit_w ); /*Q14 */
    L_tmp = Isqrt( L_tmp );          /*Q(31-7) */
    tmp = round_fx( L_tmp );         /*Q8 */
@@ -1303,6 +1302,8 @@ void hf_synth_amr_wb_fx(

    return;
}


static void hf_synthesis_amr_wb_fx(
    const Word32 core_brate,   /* i  : core bitrate :                       Q0*/
    const Word16 output_subfr, /* i  : output sub-frame length :            Q0*/
@@ -1328,6 +1329,7 @@ static void hf_synthesis_amr_wb_fx(
    Word32 L_tmp;
    Word16 q1, q2, q3, shift;
    Word16 *pt1, *pt2, flag;

    IF( EQ_32( core_brate, ACELP_23k85 ) )
    {
        ener = dot_prod_satcontr( exc, exc, Q_exc, Q_exc, &q1, L_SUBFR );
@@ -1463,6 +1465,7 @@ static void hf_synthesis_amr_wb_fx(
    return;
}


static Word16 EnhanceClass_fx(
    const Word16 qq_fx,           /* Qx */
    const Word16 pp_fx,           /* Qx */
@@ -1525,10 +1528,12 @@ static Word16 EnhanceClass_fx(
        *unvoicing_flag = 0;
        move16();
    }

    test();
    return ( *unvoicing_flag && GT_16( qq_fx, pp_fx ) );
}


static void envelope_fx(
    AMRWB_IO_DEC_HANDLE hAmrwb_IO,
    const Word32 core_brate,    /* i  : core bitrate                                  Q0*/
@@ -1552,7 +1557,6 @@ static void envelope_fx(
    const Word16 *pt2, *pt3;
    Word16 Aq[M + 1];


    /* Aq has dynamic scaling
      go back to Q12 to make sure there's no overflow while calculating qx,qy*/
    shift = sub( norm_s( Aq_dyn_scal[0] ), 2 );
@@ -1746,7 +1750,6 @@ static void envelope_fx(
    }
    qy = round_fx( L_shr( L_tmp, 1 ) ); /*Q(10+q1)*/


    L_tmp = L_mult( qx, qx );                                          /* Q21 + 2q1 */
    L_tmp = L_mac( L_tmp, qy, qy );                                    /* Q21 + 2q1 */
    qq = round_fx( Isqrt( L_shr( L_tmp, add( 11, shl( q1, 1 ) ) ) ) ); /*Q10*/
@@ -1813,16 +1816,17 @@ static void envelope_fx(
        rr = s_min( est_level1, est_level2 );
    }


    q1 = norm_s( pp );
    tmp = div_s( shl( 1, sub( 14, q1 ) ), pp ); /*Q(29-q1-10) */
    L_tmp = L_mult( rr, tmp );                  /*Q(30-q1-10+10) */

    *sub_gain = s_min( 20480 /* 5.0f in Q12 */, round_fx_sat( L_shl_sat( L_tmp, sub( q1, 2 ) ) ) ); /*Q12 */
    move16();

    return;
}


/*---------------------------------------------------------------------*
 * AdaptiveStartBand_fx()
 *
+18 −10
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@
#include "rom_com.h"     /* Static table prototypes                */
#include "prot_fx.h"     /* Function prototypes                    */
#include "prot_fx_enc.h" /* Function prototypes                    */
#include "ivas_prot_fx.h" /* Function prototypes                    */


/*============================================================================*/
@@ -63,6 +62,7 @@ void FEC_encode_fx(
    move16();
    sign = 0;
    move16();

    test();
    test();
    IF( GT_16( coder_type, UNVOICED ) && LT_16( coder_type, AUDIO ) && acelp_cfg.FEC_mode > 0 )
@@ -70,6 +70,7 @@ void FEC_encode_fx(
        /*-----------------------------------------------------------------*
         * encode signal class (not needed for VC mode since it is clearly voiced) (2 bits)
         *-----------------------------------------------------------------*/

        IF( NE_16( coder_type, VOICED ) )
        {
            /* encode signal clas with 2 bits */
@@ -94,12 +95,14 @@ void FEC_encode_fx(
                index = 3;
                move16();
            }

            push_indice( hBstr, IND_FEC_CLAS, index, FEC_BITS_CLS );
        }

        /*-----------------------------------------------------------------*
         * encode frame energy (5 bits)
         *-----------------------------------------------------------------*/

        IF( GT_16( acelp_cfg.FEC_mode, 1 ) ) /* GENERIC and VOICED frames */
        {
            /* frame energy (maximum energy per pitch period for voiced frames or mean energy per sample over 2nd halframe for unvoiced frames) */
@@ -114,14 +117,16 @@ void FEC_encode_fx(
            Ltmp = Mpy_32_16( enr_lg_ent, enr_lg_frac, LG10_s3_0 ); /* Q14 */
            tmpS = extract_h( L_shl( Ltmp, 1 ) );                   /* Q15 + 1 -> Q0*/

            tmpS = s_min( tmpS, 31 );
            tmpS = s_min( tmpS, FEC_ENR_QLIMIT );
            tmpS = s_max( tmpS, 0 );

            push_indice( hBstr, IND_FEC_ENR, tmpS, FEC_BITS_ENR );
        }

        /*-----------------------------------------------------------------*
         * Encode last glottal pulse position (8 bits)
         *-----------------------------------------------------------------*/

        IF( GT_16( acelp_cfg.FEC_mode, 2 ) ) /* GENERIC frames */
        {
            /* retrieve the last glottal pulse position of the previous frame */
@@ -262,9 +267,11 @@ void FEC_lsf_estim_enc_fx(
            move16();
        }
    }

    /*----------------------------------------------------------------------*
     * Extrapolate LSF vector
     *----------------------------------------------------------------------*/

    tmp = sub( 32767, alpha ); /* Q15 */
    /* extrapolate the old LSF vector */
    FOR( i = 0; i < M; i++ )
@@ -292,7 +299,7 @@ void FEC_lsf_estim_enc_fx(

    return;
}

#ifndef FIX_2348_REPLACE_FEC_ENC
/*-------------------------------------------------------------------*
 * FEC_encode()
 *
@@ -472,3 +479,4 @@ void FEC_encode_ivas_fx(

    return;
}
#endif
+5 −0
Original line number Diff line number Diff line
@@ -1369,9 +1369,14 @@ ivas_error acelp_core_enc_ivas_fx(
         * Encode supplementary information for Frame Error Concealment
         *-----------------------------------------------------------------*/

#ifndef FIX_2348_REPLACE_FEC_ENC
        Scale_sig( syn_fx, L_FRAME, sub( s_min( st->Q_syn, Q_new ), st->Q_syn ) ); // min( st->Q_syn, Q_new )
        Scale_sig( res_fx, st->L_frame, sub( s_min( st->Q_syn, Q_new ), Q_new ) ); // min( st->Q_syn, Q_new )
        FEC_encode_ivas_fx( hBstr, st->acelp_cfg, syn_fx, st->coder_type, st->clas, pitch_buf, res_fx, &st->Last_pulse_pos, st->L_frame, st->total_brate, s_min( st->Q_syn, Q_new ) );
#else
        FEC_encode_fx( hBstr, st->acelp_cfg, syn_fx, st->coder_type, st->clas, pitch_buf, res_fx, &st->Last_pulse_pos, st->L_frame, st->total_brate, add( st->Q_syn, 1 ), 0 );
#endif

        IF( st->hBWE_TD != NULL )
        {
            IF( EQ_16( st->L_frame, L_FRAME ) )
Loading