summaryrefslogtreecommitdiffstats
path: root/common/lz.c
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2010-06-20 17:18:56 +0300
committerAlexander Larsson <alexl@redhat.com>2010-06-21 15:18:26 +0200
commit537280f183d3a35e8dee8a20238c71e7440cb28c (patch)
treefdec86a392b8cde474b8e1b5c85f03bb6caf441e /common/lz.c
parent25bb38f643af6f0015df369a22176275b6ebfae0 (diff)
downloadspice-537280f183d3a35e8dee8a20238c71e7440cb28c.tar.gz
spice-537280f183d3a35e8dee8a20238c71e7440cb28c.tar.xz
spice-537280f183d3a35e8dee8a20238c71e7440cb28c.zip
Lossy compression of RGBA images (on WAN connection)
The RGB channels are compressed using JPEG. The alpha channel is compressed using LZ.
Diffstat (limited to 'common/lz.c')
-rw-r--r--common/lz.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/lz.c b/common/lz.c
index 73a797c7..e5635849 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -565,6 +565,9 @@ int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_do
lz_rgb32_compress(encoder);
lz_rgb_alpha_compress(encoder);
break;
+ case LZ_IMAGE_TYPE_XXXA:
+ lz_rgb_alpha_compress(encoder);
+ break;
case LZ_IMAGE_TYPE_INVALID:
default:
encoder->usr->error(encoder->usr, "bad image type\n");
@@ -661,6 +664,7 @@ void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf)
case LZ_IMAGE_TYPE_RGB24:
case LZ_IMAGE_TYPE_RGB32:
case LZ_IMAGE_TYPE_RGBA:
+ case LZ_IMAGE_TYPE_XXXA:
case LZ_IMAGE_TYPE_INVALID:
default:
encoder->usr->error(encoder->usr, "bad image type\n");
@@ -705,6 +709,14 @@ void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf)
encoder->usr->error(encoder->usr, "unsupported output format\n");
}
break;
+ case LZ_IMAGE_TYPE_XXXA:
+ if (encoder->type == to_type) {
+ alpha_size = lz_rgb_alpha_decompress(encoder, (rgb32_pixel_t *)buf, size);
+ out_size = alpha_size;
+ } else {
+ encoder->usr->error(encoder->usr, "unsupported output format\n");
+ }
+ break;
case LZ_IMAGE_TYPE_PLT1_LE:
case LZ_IMAGE_TYPE_PLT1_BE:
case LZ_IMAGE_TYPE_PLT4_LE: