You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/lpc_functions: compute_lpc_coefs: add starting lpc order and err cache parameters
This commit is contained in:
@ -185,7 +185,7 @@ static void AAC_RENAME(apply_tns)(void *_coef_param, TemporalNoiseShaping *tns,
|
||||
continue;
|
||||
|
||||
// tns_decode_coef
|
||||
compute_lpc_coefs(tns->AAC_RENAME(coef)[w][filt], order, lpc, 0, 0, 0);
|
||||
compute_lpc_coefs(tns->AAC_RENAME(coef)[w][filt], 0, order, lpc, 0, 0, 0, NULL);
|
||||
|
||||
start = ics->swb_offset[FFMIN(bottom, mmm)];
|
||||
end = ics->swb_offset[FFMIN( top, mmm)];
|
||||
|
@ -117,7 +117,7 @@ void ff_aac_apply_tns(AACEncContext *s, SingleChannelElement *sce)
|
||||
continue;
|
||||
|
||||
// tns_decode_coef
|
||||
compute_lpc_coefs(tns->coef[w][filt], order, lpc, 0, 0, 0);
|
||||
compute_lpc_coefs(tns->coef[w][filt], 0, order, lpc, 0, 0, 0, NULL);
|
||||
|
||||
start = ics->swb_offset[FFMIN(bottom, mmm)];
|
||||
end = ics->swb_offset[FFMIN( top, mmm)];
|
||||
|
@ -267,7 +267,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
|
||||
|
||||
s->lpc_compute_autocorr(s->windowed_samples, blocksize, max_order, autoc);
|
||||
|
||||
compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1);
|
||||
compute_lpc_coefs(autoc, 0, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1, NULL);
|
||||
|
||||
for(i=0; i<max_order; i++)
|
||||
ref[i] = fabs(lpc[i][i]);
|
||||
|
@ -51,22 +51,27 @@ typedef float LPC_TYPE_U;
|
||||
* Levinson-Durbin recursion.
|
||||
* Produce LPC coefficients from autocorrelation data.
|
||||
*/
|
||||
static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
|
||||
static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int i, int max_order,
|
||||
LPC_TYPE *lpc, int lpc_stride, int fail,
|
||||
int normalize)
|
||||
int normalize, LPC_TYPE *err_ptr)
|
||||
{
|
||||
LPC_TYPE err = 0;
|
||||
LPC_TYPE *lpc_last = lpc;
|
||||
|
||||
av_assert2(normalize || !fail);
|
||||
|
||||
if (normalize)
|
||||
if (normalize) {
|
||||
if (i == 0)
|
||||
err = *autoc++;
|
||||
else {
|
||||
err = *err_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (fail && (autoc[max_order - 1] == 0 || err <= 0))
|
||||
return -1;
|
||||
|
||||
for(int i = 0; i < max_order; i++) {
|
||||
for( ; i < max_order; i++) {
|
||||
LPC_TYPE r = LPC_SRA_R(-autoc[i], 5);
|
||||
|
||||
if (normalize) {
|
||||
@ -94,6 +99,9 @@ static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
|
||||
lpc += lpc_stride;
|
||||
}
|
||||
|
||||
if (err_ptr)
|
||||
*err_ptr = err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ static void backward_filter(RA288Context *ractx,
|
||||
|
||||
do_hybrid_window(ractx->vector_fmul, order, n, non_rec, temp, hist, rec, window);
|
||||
|
||||
if (!compute_lpc_coefs(temp, order, lpc, 0, 1, 1))
|
||||
if (!compute_lpc_coefs(temp, 0, order, lpc, 0, 1, 1, NULL))
|
||||
ractx->vector_fmul(lpc, lpc, tab, FFALIGN(order, 16));
|
||||
|
||||
memmove(hist, hist + n, move_size*sizeof(*hist));
|
||||
|
Reference in New Issue
Block a user