mirror of https://github.com/mpv-player/mpv
gamma correction support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4230 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
6a8715f9b9
commit
555c676683
|
@ -39,6 +39,14 @@ extern char *lirc_configfile;
|
|||
extern int vo_doublebuffering;
|
||||
extern int vo_fsmode;
|
||||
extern int vo_dbpp;
|
||||
/* gamma correction */
|
||||
extern int vo_gamma_brightness;
|
||||
extern int vo_gamma_saturation;
|
||||
extern int vo_gamma_contrast;
|
||||
extern int vo_gamma_hue;
|
||||
extern int vo_gamma_red_intense;
|
||||
extern int vo_gamma_green_intense;
|
||||
extern int vo_gamma_blue_intense;
|
||||
#endif
|
||||
|
||||
#ifdef USE_SUB
|
||||
|
@ -237,6 +245,13 @@ static config_t mplayer_opts[]={
|
|||
{"fsmode", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, NULL},
|
||||
{"double", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
{"nodouble", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
||||
{"brightness",&vo_gamma_brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL},
|
||||
{"saturation",&vo_gamma_saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL},
|
||||
{"constrast",&vo_gamma_contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL},
|
||||
{"hue",&vo_gamma_hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL},
|
||||
{"red_instense",&vo_gamma_red_intense, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL},
|
||||
{"green_intense",&vo_gamma_green_intense, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL},
|
||||
{"blue_intense",&vo_gamma_blue_intense, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL},
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AA
|
||||
|
|
|
@ -47,7 +47,16 @@ int vo_pts=0; // for hw decoding
|
|||
float vo_fps=0; // for mp1e rte
|
||||
|
||||
char *vo_subdevice = NULL;
|
||||
|
||||
/****************************************
|
||||
* GAMMA CORRECTION *
|
||||
****************************************/
|
||||
int vo_gamma_brightness=0;
|
||||
int vo_gamma_saturation=0;
|
||||
int vo_gamma_contrast=0;
|
||||
int vo_gamma_hue=0;
|
||||
int vo_gamma_red_intense=0;
|
||||
int vo_gamma_green_intense=0;
|
||||
int vo_gamma_blue_intense=0;
|
||||
//
|
||||
// Externally visible list of all vo drivers
|
||||
//
|
||||
|
|
|
@ -154,15 +154,51 @@ int vidix_init(unsigned src_width,unsigned src_height,
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern int vo_gamma_brightness;
|
||||
extern int vo_gamma_saturation;
|
||||
extern int vo_gamma_contrast;
|
||||
extern int vo_gamma_hue;
|
||||
extern int vo_gamma_red_intense;
|
||||
extern int vo_gamma_green_intense;
|
||||
extern int vo_gamma_blue_intense;
|
||||
|
||||
vidix_video_eq_t vid_eq;
|
||||
|
||||
void vidix_start(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if(verbose > 1)
|
||||
{
|
||||
printf("vosub_vidix: vo_gamma_brightness=%i\n"
|
||||
"vosub_vidix: vo_gamma_saturation=%i\n"
|
||||
"vosub_vidix: vo_gamma_contrast=%i\n"
|
||||
"vosub_vidix: vo_gamma_hue=%i\n"
|
||||
"vosub_vidix: vo_gamma_red_intense=%i\n"
|
||||
"vosub_vidix: vo_gamma_green_intense=%i\n"
|
||||
"vosub_vidix: vo_gamma_blue_intense=%i\n"
|
||||
,vo_gamma_brightness
|
||||
,vo_gamma_saturation
|
||||
,vo_gamma_contrast
|
||||
,vo_gamma_hue
|
||||
,vo_gamma_red_intense
|
||||
,vo_gamma_green_intense
|
||||
,vo_gamma_blue_intense);
|
||||
}
|
||||
if((err=vdlPlaybackOn(vidix_handler))!=0)
|
||||
{
|
||||
printf("vosub_vidix: Can't start playback: %s\n",strerror(err));
|
||||
return -1;
|
||||
}
|
||||
vid_eq.brightness = vo_gamma_brightness;
|
||||
vid_eq.saturation = vo_gamma_saturation;
|
||||
vid_eq.contrast = vo_gamma_contrast;
|
||||
vid_eq.hue = vo_gamma_hue;
|
||||
vid_eq.red_intense = vo_gamma_red_intense;
|
||||
vid_eq.green_intense = vo_gamma_green_intense;
|
||||
vid_eq.blue_intense = vo_gamma_blue_intense;
|
||||
vid_eq.flags = VEQ_FLG_ITU_R_BT_601;
|
||||
vdlPlaybackSetEq(vidix_handler,&vid_eq);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1070,20 +1070,39 @@ int vixPlaybackGetEq( vidix_video_eq_t * eq)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef RAGE128
|
||||
#define RTFSaturation(a) (1.0 + ((a)*1.0)/1000.0)
|
||||
#define RTFBrightness(a) (((a)*1.0)/2000.0)
|
||||
#define RTFContrast(a) (1.0 + ((a)*1.0)/1000.0)
|
||||
#define RTFHue(a) (((a)*3.1416)/1000.0)
|
||||
#define RTFCheckParam(a) {if((a)<-1000) (a)=-1000; if((a)>1000) (a)=1000;}
|
||||
#endif
|
||||
|
||||
int vixPlaybackSetEq( const vidix_video_eq_t * eq)
|
||||
{
|
||||
#ifdef RAGE128
|
||||
int br,sat;
|
||||
#else
|
||||
int itu_space;
|
||||
#endif
|
||||
memcpy(&equal,eq,sizeof(vidix_video_eq_t));
|
||||
#ifdef RAGE128
|
||||
br = equal.brightness * 64 / 1000;
|
||||
sat = equal.saturation * 32 / 1000;
|
||||
if(sat < 0) sat = 0;
|
||||
if(br < -64) br = -64; if(br > 63) br = 63;
|
||||
sat = (equal.saturation + 1000) * 32 / 1000;
|
||||
if(sat < 0) sat = 0; if(sat > 31) sat = 31;
|
||||
OUTREG(OV0_COLOUR_CNTL, (br & 0x7f) | (sat << 8) | (sat << 16));
|
||||
#else
|
||||
radeon_set_transform(equal.brightness,equal.contrast,
|
||||
equal.saturation,equal.hue,0);
|
||||
itu_space = equal.flags == VEQ_FLG_ITU_R_BT_709 ? 1 : 0;
|
||||
RTFCheckParam(equal.brightness);
|
||||
RTFCheckParam(equal.saturation);
|
||||
RTFCheckParam(equal.contrast);
|
||||
RTFCheckParam(equal.hue);
|
||||
radeon_set_transform(RTFBrightness(equal.brightness),
|
||||
RTFContrast(equal.contrast),
|
||||
RTFSaturation(equal.saturation),
|
||||
RTFHue(equal.hue),
|
||||
itu_space);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue