[Spice-devel] [spice-common v2 06/15] quic: Call directly encode_state_run from templates.

Christophe Fergeau cfergeau at redhat.com
Tue Jul 10 09:02:13 UTC 2018


From: Frediano Ziglio <fziglio at redhat.com>

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 common/quic.c          | 21 ---------------------
 common/quic_rgb_tmpl.c |  6 +++---
 common/quic_tmpl.c     |  6 +++---
 3 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/common/quic.c b/common/quic.c
index 6ed316c..cf4f087 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -540,16 +540,6 @@ static void encode_state_run(Encoder *encoder, CommonState *state, unsigned int
     }
 }
 
-static void encode_run(Encoder *encoder, unsigned int runlen) //todo: try use end of line
-{
-    encode_state_run(encoder, &encoder->rgb_state, runlen);
-}
-
-static void encode_channel_run(Encoder *encoder, Channel *channel, unsigned int runlen)
-{
-    encode_state_run(encoder, &channel->state, runlen);
-}
-
 
 /* decoding routine: reads bits from the input and returns a run length. */
 /* argument is the number of pixels left to end-of-line (bound on run length) */
@@ -593,17 +583,6 @@ static int decode_state_run(Encoder *encoder, CommonState *state)
     return runlen;
 }
 
-static int decode_run(Encoder *encoder)
-{
-    return decode_state_run(encoder, &encoder->rgb_state);
-}
-
-
-static int decode_channel_run(Encoder *encoder, Channel *channel)
-{
-    return decode_state_run(encoder, &channel->state);
-}
-
 static inline void init_decode_io(Encoder *encoder)
 {
     encoder->io_next_word = encoder->io_word = GUINT32_FROM_LE(*(encoder->io_now++));
diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
index 2e76645..0243252 100644
--- a/common/quic_rgb_tmpl.c
+++ b/common/quic_rgb_tmpl.c
@@ -326,11 +326,11 @@ do_run:
         while (SAME_PIXEL(&cur_row[i], &cur_row[i - 1])) {
             run_size++;
             if (++i == end) {
-                encode_run(encoder, run_size);
+                encode_state_run(encoder, state, run_size);
                 return;
             }
         }
-        encode_run(encoder, run_size);
+        encode_state_run(encoder, state, run_size);
         stopidx = i + state->waitcnt;
     }
 }
@@ -582,7 +582,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder,
 do_run:
         state->waitcnt = stopidx - i;
         run_index = i;
-        run_end = i + decode_run(encoder);
+        run_end = i + decode_state_run(encoder, state);
 
         for (; i < run_end; i++) {
             UNCOMPRESS_PIX_START(&cur_row[i]);
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index 68acf0f..8d585fd 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -246,11 +246,11 @@ do_run:
         while (SAME_PIXEL(&cur_row[i], &cur_row[i - 1])) {
             run_size++;
             if (++i == end) {
-                encode_channel_run(encoder, channel_a, run_size);
+                encode_state_run(encoder, state, run_size);
                 return;
             }
         }
-        encode_channel_run(encoder, channel_a, run_size);
+        encode_state_run(encoder, state, run_size);
         stopidx = i + state->waitcnt;
     }
 }
@@ -472,7 +472,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel_a,
 do_run:
         state->waitcnt = stopidx - i;
         run_index = i;
-        run_end = i + decode_channel_run(encoder, channel_a);
+        run_end = i + decode_state_run(encoder, state);
 
         for (; i < run_end; i++) {
             UNCOMPRESS_PIX_START(&cur_row[i]);
-- 
2.17.1



More information about the Spice-devel mailing list