[Spice-devel] [spice-common v2 3/6] quic: Use DEFwmimax constant rather than wmimax variable
Christophe Fergeau
cfergeau at redhat.com
Tue Aug 1 13:55:06 UTC 2017
We never change its value, so we basically have 2 constants for the
same thing, DEFwmimax and wmimax. This commit removes the latter.
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
common/quic.c | 3 ---
common/quic_rgb_tmpl.c | 24 ++++++++++++------------
common/quic_tmpl.c | 24 ++++++++++++------------
3 files changed, 24 insertions(+), 27 deletions(-)
diff --git a/common/quic.c b/common/quic.c
index 04fdd62..049a5cd 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -172,9 +172,6 @@ struct Encoder {
CommonState rgb_state;
};
-/* target wait mask index */
-static const int wmimax = DEFwmimax;
-
/* bppmask[i] contains i ones as lsb-s */
static const unsigned long int bppmask[33] = {
0x00000000, /* [0] */
diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
index bd2a70a..f3d07a5 100644
--- a/common/quic_rgb_tmpl.c
+++ b/common/quic_rgb_tmpl.c
@@ -284,7 +284,7 @@ static void FNAME(compress_row0)(Encoder *encoder, const PIXEL *cur_row,
const unsigned int bpc_mask = BPC_MASK;
int pos = 0;
- while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) {
+ while ((DEFwmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) {
if (encoder->rgb_state.wmileft) {
FNAME(compress_row0_seg)(encoder, pos, cur_row, pos + encoder->rgb_state.wmileft,
bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask);
@@ -300,12 +300,12 @@ static void FNAME(compress_row0)(Encoder *encoder, const PIXEL *cur_row,
if (width) {
FNAME(compress_row0_seg)(encoder, pos, cur_row, pos + width,
bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask);
- if (wmimax > (int)encoder->rgb_state.wmidx) {
+ if (DEFwmimax > (int)encoder->rgb_state.wmidx) {
encoder->rgb_state.wmileft -= width;
}
}
- spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
+ spice_assert((int)encoder->rgb_state.wmidx <= DEFwmimax);
spice_assert(encoder->rgb_state.wmidx <= 32);
spice_assert(DEFwminext > 0);
}
@@ -428,7 +428,7 @@ static void FNAME(compress_row)(Encoder *encoder,
const unsigned int bpc_mask = BPC_MASK;
unsigned int pos = 0;
- while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) {
+ while ((DEFwmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) {
if (encoder->rgb_state.wmileft) {
FNAME(compress_row_seg)(encoder, pos, prev_row, cur_row,
pos + encoder->rgb_state.wmileft,
@@ -446,12 +446,12 @@ static void FNAME(compress_row)(Encoder *encoder,
if (width) {
FNAME(compress_row_seg)(encoder, pos, prev_row, cur_row, pos + width,
bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask);
- if (wmimax > (int)encoder->rgb_state.wmidx) {
+ if (DEFwmimax > (int)encoder->rgb_state.wmidx) {
encoder->rgb_state.wmileft -= width;
}
}
- spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
+ spice_assert((int)encoder->rgb_state.wmidx <= DEFwmimax);
spice_assert(encoder->rgb_state.wmidx <= 32);
spice_assert(DEFwminext > 0);
}
@@ -544,7 +544,7 @@ static void FNAME(uncompress_row0)(Encoder *encoder,
const unsigned int bpc_mask = BPC_MASK;
unsigned int pos = 0;
- while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) {
+ while ((DEFwmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) {
if (encoder->rgb_state.wmileft) {
FNAME(uncompress_row0_seg)(encoder, pos, cur_row,
pos + encoder->rgb_state.wmileft,
@@ -562,12 +562,12 @@ static void FNAME(uncompress_row0)(Encoder *encoder,
if (width) {
FNAME(uncompress_row0_seg)(encoder, pos, cur_row, pos + width,
bppmask[encoder->rgb_state.wmidx], bpc, bpc_mask);
- if (wmimax > (int)encoder->rgb_state.wmidx) {
+ if (DEFwmimax > (int)encoder->rgb_state.wmidx) {
encoder->rgb_state.wmileft -= width;
}
}
- spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
+ spice_assert((int)encoder->rgb_state.wmidx <= DEFwmimax);
spice_assert(encoder->rgb_state.wmidx <= 32);
spice_assert(DEFwminext > 0);
}
@@ -700,7 +700,7 @@ static void FNAME(uncompress_row)(Encoder *encoder,
const unsigned int bpc_mask = BPC_MASK;
unsigned int pos = 0;
- while ((wmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) {
+ while ((DEFwmimax > (int)encoder->rgb_state.wmidx) && (encoder->rgb_state.wmileft <= width)) {
if (encoder->rgb_state.wmileft) {
FNAME(uncompress_row_seg)(encoder, prev_row, cur_row, pos,
pos + encoder->rgb_state.wmileft, bpc, bpc_mask);
@@ -716,12 +716,12 @@ static void FNAME(uncompress_row)(Encoder *encoder,
if (width) {
FNAME(uncompress_row_seg)(encoder, prev_row, cur_row, pos,
pos + width, bpc, bpc_mask);
- if (wmimax > (int)encoder->rgb_state.wmidx) {
+ if (DEFwmimax > (int)encoder->rgb_state.wmidx) {
encoder->rgb_state.wmileft -= width;
}
}
- spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
+ spice_assert((int)encoder->rgb_state.wmidx <= DEFwmimax);
spice_assert(encoder->rgb_state.wmidx <= 32);
spice_assert(DEFwminext > 0);
}
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index 0ad9dd6..4f76743 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -212,7 +212,7 @@ static void FNAME(compress_row0)(Encoder *encoder, Channel *channel, const PIXEL
const unsigned int bpc_mask = BPC_MASK;
int pos = 0;
- while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) {
+ while ((DEFwmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) {
if (channel->state.wmileft) {
FNAME(compress_row0_seg)(encoder, channel, pos, cur_row, pos + channel->state.wmileft,
bppmask[channel->state.wmidx], bpc, bpc_mask);
@@ -228,12 +228,12 @@ static void FNAME(compress_row0)(Encoder *encoder, Channel *channel, const PIXEL
if (width) {
FNAME(compress_row0_seg)(encoder, channel, pos, cur_row, pos + width,
bppmask[channel->state.wmidx], bpc, bpc_mask);
- if (wmimax > (int)channel->state.wmidx) {
+ if (DEFwmimax > (int)channel->state.wmidx) {
channel->state.wmileft -= width;
}
}
- spice_assert((int)channel->state.wmidx <= wmimax);
+ spice_assert((int)channel->state.wmidx <= DEFwmimax);
spice_assert(channel->state.wmidx <= 32);
spice_assert(DEFwminext > 0);
}
@@ -353,7 +353,7 @@ static void FNAME(compress_row)(Encoder *encoder, Channel *channel,
const unsigned int bpc_mask = BPC_MASK;
unsigned int pos = 0;
- while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) {
+ while ((DEFwmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) {
if (channel->state.wmileft) {
FNAME(compress_row_seg)(encoder, channel, pos, prev_row, cur_row,
pos + channel->state.wmileft, bppmask[channel->state.wmidx],
@@ -370,12 +370,12 @@ static void FNAME(compress_row)(Encoder *encoder, Channel *channel,
if (width) {
FNAME(compress_row_seg)(encoder, channel, pos, prev_row, cur_row, pos + width,
bppmask[channel->state.wmidx], bpc, bpc_mask);
- if (wmimax > (int)channel->state.wmidx) {
+ if (DEFwmimax > (int)channel->state.wmidx) {
channel->state.wmileft -= width;
}
}
- spice_assert((int)channel->state.wmidx <= wmimax);
+ spice_assert((int)channel->state.wmidx <= DEFwmimax);
spice_assert(channel->state.wmidx <= 32);
spice_assert(DEFwminext > 0);
}
@@ -453,7 +453,7 @@ static void FNAME(uncompress_row0)(Encoder *encoder, Channel *channel,
BYTE * const correlate_row = channel->correlate_row;
unsigned int pos = 0;
- while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) {
+ while ((DEFwmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) {
if (channel->state.wmileft) {
FNAME(uncompress_row0_seg)(encoder, channel, pos, correlate_row, cur_row,
pos + channel->state.wmileft, bppmask[channel->state.wmidx],
@@ -470,12 +470,12 @@ static void FNAME(uncompress_row0)(Encoder *encoder, Channel *channel,
if (width) {
FNAME(uncompress_row0_seg)(encoder, channel, pos, correlate_row, cur_row, pos + width,
bppmask[channel->state.wmidx], bpc, bpc_mask);
- if (wmimax > (int)channel->state.wmidx) {
+ if (DEFwmimax > (int)channel->state.wmidx) {
channel->state.wmileft -= width;
}
}
- spice_assert((int)channel->state.wmidx <= wmimax);
+ spice_assert((int)channel->state.wmidx <= DEFwmimax);
spice_assert(channel->state.wmidx <= 32);
spice_assert(DEFwminext > 0);
}
@@ -592,7 +592,7 @@ static void FNAME(uncompress_row)(Encoder *encoder, Channel *channel,
BYTE * const correlate_row = channel->correlate_row;
unsigned int pos = 0;
- while ((wmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) {
+ while ((DEFwmimax > (int)channel->state.wmidx) && (channel->state.wmileft <= width)) {
if (channel->state.wmileft) {
FNAME(uncompress_row_seg)(encoder, channel, correlate_row, prev_row, cur_row, pos,
pos + channel->state.wmileft, bpc, bpc_mask);
@@ -608,12 +608,12 @@ static void FNAME(uncompress_row)(Encoder *encoder, Channel *channel,
if (width) {
FNAME(uncompress_row_seg)(encoder, channel, correlate_row, prev_row, cur_row, pos,
pos + width, bpc, bpc_mask);
- if (wmimax > (int)channel->state.wmidx) {
+ if (DEFwmimax > (int)channel->state.wmidx) {
channel->state.wmileft -= width;
}
}
- spice_assert((int)channel->state.wmidx <= wmimax);
+ spice_assert((int)channel->state.wmidx <= DEFwmimax);
spice_assert(channel->state.wmidx <= 32);
spice_assert(DEFwminext > 0);
}
--
2.13.3
More information about the Spice-devel
mailing list