Commit b870ff15 authored by Luis de Bethencourt's avatar Luis de Bethencourt Committed by Thiago Santos

gaudieffects: Adds new plugin 'gaudieffects'

Adds the new 'gaudieffects' plugin, originally found
here: http://github.com/luisbg/gaudi_effects

Contains the following video effect elements: burn, chromium, dilate,
dodge, exclusion and solarize.

Thanks to Jan Schmidt for the reviewing and refactoring
parent b4e44737
......@@ -278,6 +278,7 @@ AG_GST_CHECK_PLUGIN(dvdspu)
AG_GST_CHECK_PLUGIN(festival)
AG_GST_CHECK_PLUGIN(freeze)
AG_GST_CHECK_PLUGIN(frei0r)
AG_GST_CHECK_PLUGIN(gaudieffects)
AG_GST_CHECK_PLUGIN(geometrictransform)
AG_GST_CHECK_PLUGIN(h264parse)
AG_GST_CHECK_PLUGIN(hdvparse)
......@@ -1684,6 +1685,7 @@ gst/dvdspu/Makefile
gst/festival/Makefile
gst/freeze/Makefile
gst/frei0r/Makefile
gst/gaudieffects/Makefile
gst/geometrictransform/Makefile
gst/h264parse/Makefile
gst/hdvparse/Makefile
......
plugin_LTLIBRARIES = libgstgaudieffects.la
libgstgaudieffects_la_SOURCES = gstburn.c gstchromium.c gstdilate.c \
gstdodge.c gstexclusion.c gstsolarize.c gstplugin.c
libgstgaudieffects_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
libgstgaudieffects_la_LIBADD = $(GST_LIBS) -lgstvideo-@GST_MAJORMINOR@
libgstgaudieffects_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstgaudieffects_la_LIBTOOLFLAGS = --tag=disable-static
# headers we need but don't want installed
noinst_HEADERS = \
gstburn.h gstchromium.h gstdilate.h gstdodge.h \
gstexclusion.h gstplugin.h gstsolarize.h
/*
* GStreamer
* Copyright (C) 2010 Luis de Bethencourt <luis@debethencourt.com>
*
* Burn - curve adjustment video effect.
* Based on Pete Warden's FreeFrame plugin with the same name.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Alternatively, the contents of this file may be used under the
* GNU Lesser General Public License Version 2.1 (the "LGPL"), in
* which case the following provisions apply instead of the ones
* mentioned above:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:element-burn
*
* Burn adjusts the colors of a video stream in realtime.
*
* <refsect2>
* <title>Example launch line</title>
* |[
* gst-launch -v videotestsrc ! burn ! ffmpegcolorspace ! autovideosink
* ]| This pipeline shows the effect of burn on a test stream
* </refsect2>
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gst/gst.h>
#include <math.h>
#include "gstplugin.h"
#include "gstburn.h"
#include <gst/video/video.h>
#include <gst/controller/gstcontroller.h>
GST_DEBUG_CATEGORY_STATIC (gst_burn_debug);
#define GST_CAT_DEFAULT gst_burn_debug
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define CAPS_STR GST_VIDEO_CAPS_BGRx ";" GST_VIDEO_CAPS_RGBx
#else
#define CAPS_STR GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_xBGR
#endif
/* Filter signals and args. */
enum
{
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_SILENT
};
/* Initializations */
static gint gate_int (gint value, gint min, gint max);
static void transform (guint32 * src, guint32 * dest, gint video_area);
/* The capabilities of the inputs and outputs. */
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CAPS_STR)
);
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CAPS_STR)
);
GST_BOILERPLATE (Gstburn, gst_burn, GstVideoFilter, GST_TYPE_VIDEO_FILTER);
static void gst_burn_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_burn_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_burn_set_caps (GstBaseTransform * btrans,
GstCaps * incaps, GstCaps * outcaps);
static GstFlowReturn gst_burn_transform (GstBaseTransform * btrans,
GstBuffer * in_buf, GstBuffer * out_buf);
/* GObject vmethod implementations */
static void
gst_burn_base_init (gpointer gclass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
gst_element_class_set_details_simple (element_class,
"Burn",
"Filter/Effect/Video",
"Burn adjusts the colors in the video signal.",
"Luis de Bethencourt <luis@debethencourt.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
}
/* Initialize the burn's class. */
static void
gst_burn_class_init (GstburnClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
gobject_class->set_property = gst_burn_set_property;
gobject_class->get_property = gst_burn_get_property;
g_object_class_install_property (gobject_class, PROP_SILENT,
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
FALSE, G_PARAM_READWRITE));
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_burn_set_caps);
trans_class->transform = GST_DEBUG_FUNCPTR (gst_burn_transform);
}
/* Initialize the new element,
* instantiate pads and add them to element,
* set pad calback functions, and
* initialize instance structure.
*/
static void
gst_burn_init (Gstburn * filter, GstburnClass * gclass)
{
filter->silent = FALSE;
}
static void
gst_burn_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
Gstburn *filter = GST_BURN (object);
switch (prop_id) {
case PROP_SILENT:
filter->silent = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_burn_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
Gstburn *filter = GST_BURN (object);
switch (prop_id) {
case PROP_SILENT:
g_value_set_boolean (value, filter->silent);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/* GstElement vmethod implementations */
/* Handle the link with other elements. */
static gboolean
gst_burn_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
{
Gstburn *filter = GST_BURN (btrans);
GstStructure *structure;
gboolean ret = TRUE;
structure = gst_caps_get_structure (incaps, 0);
ret &= gst_structure_get_int (structure, "width", &filter->width);
ret &= gst_structure_get_int (structure, "height", &filter->height);
return ret;
}
/* Actual processing. */
static GstFlowReturn
gst_burn_transform (GstBaseTransform * btrans,
GstBuffer * in_buf, GstBuffer * out_buf)
{
Gstburn *filter = GST_BURN (btrans);
gint video_size;
guint32 *src = (guint32 *) GST_BUFFER_DATA (in_buf);
guint32 *dest = (guint32 *) GST_BUFFER_DATA (out_buf);
video_size = filter->width * filter->height;
transform (src, dest, video_size);
return GST_FLOW_OK;
}
/* Entry point to initialize the plug-in.
* Register the element factories and other features. */
gboolean
gst_burn_plugin_init (GstPlugin * burn)
{
/* debug category for fltering log messages */
GST_DEBUG_CATEGORY_INIT (gst_burn_debug, "burn", 0, "Template burn");
return gst_element_register (burn, "burn", GST_RANK_NONE, GST_TYPE_BURN);
}
/*** Now the image processing work.... ***/
/* Keep the values inbounds. */
static gint
gate_int (gint value, gint min, gint max)
{
if (value < min) {
return min;
} else if (value > max) {
return max;
} else {
return value;
}
}
/* Transform processes each frame. */
static void
transform (guint32 * src, guint32 * dest, gint video_area)
{
guint32 in, red, green, blue;
gint x;
gint adjustment = 175;
for (x = 0; x < video_area; x++) {
in = *src++;
red = (in >> 16) & 0xff;
green = (in >> 8) & 0xff;
blue = (in) & 0xff;
red = 256 - ((256 * (255 - red)) / (red + adjustment));
green = 256 - ((256 * (255 - green)) / (green + adjustment));
blue = 256 - ((256 * (255 - blue)) / (blue + adjustment));
red = gate_int (red, 0, 255);
green = gate_int (green, 0, 255);
blue = gate_int (blue, 0, 255);
*dest++ = (red << 16) | (green << 8) | blue;
}
}
/*
* GStreamer
* Copyright (C) 2010 Luis de Bethencourt <luis@debethencourt.com>
*
* Burn - curve adjustment film video effect.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Alternatively, the contents of this file may be used under the
* GNU Lesser General Public License Version 2.1 (the "LGPL"), in
* which case the following provisions apply instead of the ones
* mentioned above:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BURN_H__
#define __GST_BURN_H__
#include <gst/gst.h>
#include <gst/video/gstvideofilter.h>
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
#define GST_TYPE_BURN \
(gst_burn_get_type())
#define GST_BURN(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BURN,Gstburn))
#define GST_BURN_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BURN,GstburnClass))
#define GST_IS_BURN(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BURN))
#define GST_IS_BURN_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BURN))
typedef struct _Gstburn Gstburn;
typedef struct _GstburnClass GstburnClass;
struct _Gstburn
{
GstVideoFilter videofilter;
/* < private > */
gint width, height;
gboolean silent;
};
struct _GstburnClass
{
GstVideoFilterClass parent_class;
};
GType gst_burn_get_type (void);
G_END_DECLS
#endif /* __GST_BURN_H__ */
/*
* GStreamer
* Copyright (C) 2010 Luis de Bethencourt <luis@debethencourt.com>
*
* Chromium - burning chrome video effect.
* Based on Pete Warden's FreeFrame plugin with the same name.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Alternatively, the contents of this file may be used under the
* GNU Lesser General Public License Version 2.1 (the "LGPL"), in
* which case the following provisions apply instead of the ones
* mentioned above:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:element-chromium
*
* Chromium breaks the colors of a video stream in realtime.
*
* <refsect2>
* <title>Example launch line</title>
* |[
* gst-launch -v videotestsrc ! chromium ! ffmpegcolorspace ! autovideosink
* ]| This pipeline shows the effect of chromium on a test stream
* </refsect2>
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gst/gst.h>
#include <math.h>
#include "gstplugin.h"
#include "gstchromium.h"
#include <gst/video/video.h>
#include <gst/controller/gstcontroller.h>
GST_DEBUG_CATEGORY_STATIC (gst_chromium_debug);
#define GST_CAT_DEFAULT gst_chromium_debug
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define CAPS_STR GST_VIDEO_CAPS_BGRx ";" GST_VIDEO_CAPS_RGBx
#else
#define CAPS_STR GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_xBGR
#endif
/* Filter signals and args. */
enum
{
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_SILENT
};
/* Initializations */
const float pi = 3.141582f;
gint cosTablePi = 512;
gint cosTableTwoPi = (2 * 512);
gint cosTableOne = 512;
gint cosTableMask = 1023;
gint cosTable[2 * 512];
static gint gate_int (gint value, gint min, gint max);
void setup_cos_table (void);
static gint cos_from_table (int angle);
inline int abs_int (int val);
static void transform (guint32 * src, guint32 * dest, gint video_area);
/* The capabilities of the inputs and outputs. */
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CAPS_STR)
);
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (CAPS_STR)
);
GST_BOILERPLATE (Gstchromium, gst_chromium, GstVideoFilter,
GST_TYPE_VIDEO_FILTER);
static void gst_chromium_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_chromium_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_chromium_set_caps (GstBaseTransform * btrans,
GstCaps * incaps, GstCaps * outcaps);
static GstFlowReturn gst_chromium_transform (GstBaseTransform * btrans,
GstBuffer * in_buf, GstBuffer * out_buf);
/* GObject vmethod implementations */
static void
gst_chromium_base_init (gpointer gclass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
gst_element_class_set_details_simple (element_class,
"Chromium",
"Filter/Effect/Video",
"Chromium breaks the colors of the video signal.",
"Luis de Bethencourt <luis@debethencourt.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
}
/* Initialize the chromium's class. */
static void
gst_chromium_class_init (GstchromiumClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
gobject_class->set_property = gst_chromium_set_property;
gobject_class->get_property = gst_chromium_get_property;
g_object_class_install_property (gobject_class, PROP_SILENT,
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
FALSE, G_PARAM_READWRITE));
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_chromium_set_caps);
trans_class->transform = GST_DEBUG_FUNCPTR (gst_chromium_transform);
}
/* Initialize the new element,
* instantiate pads and add them to element,
* set pad calback functions, and
* initialize instance structure.
*/
static void
gst_chromium_init (Gstchromium * filter, GstchromiumClass * gclass)
{
filter->silent = FALSE;
setup_cos_table ();
}
static void
gst_chromium_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
Gstchromium *filter = GST_CHROMIUM (object);
switch (prop_id) {
case PROP_SILENT:
filter->silent = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_chromium_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
Gstchromium *filter = GST_CHROMIUM (object);
switch (prop_id) {
case PROP_SILENT:
g_value_set_boolean (value, filter->silent);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/* GstElement vmethod implementations */
/* Handle the link with other elements. */
static gboolean
gst_chromium_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
GstCaps * outcaps)
{
Gstchromium *filter = GST_CHROMIUM (btrans);
GstStructure *structure;
gboolean ret = TRUE;
structure = gst_caps_get_structure (incaps, 0);
ret &= gst_structure_get_int (structure, "width", &filter->width);
ret &= gst_structure_get_int (structure, "height", &filter->height);
return ret;
}
/* Actual processing. */
static GstFlowReturn
gst_chromium_transform (GstBaseTransform * btrans,
GstBuffer * in_buf, GstBuffer * out_buf)
{
Gstchromium *filter = GST_CHROMIUM (btrans);
gint video_size;
guint32 *src = (guint32 *) GST_BUFFER_DATA (in_buf);
guint32 *dest = (guint32 *) GST_BUFFER_DATA (out_buf);
video_size = filter->width * filter->height;
transform (src, dest, video_size);
return GST_FLOW_OK;
}
/* Entry point to initialize the plug-in.
* Register the element factories and other features. */
gboolean
gst_chromium_plugin_init (GstPlugin * chromium)
{
/* debug category for fltering log messages */
GST_DEBUG_CATEGORY_INIT (gst_chromium_debug, "chromium",
0, "Template chromium");
return gst_element_register (chromium, "chromium", GST_RANK_NONE,
GST_TYPE_CHROMIUM);
}
/*** Now the image processing work.... ***/
/* Set up the cosine table. */
void
setup_cos_table (void)
{
int angle;
for (angle = 0; angle < cosTableTwoPi; ++angle) {
float angleInRadians = ((float) (angle) / cosTablePi) * pi;
cosTable[angle] = (int) (cos (angleInRadians) * cosTableOne);
}
}
/* Keep the values absolute. */
inline int
abs_int (int val)
{
if (val > 0) {
return val;
} else {
return -val;
}
}
/* Keep the values inbounds. */
static gint
gate_int (gint value, gint min, gint max)
{
if (value < min) {
return min;
} else if (value > max) {
return max;
} else {
return value;
}
}
/* Cosine from Table. */
static gint
cos_from_table (int angle)
{
angle &= cosTableMask;
return cosTable[angle];
}
/* Transform processes each frame. */
static void
transform (guint32 * src, guint32 * dest, gint video_area)
{
guint32 in, red, green, blue;
gint x;
guint32 edge_a, edge_b;
edge_a = 200;
edge_b = 1;
for (x = 0; x < video_area; x++) {
in = *src++;
red = (in >> 16) & 0xff;
green = (in >> 8) & 0xff;
blue = (in) & 0xff;
red = abs_int (cos_from_table ((red + edge_a) + ((red * edge_b) / 2)));