From 45ae0716be3319bac4585b8fedac529a0809a44c Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 9 Dec 2015 00:22:12 +0100 Subject: 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. --- demux/demux_disc.c | 2 +- sub/draw_bmp.c | 4 ++-- sub/sd_ass.c | 6 +++--- video/csputils.c | 8 ++++---- video/csputils.h | 4 ++-- video/out/opengl/video.c | 2 +- video/out/vo_direct3d.c | 2 +- video/vdpau_mixer.c | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/demux/demux_disc.c b/demux/demux_disc.c index dd2fd866a5..b994b3cf11 100644 --- a/demux/demux_disc.c +++ b/demux/demux_disc.c @@ -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: "); diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c index 0c12c7078a..da4760e105 100644 --- a/sub/draw_bmp.c +++ b/sub/draw_bmp.c @@ -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) { diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 092b260677..2948475e7a 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -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]; diff --git a/video/csputils.c b/video/csputils.c index ff5ae3870d..fb9d971517 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -3,7 +3,7 @@ * * Copyleft (C) 2009 Reimar Döffinger * - * 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); diff --git a/video/csputils.h b/video/csputils.h index 811f6bbef1..39346746c5 100644 --- a/video/csputils.h +++ b/video/csputils.h @@ -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]); diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index 7ac56cb414..8b7ec35478 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -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); diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c index 76c92ca339..f9a5cb092f 100644 --- a/video/out/vo_direct3d.c +++ b/video/out/vo_direct3d.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]; diff --git a/video/vdpau_mixer.c b/video/vdpau_mixer.c index d568285f92..7025aef459 100644 --- a/video/vdpau_mixer.c +++ b/video/vdpau_mixer.c @@ -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++) -- cgit v1.2.3