diff options
author | wm4 <wm4@nowhere> | 2012-10-25 19:37:47 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-10-28 15:31:32 +0100 |
commit | 65b313a8b0b1a97f7d51f1fec4517adaa9334aa3 (patch) | |
tree | cd2bdff738502c6603675b44ee7ac7322a1aa99d /libvo | |
parent | 18d4eebedb7f80493da87f8506ff0b2db796510a (diff) | |
download | mpv-65b313a8b0b1a97f7d51f1fec4517adaa9334aa3.tar.bz2 mpv-65b313a8b0b1a97f7d51f1fec4517adaa9334aa3.tar.xz |
draw_bmp, csputils: use function instead of macro
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/csputils.c | 7 | ||||
-rw-r--r-- | libvo/csputils.h | 11 |
2 files changed, 5 insertions, 13 deletions
diff --git a/libvo/csputils.c b/libvo/csputils.c index b0255a00dc..5ddea3ae55 100644 --- a/libvo/csputils.c +++ b/libvo/csputils.c @@ -364,14 +364,15 @@ void mp_invert_yuv2rgb(float out[3][4], float in[3][4]) // Multiply the color in c with the given matrix. // c is {R, G, B} or {Y, U, V} (depending on input/output and matrix). -void mp_map_color(float matrix[3][4], uint8_t c[3]) +// Each component is an unsigned number with the given count of bits. +void mp_map_color(float matrix[3][4], int bits, int c[3]) { uint8_t in[3] = {c[0], c[1], c[2]}; for (int i = 0; i < 3; i++) { double val = matrix[i][3] * 255; for (int x = 0; x < 3; x++) val += matrix[i][x] * in[x]; - int ival = lrint(val); - c[i] = FFMIN(FFMAX(ival, 0), 255); + int ival = lrint(val * (1 << (bits - 8))); + c[i] = av_clip(ival, 0, (1 << bits) - 1); } } diff --git a/libvo/csputils.h b/libvo/csputils.h index e4fb32e156..1d9ebdc62e 100644 --- a/libvo/csputils.h +++ b/libvo/csputils.h @@ -139,16 +139,7 @@ void mp_gen_gamma_map(unsigned char *map, int size, float gamma); void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]); void mp_gen_yuv2rgb_map(struct mp_csp_params *params, uint8_t *map, int size); -#define MP_MAP_YUV2RGB_COLOR(m, y, u, v, scale, c) ((m)[c][0] * (y) + \ - (m)[c][1] * (u) + \ - (m)[c][2] * (v) + \ - (m)[c][3] * (scale)) -#define MP_MAP_RGB2YUV_COLOR(minv, r, g, b, scale, c) ((minv)[c][0] * (r) + \ - (minv)[c][1] * (g) + \ - (minv)[c][2] * (b) + \ - (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]); +void mp_map_color(float matrix[3][4], int bits, int c[3]); #endif /* MPLAYER_CSPUTILS_H */ |