Commit cc821420 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Merge branch 'main' into basop-2059-reverb-structure-memory-non-optimality

parents d82af92c d3508f9d
Loading
Loading
Loading
Loading
Loading
+0 −110
Original line number Diff line number Diff line
@@ -58,11 +58,7 @@ ivas_error createFdCngCom_fx(
 *
 *-------------------------------------------------------------------*/

#ifdef FIX_2245_INIT_FD_CNG_EVS
void initFdCngCom(
#else
void ivas_initFdCngCom_fx(
#endif
    HANDLE_FD_CNG_COM hFdCngCom,
    Word16 scale )
{
@@ -178,112 +174,6 @@ void ivas_initFdCngCom_fx(
    return;
}

#ifndef FIX_2245_INIT_FD_CNG_EVS
void initFdCngCom( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale )
{
    /* Calculate CLDFB scaling factor */
    /* shl(i_mult2(scale, scale), 3) does not fit in 16 bit */
    /*hFdCngCom->scalingFactor = div_s(1, shl(i_mult2(scale, scale), 3));*/
    assert( 2048 /*1.0/(1<<4) Q15*/ < mult( scale, scale ) );
    /* Exponent invScalingFactor: -16 = -(2*7 (scale) + 2 (8.0) */
    hFdCngCom->invScalingFactor = shl( mult( scale, scale ), 1 );
    move16();
    /* Exponent scalingFactor: -15 = -(2*7 (scale) + 2 (8.0) - 1 (1.0)) */
    hFdCngCom->scalingFactor = div_s( 0x4000, hFdCngCom->invScalingFactor );
    move16();

    /* Initialize the overlap-add */
    set16_fx( hFdCngCom->timeDomainBuffer, 0, L_FRAME16k );
    hFdCngCom->olapBufferAna = NULL;
    set16_fx( hFdCngCom->olapBufferAna_fx, 0, FFTLEN );

    set16_fx( hFdCngCom->olapBufferSynth, 0, FFTLEN );
    hFdCngCom->olapBufferSynth2 = NULL;

    /* Initialize the comfort noise generation */
    set32_fx( hFdCngCom->fftBuffer, 0, FFTLEN );
    set32_fx( hFdCngCom->cngNoiseLevel, 0, FFTCLDFBLEN );
    set16_fx( &hFdCngCom->cngNoiseLevelExp, 0, 1 );

    /* Initialize quantizer */
    set32_fx( hFdCngCom->sidNoiseEst, 0, NPART );
    set16_fx( &hFdCngCom->sidNoiseEstExp, 0, 1 );
    set16_fx( hFdCngCom->A_cng, 0, M + 1 );
    hFdCngCom->A_cng[0] = 4096 /*1.f Q12*/; /* 3Q12 */
    move16();

    /* Set some counters and flags */
    hFdCngCom->inactive_frame_counter = 0; /* Either SID or zero frames */
    move16();
    hFdCngCom->active_frame_counter = 0;
    move16();
    hFdCngCom->frame_type_previous = ACTIVE_FRAME;
    move16();
    hFdCngCom->flag_noisy_speech = 0;
    move16();
    hFdCngCom->likelihood_noisy_speech = 0;
    move16();
    hFdCngCom->numCoreBands = 0;
    move16();
    hFdCngCom->stopBand = 0;
    move16();
    hFdCngCom->startBand = 0;
    move16();
    hFdCngCom->stopFFTbin = 0;
    move16();
    hFdCngCom->frameSize = 0;
    move16();
    hFdCngCom->fftlen = 0;
    move16();
    hFdCngCom->seed = 0;
    move16();
    // hFdCngCom->seed2 = 1;
    // move16();
    // hFdCngCom->seed3 = 2;
    // move16();
    hFdCngCom->CngBitrate = -1;
    move16();

    /* Initialize noise estimation algorithm */
    set32_fx( hFdCngCom->periodog, 0, PERIODOGLEN );
    mhvals( MSNUMSUBFR * MSSUBFRLEN, &( hFdCngCom->msM_win ) );
    mhvals( MSSUBFRLEN, &( hFdCngCom->msM_subwin ) );
    set32_fx( hFdCngCom->msPeriodogSum, 0, 2 );
    hFdCngCom->msPeriodogSum_exp[0] = 0;
    move16();
    hFdCngCom->msPeriodogSum_exp[1] = 0;
    move16();
    set32_fx( hFdCngCom->msPsdSum, 0, 2 );
    set16_fx( hFdCngCom->msSlope, 0, 2 );
    set32_fx( hFdCngCom->msQeqInvAv, 0, 2 );
    hFdCngCom->msQeqInvAv_exp[0] = 0;
    move16();
    hFdCngCom->msQeqInvAv_exp[1] = 0;
    move16();
    hFdCngCom->msFrCnt_init_counter = 0;
    move16();
    hFdCngCom->msFrCnt_init_thresh = 1;
    move16();
    hFdCngCom->init_old = 0;
    move16();
    hFdCngCom->offsetflag = 0;
    move16();
    hFdCngCom->msFrCnt = MSSUBFRLEN;
    move16();
    hFdCngCom->msMinBufferPtr = 0;
    move16();
    hFdCngCom->msAlphaCor[0] = 644245120l /*0.3f Q31*/;
    move16();
    hFdCngCom->msAlphaCor[1] = 644245120l /*0.3f Q31*/;
    move16();
    set16_fx( hFdCngCom->psize, 0, NPART );
    /* Initialize exponents */
    hFdCngCom->exp_cldfb_periodog = 0;
    move16();

    return;
}
#endif
/*-------------------------------------------------------------------
 * deleteFdCngCom()
 *
+8 −1
Original line number Diff line number Diff line
@@ -1375,7 +1375,11 @@ void pca_enc_s3_fx(

    q_ang_2surv_fx( ph1_fx, n1, ph1_q_fx, ind1 );

#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE
    tmp = mac_r( L_mac( L_mult( q_fx[1], q_fx[1] ), q_fx[2], q_fx[2] ), q_fx[3], q_fx[3] ); // Q15 + Q15 - Q15 -> Q15
#else
    tmp = add( add( mult( q_fx[1], q_fx[1] ), mult( q_fx[2], q_fx[2] ) ), mult( q_fx[3], q_fx[3] ) ); // Q15 + Q15 - Q15 -> Q15
#endif
    r_e = 0;
    move16();
    r_fx = Sqrt16( tmp, &r_e );
@@ -1429,8 +1433,11 @@ void pca_enc_s3_fx(
        q_ang_2surv_fx( ph2_fx, n2[i], ph2_q_fx + 2 * i, ind2 + 2 * i );
    }

#ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE
    r_fx = Sqrt16( mac_r( L_mult( q_fx[2], q_fx[2] ), q_fx[3], q_fx[3] ), &r_e );
#else
    r_fx = Sqrt16( add( mult( q_fx[2], q_fx[2] ), mult( q_fx[3], q_fx[3] ) ), &r_e );

#endif

    v_fx = BASOP_Util_Divide1616_Scale( q_fx[2], r_fx, &v_e );
    v_e = add( v_e, sub( 0, r_e ) );
+1 −10
Original line number Diff line number Diff line
@@ -1884,6 +1884,7 @@ void GenShapedWBExcitation_ivas_fx(
    Word16 *mem_genSHBexc_filt_down3,                           /* i/o : memory                        Q_bwe_exc*/
    Word16 *state_lpc_syn,                                      /* i/o : memory                        Q_bwe_exc*/
    const Word16 coder_type,                                    /* i : coding type                              */
    const Word16 element_mode,                                  /* i : element mode                             */
    const Word16 *bwe_exc_extended,                             /* i : bwidth extended exciatation     Q_bwe_exc*/
    const Word16 Q_bwe_exc,
    Word16 bwe_seed[],                                          /* i/o : random number generator seed           */
@@ -1990,16 +1991,6 @@ ivas_error stereo_memory_dec_fx(
    const Word16 nchan_transport                                /* i  : number of transport channels            */
);

#ifndef FIX_2245_INIT_FD_CNG_EVS
void initFdCngDec_ivas_fx(
    DEC_CORE_HANDLE st,                                         /* i/o: decoder state structure                 */
    Word16 scale 
);

void ivas_initFdCngCom_fx( 
    HANDLE_FD_CNG_COM hFdCngCom, Word16 scale 
);
#endif
Word16 set_ACELP_flag_IVAS(
    const Word16 element_mode,                                  /* i  : element mode                            */
    const Word32 element_brate,                                 /* i  : element bitrate                         */
+5 −5
Original line number Diff line number Diff line
@@ -87,10 +87,9 @@
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_1435_MOVE_STEREO_PANNING                    /* VA: issue 1435: do the EVS stereo panning in the renderer */
#define FIX_BASOP_2059_REVERB_MEMORY                    /* Philips: Fix for reverb memory non-optimality */
#define FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND /* OR : Fix issue basop 2201 hrtf_file_reader crend differs between basop ivas-main and ivas-float-update */
#define FIX_2245_INIT_FD_CNG_EVS                        /* Dolby/VA: Issue 2245: initialize FD CNG with EVS-type of init function */
#define FIX_2252_SCALING_SAVE_HB_SYNTH                  /* VA: issue 2252: fix use-of-uninit-value in save_hb_synth_fx[] scaling in FOA decoding with bitstream that starts with an SID */
#define FIX_2248_EVS_ASSERT                             /* VA: Include _sat in an EVS related part of the code */
#define FIX_2254_IMPROV_COMPLEXITY_BE                   /* VA: BE small complexity reduction  */

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

@@ -98,12 +97,12 @@
/* any switch which is non-be wrt. TS 26.251 V3.0 */

#define FIX_1454_FIX_STEREO_TO_FOA_JBM                  /* VA: issue 1454: fix buggy stereo to FOA in JBM */
#define FIX_2015_PREMPH_SAT_ALT_PART2                   /* VA: Add missing scaling factor to be passed to AVQ_cod() */
#define FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH         /* VA: Fix Issue 2253 where the encoder and decoder could get out of sync */
#define NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES /* Dolby: Fix basop issue 1967 */
#define FIX_1461_CNG_BW_SWITCHING                       /* Eri: float issue 1461: Stereo parameters are not updated when SID/NODATA forces BW to stay the same */
#define FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES      /* FhG: Using rounding in multiplication to improve precision in cngNoiseLevel[] */
#define FIX_2264_OUT_OF_BOUND_READING_IN_LOG2_NORM_LC   /* VA: Fix issue 2264 by adding a proper safeguard in log2 and by adding a missing normalization in swb_pre_proc_ivas_fx()*/
#define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT  /* Dolby: Issue 2250:  random vector generation in GenShapedSHBExcitation() */
#define FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE  /* VA: Precision improvement without increasing complexity, or complexity reduction that might be not BE on the LSB */
#define FIX_2252_LP_CNG_STARTS_SID                      /* VA: issues 2251 and 2252: fix LP CNG uninitialized value in bitstream that starts with an SID */

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

@@ -122,4 +121,5 @@

/* #################### End BASOP optimization switches ############################ */


#endif
+5 −1
Original line number Diff line number Diff line
@@ -58,9 +58,13 @@ void pred_lt4_ivas_fx(
            FOR( i = 0; i < nb_coef; i++ )
            {
                /*s += (*x1--) * (*c1) + (*x2++) * (*c2);*/
#ifdef FIX_2254_IMPROV_COMPLEXITY_BE
                s64 = W_mac_32_16( s64, ( *c1 ), *x1-- ); /* Q_exc + Q32 */
                s64 = W_mac_32_16( s64, ( *c2 ), *x2++ ); /* Q_exc + Q32 */
#else
                s64 = W_mac_32_32( s64, L_deposit_l( *x1-- ), ( *c1 ) ); /* Q_exc + Q32 */
                s64 = W_mac_32_32( s64, L_deposit_l( *x2++ ), ( *c2 ) ); /* Q_exc + Q32 */

#endif
                c1 += up_sample;
                c2 += up_sample;
            }
Loading