mirror of https://github.com/mpv-player/mpv
csputils, vo_opengl: remove XYZ special case in color matrix retrieval
This just seems unnecessary. Refactor it a bit. There should be no functional changes.
This commit is contained in:
parent
c2d0d7818f
commit
c5c7b239b6
|
@ -527,10 +527,10 @@ void mp_get_cms_matrix(struct mp_csp_primaries src, struct mp_csp_primaries dest
|
|||
|
||||
// get the coefficients of an SMPTE 428-1 xyz -> rgb conversion matrix
|
||||
// intent = the rendering intent used to convert to the target primaries
|
||||
void mp_get_xyz2rgb_coeffs(struct mp_csp_params *params,
|
||||
struct mp_csp_primaries prim,
|
||||
enum mp_render_intent intent, struct mp_cmat *m)
|
||||
static void mp_get_xyz2rgb_coeffs(struct mp_csp_params *params,
|
||||
enum mp_render_intent intent, struct mp_cmat *m)
|
||||
{
|
||||
struct mp_csp_primaries prim = mp_get_csp_primaries(params->primaries);
|
||||
float brightness = params->brightness;
|
||||
mp_get_rgb2xyz_matrix(prim, m->m);
|
||||
mp_invert_matrix3x3(m->m);
|
||||
|
@ -636,8 +636,7 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, struct mp_cmat *m)
|
|||
// The vo should probably not be using a matrix generated by this
|
||||
// function for XYZ sources, but if it does, let's just assume it
|
||||
// wants BT.709 with D65 white point (virtually all other content).
|
||||
mp_get_xyz2rgb_coeffs(params, mp_get_csp_primaries(MP_CSP_PRIM_BT_709),
|
||||
MP_INTENT_RELATIVE_COLORIMETRIC, m);
|
||||
mp_get_xyz2rgb_coeffs(params, MP_INTENT_RELATIVE_COLORIMETRIC, m);
|
||||
levels_in = -1;
|
||||
break;
|
||||
}
|
||||
|
@ -720,6 +719,7 @@ void mp_csp_set_image_params(struct mp_csp_params *params,
|
|||
mp_image_params_guess_csp(&p); // ensure consistency
|
||||
params->colorspace = p.colorspace;
|
||||
params->levels_in = p.colorlevels;
|
||||
params->primaries = p.primaries;
|
||||
}
|
||||
|
||||
// Copy settings from eq into params.
|
||||
|
|
|
@ -120,6 +120,7 @@ struct mp_csp_params {
|
|||
enum mp_csp colorspace;
|
||||
enum mp_csp_levels levels_in; // encoded video
|
||||
enum mp_csp_levels levels_out; // output device
|
||||
enum mp_csp_prim primaries;
|
||||
float brightness;
|
||||
float contrast;
|
||||
float hue;
|
||||
|
@ -135,6 +136,7 @@ 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, \
|
||||
.levels_out = MP_CSP_LEVELS_PC, \
|
||||
.brightness = 0, .contrast = 1, .hue = 0, .saturation = 1, \
|
||||
.gamma = 1, .texture_bits = 8, .input_bits = 8}
|
||||
|
@ -249,9 +251,6 @@ void mp_get_cms_matrix(struct mp_csp_primaries src, struct mp_csp_primaries dest
|
|||
enum mp_render_intent intent, float cms_matrix[3][3]);
|
||||
|
||||
double mp_get_csp_mul(enum mp_csp csp, int input_bits, int texture_bits);
|
||||
|
||||
void mp_get_xyz2rgb_coeffs(struct mp_csp_params *params, struct mp_csp_primaries prim,
|
||||
enum mp_render_intent intent, struct mp_cmat *xyz2rgb);
|
||||
void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, struct mp_cmat *yuv2rgb);
|
||||
|
||||
void mp_invert_matrix3x3(float m[3][3]);
|
||||
|
|
|
@ -1491,12 +1491,7 @@ static void pass_convert_yuv(struct gl_video *p)
|
|||
// Conversion to RGB. For RGB itself, this still applies e.g. brightness
|
||||
// and contrast controls, or expansion of e.g. LSB-packed 10 bit data.
|
||||
struct mp_cmat m = {{{0}}};
|
||||
if (p->image_desc.flags & MP_IMGFLAG_XYZ) {
|
||||
struct mp_csp_primaries csp = mp_get_csp_primaries(p->image_params.primaries);
|
||||
mp_get_xyz2rgb_coeffs(&cparams, csp, MP_INTENT_RELATIVE_COLORIMETRIC, &m);
|
||||
} else {
|
||||
mp_get_yuv2rgb_coeffs(&cparams, &m);
|
||||
}
|
||||
mp_get_yuv2rgb_coeffs(&cparams, &m);
|
||||
gl_sc_uniform_mat3(sc, "colormatrix", true, &m.m[0][0]);
|
||||
gl_sc_uniform_vec3(sc, "colormatrix_c", m.c);
|
||||
|
||||
|
|
Loading…
Reference in New Issue