windows support: remove _UWIN define
[mplayer.git] / libvo / csputils.h
blob3a754a82736960adbe4c5278101d4cd4630be230
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * You can alternatively redistribute this file and/or
19 * modify it under the terms of the GNU Lesser General Public
20 * License as published by the Free Software Foundation; either
21 * version 2.1 of the License, or (at your option) any later version.
24 #ifndef MPLAYER_CSPUTILS_H
25 #define MPLAYER_CSPUTILS_H
27 #include <stdint.h>
30 /* NOTE: the csp and levels AUTO values are converted to specific ones
31 * above vf/vo level. At least vf_scale relies on all valid settings being
32 * nonzero at vf/vo level.
35 enum mp_csp {
36 MP_CSP_AUTO,
37 MP_CSP_BT_601,
38 MP_CSP_BT_709,
39 MP_CSP_SMPTE_240M,
40 MP_CSP_COUNT
43 // Any enum mp_csp value is a valid index (except MP_CSP_COUNT)
44 extern char * const mp_csp_names[MP_CSP_COUNT];
46 enum mp_csp_levels {
47 MP_CSP_LEVELS_AUTO,
48 MP_CSP_LEVELS_TV,
49 MP_CSP_LEVELS_PC,
50 MP_CSP_LEVELS_COUNT,
53 struct mp_csp_details {
54 enum mp_csp format;
55 enum mp_csp_levels levels_in; // encoded video
56 enum mp_csp_levels levels_out; // output device
59 // initializer for struct mp_csp_details that contains reasonable defaults
60 #define MP_CSP_DETAILS_DEFAULTS {MP_CSP_BT_601, MP_CSP_LEVELS_TV, MP_CSP_LEVELS_PC}
62 struct mp_csp_params {
63 struct mp_csp_details colorspace;
64 float brightness;
65 float contrast;
66 float hue;
67 float saturation;
68 float rgamma;
69 float ggamma;
70 float bgamma;
71 int input_shift;
74 enum mp_csp_equalizer_param {
75 MP_CSP_EQ_BRIGHTNESS,
76 MP_CSP_EQ_CONTRAST,
77 MP_CSP_EQ_HUE,
78 MP_CSP_EQ_SATURATION,
79 MP_CSP_EQ_GAMMA,
80 MP_CSP_EQ_COUNT,
83 #define MP_CSP_EQ_CAPS_COLORMATRIX \
84 ( (1 << MP_CSP_EQ_BRIGHTNESS) \
85 | (1 << MP_CSP_EQ_CONTRAST) \
86 | (1 << MP_CSP_EQ_HUE) \
87 | (1 << MP_CSP_EQ_SATURATION) )
89 #define MP_CSP_EQ_CAPS_GAMMA (1 << MP_CSP_EQ_GAMMA)
91 extern char * const mp_csp_equalizer_names[MP_CSP_EQ_COUNT];
93 // Default initialization with 0 is enough, except for the capabilities field
94 struct mp_csp_equalizer {
95 // Bit field of capabilities. For example (1 << MP_CSP_EQ_HUE) means hue
96 // support is available.
97 int capabilities;
98 // Value for each property is in the range [-100, 100].
99 // 0 is default, meaning neutral or no change.
100 int values[MP_CSP_EQ_COUNT];
104 void mp_csp_copy_equalizer_values(struct mp_csp_params *params,
105 const struct mp_csp_equalizer *eq);
107 int mp_csp_equalizer_set(struct mp_csp_equalizer *eq, const char *property,
108 int value);
110 int mp_csp_equalizer_get(struct mp_csp_equalizer *eq, const char *property,
111 int *out_value);
113 enum mp_csp mp_csp_guess_colorspace(int width, int height);
115 void mp_gen_gamma_map(unsigned char *map, int size, float gamma);
116 #define ROW_R 0
117 #define ROW_G 1
118 #define ROW_B 2
119 #define COL_Y 0
120 #define COL_U 1
121 #define COL_V 2
122 #define COL_C 3
123 void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]);
124 void mp_gen_yuv2rgb_map(struct mp_csp_params *params, uint8_t *map, int size);
126 #endif /* MPLAYER_CSPUTILS_H */