[vlc-devel] commit: Don't reinvent max/min for the nth time. (Jean-Baptiste Kempf )

git version control git at videolan.org
Sat Mar 8 11:26:02 CET 2008


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Mar  8 02:20:00 2008 -0800| [d8e694951c607897b968e7f1b51c4e7c60d29b89]

Don't reinvent max/min for the nth time.

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

 modules/video_filter/motiondetect.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/video_filter/motiondetect.c b/modules/video_filter/motiondetect.c
index 2a1ab1c..0f6ee3c 100644
--- a/modules/video_filter/motiondetect.c
+++ b/modules/video_filter/motiondetect.c
@@ -390,14 +390,13 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
         {
             if( colors[j] != j ) continue;
             if( color_x_min[j] == -1 ) continue;
-#define max( a, b ) ( a > b ? a : b )
-#define min( a, b ) ( a < b ? a : b )
-            if( max( color_x_min[i], color_x_min[j] ) < min( color_x_max[i], color_x_max[j] ) && max( color_y_min[i], color_y_min[j] ) < min( color_y_max[i], color_y_max[j] ) )
+            if( __MAX( color_x_min[i], color_x_min[j] ) < __MIN( color_x_max[i], color_x_max[j] ) &&
+                __MAX( color_y_min[i], color_y_min[j] ) < __MIN( color_y_max[i], color_y_max[j] ) )
             {
-                color_x_min[i] = min( color_x_min[i], color_x_min[j] );
-                color_x_max[i] = max( color_x_max[i], color_x_max[j] );
-                color_y_min[i] = min( color_y_min[i], color_y_min[j] );
-                color_y_max[i] = max( color_y_max[i], color_y_max[j] );
+                color_x_min[i] = __MIN( color_x_min[i], color_x_min[j] );
+                color_x_max[i] = __MAX( color_x_max[i], color_x_max[j] );
+                color_y_min[i] = __MIN( color_y_min[i], color_y_min[j] );
+                color_y_max[i] = __MAX( color_y_max[i], color_y_max[j] );
                 color_x_min[j] = -1;
                 j = 0;
             }




More information about the vlc-devel mailing list