From 5410a5b2c55b5c7d9889451c1d6e56c697325a2c Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 6 Jan 2015 15:21:26 +0100 Subject: csputils: move image_params -> csp_params into a function Although the line count increases, this is better for making sure everything is handled consistently for all users of the mp_csp_params stuff. This also makes sure mp_csp_params is always initialized with MP_CSP_PARAMS_DEFAULTS (for consistency). --- video/csputils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'video/csputils.c') diff --git a/video/csputils.c b/video/csputils.c index db206330bd..70edbfa6a3 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -35,6 +35,7 @@ #include #include +#include "mp_image.h" #include "csputils.h" const char *const mp_csp_names[MP_CSP_COUNT] = { @@ -682,6 +683,17 @@ void mp_gen_yuv2rgb_map(struct mp_csp_params *params, unsigned char *map, int si } } +// Set colorspace related fields in p from f. Don't touch other fields. +void mp_csp_set_image_params(struct mp_csp_params *params, + const struct mp_image_params *imgparams) +{ + struct mp_image_params p = *imgparams; + mp_image_params_guess_csp(&p); // ensure consistency + params->colorspace = p.colorspace; + params->levels_in = p.colorlevels; + params->levels_out = p.outputlevels; +} + // Copy settings from eq into params. void mp_csp_copy_equalizer_values(struct mp_csp_params *params, const struct mp_csp_equalizer *eq) -- cgit v1.2.3