[Spice-devel] [PATCH 1/4] LZ4: Limit LZ4 to RGB formats

Javier Celaya javier.celaya at flexvm.es
Mon Jan 26 08:53:47 PST 2015


Currently, the LZ4 encoding only (partially) supports RGB images, so
we must check the image format before using it. In the future, indexed
formats may be implemented too, but their use is usually very small
compared to RGB.
---
 server/red_worker.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server/red_worker.c b/server/red_worker.c
index a18987a..8f07ee9 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -6678,6 +6678,7 @@ static inline int red_compress_image(DisplayChannelClient *dcc,
         if (!glz) {
 #ifdef USE_LZ4
             if (image_compression == SPICE_IMAGE_COMPRESS_LZ4 &&
+                bitmap_fmt_is_rgb(src->format) &&
                 red_channel_client_test_remote_cap(&dcc->common.base,
                         SPICE_DISPLAY_CAP_LZ4_COMPRESSION)) {
                 ret = red_lz4_compress_image(dcc, dest, src, o_comp_data,
@@ -8918,6 +8919,7 @@ static void red_marshall_image(RedChannelClient *rcc, SpiceMarshaller *m, ImageI
         } else {
 #ifdef USE_LZ4
             if (comp_mode == SPICE_IMAGE_COMPRESS_LZ4 &&
+                bitmap_fmt_is_rgb(bitmap.format) &&
                 red_channel_client_test_remote_cap(&dcc->common.base,
                         SPICE_DISPLAY_CAP_LZ4_COMPRESSION)) {
                 comp_succeeded = red_lz4_compress_image(dcc, &red_image, &bitmap,
-- 
1.9.3



More information about the Spice-devel mailing list