summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-03-23 15:05:14 +0000
committerhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-03-23 15:05:14 +0000
commitf7756121ee35cb54b217218f9a5b07310b69625c (patch)
tree09dca6ae20b801f3332b14b7274d0b81e2d9bd1e /libmpdemux
parentca400daaf62da9ac0e0c04e794b2a51262a92475 (diff)
downloadmpv-f7756121ee35cb54b217218f9a5b07310b69625c.tar.bz2
mpv-f7756121ee35cb54b217218f9a5b07310b69625c.tar.xz
color equalizer for tv input
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9664 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/tv.c10
-rw-r--r--libmpdemux/tv.h4
-rw-r--r--libmpdemux/tvi_v4l.c14
3 files changed, 24 insertions, 4 deletions
diff --git a/libmpdemux/tv.c b/libmpdemux/tv.c
index 2f4681f205..5a173d29f4 100644
--- a/libmpdemux/tv.c
+++ b/libmpdemux/tv.c
@@ -71,6 +71,10 @@ int tv_param_alsa = 0;
#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 ===================== */
/*
@@ -443,6 +447,12 @@ int demux_open_tv(demuxer_t *demuxer)
/* 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;
demuxer->video->id = 0;
diff --git a/libmpdemux/tv.h b/libmpdemux/tv.h
index 0ad4680833..18ef4c52e6 100644
--- a/libmpdemux/tv.h
+++ b/libmpdemux/tv.h
@@ -42,6 +42,10 @@ extern int tv_param_alsa;
#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
{
diff --git a/libmpdemux/tvi_v4l.c b/libmpdemux/tvi_v4l.c
index 96e786c0f8..e68b638c8f 100644
--- a/libmpdemux/tvi_v4l.c
+++ b/libmpdemux/tvi_v4l.c
@@ -929,6 +929,12 @@ static int start(priv_t *priv)
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 @@ static int control(priv_t *priv, int cmd, void *arg)
}
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: