summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2015-02-28 00:59:09 +0100
committerNiklas Haas <git@nand.wakku.to>2015-02-28 01:07:35 +0100
commitfbacd5de31de964f7cd562304ab1c9b4a0d76015 (patch)
treecce495e7699f98ae64103b87459008b7d8503e0d /video/out
parent076b3d13855870df9eb599b7a26e708f9b8d1ace (diff)
downloadmpv-fbacd5de31de964f7cd562304ab1c9b4a0d76015.tar.bz2
mpv-fbacd5de31de964f7cd562304ab1c9b4a0d76015.tar.xz
csputils: add missing gamma support
We have MP_CSP_TRC defined, but it wasn't being used by practically anything. This commit adds missing conversion logic, adds it to mp_image, and moves the auto-guessing logic to where it should be, in mp_image_params_guess_csp (and out of vo_opengl). Note that this also fixes a minor bug: csp_prim was not being copied between mp_image structs if the format was not YUV in both cases, but this is wrong - the primaries are always relevant.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/gl_video.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 23b19b3125..9c8a64365d 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -937,8 +937,7 @@ static void compile_shaders(struct gl_video *p)
bool use_input_gamma = p->input_gamma != 1.0;
bool use_conv_gamma = p->conv_gamma != 1.0;
bool use_const_luma = p->image_params.colorspace == MP_CSP_BT_2020_C;
-
- enum mp_csp_trc gamma_fun = MP_CSP_TRC_NONE;
+ enum mp_csp_trc gamma_fun = p->image_params.gamma;
// If either color correction option (3dlut or srgb) is enabled, or if
// sigmoidal upscaling is requested, or if the source is linear XYZ, we
@@ -946,20 +945,6 @@ static void compile_shaders(struct gl_video *p)
bool use_linear_light = p->opts.linear_scaling || p->opts.sigmoid_upscaling
|| use_cms || is_xyz;
- if (use_linear_light) {
- // We use the color level range to distinguish between PC
- // content like images, which are most likely sRGB, and TV content
- // like movies, which are most likely BT.1886. XYZ input is always
- // treated as linear.
- if (is_xyz) {
- gamma_fun = MP_CSP_TRC_LINEAR;
- } else if (p->image_params.colorlevels == MP_CSP_LEVELS_PC) {
- gamma_fun = MP_CSP_TRC_SRGB;
- } else {
- gamma_fun = MP_CSP_TRC_BT_1886;
- }
- }
-
// The inverse of the above transformation is normally handled by
// the CMS cases, but if CMS is disabled we need to go back manually
bool use_inv_bt1886 = false;