1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

Support for colortemp adjustment with libplacebo

This commit is contained in:
jojo61 2021-04-16 13:50:45 +02:00
parent 017ad3f61b
commit 2562c4eac5
3 changed files with 33 additions and 6 deletions

View File

@ -63,7 +63,7 @@ extern void ToggleLUT();
/// vdr-plugin version number. /// vdr-plugin version number.
/// Makefile extracts the version number for generating the file name /// Makefile extracts the version number for generating the file name
/// for the distribution archive. /// for the distribution archive.
static const char *const VERSION = "3.4.4" static const char *const VERSION = "3.5"
#ifdef GIT_REV #ifdef GIT_REV
"-GIT" GIT_REV "-GIT" GIT_REV
#endif #endif
@ -109,6 +109,7 @@ static int ConfigVideoContrast = 100; ///< config video contrast
static int ConfigVideoSaturation = 100; ///< config video saturation static int ConfigVideoSaturation = 100; ///< config video saturation
static int ConfigVideoHue; ///< config video hue static int ConfigVideoHue; ///< config video hue
static int ConfigGamma=100; ///< config Gamma static int ConfigGamma=100; ///< config Gamma
static int ConfigTemperature=0; ///< config Temperature
static int ConfigTargetColorSpace; ///< config Target Colrospace static int ConfigTargetColorSpace; ///< config Target Colrospace
static int ConfigScalerTest; /// Test for Scalers static int ConfigScalerTest; /// Test for Scalers
static int ConfigColorBlindness; static int ConfigColorBlindness;
@ -979,6 +980,7 @@ class cMenuSetupSoft:public cMenuSetupPage
int Saturation; int Saturation;
int Hue; int Hue;
int Gamma; int Gamma;
int Temperature;
int TargetColorSpace; int TargetColorSpace;
int ScalerTest; int ScalerTest;
int ColorBlindnessFaktor; int ColorBlindnessFaktor;
@ -1202,10 +1204,10 @@ void cMenuSetupSoft::Create(void)
Add(new cMenuEditIntItem(tr("Saturation (0..100)"), &Saturation, 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("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 cMenuEditIntItem(tr("Hue (-314..314) "), &Hue, -314, 314, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Temperature 6500K + x * 100K"), &Temperature, -35, 35, NULL, NULL));
Add(new cMenuEditStraItem(tr("Color Blindness"), &ColorBlindness, 5, target_colorblindness)); Add(new cMenuEditStraItem(tr("Color Blindness"), &ColorBlindness, 5, target_colorblindness));
Add(new cMenuEditIntItem(tr("Color Correction (-100..100) "), &ColorBlindnessFaktor, -100, 100, tr("min"), Add(new cMenuEditIntItem(tr("Color Correction (-100..100) "), &ColorBlindnessFaktor, -100, 100, tr("min"), tr("max")));
tr("max")));
#endif #endif
Add(new cMenuEditStraItem(tr("Monitor Type"), &TargetColorSpace, 4, target_colorspace)); Add(new cMenuEditStraItem(tr("Monitor Type"), &TargetColorSpace, 4, target_colorspace));
for (i = 0; i < RESOLUTIONS; ++i) { for (i = 0; i < RESOLUTIONS; ++i) {
@ -1402,6 +1404,7 @@ cMenuSetupSoft::cMenuSetupSoft(void)
Saturation = ConfigVideoSaturation; Saturation = ConfigVideoSaturation;
Hue = ConfigVideoHue; Hue = ConfigVideoHue;
Gamma = ConfigGamma; Gamma = ConfigGamma;
Temperature = ConfigTemperature;
TargetColorSpace = ConfigTargetColorSpace; TargetColorSpace = ConfigTargetColorSpace;
ColorBlindness = ConfigColorBlindness; ColorBlindness = ConfigColorBlindness;
ColorBlindnessFaktor = ConfigColorBlindnessFaktor; ColorBlindnessFaktor = ConfigColorBlindnessFaktor;
@ -1534,6 +1537,8 @@ void cMenuSetupSoft::Store(void)
VideoSetSaturation(ConfigVideoSaturation); VideoSetSaturation(ConfigVideoSaturation);
SetupStore("Gamma", ConfigGamma = Gamma); SetupStore("Gamma", ConfigGamma = Gamma);
VideoSetGamma(ConfigGamma); VideoSetGamma(ConfigGamma);
SetupStore("Temperature", ConfigTemperature = Temperature);
VideoSetTemperature(ConfigTemperature);
SetupStore("TargetColorSpace", ConfigTargetColorSpace = TargetColorSpace); SetupStore("TargetColorSpace", ConfigTargetColorSpace = TargetColorSpace);
VideoSetTargetColor(ConfigTargetColorSpace); VideoSetTargetColor(ConfigTargetColorSpace);
SetupStore("Hue", ConfigVideoHue = Hue); SetupStore("Hue", ConfigVideoHue = Hue);
@ -3325,6 +3330,14 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
ConfigGamma = i > 100 ? 100 : i; ConfigGamma = i > 100 ? 100 : i;
VideoSetGamma(ConfigGamma); VideoSetGamma(ConfigGamma);
return true; return true;
}
if (!strcasecmp(name, "Temperature")) {
int i;
i = atoi(value);
ConfigTemperature = i > 100 ? 100 : i;
VideoSetTemperature(ConfigTemperature);
return true;
} }
if (!strcasecmp(name, "TargetColorSpace")) { if (!strcasecmp(name, "TargetColorSpace")) {
VideoSetTargetColor(ConfigTargetColorSpace = atoi(value)); VideoSetTargetColor(ConfigTargetColorSpace = atoi(value));

13
video.c
View File

@ -451,6 +451,7 @@ static float VideoContrast = 1.0f;
static float VideoSaturation = 1.0f; static float VideoSaturation = 1.0f;
static float VideoHue = 0.0f; static float VideoHue = 0.0f;
static float VideoGamma = 1.0f; static float VideoGamma = 1.0f;
static float VideoTemperature = 0.0f;
static int VulkanTargetColorSpace = 0; static int VulkanTargetColorSpace = 0;
static int VideoScalerTest = 0; static int VideoScalerTest = 0;
static int VideoColorBlindness = 0; static int VideoColorBlindness = 0;
@ -4110,6 +4111,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused))
colors.saturation = VideoSaturation; colors.saturation = VideoSaturation;
colors.hue = VideoHue; colors.hue = VideoHue;
colors.gamma = VideoGamma; colors.gamma = VideoGamma;
colors.temperature = VideoTemperature;
if (ovl) { if (ovl) {
target->overlays = ovl; target->overlays = ovl;
@ -6772,7 +6774,16 @@ void VideoSetGamma(int gamma)
{ {
VideoGamma = (float)gamma / 100.0f; VideoGamma = (float)gamma / 100.0f;
} }
///
/// Set Color Temperature adjustment.
///
/// @param offset between -3500k and 3500k.
/// 100 represents no modification
///
void VideoSetTemperature(int temp)
{
VideoTemperature = (float)temp / 35.0f;
}
/// ///
/// Set TargetColorSpace. /// Set TargetColorSpace.
/// ///

View File

@ -116,6 +116,9 @@ extern void VideoSetSaturation(int);
/// Set Gamma. /// Set Gamma.
extern void VideoSetGamma(int); extern void VideoSetGamma(int);
/// Set Color Temp.
extern void VideoSetTemperature(int);
/// Set ColorSpace. /// Set ColorSpace.
extern void VideoSetTargetColor(int); extern void VideoSetTargetColor(int);