[Spice-devel] [PATCH spice-gtk 2/4] quic: compile with constant bpp

Christophe Fergeau cfergeau at redhat.com
Wed Sep 11 02:11:57 PDT 2013


ACK

On Tue, Sep 10, 2013 at 04:43:37PM +0200, Marc-André Lureau wrote:
> From: Marc-André Lureau <marcandre.lureau at gmail.com>
> 
> This simplifies a little bit function calling, and allows for compiler
> to potentially specialize and optimize a bit better each version.
> ---
>  common/quic_family_tmpl.c |  4 ++--
>  common/quic_rgb_tmpl.c    |  6 +++---
>  common/quic_tmpl.c        | 16 ++++++++--------
>  3 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/common/quic_family_tmpl.c b/common/quic_family_tmpl.c
> index cca2c05..287ff6d 100644
> --- a/common/quic_family_tmpl.c
> +++ b/common/quic_family_tmpl.c
> @@ -74,13 +74,13 @@ static unsigned int FNAME(golomb_decoding)(const unsigned int l, const unsigned
>  
>  /* update the bucket using just encoded curval */
>  static void FNAME(update_model)(CommonState *state, s_bucket * const bucket,
> -                                const BYTE curval, unsigned int bpp)
> +                                const BYTE curval)
>  {
> +    const unsigned int bpp = BPC;
>      COUNTER * const pcounters = bucket->pcounters;
>      unsigned int i;
>      unsigned int bestcode;
>      unsigned int bestcodelen;
> -    //unsigned int bpp = encoder->bpp;
>  
>      /* update counters, find minimum */
>  
> diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
> index 37c908c..19cc348 100644
> --- a/common/quic_rgb_tmpl.c
> +++ b/common/quic_rgb_tmpl.c
> @@ -178,11 +178,11 @@
>  
>  #define UPDATE_MODEL(index)                                                                 \
>      update_model(&encoder->rgb_state, find_bucket(channel_r, correlate_row_r[index - 1]),   \
> -                correlate_row_r[index], bpc);                                               \
> +                correlate_row_r[index]);                                               \
>      update_model(&encoder->rgb_state, find_bucket(channel_g, correlate_row_g[index - 1]),   \
> -                correlate_row_g[index], bpc);                                               \
> +                correlate_row_g[index]);                                               \
>      update_model(&encoder->rgb_state, find_bucket(channel_b, correlate_row_b[index - 1]),   \
> -                correlate_row_b[index], bpc);
> +                correlate_row_b[index]);
>  
>  
>  #ifdef RLE_PRED_1
> diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
> index b625daf..75f2ff0 100644
> --- a/common/quic_tmpl.c
> +++ b/common/quic_tmpl.c
> @@ -173,7 +173,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i,
>          } else {
>              channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask);
>              update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]),
> -                         decorelate_drow[i], bpc);
> +                         decorelate_drow[i]);
>          }
>          stopidx = ++i + channel->state.waitcnt;
>      } else {
> @@ -191,7 +191,7 @@ static void FNAME(compress_row0_seg)(Encoder *encoder, Channel *channel, int i,
>          }
>  
>          update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]),
> -                     decorelate_drow[stopidx], bpc);
> +                     decorelate_drow[stopidx]);
>          stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask);
>      }
>  
> @@ -272,7 +272,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i,
>          } else {
>              channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask);
>              update_model(&channel->state, find_bucket(channel, decorelate_drow[-1]),
> -                         decorelate_drow[0], bpc);
> +                         decorelate_drow[0]);
>          }
>          stopidx = ++i + channel->state.waitcnt;
>      } else {
> @@ -295,7 +295,7 @@ static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i,
>              }
>  
>              update_model(&channel->state, find_bucket(channel, decorelate_drow[stopidx - 1]),
> -                         decorelate_drow[stopidx], bpc);
> +                         decorelate_drow[stopidx]);
>              stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask);
>          }
>  
> @@ -406,7 +406,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i
>          } else {
>              channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask);
>              update_model(&channel->state, find_bucket(channel, correlate_row[-1]),
> -                         correlate_row[0], bpc);
> +                         correlate_row[0]);
>          }
>          stopidx = ++i + channel->state.waitcnt;
>      } else {
> @@ -426,7 +426,7 @@ static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i
>              decode_eatbits(encoder, codewordlen);
>          }
>  
> -        update_model(&channel->state, pbucket, correlate_row[stopidx], bpc);
> +        update_model(&channel->state, pbucket, correlate_row[stopidx]);
>  
>          stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask);
>      }
> @@ -511,7 +511,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel,
>          } else {
>              channel->state.waitcnt = (tabrand(&channel->state.tabrand_seed) & waitmask);
>              update_model(&channel->state, find_bucket(channel, correlate_row[-1]),
> -                         correlate_row[0], bpc);
> +                         correlate_row[0]);
>          }
>          stopidx = ++i + channel->state.waitcnt;
>      } else {
> @@ -535,7 +535,7 @@ static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel,
>                  decode_eatbits(encoder, codewordlen);
>              }
>  
> -            update_model(&channel->state, pbucket, correlate_row[stopidx], bpc);
> +            update_model(&channel->state, pbucket, correlate_row[stopidx]);
>  
>              stopidx = i + (tabrand(&channel->state.tabrand_seed) & waitmask);
>          }
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130911/da3c72ab/attachment.pgp>


More information about the Spice-devel mailing list