27 #define ORDER_METHOD_EST 0
28 #define ORDER_METHOD_2LEVEL 1
29 #define ORDER_METHOD_4LEVEL 2
30 #define ORDER_METHOD_8LEVEL 3
31 #define ORDER_METHOD_SEARCH 4
32 #define ORDER_METHOD_LOG 5
34 #define MIN_LPC_ORDER 1
35 #define MAX_LPC_ORDER 32
89 int max_order,
int precision,
92 int omethod,
int max_shift,
int zero_shift);
109 #ifdef LPC_USE_DOUBLE
110 #define LPC_TYPE double
112 #define LPC_TYPE float
126 for (i = 0; i < max_order; i++)
127 gen0[i] = gen1[i] = autoc[i + 1];
130 ref[0] = -gen1[0] / err;
131 err += gen1[0] * ref[0];
134 for (i = 1; i < max_order; i++) {
135 for (j = 0; j < max_order - i; j++) {
136 gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j];
137 gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j];
139 ref[i] = -gen1[0] / err;
140 err += gen1[0] * ref[i];
151 LPC_TYPE *lpc,
int lpc_stride,
int fail,
161 if (fail && (autoc[max_order - 1] == 0 || err <= 0))
164 for(i=0; i<max_order; i++) {
169 r -= lpc_last[j] * autoc[i-j-1];
172 err *= 1.0 - (r *
r);
177 for(j=0; j < (i+1)>>1; j++) {
181 lpc[i-1-j] = b + r * f;
static void compute_ref_coefs(const LPC_TYPE *autoc, int max_order, LPC_TYPE *ref, LPC_TYPE *error)
Schur recursion.
do not use LPC prediction or use all zero coefficients
int ff_lpc_calc_ref_coefs(LPCContext *s, const int32_t *samples, int order, double *ref)
int ff_lpc_init(LPCContext *s, int blocksize, int max_order, enum FFLPCType lpc_type)
Initialize LPCContext.
int ff_lpc_calc_coefs(LPCContext *s, const int32_t *samples, int blocksize, int min_order, int max_order, int precision, int32_t coefs[][MAX_LPC_ORDER], int *shift, enum FFLPCType lpc_type, int lpc_passes, int omethod, int max_shift, int zero_shift)
Calculate LPC coefficients for multiple orders.
void ff_lpc_end(LPCContext *s)
Uninitialize LPCContext.
static int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order, LPC_TYPE *lpc, int lpc_stride, int fail, int normalize)
Levinson-Durbin recursion.
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
Levinson-Durbin recursion.
use the codec default LPC type
double * windowed_samples
FFLPCType
LPC analysis type.
void(* lpc_compute_autocorr)(const double *data, int len, int lag, double *autoc)
Perform autocorrelation on input samples with delay of 0 to lag.
void(* lpc_apply_welch_window)(const int32_t *data, int len, double *w_data)
Apply a Welch window to an array of input samples.
void ff_lpc_init_x86(LPCContext *s)