mirror of
https://github.com/mpv-player/mpv
synced 2025-01-18 04:51:52 +00:00
csputils: rename "yuv2rgb" functions
They're not necessarily restricted to YUV aka YCbCr. vo_direct3d.c and demux_disc.c (DVD specific code) changes untested.
This commit is contained in:
parent
c5c7b239b6
commit
45ae0716be
@ -94,7 +94,7 @@ static void add_dvd_streams(demuxer_t *demuxer)
|
||||
// emulate the extradata
|
||||
struct mp_csp_params csp = MP_CSP_PARAMS_DEFAULTS;
|
||||
struct mp_cmat cmatrix;
|
||||
mp_get_yuv2rgb_coeffs(&csp, &cmatrix);
|
||||
mp_get_csp_matrix(&csp, &cmatrix);
|
||||
|
||||
char *s = talloc_strdup(sh, "");
|
||||
s = talloc_asprintf_append(s, "palette: ");
|
||||
|
@ -296,8 +296,8 @@ static void draw_ass(struct mp_draw_sub_cache *cache, struct mp_rect bb,
|
||||
struct mp_cmat yuv2rgb, rgb2yuv;
|
||||
bool need_conv = temp->fmt.flags & MP_IMGFLAG_YUV;
|
||||
if (need_conv) {
|
||||
mp_get_yuv2rgb_coeffs(&cspar, &yuv2rgb);
|
||||
mp_invert_yuv2rgb(&rgb2yuv, &yuv2rgb);
|
||||
mp_get_csp_matrix(&cspar, &yuv2rgb);
|
||||
mp_invert_cmat(&rgb2yuv, &yuv2rgb);
|
||||
}
|
||||
|
||||
for (int i = 0; i < sbs->num_parts; ++i) {
|
||||
|
@ -668,15 +668,15 @@ static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts)
|
||||
vs_params.colorspace = csp;
|
||||
vs_params.levels_in = levels;
|
||||
struct mp_cmat vs_yuv2rgb, vs_rgb2yuv;
|
||||
mp_get_yuv2rgb_coeffs(&vs_params, &vs_yuv2rgb);
|
||||
mp_invert_yuv2rgb(&vs_rgb2yuv, &vs_yuv2rgb);
|
||||
mp_get_csp_matrix(&vs_params, &vs_yuv2rgb);
|
||||
mp_invert_cmat(&vs_rgb2yuv, &vs_yuv2rgb);
|
||||
|
||||
// Proper conversion to RGB
|
||||
struct mp_csp_params rgb_params = MP_CSP_PARAMS_DEFAULTS;
|
||||
rgb_params.colorspace = params.colorspace;
|
||||
rgb_params.levels_in = params.colorlevels;
|
||||
struct mp_cmat vs2rgb;
|
||||
mp_get_yuv2rgb_coeffs(&rgb_params, &vs2rgb);
|
||||
mp_get_csp_matrix(&rgb_params, &vs2rgb);
|
||||
|
||||
for (int n = 0; n < parts->num_parts; n++) {
|
||||
struct sub_bitmap *sb = &parts->parts[n];
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyleft (C) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
|
||||
*
|
||||
* mp_invert_yuv2rgb based on DarkPlaces engine, original code (GPL2 or later)
|
||||
* mp_invert_cmat based on DarkPlaces engine, original code (GPL2 or later)
|
||||
*
|
||||
* This file is part of mpv.
|
||||
*
|
||||
@ -573,7 +573,7 @@ double mp_get_csp_mul(enum mp_csp csp, int input_bits, int texture_bits)
|
||||
return (1LL << input_bits) / ((1LL << texture_bits) - 1.) * 255 / 256;
|
||||
}
|
||||
|
||||
/* Fill in the Y, U, V vectors of a yuv2rgb conversion matrix
|
||||
/* Fill in the Y, U, V vectors of a yuv-to-rgb conversion matrix
|
||||
* based on the given luma weights of the R, G and B components (lr, lg, lb).
|
||||
* lr+lg+lb is assumed to equal 1.
|
||||
* This function is meant for colorspaces satisfying the following
|
||||
@ -605,7 +605,7 @@ static void luma_coeffs(struct mp_cmat *mat, float lr, float lg, float lb)
|
||||
}
|
||||
|
||||
// get the coefficients of the yuv -> rgb conversion matrix
|
||||
void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, struct mp_cmat *m)
|
||||
void mp_get_csp_matrix(struct mp_csp_params *params, struct mp_cmat *m)
|
||||
{
|
||||
int colorspace = params->colorspace;
|
||||
if (colorspace <= MP_CSP_AUTO || colorspace >= MP_CSP_COUNT)
|
||||
@ -767,7 +767,7 @@ int mp_csp_equalizer_set(struct mp_csp_equalizer *eq, const char *property,
|
||||
return 1;
|
||||
}
|
||||
|
||||
void mp_invert_yuv2rgb(struct mp_cmat *out, struct mp_cmat *in)
|
||||
void mp_invert_cmat(struct mp_cmat *out, struct mp_cmat *in)
|
||||
{
|
||||
*out = *in;
|
||||
mp_invert_matrix3x3(out->m);
|
||||
|
@ -251,10 +251,10 @@ 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_yuv2rgb_coeffs(struct mp_csp_params *params, struct mp_cmat *yuv2rgb);
|
||||
void mp_get_csp_matrix(struct mp_csp_params *params, struct mp_cmat *out);
|
||||
|
||||
void mp_invert_matrix3x3(float m[3][3]);
|
||||
void mp_invert_yuv2rgb(struct mp_cmat *out, struct mp_cmat *in);
|
||||
void mp_invert_cmat(struct mp_cmat *out, struct mp_cmat *in);
|
||||
void mp_map_fixp_color(struct mp_cmat *matrix, int ibits, int in[3],
|
||||
int obits, int out[3]);
|
||||
|
||||
|
@ -1491,7 +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}}};
|
||||
mp_get_yuv2rgb_coeffs(&cparams, &m);
|
||||
mp_get_csp_matrix(&cparams, &m);
|
||||
gl_sc_uniform_mat3(sc, "colormatrix", true, &m.m[0][0]);
|
||||
gl_sc_uniform_vec3(sc, "colormatrix_c", m.c);
|
||||
|
||||
|
@ -1205,7 +1205,7 @@ static void update_colorspace(d3d_priv *priv)
|
||||
csp.texture_bits = (csp.input_bits + 7) & ~7;
|
||||
|
||||
struct mp_cmat coeff;
|
||||
mp_get_yuv2rgb_coeffs(&csp, &coeff);
|
||||
mp_get_csp_matrix(&csp, &coeff);
|
||||
for (int row = 0; row < 3; row++) {
|
||||
for (int col = 0; col < 3; col++)
|
||||
priv->d3d_colormatrix.m[row][col] = coeff.m[row][col];
|
||||
|
@ -201,7 +201,7 @@ static int create_vdp_mixer(struct mp_vdpau_mixer *mixer,
|
||||
struct mp_csp_params cparams = MP_CSP_PARAMS_DEFAULTS;
|
||||
mp_csp_set_image_params(&cparams, &mixer->image_params);
|
||||
mp_csp_copy_equalizer_values(&cparams, &mixer->video_eq);
|
||||
mp_get_yuv2rgb_coeffs(&cparams, &yuv2rgb);
|
||||
mp_get_csp_matrix(&cparams, &yuv2rgb);
|
||||
|
||||
for (int r = 0; r < 3; r++) {
|
||||
for (int c = 0; c < 3; c++)
|
||||
|
Loading…
Reference in New Issue
Block a user