mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-08 09:04:33 +00:00
LZ4: Send the original format with the compressed data
This commit is contained in:
parent
16412aa101
commit
10c78a0197
@ -50,7 +50,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;
|
||||
@ -61,10 +61,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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user