diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2017-08-03 16:24:30 +0200 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2018-05-24 11:01:28 +0100 |
commit | fce119be44a5a155c76429b319080c4b8274429b (patch) | |
tree | 054b2de8b2740d4a698e270f3a9e6377dec3b11a | |
parent | 7b2c2e620ee1372b96c23852ad7eee56d454ca47 (diff) |
quic: Get rid of RLE_STAT #define
It's always set, no need to have conditional compilation based on it.
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r-- | common/quic.c | 53 | ||||
-rw-r--r-- | common/quic_tmpl.c | 12 |
2 files changed, 2 insertions, 63 deletions
diff --git a/common/quic.c b/common/quic.c index 38bd822..189f2e1 100644 --- a/common/quic.c +++ b/common/quic.c @@ -30,7 +30,6 @@ #include "bitops.h" #define RLE -#define RLE_STAT /* ASCII "QUIC" */ #define QUIC_MAGIC 0x43495551 @@ -104,7 +103,6 @@ typedef struct CommonState { unsigned int wmidx; unsigned int wmileft; -#ifdef RLE_STAT int melcstate; /* index to the state array */ int melclen; /* contents of the state array location @@ -115,7 +113,6 @@ typedef struct CommonState { of melclen bits */ unsigned long melcorder; /* 2^ melclen */ -#endif } CommonState; @@ -493,8 +490,6 @@ static inline void decode_eat32bits(Encoder *encoder) #ifdef RLE -#ifdef RLE_STAT - static inline void encode_ones(Encoder *encoder, unsigned int n) { unsigned int count; @@ -663,50 +658,6 @@ static int decode_channel_run(Encoder *encoder, Channel *channel) return runlen; } - -#else - -static inline void encode_run(Encoder *encoder, unsigned int len) -{ - int odd = len & 1U; - int msb; - - len &= ~1U; - - while ((msb = spice_bit_find_msb(len))) { - len &= ~(1 << (msb - 1)); - spice_assert(msb < 32); - encode(encoder, (1 << (msb)) - 1, msb); - encode(encoder, 0, 1); - } - - if (odd) { - encode(encoder, 2, 2); - } else { - encode(encoder, 0, 1); - } -} - -static inline unsigned int decode_run(Encoder *encoder) -{ - unsigned int len = 0; - int count; - - do { - count = 0; - while (encoder->io_word & (1U << 31)) { - decode_eatbits(encoder, 1); - count++; - spice_assert(count < 32); - } - decode_eatbits(encoder, 1); - len += (1U << count) >> 1; - } while (count > 1); - - return len; -} - -#endif #endif static inline void init_decode_io(Encoder *encoder) @@ -1028,7 +979,7 @@ static int encoder_reset(Encoder *encoder, uint32_t *io_ptr, uint32_t *io_ptr_en encoder->rgb_state.wmileft = DEFwminext; set_wm_trigger(&encoder->rgb_state); -#if defined(RLE) && defined(RLE_STAT) +#if defined(RLE) encoder_init_rle(&encoder->rgb_state); #endif @@ -1090,7 +1041,7 @@ static int encoder_reset_channels(Encoder *encoder, int channels, int width, int encoder->channels[i].state.wmileft = DEFwminext; set_wm_trigger(&encoder->channels[i].state); -#if defined(RLE) && defined(RLE_STAT) +#if defined(RLE) encoder_init_rle(&encoder->channels[i].state); #endif } diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c index b9e979f..4ea0631 100644 --- a/common/quic_tmpl.c +++ b/common/quic_tmpl.c @@ -251,19 +251,11 @@ do_run: while (cur_row[i].a == cur_row[i - 1].a) { run_size++; if (++i == end) { -#ifdef RLE_STAT encode_channel_run(encoder, channel, run_size); -#else - encode_run(encoder, run_size); -#endif return; } } -#ifdef RLE_STAT encode_channel_run(encoder, channel, run_size); -#else - encode_run(encoder, run_size); -#endif stopidx = i + channel->state.waitcnt; #endif } @@ -480,11 +472,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel, do_run: channel->state.waitcnt = stopidx - i; run_index = i; -#ifdef RLE_STAT run_end = i + decode_channel_run(encoder, channel); -#else - run_end = i + decode_run(encoder); -#endif for (; i < run_end; i++) { cur_row[i].a = cur_row[i - 1].a; |