mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
Merge commit 'c93ccf5a4cca722b39f05e9f5660b4cb75bc1740'
* commit 'c93ccf5a4cca722b39f05e9f5660b4cb75bc1740': lpc: use levinson for the first pass of multipass cholesky Conflicts: libavcodec/lpc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
32a3955259
@ -177,7 +177,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||
double autoc[MAX_LPC_ORDER+1];
|
||||
double ref[MAX_LPC_ORDER];
|
||||
double lpc[MAX_LPC_ORDER][MAX_LPC_ORDER];
|
||||
int i, j, pass;
|
||||
int i, j, pass = 0;
|
||||
int opt_order;
|
||||
|
||||
av_assert2(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER &&
|
||||
@ -190,7 +190,10 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||
ff_lpc_init(s, blocksize, max_order, lpc_type);
|
||||
}
|
||||
|
||||
if (lpc_type == FF_LPC_TYPE_LEVINSON) {
|
||||
if(lpc_passes <= 0)
|
||||
lpc_passes = 2;
|
||||
|
||||
if (lpc_type == FF_LPC_TYPE_LEVINSON || (lpc_type == FF_LPC_TYPE_CHOLESKY && lpc_passes > 1)) {
|
||||
s->lpc_apply_welch_window(samples, blocksize, s->windowed_samples);
|
||||
|
||||
s->lpc_compute_autocorr(s->windowed_samples, blocksize, max_order, autoc);
|
||||
@ -199,16 +202,20 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||
|
||||
for(i=0; i<max_order; i++)
|
||||
ref[i] = fabs(lpc[i][i]);
|
||||
} else if (lpc_type == FF_LPC_TYPE_CHOLESKY) {
|
||||
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (lpc_type == FF_LPC_TYPE_CHOLESKY) {
|
||||
LLSModel m[2];
|
||||
LOCAL_ALIGNED(32, double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]);
|
||||
double av_uninit(weight);
|
||||
memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
|
||||
|
||||
if(lpc_passes <= 0)
|
||||
lpc_passes = 2;
|
||||
for(j=0; j<max_order; j++)
|
||||
m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
|
||||
|
||||
for(pass=0; pass<lpc_passes; pass++){
|
||||
for(; pass<lpc_passes; pass++){
|
||||
avpriv_init_lls(&m[pass&1], max_order);
|
||||
|
||||
weight=0;
|
||||
@ -240,8 +247,8 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||
}
|
||||
for(i=max_order-1; i>0; i--)
|
||||
ref[i] = ref[i-1] - ref[i];
|
||||
} else
|
||||
av_assert0(0);
|
||||
}
|
||||
|
||||
opt_order = max_order;
|
||||
|
||||
if(omethod == ORDER_METHOD_EST) {
|
||||
@ -264,15 +271,11 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order,
|
||||
s->max_order = max_order;
|
||||
s->lpc_type = lpc_type;
|
||||
|
||||
if (lpc_type == FF_LPC_TYPE_LEVINSON) {
|
||||
s->windowed_buffer = av_mallocz((blocksize + 2 + FFALIGN(max_order, 4)) *
|
||||
sizeof(*s->windowed_samples));
|
||||
if (!s->windowed_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
s->windowed_samples = s->windowed_buffer + FFALIGN(max_order, 4);
|
||||
} else {
|
||||
s->windowed_samples = NULL;
|
||||
}
|
||||
s->windowed_buffer = av_mallocz((blocksize + 2 + FFALIGN(max_order, 4)) *
|
||||
sizeof(*s->windowed_samples));
|
||||
if (!s->windowed_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
s->windowed_samples = s->windowed_buffer + FFALIGN(max_order, 4);
|
||||
|
||||
s->lpc_apply_welch_window = lpc_apply_welch_window_c;
|
||||
s->lpc_compute_autocorr = lpc_compute_autocorr_c;
|
||||
|
Loading…
Reference in New Issue
Block a user