diff options
author | Peter Ross <pross@xvid.org> | 2024-12-21 20:43:53 +1100 |
---|---|---|
committer | Peter Ross <pross@xvid.org> | 2025-06-23 17:11:09 +1000 |
commit | a3c900a0c48910b55b0e07f05eeaeda55ed2268f (patch) | |
tree | 842c162d240f5d39d6b927aa4ce8560f517d726c /libavcodec/lpc_functions.h | |
parent | a0b9d61fafe6dd61f2229966cfef0e07d5bc7c8a (diff) | |
download | ffmpeg-a3c900a0c48910b55b0e07f05eeaeda55ed2268f.tar.gz |
avcodec/lpc_functions: compute_lpc_coefs: add starting lpc order and err cache parameters
Diffstat (limited to 'libavcodec/lpc_functions.h')
-rw-r--r-- | libavcodec/lpc_functions.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libavcodec/lpc_functions.h b/libavcodec/lpc_functions.h index 57bcfab900..ea5f8868b9 100644 --- a/libavcodec/lpc_functions.h +++ b/libavcodec/lpc_functions.h @@ -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) - err = *autoc++; + 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; } |