From 71e97395e6da4c635acb49cf90d4898e0b2f0571 Mon Sep 17 00:00:00 2001 From: jojo61 Date: Sat, 17 Nov 2018 16:32:55 +0100 Subject: [PATCH] more config Parameters --- softhdcuvid.cpp | 26 ++++++++++++++++++++++++++ video.c | 33 +++++++++++++++++++++++++++++++-- video.h | 6 ++++++ 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/softhdcuvid.cpp b/softhdcuvid.cpp index 2709094..129e89c 100644 --- a/softhdcuvid.cpp +++ b/softhdcuvid.cpp @@ -114,6 +114,8 @@ static int ConfigVideoBrightness; ///< config video brightness static int ConfigVideoContrast = 100; ///< config video contrast static int ConfigVideoSaturation = 100; ///< config video saturation static int ConfigVideoHue; ///< config video hue +static int ConfigGamma; ///< config Gamma +static int ConfigTargetColorSpace; ///< config Target Colrospace /// config deinterlace static int ConfigVideoDeinterlace[RESOLUTIONS]; @@ -866,6 +868,8 @@ class cMenuSetupSoft:public cMenuSetupPage int Contrast; int Saturation; int Hue; + int Gamma; + int TargetColorSpace; int ResolutionShown[RESOLUTIONS]; int Scaling[RESOLUTIONS]; @@ -1003,6 +1007,11 @@ void cMenuSetupSoft::Create(void) static const char *const resolution[RESOLUTIONS] = { "576", "720", "fake 1080", "1080" ,"UHD" }; +#ifdef PLACEBO + static const char *const target_colorspace[] = { + "Monitor", "sRGB", "BT709", "HDR-HLG", "HDR10", + }; +#endif int current; int i; @@ -1088,8 +1097,11 @@ void cMenuSetupSoft::Create(void) 0, 100, tr("min"), tr("max"))); Add(new cMenuEditIntItem(tr("Saturation (0..100)"), &Saturation, 0, 100, tr("min"), tr("max"))); + Add(new cMenuEditIntItem(tr("Gamma (0..100)"), + &Gamma, 0, 100, tr("min"), tr("max"))); Add(new cMenuEditIntItem(tr("Hue (-314..314) "), &Hue, -314, 314, tr("min"), tr("max"))); + Add(new cMenuEditStraItem(tr("Monitor Colorspace"), &TargetColorSpace, 5, target_colorspace)); #endif for (i = 0; i < RESOLUTIONS; ++i) { cString msg; @@ -1287,6 +1299,8 @@ cMenuSetupSoft::cMenuSetupSoft(void) Contrast = ConfigVideoContrast; Saturation = ConfigVideoSaturation; Hue = ConfigVideoHue; + Gamma = ConfigGamma; + TargetColorSpace = ConfigTargetColorSpace; for (i = 0; i < RESOLUTIONS; ++i) { ResolutionShown[i] = 0; @@ -1425,6 +1439,10 @@ void cMenuSetupSoft::Store(void) VideoSetContrast(ConfigVideoContrast); SetupStore("Saturation", ConfigVideoSaturation = Saturation); VideoSetSaturation(ConfigVideoSaturation); + SetupStore("Gamma", ConfigGamma = Gamma); + VideoSetGamma(ConfigGamma); + SetupStore("TargetColorSpace", ConfigTargetColorSpace = TargetColorSpace); + VideoSetTargetColor(ConfigTargetColorSpace); SetupStore("Hue", ConfigVideoHue = Hue); VideoSetHue(ConfigVideoHue); @@ -3237,6 +3255,14 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value) if (!strcasecmp(name, "Saturation")) { VideoSetSaturation(ConfigVideoSaturation = atoi(value)); return true; + } + if (!strcasecmp(name, "Gamma")) { + VideoSetGamma(ConfigGamma = atoi(value)); + return true; + } + if (!strcasecmp(name, "TargetColorSpace")) { + VideoSetTargetColor(ConfigTargetColorSpace = atoi(value)); + return true; } if (!strcasecmp(name, "Hue")) { VideoSetHue(ConfigVideoHue = atoi(value)); diff --git a/video.c b/video.c index 22f1e71..d2b63f4 100644 --- a/video.c +++ b/video.c @@ -425,6 +425,7 @@ static float VideoContrast = 1.0f; static float VideoSaturation = 1.0f; static float VideoHue = 0.0f; static float VideoGamma = 1.0f; +static int VulkanTargetColorSpace = 0; static xcb_atom_t WmDeleteWindowAtom; ///< WM delete message atom static xcb_atom_t NetWmState; ///< wm-state message atom @@ -3571,6 +3572,7 @@ static void CuvidDisplayFrame(void) struct pl_swapchain_frame frame; struct pl_render_target target; bool ok; + static int test; #endif @@ -3608,8 +3610,26 @@ static void CuvidDisplayFrame(void) // target.repr.bits.color_depth = 16; // target.repr.bits.bit_shift =0; - memcpy(&target.color,&pl_color_space_srgb,sizeof(struct pl_color_space)); // make it RGB - + switch (VulkanTargetColorSpace) { + case 0: + memcpy(&target.color,&pl_color_space_monitor,sizeof(struct pl_color_space)); + break; + case 1: + memcpy(&target.color,&pl_color_space_srgb,sizeof(struct pl_color_space)); + break; + case 2: + memcpy(&target.color,&pl_color_space_bt709,sizeof(struct pl_color_space)); + break; + case 3: + memcpy(&target.color,&pl_color_space_bt2020_hlg,sizeof(struct pl_color_space)); + break; + case 4: + memcpy(&target.color,&pl_color_space_hdr10,sizeof(struct pl_color_space)); + break; + default: + memcpy(&target.color,&pl_color_space_monitor,sizeof(struct pl_color_space)); + break; + } #endif @@ -5719,6 +5739,15 @@ void VideoSetSaturation(int saturation) void VideoSetGamma(int gamma) { VideoGamma = (float)gamma / 100.0f; +} + /// +/// Set TargetColorSpace. +/// +/// @param TargetColorSpace +/// +void VideoSetTargetColor(int color) +{ + VulkanTargetColorSpace = color; } /// /// Set hue adjustment. diff --git a/video.h b/video.h index 90b507e..05b585a 100644 --- a/video.h +++ b/video.h @@ -118,6 +118,12 @@ extern void VideoSetContrast(int); /// Set saturation adjustment. extern void VideoSetSaturation(int); + /// Set Gamm. +extern void VideoSetGamma(int); + + /// Set ColorSpace. +extern void VideoSetTargetColor(int); + /// Set hue adjustment. extern void VideoSetHue(int);