[Spice-devel] [PATCH 5/5] LZ4: Send the original format with the compressed data

Christophe Fergeau cfergeau at redhat.com
Mon Jan 26 08:35:09 PST 2015


ACK.

On Thu, Jan 22, 2015 at 05:21:08PM +0100, Javier Celaya wrote:
> ---
>  server/lz4_encoder.c | 9 +++++----
>  server/lz4_encoder.h | 2 +-
>  server/red_worker.c  | 2 +-
>  3 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/server/lz4_encoder.c b/server/lz4_encoder.c
> index 4f0f3c8..f1db69f 100644
> --- a/server/lz4_encoder.c
> +++ b/server/lz4_encoder.c
> @@ -59,7 +59,7 @@ void lz4_encoder_destroy(Lz4EncoderContext* encoder)
>  }
>  
>  int lz4_encode(Lz4EncoderContext *lz4, int height, int stride, uint8_t *io_ptr,
> -               unsigned int num_io_bytes, int top_down)
> +               unsigned int num_io_bytes, int top_down, uint8_t format)
>  {
>      Lz4Encoder *enc = (Lz4Encoder *)lz4;
>      uint8_t *lines;
> @@ -70,10 +70,11 @@ int lz4_encode(Lz4EncoderContext *lz4, int height, int stride, uint8_t *io_ptr,
>      uint8_t *out_buf = io_ptr;
>      LZ4_stream_t *stream = LZ4_createStream();
>  
> -    // Encode direction
> +    // Encode direction and format
>      *(out_buf++) = top_down ? 1 : 0;
> -    num_io_bytes--;
> -    out_size = 1;
> +    *(out_buf++) = format;
> +    num_io_bytes -= 2;
> +    out_size = 2;
>  
>      do {
>          num_lines = enc->usr->more_lines(enc->usr, &lines);
> diff --git a/server/lz4_encoder.h b/server/lz4_encoder.h
> index 97b8dc8..f1de12a 100644
> --- a/server/lz4_encoder.h
> +++ b/server/lz4_encoder.h
> @@ -45,5 +45,5 @@ void lz4_encoder_destroy(Lz4EncoderContext *encoder);
>  
>  /* returns the total size of the encoded data. */
>  int lz4_encode(Lz4EncoderContext *lz4, int height, int stride, uint8_t *io_ptr,
> -               unsigned int num_io_bytes, int top_down);
> +               unsigned int num_io_bytes, int top_down, uint8_t format);
>  #endif
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 922a459..58cc827 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -6459,7 +6459,7 @@ static int red_lz4_compress_image(DisplayChannelClient *dcc, SpiceImage *dest,
>  
>      lz4_size = lz4_encode(lz4, src->y, src->stride, (uint8_t*)lz4_data->data.bufs_head->buf,
>                            sizeof(lz4_data->data.bufs_head->buf),
> -                          src->flags & SPICE_BITMAP_FLAGS_TOP_DOWN);
> +                          src->flags & SPICE_BITMAP_FLAGS_TOP_DOWN, src->format);
>  
>      // the compressed buffer is bigger than the original data
>      if (lz4_size > (src->y * src->stride)) {
> -- 
> 1.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150126/88d5bd48/attachment.sig>


More information about the Spice-devel mailing list