diff --git a/server/Makefile.am b/server/Makefile.am index 1e7e8fa6..3db81db0 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -71,7 +71,6 @@ libspice_server_la_SOURCES = \ demarshallers.h \ glz-encoder.c \ glz-encoder.h \ - glz_encoder_config.h \ glz-encoder-dict.c \ glz-encoder-dict.h \ glz-encoder-priv.h \ diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h index 8f61b524..4e9b66af 100644 --- a/server/dcc-encoders.h +++ b/server/dcc-encoders.h @@ -24,7 +24,6 @@ #include "red-channel.h" #include "red-parse-qxl.h" #include "image-cache.h" -#include "glz-encoder-dict.h" #include "glz-encoder.h" #include "jpeg-encoder.h" #ifdef USE_LZ4 diff --git a/server/glz-encoder-dict.c b/server/glz-encoder-dict.c index 1fd67530..af74736b 100644 --- a/server/glz-encoder-dict.c +++ b/server/glz-encoder-dict.c @@ -22,6 +22,7 @@ #include #include +#include "glz-encoder.h" #include "glz-encoder-dict.h" #include "glz-encoder-priv.h" diff --git a/server/glz-encoder-dict.h b/server/glz-encoder-dict.h index 960f165d..79b37812 100644 --- a/server/glz-encoder-dict.h +++ b/server/glz-encoder-dict.h @@ -19,7 +19,6 @@ #define GLZ_ENCODER_DICT_H_ #include -#include "glz_encoder_config.h" /* Interface for maintaining lz dictionary that is shared among several encoders. @@ -30,6 +29,9 @@ typedef void GlzEncDictContext; typedef void GlzEncDictImageContext; +typedef void GlzUsrImageContext; +typedef struct GlzEncoderUsrContext GlzEncoderUsrContext; + /* NOTE: DISPLAY_MIGRATE_DATA_VERSION should change in case GlzEncDictRestoreData changes*/ typedef struct GlzEncDictRestoreData { uint32_t size; diff --git a/server/glz-encoder-priv.h b/server/glz-encoder-priv.h index a4089668..3f225082 100644 --- a/server/glz-encoder-priv.h +++ b/server/glz-encoder-priv.h @@ -183,4 +183,16 @@ void glz_dictionary_post_encode(uint32_t encoder_id, GlzEncoderUsrContext *usr, (dict)->window.encoders_heads[enc_id]].pixels_so_far <= \ ref_seg->pixels_so_far))) +#ifdef DEBUG + +#define GLZ_ASSERT(usr, x) \ + if (!(x)) (usr)->error(usr, "%s: ASSERT %s failed\n", __FUNCTION__, #x); + +#else + +#define GLZ_ASSERT(usr, x) + +#endif + + #endif // GLZ_ENCODER_PRIV_H_ diff --git a/server/glz-encoder.h b/server/glz-encoder.h index 93164ed0..dc08830d 100644 --- a/server/glz-encoder.h +++ b/server/glz-encoder.h @@ -23,7 +23,25 @@ #include #include "common/lz_common.h" #include "glz-encoder-dict.h" -#include "glz_encoder_config.h" + +struct GlzEncoderUsrContext { + SPICE_GNUC_PRINTF(2, 3) void (*error)(GlzEncoderUsrContext *usr, const char *fmt, ...); + SPICE_GNUC_PRINTF(2, 3) void (*warn)(GlzEncoderUsrContext *usr, const char *fmt, ...); + SPICE_GNUC_PRINTF(2, 3) void (*info)(GlzEncoderUsrContext *usr, const char *fmt, ...); + void *(*malloc)(GlzEncoderUsrContext *usr, int size); + void (*free)(GlzEncoderUsrContext *usr, void *ptr); + + // get the next chunk of the image which is entered to the dictionary. If the image is down to + // top, return it from the last line to the first one (stride should always be positive) + int (*more_lines)(GlzEncoderUsrContext *usr, uint8_t **lines); + + // get the next chunk of the compressed buffer.return number of bytes in the chunk. + int (*more_space)(GlzEncoderUsrContext *usr, uint8_t **io_ptr); + + // called when an image is removed from the dictionary, due to the window size limit + void (*free_image)(GlzEncoderUsrContext *usr, GlzUsrImageContext *image); + +}; typedef void GlzEncoderContext; diff --git a/server/glz_encoder_config.h b/server/glz_encoder_config.h deleted file mode 100644 index 6472668d..00000000 --- a/server/glz_encoder_config.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2009 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . -*/ - -#ifndef _H_GLZ_ENCODER_CONFIG -#define _H_GLZ_ENCODER_CONFIG - -#include -#include "common/lz_common.h" - -typedef void GlzUsrImageContext; -typedef struct GlzEncoderUsrContext GlzEncoderUsrContext; - -struct GlzEncoderUsrContext { - SPICE_GNUC_PRINTF(2, 3) void (*error)(GlzEncoderUsrContext *usr, const char *fmt, ...); - SPICE_GNUC_PRINTF(2, 3) void (*warn)(GlzEncoderUsrContext *usr, const char *fmt, ...); - SPICE_GNUC_PRINTF(2, 3) void (*info)(GlzEncoderUsrContext *usr, const char *fmt, ...); - void *(*malloc)(GlzEncoderUsrContext *usr, int size); - void (*free)(GlzEncoderUsrContext *usr, void *ptr); - - // get the next chunk of the image which is entered to the dictionary. If the image is down to - // top, return it from the last line to the first one (stride should always be positive) - int (*more_lines)(GlzEncoderUsrContext *usr, uint8_t **lines); - - // get the next chunk of the compressed buffer.return number of bytes in the chunk. - int (*more_space)(GlzEncoderUsrContext *usr, uint8_t **io_ptr); - - // called when an image is removed from the dictionary, due to the window size limit - void (*free_image)(GlzEncoderUsrContext *usr, GlzUsrImageContext *image); - -}; - - -#ifdef DEBUG - -#define GLZ_ASSERT(usr, x) \ - if (!(x)) (usr)->error(usr, "%s: ASSERT %s failed\n", __FUNCTION__, #x); - -#else - -#define GLZ_ASSERT(usr, x) - -#endif - - -#endif