Skip to content

Commit 1cd79c7

Browse files
committed
vo_gpu_next: when tone-mapping, set better maxCLL value
1 parent 440f35a commit 1cd79c7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

video/out/vo_gpu_next.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,16 @@ static bool draw_frame(struct vo *vo, struct vo_frame *frame)
11111111
hint.transfer = opts->target_trc;
11121112
if (opts->target_peak)
11131113
hint.hdr.max_luma = opts->target_peak;
1114+
// If tone mapping is required, adjust maxCLL and maxFALL.
1115+
if (source->hdr.max_luma > hint.hdr.max_luma) {
1116+
// Set maxCLL to the target luminance if it's not already lower.
1117+
if (!hint.hdr.max_cll || hint.hdr.max_luma < hint.hdr.max_cll || opts->tone_map.inverse)
1118+
hint.hdr.max_cll = hint.hdr.max_luma;
1119+
// There's no reliable way to estimate maxFALL here.
1120+
// Scaling it linearly with max_luma would be inaccurate, depending
1121+
// on tone mapping curve. Just reset it to 0.
1122+
hint.hdr.max_fall = 0;
1123+
}
11141124
apply_target_contrast(p, &hint, hint.hdr.min_luma);
11151125
if (!pass_colorspace)
11161126
pl_swapchain_colorspace_hint(p->sw, &hint);

0 commit comments

Comments
 (0)