Replies: 3 comments 9 replies
-
Edit: Fixed version: diff --git a/src/shaders/colorspace.c b/src/shaders/colorspace.c
index 7d1927dd..3a033640 100644
--- a/src/shaders/colorspace.c
+++ b/src/shaders/colorspace.c
@@ -1682,6 +1682,12 @@ void pl_shader_color_map_ex(pl_shader sh, const struct pl_color_map_params *para
tone.output_max = PL_MIN(tone.output_max, tone.input_max);
}
+ const float max_contrast = 1000;
+ const float src_nits = pl_hdr_rescale(tone.input_scaling, PL_HDR_NITS, tone.input_max);
+ const float min_black = pl_hdr_rescale(PL_HDR_NITS, tone.input_scaling,
+ src_nits / max_contrast);
+ tone.output_min = PL_MAX(tone.output_min, min_black);
+
const int *lut3d_size_def = pl_color_map_default_params.lut3d_size;
struct pl_gamut_map_params gamut = {
.function = PL_DEF(params->gamut_mapping, &pl_gamut_map_clip),
diff --git a/src/shaders/colorspace.c b/src/shaders/colorspace.c
index 7d1927dd..5e200f35 100644
--- a/src/shaders/colorspace.c
+++ b/src/shaders/colorspace.c
@@ -1682,6 +1682,10 @@ void pl_shader_color_map_ex(pl_shader sh, const struct pl_color_map_params *para
tone.output_max = PL_MIN(tone.output_max, tone.input_max);
}
+ const float max_contrast = 1000;
+ const float min_black = tone.input_max / max_contrast;
+ tone.output_min = PL_MAX(tone.output_min, min_black);
+
const int *lut3d_size_def = pl_color_map_default_params.lut3d_size;
struct pl_gamut_map_params gamut = {
.function = PL_DEF(params->gamut_mapping, &pl_gamut_map_clip), If it turns out to be useful, we could easily add this feature, as a sort of dynamic contrast limiter. |
Beta Was this translation helpful? Give feedback.
-
Rather than basing it off the source peak, it might make more sense to base it off either the source average, source median, or some histogram value (e.g. 10%). If you want to try with the source average, just swap out For the median/histogram, we already have measurements in place for this but it's a bit annoying to plumb the relevant values out to this call site. At best I can recommend to play with the existing |
Beta Was this translation helpful? Give feedback.
-
So, do you think we should wrap this up as a new feature and have it default to 100:1? |
Beta Was this translation helpful? Give feedback.
-
Hey dear guys, i will put this here, because i think that it belongs to libplacebo and not to mpv (as the gpu-next mode mostly uses libplacebo features)
Maybe someone can help me:
Situation
On a home theater with a projector setup, there are some kind of 2 different contrasts which decide about the image quality:
This results in a visibly degradation of details on my JVC beamer in bright scenes: In dark areas, loads of details are flattened out.
Setting the "target-contrast" option to 1'000 or lower values helps this out.
On the other hand setting this value also results in a horrible black level in dark scenes, horror movies, and so on. For those, i'd rather chose a value in between of 20'000 to 50'000.
Idea
What i now want to code is some kind of an option like a dynamic display-blacklevel that depends on the in-picture (picture by picture, like in the hdr-peak-detect feature) max-luma.
Something like:
dst.min_luma = src.max_luma / 1000
I have found out so far, that the gpu-next mappings are all sourced in the libplacebo package.
What i tried out was:
libplacebo / src / tone_mapping.c : L558 in the function static void spline(float *lut, const struct pl_tone_map_params *params)
new_output_min = params->input_max / 1000;
and for the rest of the function changing all
params->output_min
tonew_output_min
This resulted in loads of compiling errors and i recognized that i didnt even understand the complexity of the code. (Which values are contained by these variables? values from 0 to 1.0 as floats? or values from -0.5f to 0.5f with an offset?
Is anyone here with a bigger insight of the source code, who can help me out?
I think it SHOULD be a simple job when knowing where to put this "feature".
But i do not have any clue where....
Very much greetings,
Lukas
Beta Was this translation helpful? Give feedback.
All reactions