From: lilo_booter Date: Sat, 31 Jul 2004 20:39:44 +0000 (+0000) Subject: Minor fix to invert X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=97c21a27771dea7705e3293e9da519976add814b;p=melted Minor fix to invert git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@348 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/modules/plus/filter_invert.c b/src/modules/plus/filter_invert.c index 407a587..3eb8c4a 100644 --- a/src/modules/plus/filter_invert.c +++ b/src/modules/plus/filter_invert.c @@ -26,6 +26,11 @@ #include #include +static inline int clamp( int v, int l, int u ) +{ + return v < l ? l : ( v > u ? u : v ); +} + /** Do it :-). */ @@ -43,8 +48,8 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * while ( p != q ) { - *p ++ = 251 - *r ++; - *p ++ = 251 - *r ++; + *p ++ = clamp( 251 - *r ++, 16, 235 ); + *p ++ = clamp( 256 - *r ++, 16, 240 ); } }