>From 9e05afcf43dd1d561f19b66b44f700b9ffff6086 Mon Sep 17 00:00:00 2001
From: Ray Simard <rhs.ffmpeg@sylvan-glade.com>
Date: Wed, 11 Jan 2012 16:52:17 -0800
Subject: [PATCH] 1. Variable used uninitialized causing crashes. 2. Unused
 variable removed. Signed-off-by: Ray Simard
 <rhs.ffmpeg@sylvan-glade.com>

---
 libavfilter/vf_deshake.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index 7013f6c..8089698 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -254,8 +254,6 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
 
     int pos;
     double *angles = av_malloc(sizeof(*angles) * width * height / (16 * deshake->blocksize));
-    double totalangles = 0;
-
     int center_x = 0, center_y = 0;
     double p_x, p_y;
 
@@ -294,13 +292,6 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
     center_x /= pos;
     center_y /= pos;
 
-    for (x = 0; x < pos; x++) {
-        totalangles += angles[x];
-    }
-
-    //av_log(NULL, AV_LOG_ERROR, "Angle: %lf\n", totalangles / (pos - 1));
-    t->angle = totalangles / (pos - 1);
-
     t->angle = clean_mean(angles, pos);
     if (t->angle < 0.001)
         t->angle = 0;
@@ -428,11 +419,13 @@ static void end_frame(AVFilterLink *link)
     DeshakeContext *deshake = link->dst->priv;
     AVFilterBufferRef *in  = link->cur_buf;
     AVFilterBufferRef *out = link->dst->outputs[0]->out_buf;
-    Transform t;
+    Transform t, orig;
     float matrix[9];
     float alpha = 2.0 / deshake->refcount;
     char tmp[256];
-    Transform orig;
+
+    memset(&t,0,sizeof(t));
+    memset(&orig,0,sizeof(orig));
 
     if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) {
         // Find the most likely global motion for the current frame
-- 
1.7.5.1


