[Spice-devel] [spice-common v3 02/12] quic: Remove configurable PRED
Frediano Ziglio
fziglio at redhat.com
Fri Aug 4 07:33:09 UTC 2017
>
> It's hardcoded at compile-time, and I don't think it was changed in
> years...
>
> Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> ---
> common/quic.c | 1 -
> common/quic_rgb_tmpl.c | 31 -------------------------------
> common/quic_tmpl.c | 38 --------------------------------------
> 3 files changed, 70 deletions(-)
>
> diff --git a/common/quic.c b/common/quic.c
> index 309ee75..c8c9547 100644
> --- a/common/quic.c
> +++ b/common/quic.c
> @@ -31,7 +31,6 @@
>
> #define RLE
> #define RLE_STAT
> -#define PRED_1
> #define QUIC_RGB
>
> /* ASCII "QUIC" */
> diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
> index cc3c045..3cacb33 100644
> --- a/common/quic_rgb_tmpl.c
> +++ b/common/quic_rgb_tmpl.c
> @@ -120,7 +120,6 @@
> #define CORRELATE_0(channel, curr, correlate, bpc_mask)\
> ((family.xlatL2U[correlate] + _PIXEL_A(channel, curr)) & bpc_mask)
>
> -#ifdef PRED_1
>
> /* (a+b)/2 */
> #define DECORRELATE(channel, prev, curr, bpc_mask, r)
> \
> @@ -130,36 +129,6 @@
> #define CORRELATE(channel, prev, curr, correlate, bpc_mask, r)
> \
> SET_##channel(r, ((family.xlatL2U[correlate] +
> \
> (int)((_PIXEL_A(channel, curr) + _PIXEL_B(channel, prev)) >> 1)) &
> bpc_mask))
> -#endif
> -
> -#ifdef PRED_2
> -
> -/* .75a+.75b-.5c */
> -#define DECORRELATE(channel, prev, curr, bpc_mask, r) {
> \
> - int p = ((int)(3 * (_PIXEL_A(channel, curr) + _PIXEL_B(channel, prev)))
> - \
> - (int)(_PIXEL_C(channel, prev) << 1)) >> 2;
> \
> - if (p < 0) {
> \
> - p = 0;
> \
> - } else if ((unsigned)p > bpc_mask) {
> \
> - p = bpc_mask;
> \
> - }
> \
> - r = family.xlatU2L[(unsigned)((int)GET_##channel(curr) - p) & bpc_mask];
> \
> -}
> -
> -#define CORRELATE(channel, prev, curr, correlate, bpc_mask, r) {
> \
> - const int p = ((int)(3 * (_PIXEL_A(channel, curr) + _PIXEL_B(channel,
> prev))) - \
> - (int)(_PIXEL_C(channel, prev) << 1) ) >> 2;
> \
> - const unsigned int s = family.xlatL2U[correlate];
> \
> - if (!(p & ~bpc_mask)) {
> \
> - SET_##channel(r, (s + (unsigned)p) & bpc_mask);
> \
> - } else if (p < 0) {
> \
> - SET_##channel(r, s);
> \
> - } else {
> \
> - SET_##channel(r, (s + bpc_mask) & bpc_mask);
> \
> - }
> \
> -}
> -
> -#endif
>
>
> #define COMPRESS_ONE_ROW0_0(channel)
> \
> diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
> index d49a408..6c639c7 100644
> --- a/common/quic_tmpl.c
> +++ b/common/quic_tmpl.c
> @@ -73,7 +73,6 @@ static inline void FNAME(correlate_0)(PIXEL *curr, const
> BYTE correlate,
> curr->a = (family.xlatL2U[correlate] + _PIXEL_A) & bpc_mask;
> }
>
> -#ifdef PRED_1
>
> /* (a+b)/2 */
> static inline BYTE FNAME(decorrelate)(const PIXEL *const prev, const PIXEL *
> const curr,
> @@ -89,43 +88,6 @@ static inline void FNAME(correlate)(const PIXEL *prev,
> PIXEL *curr, const BYTE c
> curr->a = (family.xlatL2U[correlate] + (int)((_PIXEL_A + _PIXEL_B) >>
> 1)) & bpc_mask;
> }
>
> -#endif
> -
> -#ifdef PRED_2
> -
> -/* .75a+.75b-.5c */
> -static inline BYTE FNAME(decorrelate)(const PIXEL *const prev, const PIXEL *
> const curr,
> - const unsigned int bpc_mask)
> -{
> - int p = ((int)(3 * (_PIXEL_A + _PIXEL_B)) - (int)(_PIXEL_C << 1)) >> 2;
> -
> - if (p < 0) {
> - p = 0;
> - } else if ((unsigned)p > bpc_mask) {
> - p = bpc_mask;
> - }
> -
> - {
> - return family.xlatU2L[(unsigned)((int)curr->a - p) & bpc_mask];
> - }
> -}
> -
> -static inline void FNAME(correlate)(const PIXEL *prev, PIXEL *curr, const
> BYTE correlate,
> - const unsigned int bpc_mask)
> -{
> - const int p = ((int)(3 * (_PIXEL_A + _PIXEL_B)) - (int)(_PIXEL_C << 1))
> >> 2;
> - const unsigned int s = family.xlatL2U[correlate];
> -
> - if (!(p & ~bpc_mask)) {
> - curr->a = (s + (unsigned)p) & bpc_mask;
> - } else if (p < 0) {
> - curr->a = s;
> - } else {
> - curr->a = (s + bpc_mask) & bpc_mask;
> - }
> -}
> -
> -#endif
>
> static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int
> i,
> const PIXEL * const cur_row,
Acked-by: Frediano Ziglio <fziglio at redhat.com>
Code compile to the same binary.
Frediano
More information about the Spice-devel
mailing list