Commit 4e5e45bb authored by vaillancour's avatar vaillancour
Browse files

more work on reusing evs

parent 4092556d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1296,7 +1296,7 @@ ivas_error acelp_core_enc_ivas_fx(
         *---------------------------------------------------------------*/

        calc_residu_fx( st, inp, res_fx, Aq );
#if 1//def REUSE_EVS_ACELP_SHIFT // This should be moved outside of ACELP
#ifdef REUSE_EVS_ACELP_SHIFT // This should be moved outside of ACELP
        {
            Word16 tmp, max;
            max = 0;
+2 −2
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ void encod_gen_voic_fx(

    shift_wsp = add( Q_new, shift );
#ifdef REUSE_EVS_ACELP
    if ( st_fx->element_mode > EVS_MONO/* && LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && st_fx->element_mode == IVAS_CPE_TD*/ )
    if ( st_fx->element_mode > EVS_MONO && LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        shift_wsp = sub( shift_wsp, 1 );
    }
@@ -203,7 +203,7 @@ void encod_gen_voic_fx(

        Copy( &res_fx[i_subfr_fx], &exc_fx[i_subfr_fx], L_SUBFR ); /*Q_new*/
#ifdef USE_NEW_TARGET
        IF( st_fx->element_mode > EVS_MONO/* && st_fx->idchan == 1*/ )
        IF( st_fx->element_mode > EVS_MONO )
        {
            Word16 q_h1;
            find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr_fx, &hLPDmem->mem_w0, p_Aq_fx,
+22 −4
Original line number Diff line number Diff line
@@ -573,7 +573,7 @@ void enc_pit_exc_ivas_fx(
    Word16 use_fcb;
    Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */
    Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes*/
#ifdef USE_NEW_TARGET
#if 1//def USE_NEW_TARGET
    Word16 q_h1;
#endif
    BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
@@ -722,16 +722,17 @@ void enc_pit_exc_ivas_fx(
         *----------------------------------------------------------------*/
        Copy( &res[i_subfr], &exc[i_subfr], L_subfr ); /* Q_new */
                                                       /* condition on target (compared to float) has been put outside the loop */
#ifdef REUSE_EVS_ACELP
#ifdef USE_NEW_TARGET
        IF( st_fx->element_mode > EVS_MONO && st_fx->element_mode == IVAS_CPE_DFT )
        IF( st_fx->element_mode > EVS_MONO/* && st_fx->element_mode == IVAS_CPE_DFT*/ )
        {
            find_targets_ivas_fx( speech, hGSCEnc->mem_syn_tmp_fx, i_subfr, &hGSCEnc->mem_w0_tmp_fx, p_Aq,
                                  res, L_subfr, p_Aw, st_fx->preemph_fac, xn, cn, h1 );

            q_h1 = sub( 14, norm_s( h1[0] ) );
            Copy_Scale_sig( h1, h2, L_subfr, add( sub( 11, q_h1 ), shift ) ); /*Q11*/
            Copy_Scale_sig( h1, h2, L_subfr, sub( 11, q_h1 ) ); /*Q11*/
            move16();
            Scale_sig( h1, L_subfr, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/
            Scale_sig( h1, L_subfr, add( sub( 14, q_h1 ), shift ) );
        }
        ELSE
#endif
@@ -741,6 +742,23 @@ void enc_pit_exc_ivas_fx(
            Copy_Scale_sig( h1, h2, L_subfr, -2 );
            Scale_sig( h1, L_subfr, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */
        }                                              
#else
        find_targets_ivas_fx( speech, hGSCEnc->mem_syn_tmp_fx, i_subfr, &hGSCEnc->mem_w0_tmp_fx, p_Aq,
                              res, L_subfr, p_Aw, st_fx->preemph_fac, xn, cn, h1 );

        q_h1 = sub( 14, norm_s( h1[0] ) );
        if ( q_h1 != 12 )
            printf( "q_h1 = %d", q_h1 );
        Copy_Scale_sig( h1, h2, L_subfr, sub( 11, q_h1 ) ); /*Q11*/
        move16();
        Scale_sig( h1, L_subfr, add( sub( 14, q_h1 ), shift ) ); /* set h1[] in Q14 with scaling for convolution Q14*/

        #endif
#ifdef USE_NEW_TARGET
        dbgwriteUnScaled( h1, MW16, L_subfr, 256, 1, "h1_newT" );
#else
        dbgwriteUnScaled( h1, MW16, L_subfr, 256, 1, "h1_oldT" );
#endif
        /* scaling of xn[] to limit dynamic at 12 bits */
        Scale_sig( xn, L_subfr, shift ); /* Q_new - 1 + shift */

+2 −2
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ Word16 encod_tran_fx(
    set16_fx( code_preQ, 0, L_SUBFR );
    shift_wsp = add( Q_new, shift );
#ifdef REUSE_EVS_ACELP_TC
    if ( st_fx->element_mode > EVS_MONO/* && LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && st_fx->element_mode == IVAS_CPE_TD*/ )
    if ( st_fx->element_mode > EVS_MONO && LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
    {
        shift_wsp = sub( shift_wsp, 1 );
    }
@@ -165,7 +165,7 @@ Word16 encod_tran_fx(

        Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */
#ifdef USE_NEW_TARGET
        IF( st_fx->element_mode > EVS_MONO /*&& st_fx->idchan == 1*/ )
        IF( st_fx->element_mode > EVS_MONO )
        {
            Word16 q_h1;
            find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq,
+17 −1
Original line number Diff line number Diff line
@@ -323,6 +323,7 @@ void encod_unvoiced_fx(
        i_subfr_idx = shr( i_subfr, 6 );
        Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */

#ifdef USE_UC_EVS
#ifdef USE_NEW_TARGET
        IF( st_fx->element_mode > EVS_MONO /*&& st_fx->idchan == 1*/ )
        {
@@ -332,7 +333,7 @@ void encod_unvoiced_fx(

            q_h1 = sub( 14, norm_s( h1_fx[0] ) );
            Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, sub( 11, q_h1 ) );
            Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) );
            Scale_sig( h1_fx, L_SUBFR, add( sub( 14, q_h1 ), shift ) );

            /* scaling of xn[] to limit dynamic at 12 bits */
            Scale_sig( xn_fx, L_SUBFR, shift ); // Q_new - 1 + shift
@@ -350,6 +351,21 @@ void encod_unvoiced_fx(
            /* scaling of xn[] to limit dynamic at 12 bits */
            Scale_sig( xn_fx, L_SUBFR, shift );
        }
#else
        {
            Word16 q_h1;
            find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq_fx,
                                  res_fx, L_SUBFR, p_Aw_fx, st_fx->preemph_fac, xn_fx, cn_fx, h1_fx );

            q_h1 = sub( 14, norm_s( h1_fx[0] ) );
            Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, sub( 11, q_h1 ) );
            Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) );

            /* scaling of xn[] to limit dynamic at 12 bits */
            Scale_sig( xn_fx, L_SUBFR, shift ); // Q_new - 1 + shift
        }
        
#endif
        /*----------------------------------------------------------------*
         * Unvoiced subframe processing
         *----------------------------------------------------------------*/
Loading