aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-12-21 16:09:11 -0500
committerMichael Niedermayer <michaelni@gmx.at>2012-01-03 21:51:53 +0100
commit9665ccda10c5292409c9edbab33eba790a4c8170 (patch)
tree1e0d8304f92614e523121d6ef49ec09abab9d67a
parent8dce2dd9cc06a28ff46a27aeeb2913cb5ae8fa19 (diff)
downloadffmpeg-9665ccda10c5292409c9edbab33eba790a4c8170.tar.gz
ra144enc: zero the reflection coeffs if the filter is unstable
fixes use of uninitialized values if the filter is still unstable after using the previous frame lpc coefficients. (cherry picked from commit 9a3f10695a011861dcf5a649e3e72580b1a4eed4) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/ra144enc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c
index 19fe06c840..2436bac147 100644
--- a/libavcodec/ra144enc.c
+++ b/libavcodec/ra144enc.c
@@ -477,7 +477,10 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
* The filter is unstable: use the coefficients of the previous frame.
*/
ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[1]);
- ff_eval_refl(lpc_refl, block_coefs[NBLOCKS - 1], avctx);
+ if (ff_eval_refl(lpc_refl, block_coefs[NBLOCKS - 1], avctx)) {
+ /* the filter is still unstable. set reflection coeffs to zero. */
+ memset(lpc_refl, 0, sizeof(lpc_refl));
+ }
}
init_put_bits(&pb, frame, buf_size);
for (i = 0; i < LPC_ORDER; i++) {