[Spice-devel] [spice-common v2 01/15] quic: Add UPDATE_MODEL_COMP macro to iterate over channels

Christophe Fergeau cfergeau at redhat.com
Tue Jul 10 09:02:08 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_rgb_tmpl.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
index e0a05ca..2e76645 100644
--- a/common/quic_rgb_tmpl.c
+++ b/common/quic_rgb_tmpl.c
@@ -140,13 +140,13 @@
     golomb_coding(encoder, correlate_row_##channel[index], find_bucket(channel_##channel, \
                   correlate_row_##channel[index -1])->bestcode)
 
+#define UPDATE_MODEL_COMP(channel, index)                                                             \
+    update_model(state, find_bucket(channel_##channel, correlate_row_##channel[index - 1]),        \
+                 correlate_row_##channel[index])
 #define UPDATE_MODEL(index)                                                            \
-    update_model(state, find_bucket(channel_r, correlate_row_r[index - 1]),            \
-                correlate_row_r[index]);                                               \
-    update_model(state, find_bucket(channel_g, correlate_row_g[index - 1]),            \
-                correlate_row_g[index]);                                               \
-    update_model(state, find_bucket(channel_b, correlate_row_b[index - 1]),            \
-                correlate_row_b[index]);
+    UPDATE_MODEL_COMP(r, index); \
+    UPDATE_MODEL_COMP(g, index); \
+    UPDATE_MODEL_COMP(b, index)
 
 
 #define RLE_PRED_IMP                                                                \
@@ -670,3 +670,4 @@ static void FNAME(uncompress_row)(Encoder *encoder,
 #undef SET_b
 #undef GET_b
 #undef UNCOMPRESS_PIX_START
+#undef UPDATE_MODEL_COMP
-- 
2.17.1



More information about the Spice-devel mailing list