/* For input in Q24 domain */ opus_int32 silk_LPC_inverse_pred_gain_Q24( /* O Returns inverse prediction gain in energy domain, Q30 */ const opus_int32 *A_Q24, /* I Prediction coefficients [order] */ const opus_int order /* I Prediction order */ ) { opus_int k; opus_int32 Atmp_QA[ SILK_MAX_ORDER_LPC ]; /* Increase Q domain of the AR coefficients */ for( k = 0; k < order; k++ ) { Atmp_QA[ k ] = silk_RSHIFT32( A_Q24[ k ], 24 - QA ); } return LPC_inverse_pred_gain_QA( Atmp_QA, order ); }
/* For input in Q24 domain */ int32_t silk_LPC_inverse_pred_gain_Q24( /* O Returns inverse prediction gain in energy domain, Q30 */ const int32_t * A_Q24, /* I Prediction coefficients [order] */ const int order /* I Prediction order */ ) { int k; int32_t Atmp_QA[2][SILK_MAX_ORDER_LPC]; int32_t *Anew_QA; memzero(Atmp_QA, (2 * SILK_MAX_ORDER_LPC) * sizeof(int32_t)); Anew_QA = Atmp_QA[order & 1]; /* Increase Q domain of the AR coefficients */ for (k = 0; k < order; k++) { Anew_QA[k] = silk_RSHIFT32(A_Q24[k], 24 - QA); } return LPC_inverse_pred_gain_QA(Atmp_QA, order); }
/* For input in Q12 domain */ opus_int32 silk_LPC_inverse_pred_gain( /* O Returns inverse prediction gain in energy domain, Q30 */ const opus_int16 *A_Q12, /* I Prediction coefficients, Q12 [order] */ const opus_int order /* I Prediction order */ ) { opus_int k; opus_int32 Atmp_QA[ SILK_MAX_ORDER_LPC ]; opus_int32 DC_resp = 0; /* Increase Q domain of the AR coefficients */ for( k = 0; k < order; k++ ) { DC_resp += (opus_int32)A_Q12[ k ]; Atmp_QA[ k ] = silk_LSHIFT32( (opus_int32)A_Q12[ k ], QA - 12 ); } /* If the DC is unstable, we don't even need to do the full calculations */ if( DC_resp >= 4096 ) { return 0; } return LPC_inverse_pred_gain_QA( Atmp_QA, order ); }