[vlc-commits] Fixed extract video filter when requesting black color.

Laurent Aimar git at videolan.org
Mon Sep 5 21:13:15 CEST 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Sep  5 21:00:07 2011 +0200| [a3628756655e442f69f719632a7a173cf31518b0] | committer: Laurent Aimar

Fixed extract video filter when requesting black color.

It closes #4695.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3628756655e442f69f719632a7a173cf31518b0
---

 modules/video_filter/extract.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/video_filter/extract.c b/modules/video_filter/extract.c
index d317a70..4b172a6 100644
--- a/modules/video_filter/extract.c
+++ b/modules/video_filter/extract.c
@@ -291,9 +291,12 @@ static void make_projection_matrix( filter_t *p_filter, int color, int *matrix )
     double green = ((double)(( 0x00FF00 & color )>>8))/255.;
     double blue = ((double)( 0x0000FF & color ))/255.;
     double norm = sqrt( red*red + green*green + blue*blue );
-    red /= norm;
-    green /= norm;
-    blue /= norm;
+    if( norm > 0 )
+    {
+        red /= norm;
+        green /= norm;
+        blue /= norm;
+    }
     /* XXX: We might still need to norm the rgb_matrix */
     double rgb_matrix[9] =
         { red*red,    red*green,   red*blue,



More information about the vlc-commits mailing list