summaryrefslogtreecommitdiffstats
path: root/sub/sd_ass.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-09 00:08:00 +0100
committerwm4 <wm4@nowhere>2015-12-09 00:08:00 +0100
commitc2d0d7818f1045fbee5f296d614a11d25784215f (patch)
tree68e94cac3a422d1d20ea0c464f22ea965c9166c0 /sub/sd_ass.c
parent0d7d935e8863ae759f284739769f250b1302a9ec (diff)
downloadmpv-c2d0d7818f1045fbee5f296d614a11d25784215f.tar.bz2
mpv-c2d0d7818f1045fbee5f296d614a11d25784215f.tar.xz
csputils: remove obscure int_bits matrix scaling
This has no reason to be there. Put the functionality into another function instead. While we're at it, also adjust for possible accuracy issues with high bit depth YUV (matters for rendering subtitles into screenshots only).
Diffstat (limited to 'sub/sd_ass.c')
-rw-r--r--sub/sd_ass.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 9e4da9a379..092b260677 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -667,8 +667,6 @@ static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts)
struct mp_csp_params vs_params = MP_CSP_PARAMS_DEFAULTS;
vs_params.colorspace = csp;
vs_params.levels_in = levels;
- vs_params.int_bits_in = 8;
- vs_params.int_bits_out = 8;
struct mp_cmat vs_yuv2rgb, vs_rgb2yuv;
mp_get_yuv2rgb_coeffs(&vs_params, &vs_yuv2rgb);
mp_invert_yuv2rgb(&vs_rgb2yuv, &vs_yuv2rgb);
@@ -677,8 +675,6 @@ static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts)
struct mp_csp_params rgb_params = MP_CSP_PARAMS_DEFAULTS;
rgb_params.colorspace = params.colorspace;
rgb_params.levels_in = params.colorlevels;
- rgb_params.int_bits_in = 8;
- rgb_params.int_bits_out = 8;
struct mp_cmat vs2rgb;
mp_get_yuv2rgb_coeffs(&rgb_params, &vs2rgb);
@@ -689,9 +685,9 @@ static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts)
int g = (color >> 16u) & 0xff;
int b = (color >> 8u) & 0xff;
int a = 0xff - (color & 0xff);
- int c[3] = {r, g, b};
- mp_map_int_color(&vs_rgb2yuv, 8, c);
- mp_map_int_color(&vs2rgb, 8, c);
- sb->libass.color = MP_ASS_RGBA(c[0], c[1], c[2], a);
+ int rgb[3] = {r, g, b}, yuv[3];
+ mp_map_fixp_color(&vs_rgb2yuv, 8, rgb, 8, yuv);
+ mp_map_fixp_color(&vs2rgb, 8, yuv, 8, rgb);
+ sb->libass.color = MP_ASS_RGBA(rgb[0], rgb[1], rgb[2], a);
}
}