changeset 9131:67d28a3f918a

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 <jbj@knef.dk>
author arpi
date Tue, 28 Jan 2003 00:27:59 +0000
parents 8a0a93d6b4c3
children c945b963d7c6
files libmpcodecs/vf_bmovl.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_bmovl.c	Tue Jan 28 00:25:38 2003 +0000
+++ b/libmpcodecs/vf_bmovl.c	Tue Jan 28 00:27:59 2003 +0000
@@ -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))