summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-25 21:23:18 +0200
committerwm4 <wm4@nowhere>2012-10-28 15:31:32 +0100
commitd072e857d71150508f308168953753b6c7441009 (patch)
treee0c2263b183cedce7a7e2532122c4025f012963c /sub
parent65b313a8b0b1a97f7d51f1fec4517adaa9334aa3 (diff)
downloadmpv-d072e857d71150508f308168953753b6c7441009.tar.bz2
mpv-d072e857d71150508f308168953753b6c7441009.tar.xz
csputils: better support for integer color values
Diffstat (limited to 'sub')
-rw-r--r--sub/draw_bmp.c4
-rw-r--r--sub/spudec.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c
index 4740bec6c1..5f68e17f1d 100644
--- a/sub/draw_bmp.c
+++ b/sub/draw_bmp.c
@@ -283,6 +283,8 @@ static void draw_ass(struct mp_draw_sub_cache **cache, struct mp_rect bb,
{
struct mp_csp_params cspar = MP_CSP_PARAMS_DEFAULTS;
cspar.colorspace = *csp;
+ cspar.int_bits_in = bits;
+ cspar.int_bits_out = 8;
float yuv2rgb[3][4], rgb2yuv[3][4];
mp_get_yuv2rgb_coeffs(&cspar, yuv2rgb);
@@ -301,7 +303,7 @@ static void draw_ass(struct mp_draw_sub_cache **cache, struct mp_rect bb,
int b = (sb->libass.color >> 8) & 0xFF;
int a = 255 - (sb->libass.color & 0xFF);
int color_yuv[3] = {r, g, b};
- mp_map_color(rgb2yuv, bits, color_yuv);
+ mp_map_int_color(rgb2yuv, bits, color_yuv);
int bytes = (bits + 7) / 8;
uint8_t *alpha_p = (uint8_t *)sb->bitmap + src_y * sb->stride + src_x;
diff --git a/sub/spudec.c b/sub/spudec.c
index 3f9e5d701a..2dd030f54a 100644
--- a/sub/spudec.c
+++ b/sub/spudec.c
@@ -188,6 +188,8 @@ static void setup_palette(spudec_handle_t *spu, uint32_t palette[256])
{
memset(palette, 0, sizeof(palette));
struct mp_csp_params csp = MP_CSP_PARAMS_DEFAULTS;
+ csp.int_bits_in = 8;
+ csp.int_bits_out = 8;
float cmatrix[3][4];
mp_get_yuv2rgb_coeffs(&csp, cmatrix);
for (int i = 0; i < 4; ++i) {
@@ -199,7 +201,7 @@ static void setup_palette(spudec_handle_t *spu, uint32_t palette[256])
int color = spu->custom ? spu->cuspal[i] :
spu->global_palette[spu->palette[i]];
int c[3] = {(color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff};
- mp_map_color(cmatrix, 8, c);
+ mp_map_int_color(cmatrix, 8, c);
// R and G swapped, possibly due to vobsub_palette_to_yuv()
palette[i] = (alpha << 24u) | (c[2] << 16) | (c[1] << 8) | c[0];
}