[Spice-devel] [PATCH spice-common 3/3] lz: Inline GET_{r, g, b} macros

Frediano Ziglio fziglio at redhat.com
Wed May 9 13:10:39 UTC 2018


With last changes are just used once and are straight forward.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 common/lz_compress_tmpl.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
index b778e9d..6334020 100644
--- a/common/lz_compress_tmpl.c
+++ b/common/lz_compress_tmpl.c
@@ -133,9 +133,7 @@
 
 #if  defined(LZ_RGB24) || defined(LZ_RGB32)
 #define ENCODE_PIXEL(e, pix) {encode(e, (pix).b); encode(e, (pix).g); encode(e, (pix).r);}
-#define GET_r(pix) ((pix).r)
-#define GET_g(pix) ((pix).g)
-#define GET_b(pix) ((pix).b)
+#define SAME_PIXEL(p1, p2) ((p1).r == (p2).r && (p1).g == (p2).g && (p1).b == (p2).b)
 #define HASH_FUNC(v, p) {    \
     v = DJB2_START;          \
     DJB2_HASH(v, p[0].r);    \
@@ -151,12 +149,6 @@
     }
 #endif
 
-#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))
-
-#endif
-
 #define PIXEL_ID(pix_ptr, seg_ptr) (pix_ptr - ((PIXEL *)seg_ptr->lines) + seg_ptr->size_delta)
 
 // when encoding, the ref can be in previous segment, and we should check that it doesn't
@@ -520,9 +512,6 @@ static void FNAME(compress)(Encoder *encoder)
 #undef HASH_FUNC
 #undef BYTES_TO_16
 #undef HASH_FUNC_16
-#undef GET_r
-#undef GET_g
-#undef GET_b
 #undef GET_CODE
 #undef LZ_PLT
 #undef LZ_RGB_ALPHA
-- 
2.17.0



More information about the Spice-devel mailing list