2003-07-02 06:31:33 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* Copyright (C) <2003> David Schleef <ds@schleef.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-11-08 02:52:41 +00:00
|
|
|
/*
|
|
|
|
* This file was (probably) generated from gstvideobalance.c,
|
2003-11-08 02:57:18 +00:00
|
|
|
* gstvideobalance.c,v 1.7 2003/11/08 02:48:59 dschleef Exp
|
2003-11-08 02:52:41 +00:00
|
|
|
*/
|
|
|
|
|
2003-11-07 12:47:01 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-07-27 21:51:32 +00:00
|
|
|
#include "gstvideobalance.h"
|
Convert a few inner loops to use liboil. This is currently optional, and is only enabled if liboil is present (duh!).
Original commit message from CVS:
Convert a few inner loops to use liboil. This is currently
optional, and is only enabled if liboil is present (duh!).
* configure.ac: Check for liboil-0.1
* gst/intfloat/Makefile.am:
* gst/intfloat/gstint2float.c: (conv_f32_s16), (scalarmult_f32),
(gst_int2float_chain_gint16):
* gst/videofilter/Makefile.am:
* gst/videofilter/gstvideobalance.c: (gst_videobalance_class_init),
(tablelookup_u8), (gst_videobalance_planar411):
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (plugin_init):
* gst/videotestsrc/videotestsrc.c: (splat_u8), (paint_hline_YUY2),
(paint_hline_IYU2), (paint_hline_str4), (paint_hline_str3),
(paint_hline_RGB565), (paint_hline_xRGB1555):
2004-02-12 07:37:50 +00:00
|
|
|
#ifdef HAVE_LIBOIL
|
|
|
|
#include <liboil/liboil.h>
|
|
|
|
#endif
|
2003-07-02 06:49:37 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
#include <gst/colorbalance/colorbalance.h>
|
|
|
|
|
2003-07-02 06:31:33 +00:00
|
|
|
/* GstVideobalance signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-07-02 06:31:33 +00:00
|
|
|
ARG_0,
|
2003-07-02 06:49:37 +00:00
|
|
|
ARG_CONTRAST,
|
|
|
|
ARG_BRIGHTNESS,
|
|
|
|
ARG_HUE,
|
2004-01-13 17:57:24 +00:00
|
|
|
ARG_SATURATION
|
2004-03-14 22:34:33 +00:00
|
|
|
/* FILL ME */
|
2003-07-02 06:31:33 +00:00
|
|
|
};
|
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
static GstVideofilterClass *parent_class = NULL;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_videobalance_base_init (gpointer g_class);
|
|
|
|
static void gst_videobalance_class_init (gpointer g_class, gpointer class_data);
|
|
|
|
static void gst_videobalance_init (GTypeInstance * instance, gpointer g_class);
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_videobalance_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_videobalance_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_videobalance_planar411 (GstVideofilter * videofilter,
|
|
|
|
void *dest, void *src);
|
|
|
|
static void gst_videobalance_setup (GstVideofilter * videofilter);
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_videobalance_interface_init (GstImplementsInterfaceClass *
|
|
|
|
klass);
|
|
|
|
static void gst_videobalance_colorbalance_init (GstColorBalanceClass * iface);
|
2004-01-14 17:15:34 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_videobalance_dispose (GObject * object);
|
|
|
|
static void gst_videobalance_update_properties (GstVideobalance * videobalance);
|
2004-01-14 17:15:34 +00:00
|
|
|
|
2003-07-02 06:31:33 +00:00
|
|
|
GType
|
|
|
|
gst_videobalance_get_type (void)
|
|
|
|
{
|
|
|
|
static GType videobalance_type = 0;
|
|
|
|
|
|
|
|
if (!videobalance_type) {
|
|
|
|
static const GTypeInfo videobalance_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstVideobalanceClass),
|
2003-11-08 02:52:41 +00:00
|
|
|
gst_videobalance_base_init,
|
2003-07-02 06:31:33 +00:00
|
|
|
NULL,
|
2003-11-08 02:52:41 +00:00
|
|
|
gst_videobalance_class_init,
|
2003-07-02 06:31:33 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstVideobalance),
|
2003-07-02 06:31:33 +00:00
|
|
|
0,
|
2003-11-08 02:52:41 +00:00
|
|
|
gst_videobalance_init,
|
2003-07-02 06:31:33 +00:00
|
|
|
};
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
static const GInterfaceInfo iface_info = {
|
|
|
|
(GInterfaceInitFunc) gst_videobalance_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
static const GInterfaceInfo colorbalance_info = {
|
|
|
|
(GInterfaceInitFunc) gst_videobalance_colorbalance_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
videobalance_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
|
2004-03-15 19:32:27 +00:00
|
|
|
"GstVideobalance", &videobalance_info, 0);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
g_type_add_interface_static (videobalance_type,
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
|
2004-01-14 17:15:34 +00:00
|
|
|
g_type_add_interface_static (videobalance_type, GST_TYPE_COLOR_BALANCE,
|
2004-03-15 19:32:27 +00:00
|
|
|
&colorbalance_info);
|
2003-07-02 06:31:33 +00:00
|
|
|
}
|
|
|
|
return videobalance_type;
|
|
|
|
}
|
|
|
|
|
2003-11-02 22:54:47 +00:00
|
|
|
static void
|
2003-11-08 02:52:41 +00:00
|
|
|
gst_videobalance_base_init (gpointer g_class)
|
2003-11-02 22:54:47 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstElementDetails videobalance_details =
|
|
|
|
GST_ELEMENT_DETAILS ("Video Balance Control",
|
|
|
|
"Filter/Effect/Video",
|
|
|
|
"Adjusts brightness, contrast, hue, saturation on a video stream",
|
|
|
|
"David Schleef <ds@schleef.org>");
|
2003-11-08 02:52:41 +00:00
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
|
|
|
|
int i;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-11-02 22:54:47 +00:00
|
|
|
gst_element_class_set_details (element_class, &videobalance_details);
|
2003-11-08 02:52:41 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (gst_videobalance_formats); i++) {
|
|
|
|
gst_videofilter_class_add_format (videofilter_class,
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_videobalance_formats + i);
|
2003-11-08 02:52:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
2003-11-02 22:54:47 +00:00
|
|
|
}
|
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_dispose (GObject * object)
|
2004-01-14 17:15:34 +00:00
|
|
|
{
|
|
|
|
GList *channels = NULL;
|
|
|
|
GstVideobalance *balance;
|
2004-01-25 11:17:11 +00:00
|
|
|
gint i;
|
2004-01-14 17:15:34 +00:00
|
|
|
|
|
|
|
balance = GST_VIDEOBALANCE (object);
|
2004-01-25 11:17:11 +00:00
|
|
|
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
if (balance->tableu) {
|
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
g_free (balance->tableu[i]);
|
|
|
|
g_free (balance->tableu);
|
|
|
|
balance->tableu = NULL;
|
2004-01-25 11:17:11 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
if (balance->tablev) {
|
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
g_free (balance->tablev[i]);
|
|
|
|
g_free (balance->tablev);
|
|
|
|
balance->tablev = NULL;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
if (balance->tabley) {
|
|
|
|
g_free (balance->tabley);
|
|
|
|
balance->tabley = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
channels = balance->channels;
|
2004-03-14 22:34:33 +00:00
|
|
|
while (channels) {
|
|
|
|
GstColorBalanceChannel *channel = channels->data;
|
|
|
|
|
|
|
|
g_object_unref (channel);
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
channels->data = NULL;
|
2004-03-14 22:34:33 +00:00
|
|
|
channels = g_list_next (channels);
|
|
|
|
}
|
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
if (balance->channels)
|
|
|
|
g_list_free (balance->channels);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2003-07-02 06:31:33 +00:00
|
|
|
static void
|
2003-11-08 02:52:41 +00:00
|
|
|
gst_videobalance_class_init (gpointer g_class, gpointer class_data)
|
2003-07-02 06:31:33 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2003-11-08 02:52:41 +00:00
|
|
|
GstVideofilterClass *videofilter_class;
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2003-11-08 02:52:41 +00:00
|
|
|
gobject_class = G_OBJECT_CLASS (g_class);
|
|
|
|
videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
parent_class = g_type_class_ref (GST_TYPE_VIDEOFILTER);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-05-06 11:25:56 +00:00
|
|
|
gobject_class->set_property = gst_videobalance_set_property;
|
|
|
|
gobject_class->get_property = gst_videobalance_get_property;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_CONTRAST,
|
|
|
|
g_param_spec_double ("contrast", "Contrast", "contrast",
|
2004-03-15 19:32:27 +00:00
|
|
|
0, 2, 1, G_PARAM_READWRITE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_BRIGHTNESS,
|
|
|
|
g_param_spec_double ("brightness", "Brightness", "brightness",
|
2004-03-15 19:32:27 +00:00
|
|
|
-1, 1, 0, G_PARAM_READWRITE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_HUE,
|
|
|
|
g_param_spec_double ("hue", "Hue", "hue", -1, 1, 0, G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (gobject_class, ARG_SATURATION,
|
|
|
|
g_param_spec_double ("saturation", "Saturation", "saturation",
|
2004-03-15 19:32:27 +00:00
|
|
|
0, 2, 1, G_PARAM_READWRITE));
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
gobject_class->dispose = gst_videobalance_dispose;
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2003-11-08 02:52:41 +00:00
|
|
|
videofilter_class->setup = gst_videobalance_setup;
|
Convert a few inner loops to use liboil. This is currently optional, and is only enabled if liboil is present (duh!).
Original commit message from CVS:
Convert a few inner loops to use liboil. This is currently
optional, and is only enabled if liboil is present (duh!).
* configure.ac: Check for liboil-0.1
* gst/intfloat/Makefile.am:
* gst/intfloat/gstint2float.c: (conv_f32_s16), (scalarmult_f32),
(gst_int2float_chain_gint16):
* gst/videofilter/Makefile.am:
* gst/videofilter/gstvideobalance.c: (gst_videobalance_class_init),
(tablelookup_u8), (gst_videobalance_planar411):
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (plugin_init):
* gst/videotestsrc/videotestsrc.c: (splat_u8), (paint_hline_YUY2),
(paint_hline_IYU2), (paint_hline_str4), (paint_hline_str3),
(paint_hline_RGB565), (paint_hline_xRGB1555):
2004-02-12 07:37:50 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBOIL
|
2004-03-14 22:34:33 +00:00
|
|
|
oil_init ();
|
Convert a few inner loops to use liboil. This is currently optional, and is only enabled if liboil is present (duh!).
Original commit message from CVS:
Convert a few inner loops to use liboil. This is currently
optional, and is only enabled if liboil is present (duh!).
* configure.ac: Check for liboil-0.1
* gst/intfloat/Makefile.am:
* gst/intfloat/gstint2float.c: (conv_f32_s16), (scalarmult_f32),
(gst_int2float_chain_gint16):
* gst/videofilter/Makefile.am:
* gst/videofilter/gstvideobalance.c: (gst_videobalance_class_init),
(tablelookup_u8), (gst_videobalance_planar411):
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (plugin_init):
* gst/videotestsrc/videotestsrc.c: (splat_u8), (paint_hline_YUY2),
(paint_hline_IYU2), (paint_hline_str4), (paint_hline_str3),
(paint_hline_RGB565), (paint_hline_xRGB1555):
2004-02-12 07:37:50 +00:00
|
|
|
#endif
|
2003-07-02 06:31:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_init (GTypeInstance * instance, gpointer g_class)
|
2003-07-02 06:31:33 +00:00
|
|
|
{
|
2003-11-08 02:52:41 +00:00
|
|
|
GstVideobalance *videobalance = GST_VIDEOBALANCE (instance);
|
2003-07-02 06:31:33 +00:00
|
|
|
GstVideofilter *videofilter;
|
2004-01-14 17:15:34 +00:00
|
|
|
char *channels[4] = { "HUE", "SATURATION",
|
2004-03-14 22:34:33 +00:00
|
|
|
"BRIGHTNESS", "CONTRAST"
|
|
|
|
};
|
2004-01-14 17:15:34 +00:00
|
|
|
gint i;
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_DEBUG ("gst_videobalance_init");
|
|
|
|
|
|
|
|
videofilter = GST_VIDEOFILTER (videobalance);
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2003-11-08 02:52:41 +00:00
|
|
|
/* do stuff */
|
2004-03-14 22:34:33 +00:00
|
|
|
videobalance->contrast = 1.0;
|
2004-01-25 11:17:11 +00:00
|
|
|
videobalance->brightness = 0.0;
|
|
|
|
videobalance->saturation = 1.0;
|
2004-03-14 22:34:33 +00:00
|
|
|
videobalance->hue = 0.0;
|
2004-01-15 17:16:37 +00:00
|
|
|
|
2004-01-25 11:17:11 +00:00
|
|
|
videobalance->needupdate = FALSE;
|
2004-01-15 17:16:37 +00:00
|
|
|
videofilter->passthru = TRUE;
|
2004-01-25 11:17:11 +00:00
|
|
|
|
|
|
|
videobalance->tabley = g_new (guint8, 256);
|
|
|
|
videobalance->tableu = g_new (guint8 *, 256);
|
|
|
|
videobalance->tablev = g_new (guint8 *, 256);
|
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
videobalance->tableu[i] = g_new (guint8, 256);
|
|
|
|
videobalance->tablev[i] = g_new (guint8, 256);
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
/* Generate the channels list */
|
2004-03-14 22:34:33 +00:00
|
|
|
for (i = 0; i < (sizeof (channels) / sizeof (char *)); i++) {
|
|
|
|
GstColorBalanceChannel *channel;
|
|
|
|
|
|
|
|
channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
|
|
|
|
channel->label = g_strdup (channels[i]);
|
|
|
|
channel->min_value = -1000;
|
|
|
|
channel->max_value = 1000;
|
|
|
|
|
|
|
|
videobalance->channels = g_list_append (videobalance->channels, channel);
|
|
|
|
}
|
2004-01-14 17:15:34 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_interface_supported (GstImplementsInterface * iface,
|
|
|
|
GType type)
|
2004-01-14 17:15:34 +00:00
|
|
|
{
|
|
|
|
g_assert (type == GST_TYPE_COLOR_BALANCE);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_interface_init (GstImplementsInterfaceClass * klass)
|
2004-01-14 17:15:34 +00:00
|
|
|
{
|
|
|
|
klass->supported = gst_videobalance_interface_supported;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GList *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_colorbalance_list_channels (GstColorBalance * balance)
|
2004-01-14 17:15:34 +00:00
|
|
|
{
|
|
|
|
GstVideobalance *videobalance = GST_VIDEOBALANCE (balance);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
g_return_val_if_fail (videobalance != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GST_IS_VIDEOBALANCE (videobalance), NULL);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-25 11:17:11 +00:00
|
|
|
return videobalance->channels;
|
2004-01-14 17:15:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_colorbalance_set_value (GstColorBalance * balance,
|
|
|
|
GstColorBalanceChannel * channel, gint value)
|
2004-01-14 17:15:34 +00:00
|
|
|
{
|
|
|
|
GstVideobalance *vb = GST_VIDEOBALANCE (balance);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
g_return_if_fail (vb != NULL);
|
|
|
|
g_return_if_fail (GST_IS_VIDEOBALANCE (vb));
|
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_get_volume),
(gst_alsa_mixer_set_volume), (gst_alsa_mixer_set_mute),
(gst_alsa_mixer_set_record), (gst_alsa_mixer_set_option),
(gst_alsa_mixer_get_option):
* ext/dvdnav/dvdnavsrc.c: (dvdnav_get_event_name),
(dvdnavsrc_print_event):
* ext/ogg/gstoggdemux.c: (_find_chain_process), (gst_ogg_print):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_pad_link),
(gst_ogg_mux_pad_unlink):
* gst/multipart/multipartmux.c: (gst_multipart_mux_pad_link),
(gst_multipart_mux_pad_unlink):
* gst/videofilter/gstvideobalance.c:
(gst_videobalance_colorbalance_set_value):
* gst/videomixer/videomixer.c: (gst_videomixer_pad_link),
(gst_videomixer_pad_unlink):
* po/uk.po:
* sys/oss/gstossmixer.c:
* sys/v4l/gstv4lcolorbalance.c:
* sys/v4l/gstv4ltuner.c:
* sys/v4l/v4lsrc_calls.c:
* sys/v4l2/gstv4l2colorbalance.c:
* sys/v4l2/gstv4l2tuner.c:
compile fixes for --disable-gst-debug, G_DISABLE_ASSERT and friends
2004-08-03 16:06:09 +00:00
|
|
|
g_return_if_fail (GST_IS_VIDEOFILTER (vb));
|
2004-01-14 17:15:34 +00:00
|
|
|
g_return_if_fail (channel->label != NULL);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-25 11:17:11 +00:00
|
|
|
if (!g_ascii_strcasecmp (channel->label, "HUE")) {
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
vb->hue = (value + 1000.0) * 2.0 / 2000.0 - 1.0;
|
2004-01-25 11:17:11 +00:00
|
|
|
} else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) {
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
vb->saturation = (value + 1000.0) * 2.0 / 2000.0;
|
2004-01-25 11:17:11 +00:00
|
|
|
} else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) {
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
vb->brightness = (value + 1000.0) * 2.0 / 2000.0 - 1.0;
|
2004-01-25 11:17:11 +00:00
|
|
|
} else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) {
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
vb->contrast = (value + 1000.0) * 2.0 / 2000.0;
|
2004-01-25 11:17:11 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-16 23:52:53 +00:00
|
|
|
gst_videobalance_update_properties (vb);
|
2004-01-14 17:15:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_colorbalance_get_value (GstColorBalance * balance,
|
|
|
|
GstColorBalanceChannel * channel)
|
2004-01-14 17:15:34 +00:00
|
|
|
{
|
|
|
|
GstVideobalance *vb = GST_VIDEOBALANCE (balance);
|
|
|
|
gint value = 0;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
g_return_val_if_fail (vb != NULL, 0);
|
|
|
|
g_return_val_if_fail (GST_IS_VIDEOBALANCE (vb), 0);
|
|
|
|
g_return_val_if_fail (channel->label != NULL, 0);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-25 11:17:11 +00:00
|
|
|
if (!g_ascii_strcasecmp (channel->label, "HUE")) {
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
value = (vb->hue + 1) * 2000.0 / 2.0 - 1000.0;
|
2004-01-25 11:17:11 +00:00
|
|
|
} else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) {
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
value = vb->saturation * 2000.0 / 2.0 - 1000.0;
|
2004-01-25 11:17:11 +00:00
|
|
|
} else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) {
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
value = (vb->brightness + 1) * 2000.0 / 2.0 - 1000.0;
|
2004-01-25 11:17:11 +00:00
|
|
|
} else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) {
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
value = vb->contrast * 2000.0 / 2.0 - 1000.0;
|
2004-01-25 11:17:11 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
return value;
|
|
|
|
}
|
2003-07-02 06:49:37 +00:00
|
|
|
|
2004-01-14 17:15:34 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_colorbalance_init (GstColorBalanceClass * iface)
|
2004-01-14 17:15:34 +00:00
|
|
|
{
|
|
|
|
GST_COLOR_BALANCE_TYPE (iface) = GST_COLOR_BALANCE_SOFTWARE;
|
|
|
|
iface->list_channels = gst_videobalance_colorbalance_list_channels;
|
|
|
|
iface->set_value = gst_videobalance_colorbalance_set_value;
|
|
|
|
iface->get_value = gst_videobalance_colorbalance_get_value;
|
2003-07-02 06:31:33 +00:00
|
|
|
}
|
|
|
|
|
2004-01-16 23:52:53 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_update_properties (GstVideobalance * videobalance)
|
2004-01-16 23:52:53 +00:00
|
|
|
{
|
2004-01-25 11:17:11 +00:00
|
|
|
GstVideofilter *vf = GST_VIDEOFILTER (videobalance);
|
|
|
|
|
|
|
|
videobalance->needupdate = TRUE;
|
|
|
|
|
|
|
|
if (videobalance->contrast == 1.0 &&
|
|
|
|
videobalance->brightness == 0.0 &&
|
2004-03-14 22:34:33 +00:00
|
|
|
videobalance->hue == 0.0 && videobalance->saturation == 1.0) {
|
2004-01-25 11:17:11 +00:00
|
|
|
vf->passthru = TRUE;
|
2004-01-16 23:52:53 +00:00
|
|
|
} else {
|
2004-01-25 11:17:11 +00:00
|
|
|
vf->passthru = FALSE;
|
2004-01-16 23:52:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-02 06:31:33 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2003-07-02 06:31:33 +00:00
|
|
|
{
|
|
|
|
GstVideobalance *src;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (GST_IS_VIDEOBALANCE (object));
|
|
|
|
src = GST_VIDEOBALANCE (object);
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_DEBUG ("gst_videobalance_set_property");
|
2003-07-02 06:31:33 +00:00
|
|
|
switch (prop_id) {
|
2003-07-02 06:49:37 +00:00
|
|
|
case ARG_CONTRAST:
|
|
|
|
src->contrast = g_value_get_double (value);
|
|
|
|
break;
|
|
|
|
case ARG_BRIGHTNESS:
|
|
|
|
src->brightness = g_value_get_double (value);
|
|
|
|
break;
|
|
|
|
case ARG_HUE:
|
|
|
|
src->hue = g_value_get_double (value);
|
|
|
|
break;
|
|
|
|
case ARG_SATURATION:
|
|
|
|
src->saturation = g_value_get_double (value);
|
2003-07-02 06:31:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-01-16 23:52:53 +00:00
|
|
|
|
|
|
|
gst_videobalance_update_properties (src);
|
2003-07-02 06:31:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2003-07-02 06:31:33 +00:00
|
|
|
{
|
|
|
|
GstVideobalance *src;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (GST_IS_VIDEOBALANCE (object));
|
|
|
|
src = GST_VIDEOBALANCE (object);
|
2003-07-02 06:31:33 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2003-07-02 06:49:37 +00:00
|
|
|
case ARG_CONTRAST:
|
|
|
|
g_value_set_double (value, src->contrast);
|
|
|
|
break;
|
|
|
|
case ARG_BRIGHTNESS:
|
|
|
|
g_value_set_double (value, src->brightness);
|
|
|
|
break;
|
|
|
|
case ARG_HUE:
|
|
|
|
g_value_set_double (value, src->hue);
|
|
|
|
break;
|
|
|
|
case ARG_SATURATION:
|
|
|
|
g_value_set_double (value, src->saturation);
|
2003-07-02 06:31:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
2003-07-02 06:31:33 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
if (!gst_library_load ("gstvideofilter"))
|
2003-07-02 06:31:33 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2003-11-08 02:52:41 +00:00
|
|
|
return gst_element_register (plugin, "videobalance", GST_RANK_NONE,
|
|
|
|
GST_TYPE_VIDEOBALANCE);
|
2003-07-02 06:31:33 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"videobalance",
|
|
|
|
"Changes hue, saturation, brightness etc. on video images",
|
2005-11-14 02:13:35 +00:00
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-07-25 14:06:15 +00:00
|
|
|
static void
|
|
|
|
gst_videobalance_setup (GstVideofilter * videofilter)
|
2003-07-02 06:31:33 +00:00
|
|
|
{
|
|
|
|
GstVideobalance *videobalance;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (GST_IS_VIDEOBALANCE (videofilter));
|
|
|
|
videobalance = GST_VIDEOBALANCE (videofilter);
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2003-11-08 02:52:41 +00:00
|
|
|
/* if any setup needs to be done, do it here */
|
|
|
|
|
2003-07-02 06:31:33 +00:00
|
|
|
}
|
|
|
|
|
2004-01-25 11:17:11 +00:00
|
|
|
/*
|
|
|
|
* look-up tables (LUT).
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_videobalance_update_tables_planar411 (GstVideobalance * vb)
|
2004-01-25 11:17:11 +00:00
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
gdouble y, u, v, hue_cos, hue_sin;
|
|
|
|
|
|
|
|
/* Y */
|
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
y = 16 + ((i - 16) * vb->contrast + vb->brightness * 255);
|
|
|
|
if (y < 0)
|
|
|
|
y = 0;
|
|
|
|
else if (y > 255)
|
|
|
|
y = 255;
|
|
|
|
vb->tabley[i] = rint (y);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME this is a bogus transformation for hue, but you get
|
|
|
|
* the idea */
|
|
|
|
hue_cos = cos (M_PI * vb->hue);
|
|
|
|
hue_sin = sin (M_PI * vb->hue);
|
|
|
|
|
|
|
|
/* U/V lookup tables are 2D, since we need both U/V for each table
|
|
|
|
* separately. */
|
|
|
|
for (i = -128; i < 128; i++) {
|
|
|
|
for (j = -128; j < 128; j++) {
|
2004-03-14 22:34:33 +00:00
|
|
|
u = 128 + ((i * hue_cos + j * hue_sin) * vb->saturation);
|
2004-01-25 11:17:11 +00:00
|
|
|
v = 128 + ((-i * hue_sin + j * hue_cos) * vb->saturation);
|
2004-03-14 22:34:33 +00:00
|
|
|
if (u < 0)
|
2004-03-15 19:32:27 +00:00
|
|
|
u = 0;
|
2004-01-25 11:17:11 +00:00
|
|
|
else if (u > 255)
|
2004-03-15 19:32:27 +00:00
|
|
|
u = 255;
|
2004-01-25 11:17:11 +00:00
|
|
|
if (v < 0)
|
2004-03-15 19:32:27 +00:00
|
|
|
v = 0;
|
2004-01-25 11:17:11 +00:00
|
|
|
else if (v > 255)
|
2004-03-15 19:32:27 +00:00
|
|
|
v = 255;
|
2004-03-14 22:34:33 +00:00
|
|
|
vb->tableu[i + 128][j + 128] = rint (u);
|
|
|
|
vb->tablev[i + 128][j + 128] = rint (v);
|
2004-01-25 11:17:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Convert a few inner loops to use liboil. This is currently optional, and is only enabled if liboil is present (duh!).
Original commit message from CVS:
Convert a few inner loops to use liboil. This is currently
optional, and is only enabled if liboil is present (duh!).
* configure.ac: Check for liboil-0.1
* gst/intfloat/Makefile.am:
* gst/intfloat/gstint2float.c: (conv_f32_s16), (scalarmult_f32),
(gst_int2float_chain_gint16):
* gst/videofilter/Makefile.am:
* gst/videofilter/gstvideobalance.c: (gst_videobalance_class_init),
(tablelookup_u8), (gst_videobalance_planar411):
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (plugin_init):
* gst/videotestsrc/videotestsrc.c: (splat_u8), (paint_hline_YUY2),
(paint_hline_IYU2), (paint_hline_str4), (paint_hline_str3),
(paint_hline_RGB565), (paint_hline_xRGB1555):
2004-02-12 07:37:50 +00:00
|
|
|
#ifndef HAVE_LIBOIL
|
2004-03-14 22:34:33 +00:00
|
|
|
void
|
2004-10-14 23:19:58 +00:00
|
|
|
oil_tablelookup_u8 (guint8 * dest, int dstr, guint8 * src, int sstr,
|
2004-03-14 22:34:33 +00:00
|
|
|
guint8 * table, int tstr, int n)
|
Convert a few inner loops to use liboil. This is currently optional, and is only enabled if liboil is present (duh!).
Original commit message from CVS:
Convert a few inner loops to use liboil. This is currently
optional, and is only enabled if liboil is present (duh!).
* configure.ac: Check for liboil-0.1
* gst/intfloat/Makefile.am:
* gst/intfloat/gstint2float.c: (conv_f32_s16), (scalarmult_f32),
(gst_int2float_chain_gint16):
* gst/videofilter/Makefile.am:
* gst/videofilter/gstvideobalance.c: (gst_videobalance_class_init),
(tablelookup_u8), (gst_videobalance_planar411):
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (plugin_init):
* gst/videotestsrc/videotestsrc.c: (splat_u8), (paint_hline_YUY2),
(paint_hline_IYU2), (paint_hline_str4), (paint_hline_str3),
(paint_hline_RGB565), (paint_hline_xRGB1555):
2004-02-12 07:37:50 +00:00
|
|
|
{
|
|
|
|
int i;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
for (i = 0; i < n; i++) {
|
Convert a few inner loops to use liboil. This is currently optional, and is only enabled if liboil is present (duh!).
Original commit message from CVS:
Convert a few inner loops to use liboil. This is currently
optional, and is only enabled if liboil is present (duh!).
* configure.ac: Check for liboil-0.1
* gst/intfloat/Makefile.am:
* gst/intfloat/gstint2float.c: (conv_f32_s16), (scalarmult_f32),
(gst_int2float_chain_gint16):
* gst/videofilter/Makefile.am:
* gst/videofilter/gstvideobalance.c: (gst_videobalance_class_init),
(tablelookup_u8), (gst_videobalance_planar411):
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (plugin_init):
* gst/videotestsrc/videotestsrc.c: (splat_u8), (paint_hline_YUY2),
(paint_hline_IYU2), (paint_hline_str4), (paint_hline_str3),
(paint_hline_RGB565), (paint_hline_xRGB1555):
2004-02-12 07:37:50 +00:00
|
|
|
*dest = table[*src * tstr];
|
|
|
|
dest += dstr;
|
|
|
|
src += sstr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
gst_videobalance_planar411 (GstVideofilter * videofilter, void *dest, void *src)
|
2003-07-02 06:31:33 +00:00
|
|
|
{
|
|
|
|
GstVideobalance *videobalance;
|
2003-07-02 06:49:37 +00:00
|
|
|
int width;
|
|
|
|
int height;
|
2004-03-14 22:34:33 +00:00
|
|
|
int x, y;
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (GST_IS_VIDEOBALANCE (videofilter));
|
|
|
|
videobalance = GST_VIDEOBALANCE (videofilter);
|
2003-07-02 06:31:33 +00:00
|
|
|
|
2004-01-25 11:17:11 +00:00
|
|
|
if (videobalance->needupdate) {
|
|
|
|
gst_videobalance_update_tables_planar411 (videobalance);
|
|
|
|
videobalance->needupdate = FALSE;
|
|
|
|
}
|
|
|
|
|
2003-07-02 06:49:37 +00:00
|
|
|
width = videofilter->from_width;
|
|
|
|
height = videofilter->from_height;
|
|
|
|
|
|
|
|
{
|
|
|
|
guint8 *cdest = dest;
|
|
|
|
guint8 *csrc = src;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
for (y = 0; y < height; y++) {
|
2004-10-14 23:19:58 +00:00
|
|
|
oil_tablelookup_u8 (cdest + y * width, 1, csrc + y * width, 1,
|
2004-03-15 19:32:27 +00:00
|
|
|
videobalance->tabley, 1, width);
|
2003-07-02 06:49:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2004-01-25 11:17:11 +00:00
|
|
|
gint u1, v1;
|
2003-07-02 06:49:37 +00:00
|
|
|
guint8 *usrc, *vsrc;
|
|
|
|
guint8 *udest, *vdest;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
usrc = src + width * height;
|
|
|
|
udest = dest + width * height;
|
|
|
|
vsrc = src + width * height + (width / 2) * (height / 2);
|
|
|
|
vdest = dest + width * height + (width / 2) * (height / 2);
|
|
|
|
|
|
|
|
for (y = 0; y < height / 2; y++) {
|
|
|
|
for (x = 0; x < width / 2; x++) {
|
2004-03-15 19:32:27 +00:00
|
|
|
u1 = usrc[y * (width / 2) + x];
|
|
|
|
v1 = vsrc[y * (width / 2) + x];
|
|
|
|
udest[y * (width / 2) + x] = videobalance->tableu[u1][v1];
|
|
|
|
vdest[y * (width / 2) + x] = videobalance->tablev[u1][v1];
|
2003-07-02 06:49:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-11-08 02:52:41 +00:00
|
|
|
|
2003-07-02 06:31:33 +00:00
|
|
|
}
|