diff options
author | Niklas Haas <git@nand.wakku.to> | 2016-06-29 09:16:13 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-07-03 19:42:52 +0200 |
commit | d81fb97f4587f73f62a760b99f686139f9b8d966 (patch) | |
tree | f97ec972e64160e1a479c1b31daf73af32ca54e1 /video/csputils.h | |
parent | 3abf9c9204e2fcbc1910deb102efab4ab9d8c149 (diff) | |
download | mpv-d81fb97f4587f73f62a760b99f686139f9b8d966.tar.bz2 mpv-d81fb97f4587f73f62a760b99f686139f9b8d966.tar.xz |
mp_image: split colorimetry metadata into its own struct
This has two reasons:
1. I tend to add new fields to this metadata, and every time I've done
so I've consistently forgotten to update all of the dozens of places in
which this colorimetry metadata might end up getting used. While most
usages don't really care about most of the metadata, sometimes the
intend was simply to “copy” the colorimetry metadata from one struct to
another. With this being inside a substruct, those lines of code can now
simply read a.color = b.color without having to care about added or
removed fields.
2. It makes the type definitions nicer for upcoming refactors.
In going through all of the usages, I also expanded a few where I felt
that omitting the “young” fields was a bug.
Diffstat (limited to 'video/csputils.h')
-rw-r--r-- | video/csputils.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/video/csputils.h b/video/csputils.h index 274b548381..0743f2bee5 100644 --- a/video/csputils.h +++ b/video/csputils.h @@ -116,11 +116,17 @@ extern const struct m_opt_choice_alternatives mp_stereo3d_names[]; #define MP_STEREO3D_NAME_DEF(x, def) \ (MP_STEREO3D_NAME(x) ? MP_STEREO3D_NAME(x) : (def)) -struct mp_csp_params { - enum mp_csp colorspace; - enum mp_csp_levels levels_in; // encoded video - enum mp_csp_levels levels_out; // output device +struct mp_colorspace { + enum mp_csp space; + enum mp_csp_levels levels; enum mp_csp_prim primaries; + enum mp_csp_trc gamma; + float peak; // 0 = auto/unknown +}; + +struct mp_csp_params { + struct mp_colorspace color; // input colorspace + enum mp_csp_levels levels_out; // output device float brightness; float contrast; float hue; @@ -134,9 +140,8 @@ struct mp_csp_params { }; #define MP_CSP_PARAMS_DEFAULTS { \ - .colorspace = MP_CSP_BT_601, \ - .levels_in = MP_CSP_LEVELS_TV, \ - .primaries = MP_CSP_PRIM_AUTO, \ + .color = { .space = MP_CSP_BT_601, \ + .levels = MP_CSP_LEVELS_TV }, \ .levels_out = MP_CSP_LEVELS_PC, \ .brightness = 0, .contrast = 1, .hue = 0, .saturation = 1, \ .gamma = 1, .texture_bits = 8, .input_bits = 8} @@ -145,6 +150,8 @@ struct mp_image_params; void mp_csp_set_image_params(struct mp_csp_params *params, const struct mp_image_params *imgparams); +bool mp_colorspace_equal(struct mp_colorspace c1, struct mp_colorspace c2); + enum mp_chroma_location { MP_CHROMA_AUTO, MP_CHROMA_LEFT, // mpeg2/4, h264 |