[Spice-devel] [spice-common 08/14] quic: Get rid of RLE #define

Christophe Fergeau cfergeau at redhat.com
Wed Jul 5 08:20:42 UTC 2017


It's always set, no need to have conditional compilation based on it.
---
 common/quic.c          |  9 ---------
 common/quic_rgb_tmpl.c | 12 ------------
 common/quic_tmpl.c     | 12 ------------
 3 files changed, 33 deletions(-)

diff --git a/common/quic.c b/common/quic.c
index a58ee08..49ac34c 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -29,8 +29,6 @@
 #include "spice_common.h"
 #include "bitops.h"
 
-#define RLE
-
 /* ASCII "QUIC" */
 #define QUIC_MAGIC 0x43495551
 #define QUIC_VERSION_MAJOR 0U
@@ -502,8 +500,6 @@ static inline void decode_eat32bits(Encoder *encoder)
     decode_eatbits(encoder, 16);
 }
 
-#ifdef RLE
-
 static inline void encode_ones(Encoder *encoder, unsigned int n)
 {
     unsigned int count;
@@ -672,7 +668,6 @@ static int decode_channel_run(Encoder *encoder, Channel *channel)
 
     return runlen;
 }
-#endif
 
 static inline void init_decode_io(Encoder *encoder)
 {
@@ -1002,9 +997,7 @@ static int encoder_reset(Encoder *encoder, uint32_t *io_ptr, uint32_t *io_ptr_en
     encoder->rgb_state.wmileft = WMINEXT;
     set_wm_trigger(&encoder->rgb_state);
 
-#if defined(RLE)
     encoder_init_rle(&encoder->rgb_state);
-#endif
 
     encoder->io_words_count = io_ptr_end - io_ptr;
     encoder->io_now = io_ptr;
@@ -1066,9 +1059,7 @@ static int encoder_reset_channels(Encoder *encoder, int channels, int width, int
         encoder->channels[i].state.wmileft = WMINEXT;
         set_wm_trigger(&encoder->channels[i].state);
 
-#if defined(RLE)
         encoder_init_rle(&encoder->channels[i].state);
-#endif
     }
     return TRUE;
 }
diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
index 0a0a1ac..112e116 100644
--- a/common/quic_rgb_tmpl.c
+++ b/common/quic_rgb_tmpl.c
@@ -154,16 +154,12 @@
                 correlate_row_b[index]);
 
 
-#ifdef RLE
 #define RLE_PRED_IMP                                                                \
 if (SAME_PIXEL(&prev_row[i - 1], &prev_row[i])) {                                   \
     if (run_index != i && i > 2 && SAME_PIXEL(&cur_row[i - 1], &cur_row[i - 2])) {  \
         goto do_run;                                                                \
     }                                                                               \
 }
-#else
-#define RLE_PRED_IMP
-#endif
 
 #ifdef COMPRESS_IMP
 
@@ -290,10 +286,8 @@ static void FNAME(compress_row_seg)(Encoder *encoder, int i,
     BYTE * const correlate_row_g = channel_g->correlate_row;
     BYTE * const correlate_row_b = channel_b->correlate_row;
     int stopidx;
-#ifdef RLE
     int run_index = 0;
     int run_size;
-#endif
 
     spice_assert(end - i > 0);
 
@@ -339,7 +333,6 @@ static void FNAME(compress_row_seg)(Encoder *encoder, int i,
 
         return;
 
-#ifdef RLE
 do_run:
         run_index = i;
         encoder->rgb_state.waitcnt = stopidx - i;
@@ -354,7 +347,6 @@ do_run:
         }
         encode_run(encoder, run_size);
         stopidx = i + encoder->rgb_state.waitcnt;
-#endif
     }
 }
 
@@ -546,10 +538,8 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder,
     BYTE * const correlate_row_b = channel_b->correlate_row;
     const unsigned int waitmask = bppmask[encoder->rgb_state.wmidx];
     int stopidx;
-#ifdef RLE
     int run_index = 0;
     int run_end;
-#endif
 
     spice_assert(end - i > 0);
 
@@ -600,7 +590,6 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder,
 
         return;
 
-#ifdef RLE
 do_run:
         encoder->rgb_state.waitcnt = stopidx - i;
         run_index = i;
@@ -618,7 +607,6 @@ do_run:
         }
 
         stopidx = i + encoder->rgb_state.waitcnt;
-#endif
     }
 }
 
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index 2245dd9..46b55ed 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -44,16 +44,12 @@
 #define _PIXEL_B ((unsigned int)prev[0].a)
 #define _PIXEL_C ((unsigned int)prev[-1].a)
 
-#ifdef RLE
 #define RLE_PRED_IMP                                                       \
 if (prev_row[i - 1].a == prev_row[i].a) {                                  \
     if (run_index != i && i > 2 && cur_row[i - 1].a == cur_row[i - 2].a) { \
         goto do_run;                                                       \
     }                                                                      \
 }
-#else
-#define RLE_PRED_IMP
-#endif
 
 /*  a  */
 static inline BYTE FNAME(decorrelate_0)(const PIXEL * const curr, const unsigned int bpc_mask)
@@ -183,10 +179,8 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i,
 {
     BYTE * const decorrelate_drow = channel->correlate_row;
     int stopidx;
-#ifdef RLE
     int run_index = 0;
     int run_size;
-#endif
 
     spice_assert(end - i > 0);
 
@@ -243,7 +237,6 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i,
 
         return;
 
-#ifdef RLE
 do_run:
         run_index = i;
         channel->state.waitcnt = stopidx - i;
@@ -258,7 +251,6 @@ do_run:
         }
         encode_channel_run(encoder, channel, run_size);
         stopidx = i + channel->state.waitcnt;
-#endif
     }
 }
 
@@ -410,10 +402,8 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel,
 {
     const unsigned int waitmask = bppmask[channel->state.wmidx];
     int stopidx;
-#ifdef RLE
     int run_index = 0;
     int run_end;
-#endif
 
     spice_assert(end - i > 0);
 
@@ -469,7 +459,6 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel,
 
         return;
 
-#ifdef RLE
 do_run:
         channel->state.waitcnt = stopidx - i;
         run_index = i;
@@ -484,7 +473,6 @@ do_run:
         }
 
         stopidx = i + channel->state.waitcnt;
-#endif
     }
 }
 
-- 
2.13.0



More information about the Spice-devel mailing list