[FFmpeg-cvslog] ra144enc: zero the reflection coeffs if the filter is unstable

Justin Ruggles git at videolan.org
Fri Dec 23 03:37:59 CET 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Wed Dec 21 16:09:11 2011 -0500| [9a3f10695a011861dcf5a649e3e72580b1a4eed4] | committer: Justin Ruggles

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9a3f10695a011861dcf5a649e3e72580b1a4eed4
---

 libavcodec/ra144enc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c
index 1d260b7..ee38bd5c 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++) {



More information about the ffmpeg-cvslog mailing list