Commit e6a77329 authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into...

- Merge remote-tracking branch 'remotes/origin/main' into 2425-remove-duplicated-functions-rc-encoder
parents 4a39e3c4 ae3fc3c5
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ Word16 get_next_coeff_unmapped(
    return *idx;
}

Word16 update_mixed_context(
Word16 update_mixed_context_fx(
    Word16 ctx, /* Q0 */
    Word16 a    /* Q0 */
)
@@ -78,7 +78,7 @@ Word16 update_mixed_context(
    return add( shl( s_and( ctx, 0xf ), 4 ), add( t, 13 ) );
}

Word32 update_mixed_context_ivas_fx(
Word32 update_mixed_context_fx_32(
    Word32 ctx, /* Q0 */
    Word16 a    /* Q0 */
)
+8 −0
Original line number Diff line number Diff line
@@ -306,7 +306,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) )

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
#ifndef FIX_2410_HARM_MODIF_FS
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 );
#else
        modify_Fs_fx( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0, NULL, NULL );
#endif
    }

    /* fft_rel(fft_io, L_FFT, LOG2_L_FFT); */
@@ -419,7 +423,11 @@ IF( NE_16( Opt_AMR_WB, 1 ) )

    IF( EQ_16( L_frame, L_FRAME16k ) )
    {
#ifndef FIX_2410_HARM_MODIF_FS
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0 );
#else
        modify_Fs_fx( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0, NULL, NULL );
#endif
    }

    /* enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame; */
+1 −1
Original line number Diff line number Diff line
@@ -2995,7 +2995,7 @@ void lpc_from_spectrum(

    /* LPC */

    E_LPC_lev_dur( r_h, r_l, A, NULL, lpcorder, NULL );
    E_LPC_lev_dur_fx( r_h, r_l, A, NULL, lpcorder, NULL );
}

/*
+6 −0
Original line number Diff line number Diff line
@@ -3031,9 +3031,15 @@ void acelp_fast_fx(
    BSTR_ENC_HANDLE hBstr,                                      /* i/o: encoder bitstream handle                */
    const Word16 cdk_index,                                     /* i  : codebook index                          */
    const Word16 dn_orig[L_SUBFR],                              /* i  : corr. between target and h[].      Q_dn */
#ifdef OPT_2416_ACELP_FAST                                      
    const Word16 Q_dncn,                                        /* i  : scaling factor of dn and cn             */  
#else
    Word16 Q_dn,
#endif
    const Word16 cn[L_SUBFR],                                   /* i  : residual after long term prediction q_cn*/
#ifndef OPT_2416_ACELP_FAST
    const Word16 q_cn,
#endif
    const Word16 H[L_SUBFR],                                    /* i  : impulse response of weighted synthesis filter  e(norm_s(H[0])+1) */
    Word16 code[L_SUBFR],                                       /* o  : algebraic (fixed) codebook excitation   */
    Word16 y[],                                                 /* o  : filtered fixed codebook excitation      */
+52 −16
Original line number Diff line number Diff line
@@ -446,12 +446,18 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word
 * Returns:
 *    void
 */
Word16 E_LPC_lev_dur( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/ )
{
    return ( E_LPC_lev_dur_stab( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
}

Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/, Word16 k_max /*Q15*/ )
static Word16 E_LPC_lev_dur_stab(
#ifdef HARM_LEV_DURBIN
    const Word16 element_mode,
#endif
    const Word16 Rh[] /*QR -16*/,
    const Word16 Rl[] /*QR -1*/,
    Word16 A[] /*Qx*/,
    Word32 epsP[] /*QR*/,
    const Word16 order,
    Word16 *mem /*Qx*/,
    Word16 k_max /*Q15*/ )
{
    Word16 i, j, k;
    Word16 hi, lo;
@@ -608,7 +614,19 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
        t0 = L_Comp( Ah[i], Al[i] );
        t1 = L_max( t1, L_abs( t0 ) );
    }

#ifdef HARM_LEV_DURBIN
    IF( element_mode == EVS_MONO )
    {
        k = s_min( norm_l( t1 ), 3 );
    }
    ELSE
    {
        k = s_min( sub( norm_l( t1 ), 1 ), 3 );
    }
#else
    k = s_min( norm_l( t1 ), 3 );
#endif
    A[0] = shl( 2048, k );
    move16();
    FOR( i = 1; i <= order; i++ )
@@ -632,16 +650,20 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
        }
    }


    return ( flag );
}

Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem )
Word16 E_LPC_lev_dur_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word16 A[] /*Qx*/, Word32 epsP[] /*QR*/, const Word16 order, Word16 *mem /*Qx*/ )
{
    return ( E_LPC_lev_dur_stab_ivas_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#ifdef HARM_LEV_DURBIN
    return ( E_LPC_lev_dur_stab( EVS_MONO, Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#else
    return ( E_LPC_lev_dur_stab( Rh, Rl, A, epsP, order, mem, 32750 ) );         /* 0.99945 in Q15 */
#endif
}

Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem, Word16 k_max )
#ifndef HARM_LEV_DURBIN
static Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem, Word16 k_max )
{
    Word16 i, j, k;
    Word16 hi, lo;
@@ -822,16 +844,27 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
        }
    }


    return ( flag );
}

Word16 E_LPC_lev_dur_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/ )
#endif
Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *mem )
{
    return ( E_LPC_lev_dur_stab_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#ifdef HARM_LEV_DURBIN
    return ( E_LPC_lev_dur_stab( IVAS_SCE /* just to differentiate from EVS_MONO */, Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#else
    return ( E_LPC_lev_dur_stab_ivas_fx( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
#endif
}

Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/, Word16 k_max /*Q15*/ )

static Word16 E_LPC_lev_dur_stab_fx_32(
    const Word16 Rh[] /*QR -16*/,
    const Word16 Rl[] /*QR -1*/,
    Word32 A[] /*QA*/,
    Word32 epsP[] /*QR*/,
    const Word16 order,
    Word32 *mem /*QA*/,
    Word16 k_max /*Q15*/ )
{
    Word16 i, j, k;
    Word16 hi, lo;
@@ -965,7 +998,6 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
        lo = L_Extract_lc( t0, &hi );           /* DPF format      */
        t0 = Mpy_32( alp_h, alp_l, hi, lo );    /* Alpha in Q31    */


        /* store denormalized alpha in epsP */
        t1 = L_shr( t0, alp_exp );
        if ( epsP != NULL )
@@ -1012,10 +1044,14 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
        }
    }


    return ( flag );
}

Word16 E_LPC_lev_dur_fx_32( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR -1*/, Word32 A[] /*QA*/, Word32 epsP[] /*QR*/, const Word16 order, Word32 *mem /*QA*/ )
{
    return ( E_LPC_lev_dur_stab_fx_32( Rh, Rl, A, epsP, order, mem, 32750 ) ); /* 0.99945 in Q15 */
}


/*
 * E_LPC_a_add_tilt
Loading