From 6992da94b0bf78c18fb1a671ea003911de67892c Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Fri, 9 Jan 2015 15:38:09 +0000 Subject: [PATCH] video-dither: remove check for below zero for unsigned value CLAMP checks both if value is '< 0' and '> max'. Value will never be a negative number since it is an unsigned integer. Removing that check and only checking if it is bigger than max and setting it appropriately. CID 1256559 --- gst-libs/gst/video/video-dither.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gst-libs/gst/video/video-dither.c b/gst-libs/gst/video/video-dither.c index af609dd32..430564c9a 100644 --- a/gst-libs/gst/video/video-dither.c +++ b/gst-libs/gst/video/video-dither.c @@ -97,7 +97,7 @@ dither_verterr_u16 (GstVideoDither * dither, gpointer pixels, guint x, guint y, e[i] = v & mp; /* quantize and store */ v &= ~mp; - p[i] = CLAMP (v, 0, 65535); + p[i] = MIN (v, 65535); } } } @@ -129,7 +129,7 @@ dither_floyd_steinberg_u8 (GstVideoDither * dither, gpointer pixels, guint x, e[i + 4] = v & mp; /* quantize and store */ v &= ~mp; - p[i] = CLAMP (v, 0, 255); + p[i] = MIN (v, 255); } } #else @@ -162,7 +162,7 @@ dither_floyd_steinberg_u16 (GstVideoDither * dither, gpointer pixels, guint x, e[i + 4] = v & mp; /* quantize and store */ v &= ~mp; - p[i] = CLAMP (v, 0, 65535); + p[i] = MIN (v, 65535); } } } @@ -189,7 +189,7 @@ dither_sierra_lite_u8 (GstVideoDither * dither, gpointer pixels, guint x, e[i + 4] = v & mp; /* quantize and store */ v &= ~mp; - p[i] = CLAMP (v, 0, 255); + p[i] = MIN (v, 255); } } @@ -215,7 +215,7 @@ dither_sierra_lite_u16 (GstVideoDither * dither, gpointer pixels, guint x, e[i + 4] = v & mp; /* quantize and store */ v &= ~mp; - p[i] = CLAMP (v & ~mp, 0, 65535); + p[i] = MIN (v & ~mp, 65535); } } -- 2.34.1