[Spice-commits] 5 commits - common/quic.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Aug 9 06:08:45 UTC 2017


 common/quic.c |   26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

New commits:
commit 429ad965371ceaaf60b81ccbed7da660ef9e0a94
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Aug 4 08:52:56 2017 +0100

    quic: turn back some commented out checks as compile time
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/common/quic.c b/common/quic.c
index 7c069e4..1be28c6 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -223,8 +223,8 @@ static const unsigned int tabrand_chaos[TABRAND_TABSIZE] = {
 
 static unsigned int stabrand(void)
 {
-    //spice_assert( !(TABRAND_SEEDMASK & TABRAND_TABSIZE));
-    //spice_assert( TABRAND_SEEDMASK + 1 == TABRAND_TABSIZE );
+    SPICE_VERIFY( !(TABRAND_SEEDMASK & TABRAND_TABSIZE));
+    SPICE_VERIFY( TABRAND_SEEDMASK + 1 == TABRAND_TABSIZE );
 
     return TABRAND_SEEDMASK;
 }
commit a6d6e8435a678838e60cf08a7b38e41bd5cf3272
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Aug 3 22:31:39 2017 +0100

    quic: use 32 bit for bppmask
    
    In most occurrences bppmask is converted to 32 bit anyway.
    In the left one a possible more bigger precision is not needed.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/common/quic.c b/common/quic.c
index a4c46d3..7c069e4 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -168,7 +168,7 @@ struct Encoder {
 };
 
 /* bppmask[i] contains i ones as lsb-s */
-static const unsigned long int bppmask[33] = {
+static const unsigned int bppmask[33] = {
     0x00000000, /* [0] */
     0x00000001, 0x00000003, 0x00000007, 0x0000000f,
     0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
@@ -329,7 +329,7 @@ static void decorrelate_init(QuicFamily *family, int bpc)
 
 static void correlate_init(QuicFamily *family, int bpc)
 {
-    const unsigned long int pixelbitmask = bppmask[bpc];
+    const unsigned int pixelbitmask = bppmask[bpc];
     unsigned long int s;
 
     //spice_assert(bpc <= 8);
commit 6a882282f12363fb3d81b8a8551cff53fe6ca47e
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Aug 3 22:09:07 2017 +0100

    quic: remove Channel::encoder
    
    This field is easily accessible from Encoder structure.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/common/quic.c b/common/quic.c
index 42670ad..a4c46d3 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -133,8 +133,6 @@ typedef struct FamilyStat {
 } FamilyStat;
 
 typedef struct Channel {
-    Encoder *encoder;
-
     int correlate_row_width;
     BYTE *correlate_row;
 
@@ -994,7 +992,6 @@ static int init_channel(Encoder *encoder, Channel *channel)
     unsigned int n_buckets;
     unsigned int n_buckets_ptrs;
 
-    channel->encoder = encoder;
     channel->correlate_row_width = 0;
     channel->correlate_row = NULL;
 
@@ -1020,9 +1017,9 @@ static int init_channel(Encoder *encoder, Channel *channel)
     return TRUE;
 }
 
-static void destroy_channel(Channel *channel)
+static void destroy_channel(Encoder *encoder, Channel *channel)
 {
-    QuicUsrContext *usr = channel->encoder->usr;
+    QuicUsrContext *usr = encoder->usr;
     if (channel->correlate_row) {
         usr->free(usr, channel->correlate_row - 1);
     }
@@ -1039,7 +1036,7 @@ static int init_encoder(Encoder *encoder, QuicUsrContext *usr)
     for (i = 0; i < MAX_CHANNELS; i++) {
         if (!init_channel(encoder, &encoder->channels[i])) {
             for (--i; i >= 0; i--) {
-                destroy_channel(&encoder->channels[i]);
+                destroy_channel(encoder, &encoder->channels[i]);
             }
             return FALSE;
         }
@@ -1638,7 +1635,7 @@ void quic_destroy(QuicContext *quic)
     }
 
     for (i = 0; i < MAX_CHANNELS; i++) {
-        destroy_channel(&encoder->channels[i]);
+        destroy_channel(encoder, &encoder->channels[i]);
     }
     encoder->usr->free(encoder->usr, encoder);
 }
commit 3306492247a4ae85e7b480d5ea3e4e6e43e60a04
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Aug 3 22:08:09 2017 +0100

    quic: remove only assigned CommonState::encoder
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/common/quic.c b/common/quic.c
index 511e733..42670ad 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -103,8 +103,6 @@ typedef struct s_bucket {
 typedef struct Encoder Encoder;
 
 typedef struct CommonState {
-    Encoder *encoder;
-
     unsigned int waitcnt;
     unsigned int tabrand_seed;
     unsigned int wm_trigger;
@@ -997,7 +995,6 @@ static int init_channel(Encoder *encoder, Channel *channel)
     unsigned int n_buckets_ptrs;
 
     channel->encoder = encoder;
-    channel->state.encoder = encoder;
     channel->correlate_row_width = 0;
     channel->correlate_row = NULL;
 
@@ -1038,7 +1035,6 @@ static int init_encoder(Encoder *encoder, QuicUsrContext *usr)
     int i;
 
     encoder->usr = usr;
-    encoder->rgb_state.encoder = encoder;
 
     for (i = 0; i < MAX_CHANNELS; i++) {
         if (!init_channel(encoder, &encoder->channels[i])) {
commit 65ba949fb067debb71c13fd2ff2bb3b6dd961500
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Aug 3 22:07:02 2017 +0100

    quic: remove only assigned num_channels field
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/common/quic.c b/common/quic.c
index b753d07..511e733 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -153,7 +153,6 @@ struct Encoder {
     QuicImageType type;
     unsigned int width;
     unsigned int height;
-    unsigned int num_channels;
 
     unsigned int n_buckets_8bpc;
     unsigned int n_buckets_5bpc;
@@ -1079,8 +1078,6 @@ static int encoder_reset_channels(Encoder *encoder, int channels, int width, int
 {
     int i;
 
-    encoder->num_channels = channels;
-
     for (i = 0; i < channels; i++) {
         s_bucket *bucket;
         s_bucket *end_bucket;


More information about the Spice-commits mailing list