Commit a5d4aab0 authored by vaclav's avatar vaclav
Browse files

FIX_2367_REMOVE_CODE_ICBWE

parent 187213dc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1357,7 +1357,7 @@ void stereo_tcx_init_dec_fx(
    const Word16 last_element_mode                              /* i  : element mode of previous frame      */
);

void stereo_icBWE_enc_ivas_fx(
void stereo_icBWE_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                */
    const Word32 shb_speech_ref_fx[],                           /* i  : SHB speech ref channel               */
    const Word16 shb_speech_ref_e,                              /* i  : SHB speech ref channel               */
+1 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@
#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 */
#define FIX_2367_REMOVE_CODE_ICBWE                      /* VA: basop issue 2367: Remove IC-BWE obsolete code  */

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

+3 −1
Original line number Diff line number Diff line
@@ -824,7 +824,8 @@ ivas_error ivas_core_enc_fx(
            Copy_Scale_sig_16_32_no_sat( new_swb_speech_buffer_fx_16, new_swb_speech_buffer_fx, L_FRAME48k + STEREO_DFT_OVL_MAX, Q16 ); // q_new_swb_speech_buffer+st->q_inp - 16 - > q_new_swb_speech_buffer+st->q_inp
            Copy_Scale_sig_16_32_no_sat( voice_factors_fx[0], voice_factors_fx32[0], NB_SUBFR16k, Q16 );                                // Q31

            stereo_icBWE_enc_ivas_fx( hCPE, shb_speech_fx32, sub( Q31, Q_shb_spch ), new_swb_speech_buffer_fx, sub( Q31, q_new_swb_speech_buffer ), voice_factors_fx32[0] );
            stereo_icBWE_enc_fx( hCPE, shb_speech_fx32, sub( Q31, Q_shb_spch ), new_swb_speech_buffer_fx, sub( Q31, q_new_swb_speech_buffer ), voice_factors_fx32[0] );
#ifndef FIX_2367_REMOVE_CODE_ICBWE

            IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) )
            {
@@ -840,6 +841,7 @@ ivas_error ivas_core_enc_fx(
                    move32();
                }
            }
#endif
        }

        Copy( tmp_old_input_fx, st->input_fx - input_frame, input_frame );
+46 −44
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include "ivas_rom_com.h"
#include "ivas_prot_fx.h"


/*-------------------------------------------------------------------*
 * ic_bwe_enc_reset()
 *
@@ -90,21 +91,24 @@ static void ic_bwe_enc_reset_fx(
    return;
}


/*--------------------------------------------------------------------------*
 * ic_bwe_specMapping()
 *
 * Encode and apply the spectral shape mapping of ref to the non-ref channel
 *---------------------------------------------------------------------------*/
static Word16 ic_bwe_enc_specMapping_ivas_fx(

static Word16 ic_bwe_enc_specMapping_fx(
    const Word32 *shb_frame_target_fx, /* i  : target shb                       Q31-shb_frame_target_e*/
    Word16 shb_frame_target_e,
    const Word16 shb_frame_target_e,   /* i  : Q value shb_frame_target_fx      */
    Word32 *shb_synth_nonref_fx,       /* o  : non-ref shb synth                Q31-shb_synth_nonref_e*/
    Word16 *shb_synth_nonref_e,
    Word16 *shb_synth_nonref_e,        /* i/o: Q value shb_synth_nonref_fx      */
    Word32 *specMapping_fx,            /* i/o: current frame's mapping          Qx*/
    Word32 *memShbSpecMapping_fx,      /* i/o: current frame's mapping          Q31-memShbSpecMapping_e*/
    Word16 *memShbSpecMapping_e,
    Word16 *memShbSpecMapping_e,       /* i/o: Q value memShbSpecMapping_fx     */
    Word32 *memShbSpecXcorr_fx,        /* i/o: ic bwe spec mapping scorr memory Q31-memShbSpecXcorr_e*/
    Word16 *memShbSpecXcorr_e )
    Word16 *memShbSpecXcorr_e          /* i/o: Q value memShbSpecMapping_fx     */
)
{
    Word16 idx;
    Word16 max_exp;
@@ -129,7 +133,6 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx(
    move16();

    /* Calculate rxx(1)/rxx(0) of the non ref target */

    temp00_fx = dotp_fx_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx, shb_frame_target_e, L_FRAME16k - 1, &temp00_exp );     /* Q31-temp0_exp */
    temp11_fx = dotp_fx_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx + 1, shb_frame_target_e, L_FRAME16k - 1, &temp11_exp ); /* Q31-temp1_exp */

