diff options
author | Niklas Haas <git@nand.wakku.to> | 2014-04-02 00:40:36 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-06-22 19:05:43 +0200 |
commit | 664f8e9832e7ee9835816621faf4b57ffbcc8628 (patch) | |
tree | 5a4183678358bdfa04a3a88ec94350b6a430323a /video/mp_image.c | |
parent | fbd35caef830a1d0a25f1ee6e3b5d71453c98a59 (diff) | |
download | mpv-664f8e9832e7ee9835816621faf4b57ffbcc8628.tar.bz2 mpv-664f8e9832e7ee9835816621faf4b57ffbcc8628.tar.xz |
video: Include better heuristics for guessing primaries
These consult the vertical resolution, matching against 576 for
PAL and 480/486 for NTSC. The documentation has also been updated.
Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index eb754499d1..d83a9ae3c1 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -537,14 +537,15 @@ void mp_image_params_guess_csp(struct mp_image_params *params) if (params->colorlevels == MP_CSP_LEVELS_AUTO) params->colorlevels = MP_CSP_LEVELS_TV; if (params->primaries == MP_CSP_PRIM_AUTO) { - // We assume BT.709 primaries for all untagged BT.609/BT.709 - // content, because it offers the minimal deviation from all three, - // including both NTSC and PAL/SECAM. + // Guess based on the colormatrix as a first priority if (params->colorspace == MP_CSP_BT_2020_NC || params->colorspace == MP_CSP_BT_2020_C) { params->primaries = MP_CSP_PRIM_BT_2020; - } else { + } else if (params->colorspace == MP_CSP_BT_709) { params->primaries = MP_CSP_PRIM_BT_709; + } else { + // Ambiguous colormatrix for BT.601, guess based on res + params->primaries = mp_csp_guess_primaries(params->w, params->h); } } } else if (fmt.flags & MP_IMGFLAG_RGB) { |