summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEwald Snel <esnel@users.sourceforge.net>2003-02-02 12:44:03 +0000
committerEwald Snel <esnel@users.sourceforge.net>2003-02-02 12:44:03 +0000
commit9fefd435c683d35684017b2f60163d3d93c63f4e (patch)
tree2c6408bf6fd3adb816a83372f6ee55667bc2d2b9 /src
parentd2735be904ae6f88cab9cfefc47d809d9582442b (diff)
downloadxine-lib-9fefd435c683d35684017b2f60163d3d93c63f4e.tar.gz
xine-lib-9fefd435c683d35684017b2f60163d3d93c63f4e.tar.bz2
Add support for brightness, saturation, contrast (not functional yet)
CVS patchset: 4088 CVS date: 2003/02/02 12:44:03
Diffstat (limited to 'src')
-rw-r--r--src/video_out/video_out_fb.c8
-rw-r--r--src/video_out/video_out_opengl.c8
-rw-r--r--src/video_out/video_out_xshm.c44
-rw-r--r--src/video_out/yuv2rgb.c15
-rw-r--r--src/video_out/yuv2rgb.h10
5 files changed, 47 insertions, 38 deletions
diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c
index 8bbb2319e..819ef9258 100644
--- a/src/video_out/video_out_fb.c
+++ b/src/video_out/video_out_fb.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_fb.c,v 1.22 2003/01/31 14:06:18 miguelfreitas Exp $
+ * $Id: video_out_fb.c,v 1.23 2003/02/02 12:44:03 esnel Exp $
*
* video_out_fb.c, frame buffer xine driver by Miguel Freitas
*
@@ -641,7 +641,7 @@ static int fb_set_property(vo_driver_t *this_gen, int property, int value)
case VO_PROP_BRIGHTNESS:
this->yuv2rgb_gamma = value;
this->yuv2rgb_factory->
- set_gamma(this->yuv2rgb_factory, value);
+ set_csc_levels(this->yuv2rgb_factory, value, 128, 128);
printf("video_out_fb: gamma changed to %d\n",value);
break;
@@ -855,8 +855,8 @@ static int setup_yuv2rgb(fb_driver_t *this, config_values_t *config,
this->yuv2rgb_factory = yuv2rgb_factory_init(this->yuv2rgb_mode,
this->yuv2rgb_swap,
this->yuv2rgb_cmap);
- this->yuv2rgb_factory->set_gamma(this->yuv2rgb_factory,
- this->yuv2rgb_gamma);
+ this->yuv2rgb_factory->set_csc_levels(this->yuv2rgb_factory,
+ this->yuv2rgb_gamma, 128, 128);
return 1;
}
diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c
index cd57082a4..de17a77b3 100644
--- a/src/video_out/video_out_opengl.c
+++ b/src/video_out/video_out_opengl.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_opengl.c,v 1.23 2003/01/29 15:34:26 miguelfreitas Exp $
+ * $Id: video_out_opengl.c,v 1.24 2003/02/02 12:44:03 esnel Exp $
*
* video_out_glut.c, glut based OpenGL rendering interface for xine
* Matthias Hopf <mat@mshopf.de>
@@ -770,7 +770,7 @@ static int opengl_set_property (vo_driver_t *this_gen,
break;
case VO_PROP_BRIGHTNESS:
this->yuv2rgb_gamma = value;
- this->yuv2rgb_factory->set_gamma (this->yuv2rgb_factory, value);
+ this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, value, 128, 128);
printf("video_out_opengl: gamma changed to %d\n",value);
break;
default:
@@ -947,8 +947,8 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen,
NULL, 0, NULL, NULL);
this->yuv2rgb_factory = yuv2rgb_factory_init (YUV_FORMAT, YUV_SWAP_MODE,
this->yuv2rgb_cmap);
- this->yuv2rgb_factory->set_gamma (this->yuv2rgb_factory,
- this->yuv2rgb_gamma);
+ this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory,
+ this->yuv2rgb_gamma, 128, 128);
return &this->vo_driver;
}
diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c
index 30cf25c9c..6d8f4e5b6 100644
--- a/src/video_out/video_out_xshm.c
+++ b/src/video_out/video_out_xshm.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_xshm.c,v 1.102 2003/02/02 11:21:34 esnel Exp $
+ * $Id: video_out_xshm.c,v 1.103 2003/02/02 12:44:04 esnel Exp $
*
* video_out_xshm.c, X11 shared memory extension interface for xine
*
@@ -103,7 +103,9 @@ typedef struct xshm_driver_s {
int yuv2rgb_mode;
int yuv2rgb_swap;
- int yuv2rgb_gamma;
+ int yuv2rgb_brightness;
+ int yuv2rgb_contrast;
+ int yuv2rgb_saturation;
uint8_t *yuv2rgb_cmap;
yuv2rgb_factory_t *yuv2rgb_factory;
@@ -789,7 +791,11 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) {
case VO_PROP_MAX_NUM_FRAMES:
return 15;
case VO_PROP_BRIGHTNESS:
- return this->yuv2rgb_gamma;
+ return this->yuv2rgb_brightness;
+ case VO_PROP_CONTRAST:
+ return this->yuv2rgb_contrast;
+ case VO_PROP_SATURATION:
+ return this->yuv2rgb_saturation;
default:
printf ("video_out_xshm: tried to get unsupported property %d\n",
property);
@@ -813,8 +819,11 @@ static int xshm_set_property (vo_driver_t *this_gen,
} else if ( property == VO_PROP_BRIGHTNESS) {
- this->yuv2rgb_gamma = value;
- this->yuv2rgb_factory->set_gamma (this->yuv2rgb_factory, value);
+ this->yuv2rgb_brightness = value;
+ this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory,
+ this->yuv2rgb_brightness,
+ this->yuv2rgb_contrast,
+ this->yuv2rgb_saturation);
this->sc.force_redraw = 1;
#ifdef LOG
@@ -831,9 +840,15 @@ static void xshm_get_property_min_max (vo_driver_t *this_gen,
int property, int *min, int *max) {
/* xshm_driver_t *this = (xshm_driver_t *) this_gen; */
- if ( property == VO_PROP_BRIGHTNESS) {
- *min = -100;
- *max = +100;
+ if (property == VO_PROP_BRIGHTNESS) {
+ *min = -128;
+ *max = +127;
+ } else if (property == VO_PROP_CONTRAST) {
+ *min = 0;
+ *max = 255;
+ } else if (property == VO_PROP_SATURATION) {
+ *min = 0;
+ *max = 255;
} else {
*min = 0;
*max = 0;
@@ -1202,14 +1217,17 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi
this->yuv2rgb_mode = mode;
this->yuv2rgb_swap = swapped;
- this->yuv2rgb_gamma = config->register_range (config, "video.xshm_gamma", 0,
- -100, 100,
- _("gamma correction for XShm driver"),
- NULL, 0, NULL, NULL);
+ this->yuv2rgb_brightness = config->register_range (config, "video.xshm_gamma", 0,
+ -128, 127,
+ _("gamma correction for XShm driver"),
+ NULL, 0, NULL, NULL);
this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped,
this->yuv2rgb_cmap);
- this->yuv2rgb_factory->set_gamma (this->yuv2rgb_factory, this->yuv2rgb_gamma);
+ this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory,
+ this->yuv2rgb_brightness,
+ this->yuv2rgb_contrast,
+ this->yuv2rgb_saturation);
return &this->vo_driver;
}
diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c
index 74b75d095..76ee74e5b 100644
--- a/src/video_out/yuv2rgb.c
+++ b/src/video_out/yuv2rgb.c
@@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: yuv2rgb.c,v 1.37 2003/02/02 11:21:35 esnel Exp $
+ * $Id: yuv2rgb.c,v 1.38 2003/02/02 12:44:05 esnel Exp $
*/
#include "config.h"
@@ -3125,9 +3125,10 @@ yuv2rgb_t *yuv2rgb_create_converter (yuv2rgb_factory_t *factory) {
* factory functions
*/
-void yuv2rgb_set_gamma (yuv2rgb_factory_t *this, int gamma) {
+void yuv2rgb_set_csc_levels (yuv2rgb_factory_t *this,
+ int brightness, int contrast, int saturation) {
- int i;
+ int i, gamma = brightness;
for (i = 0; i < 256; i++) {
(uint8_t *)this->table_rV[i] += this->entry_size*(gamma - this->gamma);
@@ -3140,11 +3141,6 @@ void yuv2rgb_set_gamma (yuv2rgb_factory_t *this, int gamma) {
this->gamma = gamma;
}
-int yuv2rgb_get_gamma (yuv2rgb_factory_t *this) {
-
- return this->gamma;
-}
-
static void yuv2rgb_factory_dispose (yuv2rgb_factory_t *this) {
free (this->table_base);
@@ -3166,8 +3162,7 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped,
this->swapped = swapped;
this->cmap = cmap;
this->create_converter = yuv2rgb_create_converter;
- this->set_gamma = yuv2rgb_set_gamma;
- this->get_gamma = yuv2rgb_get_gamma;
+ this->set_csc_levels = yuv2rgb_set_csc_levels;
this->dispose = yuv2rgb_factory_dispose;
this->matrix_coefficients = 6;
this->table_base = NULL;
diff --git a/src/video_out/yuv2rgb.h b/src/video_out/yuv2rgb.h
index 808a84d7a..dc65adbb7 100644
--- a/src/video_out/yuv2rgb.h
+++ b/src/video_out/yuv2rgb.h
@@ -114,15 +114,11 @@ struct yuv2rgb_factory_s {
yuv2rgb_t* (*create_converter) (yuv2rgb_factory_t *this);
/*
- * adjust gamma (-100 to 100 looks fine)
+ * set color space conversion levels
* for all converters produced by this factory
*/
- void (*set_gamma) (yuv2rgb_factory_t *this, int gamma);
-
- /*
- * get gamma value
- */
- int (*get_gamma) (yuv2rgb_factory_t *this);
+ void (*set_csc_levels) (yuv2rgb_factory_t *this,
+ int brightness, int contrast, int saturation);
/*
* free resources