[Spice-devel] [spice-common v2 03/13] quic: Get rid of QUIC_RGB #define
Christophe Fergeau
cfergeau at redhat.com
Wed Aug 2 08:15:00 UTC 2017
It's always set, no need to have conditional compilation based on it.
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
common/quic.c | 151 -----------------------------------------------------
common/quic_tmpl.c | 6 ---
2 files changed, 157 deletions(-)
diff --git a/common/quic.c b/common/quic.c
index 9386a09..e36df8d 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -31,7 +31,6 @@
#define RLE
#define RLE_STAT
-#define QUIC_RGB
/* ASCII "QUIC" */
#define QUIC_MAGIC 0x43495551
@@ -306,10 +305,8 @@ static unsigned int cnt_l_zeroes(const unsigned int bits)
#define QUIC_FAMILY_8BPC
#include "quic_family_tmpl.c"
-#ifdef QUIC_RGB
#define QUIC_FAMILY_5BPC
#include "quic_family_tmpl.c"
-#endif
static void decorelate_init(QuicFamily *family, int bpc)
{
@@ -530,7 +527,6 @@ static void encoder_init_rle(CommonState *state)
state->melcorder = 1 << state->melclen;
}
-#ifdef QUIC_RGB
static void encode_run(Encoder *encoder, unsigned int runlen) //todo: try use end of line
{
@@ -561,8 +557,6 @@ static void encode_run(Encoder *encoder, unsigned int runlen) //todo: try use en
}
}
-#endif
-
static void encode_channel_run(Encoder *encoder, Channel *channel, unsigned int runlen)
{
//todo: try use end of line
@@ -596,7 +590,6 @@ static void encode_channel_run(Encoder *encoder, Channel *channel, unsigned int
/* 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) */
-#ifdef QUIC_RGB
static int decode_run(Encoder *encoder)
{
int runlen = 0;
@@ -636,7 +629,6 @@ static int decode_run(Encoder *encoder)
return runlen;
}
-#endif
static int decode_channel_run(Encoder *encoder, Channel *channel)
{
@@ -770,8 +762,6 @@ typedef uint16_t rgb16_pixel_t;
#define FOUR_BYTE
#include "quic_tmpl.c"
-#ifdef QUIC_RGB
-
#define QUIC_RGB32
#include "quic_rgb_tmpl.c"
@@ -784,13 +774,6 @@ typedef uint16_t rgb16_pixel_t;
#define QUIC_RGB16_TO_32
#include "quic_rgb_tmpl.c"
-#else
-
-#define THREE_BYTE
-#include "quic_tmpl.c"
-
-#endif
-
static void fill_model_structures(SPICE_GNUC_UNUSED Encoder *encoder, FamilyStat *family_stat,
unsigned int rep_first, unsigned int first_size,
unsigned int rep_next, unsigned int mul_size,
@@ -1141,9 +1124,6 @@ static void quic_image_params(Encoder *encoder, QuicImageType type, int *channel
case QUIC_IMAGE_TYPE_RGB16:
*channels = 3;
*bpc = 5;
-#ifndef QUIC_RGB
- encoder->usr->error(encoder->usr, "not implemented\n");
-#endif
break;
case QUIC_IMAGE_TYPE_RGB24:
*channels = 3;
@@ -1208,9 +1188,6 @@ int quic_encode(QuicContext *quic, QuicImageType type, int width, int height,
uint8_t *prev;
int channels;
int bpc;
-#ifndef QUIC_RGB
- int i;
-#endif
lines_end = line + num_lines * stride;
if (line == NULL && lines_end != line) {
@@ -1237,7 +1214,6 @@ int quic_encode(QuicContext *quic, QuicImageType type, int width, int height,
FILL_LINES();
switch (type) {
-#ifdef QUIC_RGB
case QUIC_IMAGE_TYPE_RGB32:
spice_assert(ABS(stride) >= width * 4);
QUIC_COMPRESS_RGB(32);
@@ -1277,47 +1253,6 @@ int quic_encode(QuicContext *quic, QuicImageType type, int width, int height,
encoder->rows_completed++;
}
break;
-#else
- case QUIC_IMAGE_TYPE_RGB24:
- spice_assert(ABS(stride) >= width * 3);
- for (i = 0; i < 3; i++) {
- encoder->channels[i].correlate_row[-1] = 0;
- quic_three_compress_row0(encoder, &encoder->channels[i], (three_bytes_t *)(line + i),
- width);
- }
- encoder->rows_completed++;
- for (row = 1; row < height; row++) {
- prev = line;
- NEXT_LINE();
- for (i = 0; i < 3; i++) {
- encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0];
- quic_three_compress_row(encoder, &encoder->channels[i], (three_bytes_t *)(prev + i),
- (three_bytes_t *)(line + i), width);
- }
- encoder->rows_completed++;
- }
- break;
- case QUIC_IMAGE_TYPE_RGB32:
- case QUIC_IMAGE_TYPE_RGBA:
- spice_assert(ABS(stride) >= width * 4);
- for (i = 0; i < channels; i++) {
- encoder->channels[i].correlate_row[-1] = 0;
- quic_four_compress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(line + i),
- width);
- }
- encoder->rows_completed++;
- for (row = 1; row < height; row++) {
- prev = line;
- NEXT_LINE();
- for (i = 0; i < channels; i++) {
- encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0];
- quic_four_compress_row(encoder, &encoder->channels[i], (four_bytes_t *)(prev + i),
- (four_bytes_t *)(line + i), width);
- }
- encoder->rows_completed++;
- }
- break;
-#endif
case QUIC_IMAGE_TYPE_GRAY:
spice_assert(ABS(stride) >= width);
encoder->channels[0].correlate_row[-1] = 0;
@@ -1397,19 +1332,6 @@ int quic_decode_begin(QuicContext *quic, uint32_t *io_ptr, unsigned int num_io_w
return QUIC_OK;
}
-#ifndef QUIC_RGB
-static void clear_row(four_bytes_t *row, int width)
-{
- four_bytes_t *end;
- for (end = row + width; row < end; row++) {
- row->a = 0;
- }
-}
-
-#endif
-
-#ifdef QUIC_RGB
-
static void uncompress_rgba(Encoder *encoder, uint8_t *buf, int stride)
{
unsigned int row;
@@ -1443,8 +1365,6 @@ static void uncompress_rgba(Encoder *encoder, uint8_t *buf, int stride)
}
}
-#endif
-
static void uncompress_gray(Encoder *encoder, uint8_t *buf, int stride)
{
unsigned int row;
@@ -1485,14 +1405,10 @@ int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride)
Encoder *encoder = (Encoder *)quic;
unsigned int row;
uint8_t *prev;
-#ifndef QUIC_RGB
- int i;
-#endif
spice_assert(buf);
switch (encoder->type) {
-#ifdef QUIC_RGB
case QUIC_IMAGE_TYPE_RGB32:
case QUIC_IMAGE_TYPE_RGB24:
if (type == QUIC_IMAGE_TYPE_RGB32) {
@@ -1528,73 +1444,6 @@ int quic_decode(QuicContext *quic, QuicImageType type, uint8_t *buf, int stride)
spice_assert(ABS(stride) >= (int)encoder->width * 4);
uncompress_rgba(encoder, buf, stride);
break;
-#else
- case QUIC_IMAGE_TYPE_RGB24:
- spice_assert(ABS(stride) >= (int)encoder->width * 3);
- for (i = 0; i < 3; i++) {
- encoder->channels[i].correlate_row[-1] = 0;
- quic_three_uncompress_row0(encoder, &encoder->channels[i], (three_bytes_t *)(buf + i),
- encoder->width);
- }
- encoder->rows_completed++;
- for (row = 1; row < encoder->height; row++) {
- prev = buf;
- buf += stride;
- for (i = 0; i < 3; i++) {
- encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0];
- quic_three_uncompress_row(encoder, &encoder->channels[i],
- (three_bytes_t *)(prev + i),
- (three_bytes_t *)(buf + i),
- encoder->width);
- }
- encoder->rows_completed++;
- }
- break;
- case QUIC_IMAGE_TYPE_RGB32:
- spice_assert(ABS(stride) >= encoder->width * 4);
- for (i = 0; i < 3; i++) {
- encoder->channels[i].correlate_row[-1] = 0;
- quic_four_uncompress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(buf + i),
- encoder->width);
- }
- clear_row((four_bytes_t *)(buf + 3), encoder->width);
- encoder->rows_completed++;
- for (row = 1; row < encoder->height; row++) {
- prev = buf;
- buf += stride;
- for (i = 0; i < 3; i++) {
- encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0];
- quic_four_uncompress_row(encoder, &encoder->channels[i],
- (four_bytes_t *)(prev + i),
- (four_bytes_t *)(buf + i),
- encoder->width);
- }
- clear_row((four_bytes_t *)(buf + 3), encoder->width);
- encoder->rows_completed++;
- }
- break;
- case QUIC_IMAGE_TYPE_RGBA:
- spice_assert(ABS(stride) >= encoder->width * 4);
- for (i = 0; i < 4; i++) {
- encoder->channels[i].correlate_row[-1] = 0;
- quic_four_uncompress_row0(encoder, &encoder->channels[i], (four_bytes_t *)(buf + i),
- encoder->width);
- }
- encoder->rows_completed++;
- for (row = 1; row < encoder->height; row++) {
- prev = buf;
- buf += stride;
- for (i = 0; i < 4; i++) {
- encoder->channels[i].correlate_row[-1] = encoder->channels[i].correlate_row[0];
- quic_four_uncompress_row(encoder, &encoder->channels[i],
- (four_bytes_t *)(prev + i),
- (four_bytes_t *)(buf + i),
- encoder->width);
- }
- encoder->rows_completed++;
- }
- break;
-#endif
case QUIC_IMAGE_TYPE_GRAY:
if (type != QUIC_IMAGE_TYPE_GRAY) {
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index 5874fe4..43c5c3f 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -25,12 +25,6 @@
#define PIXEL one_byte_t
#endif
-#ifdef THREE_BYTE
-#undef THREE_BYTE
-#define FNAME(name) quic_three_##name
-#define PIXEL three_bytes_t
-#endif
-
#ifdef FOUR_BYTE
#undef FOUR_BYTE
#define FNAME(name) quic_four_##name
--
2.13.3
More information about the Spice-devel
mailing list