[spice-common v3 04/12] quic: Get rid of RLE_STAT #define

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's always set, no need to have conditional compilation based on it.

Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
---
 common/quic.c      | 53 ++---------------------------------------------------
 common/quic_tmpl.c | 12 ------------
 2 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/common/quic.c b/common/quic.c
index db9f2f7..0403db9 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
@@ -106,7 +105,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
@@ -117,7 +115,6 @@ typedef struct CommonState {
                      of melclen bits */
 
     unsigned long melcorder;  /* 2^ melclen */
-#endif
 } CommonState;
 
 
@@ -498,8 +495,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;
@@ -668,50 +663,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)
@@ -1042,7 +993,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
 
@@ -1106,7 +1057,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 f620cc9..315973d 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -252,19 +252,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
     }
@@ -481,11 +473,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;
-- 
2.13.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]