summaryrefslogtreecommitdiffstats
path: root/video/csputils.c
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-06-28 14:28:32 +0200
committerwm4 <wm4@nowhere>2016-06-28 19:48:29 +0200
commitdc9a5cbfd7c30d4f0597ec0aad91dadf63defbba (patch)
tree2bb156f5f84643068e34e4817860597f73c262dc /video/csputils.c
parent65499d863a41cd7403302b8b635e18b764d4f9eb (diff)
downloadmpv-dc9a5cbfd7c30d4f0597ec0aad91dadf63defbba.tar.bz2
mpv-dc9a5cbfd7c30d4f0597ec0aad91dadf63defbba.tar.xz
vo_opengl: revise the transfer curve logic
Instead of hard-coding a big list, move some of the functionality to csputils. Affects both the auto-guess blacklist and the peak estimation. Also update the comments.
Diffstat (limited to 'video/csputils.c')
-rw-r--r--video/csputils.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/video/csputils.c b/video/csputils.c
index 65b26acb3a..d419152e2c 100644
--- a/video/csputils.c
+++ b/video/csputils.c
@@ -437,6 +437,31 @@ struct mp_csp_primaries mp_get_csp_primaries(enum mp_csp_prim spc)
}
}
+// Get the relative peak of a transfer curve, that is: (source reference /
+// display reference), or 0 if there is none (i.e. source has an absolute peak)
+float mp_csp_trc_rel_peak(enum mp_csp_trc trc)
+{
+ switch (trc) {
+ case MP_CSP_TRC_SMPTE_ST2084: return 0.0; // This has a fixed peak
+ case MP_CSP_TRC_ARIB_STD_B67: return 12.0;
+ case MP_CSP_TRC_V_LOG: return 46.0855;
+ }
+
+ return 1.0;
+}
+
+bool mp_trc_is_hdr(enum mp_csp_trc trc)
+{
+ switch (trc) {
+ case MP_CSP_TRC_SMPTE_ST2084:
+ case MP_CSP_TRC_ARIB_STD_B67:
+ case MP_CSP_TRC_V_LOG:
+ return true;
+ }
+
+ return false;
+}
+
// Compute the RGB/XYZ matrix as described here:
// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
static void mp_get_rgb2xyz_matrix(struct mp_csp_primaries space, float m[3][3])