forked from len0rd/rockbox
Sync opus codec to upstream git
Change-Id: I0cfcc0005c4ad7bfbb1aaf454188ce70fb043dc1
This commit is contained in:
parent
75d9393796
commit
14c6bb798d
286 changed files with 48931 additions and 1278 deletions
|
@ -46,7 +46,8 @@ static OPUS_INLINE void silk_PLC_update(
|
|||
static OPUS_INLINE void silk_PLC_conceal(
|
||||
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
|
||||
opus_int16 frame[] /* O LPC residual signal */
|
||||
opus_int16 frame[], /* O LPC residual signal */
|
||||
int arch /* I Run-time architecture */
|
||||
);
|
||||
|
||||
|
||||
|
@ -65,7 +66,8 @@ void silk_PLC(
|
|||
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
|
||||
opus_int16 frame[], /* I/O signal */
|
||||
opus_int lost /* I Loss flag */
|
||||
opus_int lost, /* I Loss flag */
|
||||
int arch /* I Run-time architecture */
|
||||
)
|
||||
{
|
||||
/* PLC control function */
|
||||
|
@ -78,7 +80,7 @@ void silk_PLC(
|
|||
/****************************/
|
||||
/* Generate Signal */
|
||||
/****************************/
|
||||
silk_PLC_conceal( psDec, psDecCtrl, frame );
|
||||
silk_PLC_conceal( psDec, psDecCtrl, frame, arch );
|
||||
|
||||
psDec->lossCnt++;
|
||||
} else {
|
||||
|
@ -192,7 +194,8 @@ static OPUS_INLINE void silk_PLC_energy(opus_int32 *energy1, opus_int *shift1, o
|
|||
static OPUS_INLINE void silk_PLC_conceal(
|
||||
silk_decoder_state *psDec, /* I/O Decoder state */
|
||||
silk_decoder_control *psDecCtrl, /* I/O Decoder control */
|
||||
opus_int16 frame[] /* O LPC residual signal */
|
||||
opus_int16 frame[], /* O LPC residual signal */
|
||||
int arch /* I Run-time architecture */
|
||||
)
|
||||
{
|
||||
opus_int i, j, k;
|
||||
|
@ -272,7 +275,7 @@ static OPUS_INLINE void silk_PLC_conceal(
|
|||
/* Reduce random noise for unvoiced frames with high LPC gain */
|
||||
opus_int32 invGain_Q30, down_scale_Q30;
|
||||
|
||||
invGain_Q30 = silk_LPC_inverse_pred_gain( psPLC->prevLPC_Q12, psDec->LPC_order );
|
||||
invGain_Q30 = silk_LPC_inverse_pred_gain( psPLC->prevLPC_Q12, psDec->LPC_order, arch );
|
||||
|
||||
down_scale_Q30 = silk_min_32( silk_RSHIFT( (opus_int32)1 << 30, LOG2_INV_LPC_GAIN_HIGH_THRES ), invGain_Q30 );
|
||||
down_scale_Q30 = silk_max_32( silk_RSHIFT( (opus_int32)1 << 30, LOG2_INV_LPC_GAIN_LOW_THRES ), down_scale_Q30 );
|
||||
|
@ -288,8 +291,8 @@ static OPUS_INLINE void silk_PLC_conceal(
|
|||
|
||||
/* Rewhiten LTP state */
|
||||
idx = psDec->ltp_mem_length - lag - psDec->LPC_order - LTP_ORDER / 2;
|
||||
silk_assert( idx > 0 );
|
||||
silk_LPC_analysis_filter( &sLTP[ idx ], &psDec->outBuf[ idx ], A_Q12, psDec->ltp_mem_length - idx, psDec->LPC_order );
|
||||
celt_assert( idx > 0 );
|
||||
silk_LPC_analysis_filter( &sLTP[ idx ], &psDec->outBuf[ idx ], A_Q12, psDec->ltp_mem_length - idx, psDec->LPC_order, arch );
|
||||
/* Scale LTP state */
|
||||
inv_gain_Q30 = silk_INVERSE32_varQ( psPLC->prevGain_Q16[ 1 ], 46 );
|
||||
inv_gain_Q30 = silk_min( inv_gain_Q30, silk_int32_MAX >> 1 );
|
||||
|
@ -325,8 +328,10 @@ static OPUS_INLINE void silk_PLC_conceal(
|
|||
for( j = 0; j < LTP_ORDER; j++ ) {
|
||||
B_Q14[ j ] = silk_RSHIFT( silk_SMULBB( harm_Gain_Q15, B_Q14[ j ] ), 15 );
|
||||
}
|
||||
/* Gradually reduce excitation gain */
|
||||
rand_scale_Q14 = silk_RSHIFT( silk_SMULBB( rand_scale_Q14, rand_Gain_Q15 ), 15 );
|
||||
if ( psDec->indices.signalType != TYPE_NO_VOICE_ACTIVITY ) {
|
||||
/* Gradually reduce excitation gain */
|
||||
rand_scale_Q14 = silk_RSHIFT( silk_SMULBB( rand_scale_Q14, rand_Gain_Q15 ), 15 );
|
||||
}
|
||||
|
||||
/* Slowly increase pitch lag */
|
||||
psPLC->pitchL_Q8 = silk_SMLAWB( psPLC->pitchL_Q8, psPLC->pitchL_Q8, PITCH_DRIFT_FAC_Q16 );
|
||||
|
@ -342,7 +347,7 @@ static OPUS_INLINE void silk_PLC_conceal(
|
|||
/* Copy LPC state */
|
||||
silk_memcpy( sLPC_Q14_ptr, psDec->sLPC_Q14_buf, MAX_LPC_ORDER * sizeof( opus_int32 ) );
|
||||
|
||||
silk_assert( psDec->LPC_order >= 10 ); /* check that unrolling works */
|
||||
celt_assert( psDec->LPC_order >= 10 ); /* check that unrolling works */
|
||||
for( i = 0; i < psDec->frame_length; i++ ) {
|
||||
/* partly unrolled */
|
||||
/* Avoids introducing a bias because silk_SMLAWB() always rounds to -inf */
|
||||
|
@ -362,7 +367,8 @@ static OPUS_INLINE void silk_PLC_conceal(
|
|||
}
|
||||
|
||||
/* Add prediction to LPC excitation */
|
||||
sLPC_Q14_ptr[ MAX_LPC_ORDER + i ] = silk_ADD_LSHIFT32( sLPC_Q14_ptr[ MAX_LPC_ORDER + i ], LPC_pred_Q10, 4 );
|
||||
sLPC_Q14_ptr[ MAX_LPC_ORDER + i ] = silk_ADD_SAT32( sLPC_Q14_ptr[ MAX_LPC_ORDER + i ],
|
||||
silk_LSHIFT_SAT32( LPC_pred_Q10, 4 ));
|
||||
|
||||
/* Scale with Gain */
|
||||
frame[ i ] = (opus_int16)silk_SAT16( silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( sLPC_Q14_ptr[ MAX_LPC_ORDER + i ], prevGain_Q10[ 1 ] ), 8 ) ) );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue