summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2018-07-10 11:02:19 +0200
committerFrediano Ziglio <fziglio@redhat.com>2018-07-10 10:34:57 +0100
commit291475318f46bbff46c8e8431e7b4257af357fa8 (patch)
tree92e466ed4f103f7c783ea3cb78be683f537f8468
parentc0cc563e10863d73935319f8ef9dd7ef4a5a4d3c (diff)
quic: Introduce COPY_PIXEL macro
Define and reuse a COPY_PIXEL macro to copy a pixel. This will help in making quic_tmpl.c and quic_rgb_tmpl.c identical. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
-rw-r--r--common/quic_rgb_tmpl.c9
-rw-r--r--common/quic_tmpl.c5
2 files changed, 10 insertions, 4 deletions
diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
index 3625728..2221201 100644
--- a/common/quic_rgb_tmpl.c
+++ b/common/quic_rgb_tmpl.c
@@ -87,6 +87,10 @@
#define SAME_PIXEL(p1, p2) \
(GET_r(p1) == GET_r(p2) && GET_g(p1) == GET_g(p2) && \
GET_b(p1) == GET_b(p2))
+#define COPY_PIXEL(dest, src) \
+ SET_r(dest, GET_r(src)); \
+ SET_g(dest, GET_g(src)); \
+ SET_b(dest, GET_b(src))
#define DECLARE_STATE_VARIABLES \
CommonState *state = &encoder->rgb_state
#define DECLARE_CHANNEL_VARIABLES \
@@ -541,9 +545,7 @@ do_run:
for (; i < run_end; i++) {
UNCOMPRESS_PIX_START(&cur_row[i]);
- SET_r(&cur_row[i], GET_r(&cur_row[i - 1]));
- SET_g(&cur_row[i], GET_g(&cur_row[i - 1]));
- SET_b(&cur_row[i], GET_b(&cur_row[i - 1]));
+ COPY_PIXEL(&cur_row[i], &cur_row[i - 1]);
}
if (i == end) {
@@ -632,3 +634,4 @@ static void FNAME_DECL(uncompress_row)(const PIXEL * const prev_row,
#undef APPLY_ALL_COMP
#undef DECLARE_STATE_VARIABLES
#undef DECLARE_CHANNEL_VARIABLES
+#undef COPY_PIXEL
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index d21f059..525eb99 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -43,6 +43,8 @@
#define SAME_PIXEL(p1, p2) \
(GET_a(p1) == GET_a(p2))
+#define COPY_PIXEL(dest, src) \
+ SET_a(dest, GET_a(src));
#define DECLARE_STATE_VARIABLES \
CommonState *state = &channel_a->state
#define DECLARE_CHANNEL_VARIABLES \
@@ -483,7 +485,7 @@ do_run:
for (; i < run_end; i++) {
UNCOMPRESS_PIX_START(&cur_row[i]);
- SET_a(&cur_row[i], GET_a(&cur_row[i - 1]));
+ COPY_PIXEL(&cur_row[i], &cur_row[i - 1]);
}
if (i == end) {
@@ -565,3 +567,4 @@ static void FNAME_DECL(uncompress_row)(const PIXEL * const prev_row,
#undef APPLY_ALL_COMP
#undef DECLARE_STATE_VARIABLES
#undef DECLARE_CHANNEL_VARIABLES
+#undef COPY_PIXEL