mirror of https://github.com/mpv-player/mpv
csputils: get rid of mp_csp_details
It used to be central, but now it's just unneeded.
This commit is contained in:
parent
02362f938f
commit
a52ca8a2b0
|
@ -289,9 +289,9 @@ static void draw_ass(struct mp_draw_sub_cache *cache, struct mp_rect bb,
|
|||
struct mp_image *temp, int bits, struct sub_bitmaps *sbs)
|
||||
{
|
||||
struct mp_csp_params cspar = MP_CSP_PARAMS_DEFAULTS;
|
||||
cspar.colorspace.format = temp->params.colorspace;
|
||||
cspar.colorspace.levels_in = temp->params.colorlevels;
|
||||
cspar.colorspace.levels_out = MP_CSP_LEVELS_PC; // RGB (libass.color)
|
||||
cspar.colorspace = temp->params.colorspace;
|
||||
cspar.levels_in = temp->params.colorlevels;
|
||||
cspar.levels_out = MP_CSP_LEVELS_PC; // RGB (libass.color)
|
||||
cspar.int_bits_in = bits;
|
||||
cspar.int_bits_out = 8;
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
struct mp_image;
|
||||
struct sub_bitmaps;
|
||||
struct mp_csp_details;
|
||||
struct mp_draw_sub_cache;
|
||||
void mp_draw_sub_bitmaps(struct mp_draw_sub_cache **cache, struct mp_image *dst,
|
||||
struct sub_bitmaps *sbs);
|
||||
|
|
|
@ -396,8 +396,8 @@ static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts)
|
|||
|
||||
// Conversion that VSFilter would use
|
||||
struct mp_csp_params vs_params = MP_CSP_PARAMS_DEFAULTS;
|
||||
vs_params.colorspace.format = csp;
|
||||
vs_params.colorspace.levels_in = levels;
|
||||
vs_params.colorspace = csp;
|
||||
vs_params.levels_in = levels;
|
||||
vs_params.int_bits_in = 8;
|
||||
vs_params.int_bits_out = 8;
|
||||
float vs_yuv2rgb[3][4], vs_rgb2yuv[3][4];
|
||||
|
@ -406,8 +406,8 @@ static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts)
|
|||
|
||||
// Proper conversion to RGB
|
||||
struct mp_csp_params rgb_params = MP_CSP_PARAMS_DEFAULTS;
|
||||
rgb_params.colorspace.format = params.colorspace;
|
||||
rgb_params.colorspace.levels_in = params.colorlevels;
|
||||
rgb_params.colorspace = params.colorspace;
|
||||
rgb_params.levels_in = params.colorlevels;
|
||||
rgb_params.int_bits_in = 8;
|
||||
rgb_params.int_bits_out = 8;
|
||||
float vs2rgb[3][4];
|
||||
|
|
|
@ -525,14 +525,14 @@ static void luma_coeffs(float m[3][4], 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, float m[3][4])
|
||||
{
|
||||
int format = params->colorspace.format;
|
||||
if (format <= MP_CSP_AUTO || format >= MP_CSP_COUNT)
|
||||
format = MP_CSP_BT_601;
|
||||
int levels_in = params->colorspace.levels_in;
|
||||
int colorspace = params->colorspace;
|
||||
if (colorspace <= MP_CSP_AUTO || colorspace >= MP_CSP_COUNT)
|
||||
colorspace = MP_CSP_BT_601;
|
||||
int levels_in = params->levels_in;
|
||||
if (levels_in <= MP_CSP_LEVELS_AUTO || levels_in >= MP_CSP_LEVELS_COUNT)
|
||||
levels_in = MP_CSP_LEVELS_TV;
|
||||
|
||||
switch (format) {
|
||||
switch (colorspace) {
|
||||
case MP_CSP_BT_601: luma_coeffs(m, 0.299, 0.587, 0.114 ); break;
|
||||
case MP_CSP_BT_709: luma_coeffs(m, 0.2126, 0.7152, 0.0722); break;
|
||||
case MP_CSP_SMPTE_240M: luma_coeffs(m, 0.2122, 0.7013, 0.0865); break;
|
||||
|
@ -601,7 +601,7 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float m[3][4])
|
|||
abort();
|
||||
}
|
||||
|
||||
int levels_out = params->colorspace.levels_out;
|
||||
int levels_out = params->levels_out;
|
||||
if (levels_out <= MP_CSP_LEVELS_AUTO || levels_out >= MP_CSP_LEVELS_COUNT)
|
||||
levels_out = MP_CSP_LEVELS_PC;
|
||||
struct rgblevels { double min, max; }
|
||||
|
|
|
@ -106,17 +106,10 @@ extern const char *const mp_stereo3d_names[MP_STEREO3D_COUNT];
|
|||
#define MP_STEREO3D_NAME_DEF(x, def) \
|
||||
(MP_STEREO3D_NAME(x) ? MP_STEREO3D_NAME(x) : (def))
|
||||
|
||||
struct mp_csp_details {
|
||||
enum mp_csp format;
|
||||
struct mp_csp_params {
|
||||
enum mp_csp colorspace;
|
||||
enum mp_csp_levels levels_in; // encoded video
|
||||
enum mp_csp_levels levels_out; // output device
|
||||
};
|
||||
|
||||
// initializer for struct mp_csp_details that contains reasonable defaults
|
||||
#define MP_CSP_DETAILS_DEFAULTS {MP_CSP_BT_601, MP_CSP_LEVELS_TV, MP_CSP_LEVELS_PC}
|
||||
|
||||
struct mp_csp_params {
|
||||
struct mp_csp_details colorspace;
|
||||
float brightness;
|
||||
float contrast;
|
||||
float hue;
|
||||
|
@ -133,7 +126,9 @@ struct mp_csp_params {
|
|||
};
|
||||
|
||||
#define MP_CSP_PARAMS_DEFAULTS { \
|
||||
.colorspace = MP_CSP_DETAILS_DEFAULTS, \
|
||||
.colorspace = MP_CSP_BT_601, \
|
||||
.levels_in = MP_CSP_LEVELS_TV, \
|
||||
.levels_out = MP_CSP_LEVELS_PC, \
|
||||
.brightness = 0, .contrast = 1, .hue = 0, .saturation = 1, \
|
||||
.rgamma = 1, .ggamma = 1, .bgamma = 1, \
|
||||
.texture_bits = 8, .input_bits = 8}
|
||||
|
|
|
@ -638,19 +638,16 @@ static void update_uniforms(struct gl_video *p, GLuint program)
|
|||
|
||||
gl->UseProgram(program);
|
||||
|
||||
struct mp_csp_details csp = MP_CSP_DETAILS_DEFAULTS;
|
||||
csp.levels_in = p->image_params.colorlevels;
|
||||
csp.levels_out = p->image_params.outputlevels;
|
||||
csp.format = p->image_params.colorspace;
|
||||
|
||||
struct mp_csp_params cparams = {
|
||||
.colorspace = csp,
|
||||
.colorspace = p->image_params.colorspace,
|
||||
.levels_in = p->image_params.colorlevels,
|
||||
.levels_out = p->image_params.outputlevels,
|
||||
.input_bits = p->plane_bits,
|
||||
.texture_bits = (p->plane_bits + 7) & ~7,
|
||||
};
|
||||
mp_csp_copy_equalizer_values(&cparams, &p->video_eq);
|
||||
if (p->image_desc.flags & MP_IMGFLAG_XYZ) {
|
||||
cparams.colorspace.format = MP_CSP_XYZ;
|
||||
cparams.colorspace = MP_CSP_XYZ;
|
||||
cparams.input_bits = 8;
|
||||
cparams.texture_bits = 8;
|
||||
}
|
||||
|
|
|
@ -1152,9 +1152,9 @@ static void update_colorspace(d3d_priv *priv)
|
|||
{
|
||||
float coeff[3][4];
|
||||
struct mp_csp_params csp = MP_CSP_PARAMS_DEFAULTS;
|
||||
csp.colorspace.format = priv->params.colorspace;
|
||||
csp.colorspace.levels_in = priv->params.colorlevels;
|
||||
csp.colorspace.levels_out = priv->params.outputlevels;
|
||||
csp.colorspace = priv->params.colorspace;
|
||||
csp.levels_in = priv->params.colorlevels;
|
||||
csp.levels_out = priv->params.outputlevels;
|
||||
mp_csp_copy_equalizer_values(&csp, &priv->video_eq);
|
||||
|
||||
if (priv->use_shaders) {
|
||||
|
|
|
@ -1346,10 +1346,11 @@ static void update_yuvconv(struct vo *vo)
|
|||
if (!vo->params)
|
||||
return;
|
||||
|
||||
struct mp_csp_params cparams = { .colorspace = MP_CSP_DETAILS_DEFAULTS };
|
||||
cparams.colorspace.format = vo->params->colorspace;
|
||||
cparams.colorspace.levels_in = vo->params->colorlevels;
|
||||
cparams.colorspace.levels_out = vo->params->outputlevels;
|
||||
struct mp_csp_params cparams = {
|
||||
.colorspace = vo->params->colorspace,
|
||||
.levels_in = vo->params->colorlevels,
|
||||
.levels_out = vo->params->outputlevels,
|
||||
};
|
||||
mp_csp_copy_equalizer_values(&cparams, &p->video_eq);
|
||||
gl_conversion_params_t params = {
|
||||
p->target, p->yuvconvtype, cparams,
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "mp_image.h"
|
||||
|
||||
struct mp_image;
|
||||
struct mp_csp_details;
|
||||
struct sws_opts;
|
||||
|
||||
// libswscale currently requires 16 bytes alignment for row pointers and
|
||||
|
|
|
@ -197,9 +197,9 @@ static int create_vdp_mixer(struct mp_vdpau_mixer *mixer)
|
|||
VdpCSCMatrix matrix;
|
||||
|
||||
struct mp_csp_params cparams = MP_CSP_PARAMS_DEFAULTS;
|
||||
cparams.colorspace.format = mixer->image_params.colorspace;
|
||||
cparams.colorspace.levels_in = mixer->image_params.colorlevels;
|
||||
cparams.colorspace.levels_out = mixer->image_params.outputlevels;
|
||||
cparams.colorspace = mixer->image_params.colorspace;
|
||||
cparams.levels_in = mixer->image_params.colorlevels;
|
||||
cparams.levels_out = mixer->image_params.outputlevels;
|
||||
mp_csp_copy_equalizer_values(&cparams, &mixer->video_eq);
|
||||
mp_get_yuv2rgb_coeffs(&cparams, matrix);
|
||||
|
||||
|
|
Loading…
Reference in New Issue