libplacebo
libplacebo copied to clipboard
Changing the targeted luminance in runtime?
Excuse me for the stupid question, but I could not find any obvious way of overriding the default luminance target (of 203 nits) when the library is used e.g., with FFMpeg? The issue is that despite the 203 nits coming from the spec (BT.2390), on a monitor which has been calibrated to 120 nits the image is way too dark. A way darker than the older SDR source and way too dark to be usable.
Re-defining PL_COLOR_SDR_WHITE (in colorspace.h) works, but I am just wondering if there is a runtime control I just cannot figure out?
It's not exposed, but this controls it:
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index cfee1117e8..ce0a19dc58 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -338,6 +338,8 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out, AVFrame *in)
pl_rect2df_aspect_set(&target.crop, aspect, s->pad_crop_ratio);
}
+ target.color.hdr.max_luma = 120;
+
/* backwards compatibility with older API */
if (!tonemapping_mode && (s->desat_str >= 0.0f || s->desat_exp >= 0.0f)) {
float str = s->desat_str < 0.0f ? 0.9f : s->desat_str;