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
This commit is contained in:
Luis de Bethencourt 2015-01-09 15:38:09 +00:00
parent 23880ec874
commit 6992da94b0

View file

@ -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);
}
}