[Spice-commits] 3 commits - server/glz-encode.tmpl.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 27 15:49:51 UTC 2018


 server/glz-encode.tmpl.c |   28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

New commits:
commit 90cd6432da2f94d268d63aa3ab466f7d8d312648
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Dec 25 18:11:50 2017 +0000

    glz: Inline GET_{r,g,b} macros
    
    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>

diff --git a/server/glz-encode.tmpl.c b/server/glz-encode.tmpl.c
index c9b39360..624bb374 100644
--- a/server/glz-encode.tmpl.c
+++ b/server/glz-encode.tmpl.c
@@ -100,9 +100,7 @@
 #define ENCODE_PIXEL(e, pix) {encode(e, (pix).b); encode(e, (pix).g); encode(e, (pix).r);}
 #define MIN_REF_ENCODE_SIZE 2
 #define MAX_REF_ENCODE_SIZE 2
-#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);    \
@@ -118,12 +116,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_per_byte) \
     (((pix_ptr) - ((PIXEL *)(seg_ptr)->lines)) * pix_per_byte + (seg_ptr)->pixels_so_far)
 
@@ -531,9 +523,6 @@ static void FNAME(compress)(Encoder *encoder)
 #undef ENCODE_PIXEL
 #undef SAME_PIXEL
 #undef HASH_FUNC
-#undef GET_r
-#undef GET_g
-#undef GET_b
 #undef GET_rgb
 #undef LZ_PLT
 #undef LZ_RGB_ALPHA
commit 9d2ec4d5c37191b50986605223af0cff5c6f90eb
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Dec 25 17:52:18 2017 +0000

    glz: Optimize SAME_PIXEL for RGB16
    
    Do not extract all components and compare one by one, can be easily
    compared together.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/glz-encode.tmpl.c b/server/glz-encode.tmpl.c
index 8e2dc03e..c9b39360 100644
--- a/server/glz-encode.tmpl.c
+++ b/server/glz-encode.tmpl.c
@@ -68,9 +68,8 @@
 #ifdef LZ_RGB16
 #define PIXEL rgb16_pixel_t
 #define FNAME(name) glz_rgb16_##name
-#define GET_r(pix) (((pix) >> 10) & 0x1f)
-#define GET_g(pix) (((pix) >> 5) & 0x1f)
-#define GET_b(pix) ((pix) & 0x1f)
+#define GET_rgb(pix) ((pix) & 0x7fffu)
+#define SAME_PIXEL(p1, p2) (GET_rgb(p1) == GET_rgb(p2))
 #define ENCODE_PIXEL(e, pix) {encode(e, (pix) >> 8); encode(e, (pix) & 0xff);}
 #define MIN_REF_ENCODE_SIZE 2
 #define MAX_REF_ENCODE_SIZE 3
@@ -119,7 +118,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))
 
@@ -535,6 +534,7 @@ static void FNAME(compress)(Encoder *encoder)
 #undef GET_r
 #undef GET_g
 #undef GET_b
+#undef GET_rgb
 #undef LZ_PLT
 #undef LZ_RGB_ALPHA
 #undef LZ_RGB16
commit aaef481691062e18758e52508efab559e5d0b427
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Dec 25 17:52:03 2017 +0000

    glz: Move some macros to a common place
    
    The macros for both depth are the same, reuse the definition.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/glz-encode.tmpl.c b/server/glz-encode.tmpl.c
index 4874a94a..8e2dc03e 100644
--- a/server/glz-encode.tmpl.c
+++ b/server/glz-encode.tmpl.c
@@ -89,21 +89,18 @@
 #ifdef LZ_RGB24
 #define PIXEL rgb24_pixel_t
 #define FNAME(name) glz_rgb24_##name
-#define ENCODE_PIXEL(e, pix) {encode(e, (pix).b); encode(e, (pix).g); encode(e, (pix).r);}
-#define MIN_REF_ENCODE_SIZE 2
-#define MAX_REF_ENCODE_SIZE 2
 #endif
 
 #ifdef LZ_RGB32
 #define PIXEL rgb32_pixel_t
 #define FNAME(name) glz_rgb32_##name
-#define ENCODE_PIXEL(e, pix) {encode(e, (pix).b); encode(e, (pix).g); encode(e, (pix).r);}
-#define MIN_REF_ENCODE_SIZE 2
-#define MAX_REF_ENCODE_SIZE 2
 #endif
 
 
 #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 MIN_REF_ENCODE_SIZE 2
+#define MAX_REF_ENCODE_SIZE 2
 #define GET_r(pix) ((pix).r)
 #define GET_g(pix) ((pix).g)
 #define GET_b(pix) ((pix).b)


More information about the Spice-commits mailing list