From 7d11e17fb3301d375b78fe635676add63ad19164 Mon Sep 17 00:00:00 2001 From: arpi Date: Tue, 28 Jan 2003 00:27:59 +0000 Subject: The code for converting RGB to YUV in bmovl is slow because it uses floating point arithmetic. The attached patch changes it to use integers instead, giving about a 2x performance boost on animations. Jonas Jensen git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9132 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_bmovl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libmpcodecs/vf_bmovl.c') diff --git a/libmpcodecs/vf_bmovl.c b/libmpcodecs/vf_bmovl.c index 5d3a93e177..5cba56d6f0 100644 --- a/libmpcodecs/vf_bmovl.c +++ b/libmpcodecs/vf_bmovl.c @@ -90,9 +90,9 @@ #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define INRANGE(a,b,c) ( ((a) < (b)) ? (b) : ( ((a) > (c)) ? (c) : (a) ) ) -#define rgb2y(R,G,B) ( (0.257 * R) + (0.504 * G) + (0.098 * B) + 16 ) -#define rgb2u(R,G,B) ( -(0.148 * R) - (0.291 * G) + (0.439 * B) + 128 ) -#define rgb2v(R,G,B) ( (0.439 * R) - (0.368 * G) - (0.071 * B) + 128 ) +#define rgb2y(R,G,B) ( (( 263*R + 516*G + 100*B) >> 10) + 16 ) +#define rgb2u(R,G,B) ( ((-152*R - 298*G + 450*B) >> 10) + 128 ) +#define rgb2v(R,G,B) ( (( 450*R - 376*G - 73*B) >> 10) + 128 ) #define DBG(a) (mp_msg(MSGT_VFILTER, MSGL_DBG2, "DEBUG: %d\n", a)) -- cgit v1.2.3