Skip to content

Commit bf731e7

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

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

video/out/vo_gpu_next.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,21 @@ 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+
// max_cll is not used in tone mapping, set it to source value.
1115+
if (!hint.hdr.max_cll)
1116+
hint.hdr.max_cll = source->hdr.max_cll;
1117+
// If tone mapping is required, adjust maxCLL and maxFALL.
1118+
if (source->hdr.max_luma > hint.hdr.max_luma || opts->tone_map.inverse) {
1119+
// Set maxCLL to the target luminance if it's not already lower.
1120+
if (!hint.hdr.max_cll || hint.hdr.max_luma < hint.hdr.max_cll || opts->tone_map.inverse)
1121+
hint.hdr.max_cll = hint.hdr.max_luma;
1122+
// There's no reliable way to estimate maxFALL here.
1123+
// Scaling it linearly with max_luma would be inaccurate, depending
1124+
// on tone mapping curve. Just reset it to 0.
1125+
hint.hdr.max_fall = 0;
1126+
}
1127+
if (!hint.hdr.max_cll && hint.hdr.max_fall > hint.hdr.max_cll)
1128+
hint.hdr.max_fall = 0;
11141129
apply_target_contrast(p, &hint, hint.hdr.min_luma);
11151130
if (!pass_colorspace)
11161131
pl_swapchain_colorspace_hint(p->sw, &hint);

0 commit comments

Comments
 (0)