mirror of
https://github.com/mpv-player/mpv
synced 2024-09-05 02:48:21 +02:00
Implement getting colors. The mapping between MPlayer's gamma range
(-100/100) and v4l's range (0-65535) had to be changed a bit to avoid rounding errors. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18174 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
f865d5a17e
commit
4d418c336f
@ -964,11 +964,6 @@ 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)
|
||||
{
|
||||
@ -1083,21 +1078,33 @@ static int control(priv_t *priv, int cmd, void *arg)
|
||||
}
|
||||
return(TVI_CONTROL_TRUE);
|
||||
case TVI_CONTROL_VID_SET_BRIGHTNESS:
|
||||
priv->picture.brightness = 65535*(*(int *)arg+100)/200;
|
||||
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||
return(TVI_CONTROL_TRUE);
|
||||
priv->picture.brightness = (327*(*(int *)arg+100)) + 68;
|
||||
return control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||
case TVI_CONTROL_VID_SET_HUE:
|
||||
priv->picture.hue = 65535*(*(int *)arg+100)/200;
|
||||
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||
return(TVI_CONTROL_TRUE);
|
||||
priv->picture.hue = (327*(*(int *)arg+100)) + 68;
|
||||
return control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||
case TVI_CONTROL_VID_SET_SATURATION:
|
||||
priv->picture.colour = 65535*(*(int *)arg+100)/200;
|
||||
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||
return(TVI_CONTROL_TRUE);
|
||||
priv->picture.colour = (327*(*(int *)arg+100)) + 68;
|
||||
return control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||
case TVI_CONTROL_VID_SET_CONTRAST:
|
||||
priv->picture.contrast = poly(*(int *)arg, 24576);
|
||||
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||
return(TVI_CONTROL_TRUE);
|
||||
priv->picture.contrast = (327*(*(int *)arg+100)) + 68;
|
||||
return control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||
case TVI_CONTROL_VID_GET_BRIGHTNESS:
|
||||
if(!control(priv, TVI_CONTROL_VID_GET_PICTURE, 0)) return 0;
|
||||
*(int*)arg = ((int)priv->picture.brightness-68)/327-100;
|
||||
return 1;
|
||||
case TVI_CONTROL_VID_GET_HUE:
|
||||
if(!control(priv, TVI_CONTROL_VID_GET_PICTURE, 0)) return 0;
|
||||
*(int*)arg = ((int)priv->picture.hue-68)/327-100;
|
||||
return 1;
|
||||
case TVI_CONTROL_VID_GET_SATURATION:
|
||||
if(!control(priv, TVI_CONTROL_VID_GET_PICTURE, 0)) return 0;
|
||||
*(int*)arg = ((int)priv->picture.colour-68)/327-100;
|
||||
return 1;
|
||||
case TVI_CONTROL_VID_GET_CONTRAST:
|
||||
if(!control(priv, TVI_CONTROL_VID_GET_PICTURE, 0)) return 0;
|
||||
*(int*)arg = ((int)priv->picture.contrast-68)/327-100;
|
||||
return 1;
|
||||
case TVI_CONTROL_VID_GET_FPS:
|
||||
*(float *)arg=priv->fps;
|
||||
return(TVI_CONTROL_TRUE);
|
||||
|
Loading…
Reference in New Issue
Block a user