quic: Use DEFwmimax constant rather than wmimax variable

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@redhat.com>
This commit is contained in:
Christophe Fergeau 2017-08-01 15:06:37 +02:00
parent f122d3dadc
commit 5684ed10be
3 changed files with 24 additions and 27 deletions

View File

@ -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] */

View File

@ -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);
}

View File

@ -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);
}