[Mplayer-cvslog] CVS: main/libmpdemux tv.c,1.51,1.52 tv.h,1.22,1.23 tvi_v4l.c,1.60,1.61

Jindrich Makovicka CVS henry at mplayerhq.hu
Sun Mar 23 16:05:17 CET 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv5576/libmpdemux

Modified Files:
	tv.c tv.h tvi_v4l.c 
Log Message:
color equalizer for tv input

Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- tv.c	19 Mar 2003 16:26:58 -0000	1.51
+++ tv.c	23 Mar 2003 15:05:14 -0000	1.52
@@ -71,6 +71,10 @@
 #endif
 char* tv_param_adevice = NULL;
 #endif
+int tv_param_brightness = 0;
+int tv_param_contrast = 0;
+int tv_param_hue = 0;
+int tv_param_saturation = 0;
 
 /* ================== DEMUX_TV ===================== */
 /*
@@ -442,6 +446,12 @@
 
     /* set height */
     funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_video->disp_h);
+
+    /* set color eq */
+    tv_set_color_options(tvh, TV_COLOR_BRIGHTNESS, tv_param_brightness);
+    tv_set_color_options(tvh, TV_COLOR_HUE, tv_param_hue);
+    tv_set_color_options(tvh, TV_COLOR_SATURATION, tv_param_saturation);
+    tv_set_color_options(tvh, TV_COLOR_CONTRAST, tv_param_contrast);
 
     demuxer->video->sh = sh_video;
     sh_video->ds = demuxer->video;

Index: tv.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- tv.h	19 Mar 2003 16:26:58 -0000	1.22
+++ tv.h	23 Mar 2003 15:05:14 -0000	1.23
@@ -42,6 +42,10 @@
 #endif
 extern char* tv_param_adevice;
 #endif
+extern int tv_param_brightness;
+extern int tv_param_contrast;
+extern int tv_param_hue;
+extern int tv_param_saturation;
 
 typedef struct tvi_info_s
 {

Index: tvi_v4l.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tvi_v4l.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- tvi_v4l.c	21 Mar 2003 16:46:38 -0000	1.60
+++ tvi_v4l.c	23 Mar 2003 15:05:14 -0000	1.61
@@ -929,6 +929,12 @@
     return(1);
 }
 
+// 2nd order polynomial with p(-100)=0, p(100)=65535, p(0)=y0
+static int poly(int x, int y0)
+{
+    return ((65535-2*y0)*x*x+6553500*x+20000*y0)/20000;
+}
+
 static int control(priv_t *priv, int cmd, void *arg)
 {
     mp_msg(MSGT_TV, MSGL_DBG2, "\ndebug: control(priv=%p, cmd=%d, arg=%p)\n",
@@ -1042,19 +1048,19 @@
 	    }
 	    return(TVI_CONTROL_TRUE);
 	case TVI_CONTROL_VID_SET_BRIGHTNESS:
-	    priv->picture.brightness = (int)*(void **)arg;
+	    priv->picture.brightness = 65535*((int)*(void **)arg+100)/200;
 	    control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
 	    return(TVI_CONTROL_TRUE);
 	case TVI_CONTROL_VID_SET_HUE:
-	    priv->picture.hue = (int)*(void **)arg;
+	    priv->picture.hue = 65535*((int)*(void **)arg+100)/200;
 	    control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
 	    return(TVI_CONTROL_TRUE);
 	case TVI_CONTROL_VID_SET_SATURATION:
-	    priv->picture.colour = (int)*(void **)arg;
+	    priv->picture.colour = 65535*((int)*(void **)arg+100)/200;
 	    control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
 	    return(TVI_CONTROL_TRUE);
 	case TVI_CONTROL_VID_SET_CONTRAST:
-	    priv->picture.contrast = (int)*(void **)arg;
+	    priv->picture.contrast = poly((int)*(void **)arg, 24576);
 	    control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
 	    return(TVI_CONTROL_TRUE);
 	case TVI_CONTROL_VID_GET_FPS:



More information about the MPlayer-cvslog mailing list