Log in

View Full Version : Some questions about vs-placebo


Alexkral
20th September 2025, 15:09
Hi, I have some questions regarding the use of vs.placebo:

- placebo.Shader "Takes a YUVxxxP16 clip as input and outputs YUV444P16". This implies two YUV<->RGB conversions, but only one matrix can be specified. Does this mean that the same matrix is ​​used for both conversions? This seems like a problem if you want to use it with a gamut mapping shader.

- I don't understand how to use the "dynamic_peak_detection" feature. I would actually like to use it with placebo.Shader if possible (maybe passing PLSceneMax as a parameter?), but understanding how to use it in placebo.Tonemap would be a good starting point.

- Also, regarding this, I see that PLSceneMax is in nits, but max_pq_y is in PQ light. :confused:

Alexkral
21st September 2025, 04:31
As for my first question: Yes, the same matrix is ​​used to convert internally to RGB and then to convert the output to YUV444P16. So, for example, to use a shader that converts from BT.2020 to BT.709, you'd set matrix = 4, set the props of the primaries of the output to BT709, and add something like this:

clip = core.resize.Bicubic(clip, format = vs.YUV420P8, matrix_s = "709")

As for my other questions, I can't think of any simple way to test this, but I'd actually be surprised if it even worked with placebo.Tonemap.

takla
22nd September 2025, 21:05
https://ffmpeg.org/ffmpeg-filters.html#Output-mode


colorspace
Configure the colorspace that output frames will be delivered in. The default value of auto outputs frames in the same format as the input frames, leading to no change. For any other value, conversion will be performed.

https://ffmpeg.org/ffmpeg-filters.html#Peak-detection

peak_detect
Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of dynamic detection from the input. Note that the detected values do not get written back to the output frames, they merely guide the internal tone mapping process. Enabled by default.

Alexkral
23rd September 2025, 06:19
Yes, the color space issue is specific to the placebo.Shader implementation, and for tone mapping it seems the only difference is that with FFmpeg you only need to enable peak_detect.

Anyway, I want to use a custom shader for tone mapping and gamut mapping, so I added a compute shader for peak detection, and it doesn't seem to significantly impact performance.