Re: [PATCH spice-common v2 1/2] lz: Optimise SAME_PIXEL for RGB16

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

 



Looks good to me, though 16bpp images are probably not used a lot these
days ;)

Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

Christophe

On Thu, May 24, 2018 at 05:15:28PM +0100, Frediano Ziglio wrote:
> Do not extract all components and compare one by one, can be easily
> compared together.
> Performance measurements on a set of 16 bit images shown an improve of
> about 10%.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  common/lz_compress_tmpl.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> Changes since v1:
> - put some comment on performance improves;
> - use less hackish macros;
> - undefine new macro at the end of template file.
> 
> diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
> index 69e69a6..5c90311 100644
> --- a/common/lz_compress_tmpl.c
> +++ b/common/lz_compress_tmpl.c
> @@ -105,9 +105,8 @@
>  #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 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 HASH_FUNC(v, p) {                 \
> @@ -153,7 +152,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))
>  
> @@ -525,6 +524,7 @@ static void FNAME(compress)(Encoder *encoder)
>  #undef GET_r
>  #undef GET_g
>  #undef GET_b
> +#undef GET_rgb
>  #undef GET_CODE
>  #undef LZ_PLT
>  #undef LZ_RGB_ALPHA
> -- 
> 2.17.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
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]