From f6197249a783f00ae583e67d113ed737d677f12c Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 8 Oct 2012 00:14:51 +0200 Subject: spudec: use csputils for color conversion Just to get rid of that conversion copy&pasted from the internet. R and G are swapped for unknown reasons. Testing various subtitles seem to yield the same results as VLC. The sub-bitmap renderers output the correct colors. The colorspace conversion is used without problems for vo_gl, vo_gl3 and vo_vdpau. The problem is most likely that apparently, the DVD palette read from the subtitle track extradata is converted to YUV using vobsub_palette_to_yuv(), and swapped in the process. Or in other words, the YUV colors spu->global_palette are encoded with R and G swapped. Add some utility definition to csputils.c/h to make converting single color values easier. --- libvo/csputils.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libvo/csputils.h') diff --git a/libvo/csputils.h b/libvo/csputils.h index 0dd75b0549..e4fb32e156 100644 --- a/libvo/csputils.h +++ b/libvo/csputils.h @@ -73,6 +73,12 @@ struct mp_csp_params { int input_bits; }; +#define MP_CSP_PARAMS_DEFAULTS { \ + .colorspace = MP_CSP_DETAILS_DEFAULTS, \ + .brightness = 0, .contrast = 1, .hue = 0, .saturation = 1, \ + .rgamma = 1, .ggamma = 1, .bgamma = 1, \ + .texture_bits = 8, .input_bits = 8} + enum mp_csp_equalizer_param { MP_CSP_EQ_BRIGHTNESS, MP_CSP_EQ_CONTRAST, @@ -143,4 +149,6 @@ void mp_gen_yuv2rgb_map(struct mp_csp_params *params, uint8_t *map, int size); (minv)[c][3] * (scale)) void mp_invert_yuv2rgb(float out[3][4], float in[3][4]); +void mp_map_color(float matrix[3][4], uint8_t c[3]); + #endif /* MPLAYER_CSPUTILS_H */ -- cgit v1.2.3