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

Frediano Ziglio fziglio at redhat.com
Thu May 24 16:15:29 UTC 2018


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

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

Changes since v1:
- rebased.

diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
index 5c90311..4f4f6c6 100644
--- a/common/lz_compress_tmpl.c
+++ b/common/lz_compress_tmpl.c
@@ -134,9 +134,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);    \
@@ -152,12 +150,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
@@ -521,9 +513,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_rgb
 #undef GET_CODE
 #undef LZ_PLT
-- 
2.17.0



More information about the Spice-devel mailing list