aboutsummaryrefslogtreecommitdiff
path: root/Plugins/plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/plugin.h')
-rw-r--r--Plugins/plugin.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/Plugins/plugin.h b/Plugins/plugin.h
index 00d3514..00281e5 100644
--- a/Plugins/plugin.h
+++ b/Plugins/plugin.h
@@ -116,4 +116,21 @@ __inline pixel32 rgbtocolor32(byte r, byte g, byte b)
return (b << 16) | (g << 8) | r;
}
+// restrict input to be 0..255 <olaf.matthes@gmx.de>
+__inline byte klamp255(long in)
+{
+ byte out = in<0 ? 0 : in;
+ out = 255<out ? 255 : out;
+ return(out);
+}
+
+// restrict input to be 16..235 as it is usual with signals
+// conforming to ITU-R 601 <olaf.matthes@gmx.de>
+__inline byte klamp601(long in)
+{
+ byte out = in<16 ? 16 : in;
+ out = 235<out ? 235 : out;
+ return(out);
+}
+
#endif // #ifndef _PLUGINH