[PATCH spice-common 2/3] lz: Optimise SAME_PIXEL for RGB16

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Do not extract all components and compare one by one, can be easily
compared together.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 common/lz_compress_tmpl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
index 69e69a6..b778e9d 100644
--- a/common/lz_compress_tmpl.c
+++ b/common/lz_compress_tmpl.c
@@ -105,9 +105,7 @@
 #ifdef LZ_RGB16
 #define PIXEL rgb16_pixel_t
 #define FNAME(name) lz_rgb16_##name
-#define GET_r(pix) (((pix) >> 10) & 0x1f)
-#define GET_g(pix) (((pix) >> 5) & 0x1f)
-#define GET_b(pix) ((pix) & 0x1f)
+#define SAME_PIXEL(p1, p2) ((((p1)^(p2)) & 0x7fffu) == 0)
 #define ENCODE_PIXEL(e, pix) {encode(e, (pix) >> 8); encode(e, (pix) & 0xff);}
 
 #define HASH_FUNC(v, p) {                 \
@@ -153,7 +151,7 @@
     }
 #endif
 
-#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32)
+#if defined(LZ_RGB24) || defined(LZ_RGB32)
 #define SAME_PIXEL(p1, p2) (GET_r(p1) == GET_r(p2) && GET_g(p1) == GET_g(p2) && \
                             GET_b(p1) == GET_b(p2))
 
-- 
2.17.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]