@@ -149,7 +152,6 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx(
    temp3_fx = L_shr( temp3_fx, sub( exp, temp3_exp ) );

    /* Smoothing */

    FOR( Word16 i = 0; i < 6; i++ )
    {
        memShbSpecXcorr_fx[i] = L_shl( memShbSpecXcorr_fx[i], sub( *memShbSpecXcorr_e, exp ) );
@@ -175,7 +177,6 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx(
        T_nonref_target_fx = BASOP_Util_Divide3232_Scale( temp11_fx, temp00_fx, &T_nonref_target_e );
    }


    memShbSpecXcorr_fx[0] = temp00_fx;
    move32();
    memShbSpecXcorr_fx[1] = temp11_fx;
@@ -189,7 +190,6 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx(
    memShbSpecXcorr_fx[5] = temp3_fx; /* Q31-exp */
    move32();


    IF( temp0_fx != 0 )
    {
        Txx1_fx = BASOP_Util_Divide3232_Scale( temp1_fx, temp0_fx, &Txx1_e ); /* Q31-Txx1_e */
@@ -215,9 +215,7 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx(

    u_fx = extract_l( *specMapping_fx );


    /* while performing (-32768)*(-32768), overflow occurs because the result comes out as 32768 after mult. This is the only case for mult where overflow happens. In order to avoid this scenario mult_sat is used */

    tmp = mult_sat( b_fx, b_fx );  // b_e  + b_e;
    tmp1 = mult_sat( a_fx, c_fx ); // a_e + c_e + 2

@@ -314,14 +312,7 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx(
 *-----------------------------------------------------------------------*/

/*! r: return quant. index value */
/*----------------------------------------------------------------------*
 * ic_bwe_gsMapping()
 *
 * Encode and apply the gain shape mapping of ref to the non-ref channel
 *-----------------------------------------------------------------------*/

/*! r: return quant. index value */
static Word16 ic_bwe_enc_gsMapping_ivas_fx(
static Word16 ic_bwe_enc_gsMapping_fx(
    const Word32 relG_targ_fx, /* i  : gDes, rel gain target       Q31-relG_targ_e*/
    Word16 relG_targ_e,
    const Word16 *shbSynth_fx,  /* i  : ref synth signal             Q15-shbSynth_e*/
@@ -416,8 +407,10 @@ static Word16 ic_bwe_enc_gsMapping_ivas_fx(
        move16();
        idx = squant_fx( temp2_fx, &gsMapping_fx16, icbwe_gsMappingDFT_tbl_fx, ( 1 << STEREO_ICBWE_GSBITS_DFT ) ); // Q12
    }

    *gsMapping_fx = L_deposit_h( gsMapping_fx16 ); // Q28
    move32();

    Word16 e;
    L_mult = Mult_32_16( *gsMapping_fx, 27213 /*=log2(10)*2^13*/ ); // Q28 + Q13 - Q15 -> Q26
    *gsMapping_fx = BASOP_util_Pow2( L_mult, 5, &e );               /* Q31-e */
@@ -425,15 +418,18 @@ static Word16 ic_bwe_enc_gsMapping_ivas_fx(

    *gsMapping_e = e; // Q31
    move16();

    return idx;
}


/*----------------------------------------------------------------------*
 * icbwe_dft_stereo_param()
 *
 * Estimate ICBWE parameters in DFT stereo
 *-----------------------------------------------------------------------*/
static void icbwe_dft_stereo_param_ivas_fx(

static void icbwe_dft_stereo_param_fx(
    STEREO_ICBWE_ENC_HANDLE hStereoICBWE,  /* i/o: */
    STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i  : */
    Encoder_State *st,                     /* i/o: */
@@ -486,7 +482,6 @@ static void icbwe_dft_stereo_param_ivas_fx(
    move16();

    /* refChanIndex_bwe refinement */

    test();
    test();
    test();
@@ -563,7 +558,6 @@ static void icbwe_dft_stereo_param_ivas_fx(
    }

    /* gsMapping estimate */

    Word16 exp;
    IF( hStereoICBWE->refChanIndx_bwe == L_CH_INDX )
    {
@@ -592,7 +586,7 @@ static void icbwe_dft_stereo_param_ivas_fx(
    move32();
    move16();

    gsIndx = ic_bwe_enc_gsMapping_ivas_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */
    gsIndx = ic_bwe_enc_gsMapping_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */

    hStereoICBWE->gDes_pastFrame_fx = L_deposit_h( gDes_fx ); /* Q31-exp */
    hStereoICBWE->gDes_pastFrame_e = exp;
@@ -611,7 +605,14 @@ static void icbwe_dft_stereo_param_ivas_fx(
    return;
}

void stereo_icBWE_enc_ivas_fx(

/*-------------------------------------------------------------------*
 * stereo_icBWE_enc()
 *
 * Encode the spatial mapping of reference to the non-reference channels in HB
 *-------------------------------------------------------------------*/

void stereo_icBWE_enc_fx(
    CPE_ENC_HANDLE hCPE,              /* i/o: CPE encoder structure         */
    const Word32 shb_speech_ref_fx[], /* i  : SHB speech ref channel        Q31-shb_speech_ref_e*/
    const Word16 shb_speech_ref_e,    /* i  : SHB speech ref channel        */
@@ -641,7 +642,6 @@ void stereo_icBWE_enc_ivas_fx(
    Word32 temp1_fx, temp2_fx;
    Word16 temp1_e, temp2_e, shb_frame_ref_e, shb_frame_nonref_e, gDes_e, tmp, exp;


    /* initialization */
    hStereoDft = hCPE->hStereoDft;
    hStereoICBWE = hCPE->hStereoICBWE;
@@ -702,7 +702,6 @@ void stereo_icBWE_enc_ivas_fx(
        move32();

        /* SHB frame buffer offsets for TBE processing << re-adjust check >>*/

        max_e = s_max( hStereoICBWE->mem_shb_speech_ref_e, shb_speech_ref_e );
        Copy_Scale_sig( hStereoICBWE->mem_shb_speech_ref_fx, hStereoICBWE->mem_shb_speech_ref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ) ); // mem_shb_speech_ref_e

@@ -722,7 +721,6 @@ void stereo_icBWE_enc_ivas_fx(
        Copy_Scale_sig32( shb_speech_ref_fx, shb_frame_ref_fx + L_LOOK_16k - refMemLen, L_FRAME16k, negate( sub( max_e, shb_speech_ref_e ) ) );                                   /* shb_speech_ref_e */
        Copy_Scale_sig_32_16( shb_frame_ref_fx + L_FRAME16k, hStereoICBWE->mem_shb_speech_ref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ) - Q16 ); // mem_shb_speech_ref_e


        test();
        test();
        IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) )
@@ -798,8 +796,8 @@ void stereo_icBWE_enc_ivas_fx(
                excSHB_nonref_fx[j] = L_shr( excSHB_nonref_fx[j], sub( max_e, exp_buf[j] ) ); /* Q31-max_e */
                move32();
            }
            /* LP synthesis */

            /* LP synthesis */
            Copy_Scale_sig32( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, sub( hStereoICBWE->mem_lpc_shbsynth_nonref_e, s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e ) ) ); /* Q31-tmp_e */
            Copy_Scale_sig32( excSHB_nonref_fx, excSHB_nonref_fx, L_FRAME16k, sub( max_e, s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e ) ) );                                                                                      /* Q31-tmp_e */
            max_e = s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e );
@@ -820,11 +818,10 @@ void stereo_icBWE_enc_ivas_fx(
            move16();
        }

        icbwe_dft_stereo_param_ivas_fx( hStereoICBWE, hStereoDft, st, shb_synth_nonref_fx, &shb_synth_nonref_e );
        icbwe_dft_stereo_param_fx( hStereoICBWE, hStereoDft, st, shb_synth_nonref_fx, &shb_synth_nonref_e );
    }
    ELSE
    {

        max_e = s_max( hStereoICBWE->mem_shb_speech_ref_e, shb_speech_ref_e );
        Copy_Scale_sig( hStereoICBWE->mem_shb_speech_ref_fx, hStereoICBWE->mem_shb_speech_ref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ) ); // mem_shb_speech_ref_e

@@ -900,7 +897,6 @@ void stereo_icBWE_enc_ivas_fx(

        /*temp1 = 0.8f*hStereoICBWE->prevNonRefEner + 0.2f*temp1;*/
        /*temp2 = 0.8f*hStereoICBWE->prevRefEner + 0.2f*temp2;*/

        IF( temp2_fx == 0 )
        {
            gDes_fx = 1073741824; /* 1.0 in Q30 */
@@ -1012,6 +1008,7 @@ void stereo_icBWE_enc_ivas_fx(
                excSHB_nonref_fx[j] = L_shr( excSHB_nonref_fx[j], sub( max_e, exp_buf[j] ) ); /* Q31-max_e */
                move32();
            }

            /* LP synthesis */
            Copy_Scale_sig32( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, sub( hStereoICBWE->mem_lpc_shbsynth_nonref_e, s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e ) ) ); /* Q31-tmp_e */
            Copy_Scale_sig32( excSHB_nonref_fx, excSHB_nonref_fx, L_FRAME16k, sub( max_e, s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e ) ) );                                                                                      /* Q31-tmp_e */
@@ -1039,7 +1036,7 @@ void stereo_icBWE_enc_ivas_fx(
        IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) )
        {
            /* IC BWE spectral mapping */
            spIndx = ic_bwe_enc_specMapping_ivas_fx( shb_frame_nonref_fx, shb_frame_nonref_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_e ), hStereoICBWE->memShbSpecXcorr_fx, &( hStereoICBWE->memShbSpecXcorr_e ) ); /* Q0 */
            spIndx = ic_bwe_enc_specMapping_fx( shb_frame_nonref_fx, shb_frame_nonref_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_e ), hStereoICBWE->memShbSpecXcorr_fx, &( hStereoICBWE->memShbSpecXcorr_e ) ); /* Q0 */
        }
        ELSE
        {
@@ -1063,7 +1060,7 @@ void stereo_icBWE_enc_ivas_fx(

        /* IC BWE GS mapping */

        gsIndx = ic_bwe_enc_gsMapping_ivas_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */
        gsIndx = ic_bwe_enc_gsMapping_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */

        hStereoICBWE->gDes_pastFrame_fx = gDes_fx; /* Q31-hStereoICBWE->gDes_pastFrame_e */
        hStereoICBWE->gDes_pastFrame_e = gDes_e;
@@ -1085,6 +1082,7 @@ void stereo_icBWE_enc_ivas_fx(
 *
 * Stereo (inter-channel) BWE mapping - encoder initialization
 *-------------------------------------------------------------------*/

void stereo_icBWE_init_enc_fx(
    STEREO_ICBWE_ENC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */
)
@@ -1173,11 +1171,14 @@ void stereo_icBWE_init_enc_fx(

    return;
}


/*-------------------------------------------------------------------*
 * findRefChanBWE()
 *
 *  Inter-channel BWE pre-proc of the non-ref channel
 *-------------------------------------------------------------------*/

static void findRefChanBWE_fx(
    const Word16 *input0_fx,  /* i/o  : input 0 Qx                   q_dataChan_fx*/
    const Word16 *input1_fx,  /* i/o  : input 1 Qx                   q_dataChan_fx*/
@@ -1219,6 +1220,7 @@ static void findRefChanBWE_fx(
 *
 *  Inter-channel BWE pre-proc of the non-ref channel
 *-------------------------------------------------------------------*/

void stereo_icBWE_preproc_fx(
    CPE_ENC_HANDLE hCPE,           /* i/o: CPE encoder structure         */
    const Word16 input_frame,      /* i  : input frame length            Q0*/