summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-05-30 19:56:58 +0200
committerwm4 <wm4@nowhere>2016-05-30 20:17:33 +0200
commit45c3e0f0d0c836158ab38db53156bb6461ad7437 (patch)
treefa74784173edcbc2771b045947e0d64ed1b44bd9 /video/mp_image.c
parent098ff4174c6c9cc59e65c6f09b23b3adaee03983 (diff)
downloadmpv-45c3e0f0d0c836158ab38db53156bb6461ad7437.tar.bz2
mpv-45c3e0f0d0c836158ab38db53156bb6461ad7437.tar.xz
vo_opengl: refactor HDR mechanism
Instead of doing HDR tone mapping on an ad-hoc basis inside pass_colormanage, the reference peak of an image is now part of the image params (alongside colorspace, gamma, etc.) and tone mapping is done whenever peak_src != peak_dst. To get sensible behavior when mixing HDR and SDR content and displays, target-brightness is a generic filler for "the assumed brightness of SDR content". This gets rid of the weird display_scaled hack, sets the framework for multiple HDR functions with difference reference peaks, and allows us to (in a future commit) autodetect the right source peak from the HDR metadata. (Apart from metadata, the source peak can also be controlled via vf_format. For HDR content this adjusts the overall image brightness, for SDR content it's like simulating a different exposure)
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index ac3d4ea5e1..d5b97481e8 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -568,6 +568,7 @@ bool mp_image_params_equal(const struct mp_image_params *p1,
p1->colorlevels == p2->colorlevels &&
p1->primaries == p2->primaries &&
p1->gamma == p2->gamma &&
+ p1->peak == p2->peak &&
p1->chroma_location == p2->chroma_location &&
p1->rotate == p2->rotate &&
p1->stereo_in == p2->stereo_in &&
@@ -662,6 +663,12 @@ void mp_image_params_guess_csp(struct mp_image_params *params)
params->primaries = MP_CSP_PRIM_AUTO;
params->gamma = MP_CSP_TRC_AUTO;
}
+
+ // Guess the reference peak (independent of the colorspace)
+ if (params->gamma == MP_CSP_TRC_SMPTE_ST2084) {
+ if (!params->peak)
+ params->peak = 10000; // As per the spec
+ }
}
// Copy properties and data of the AVFrame into the mp_image, without taking