>From 21db4db9b993d3e4a20c309faf6d72c657b1aba0 Mon Sep 17 00:00:00 2001
From: Izik Eidus <iei...@redhat.com>
Date: Tue, 29 Dec 2009 05:18:12 +0200
Subject: [PATCH] qxl: move into new murmur modifed hash

Signed-off-by: Izik Eidus <iei...@redhat.com>
---
 win/display/lookup3.c |    3 +-
 win/display/res.c     |   50 ++++++++++++++++++++++++++----------------------
 win/display/sources   |    1 -
 3 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/win/display/lookup3.c b/win/display/lookup3.c
index cef7b84..441ebc5 100644
--- a/win/display/lookup3.c
+++ b/win/display/lookup3.c
@@ -1,4 +1,5 @@
-/*
+
+                           /*
    Copyright (C) 2009 Red Hat, Inc.
 
    This program is free software; you can redistribute it and/or
diff --git a/win/display/res.c b/win/display/res.c
index 9b56937..c360c2f 100644
--- a/win/display/res.c
+++ b/win/display/res.c
@@ -21,7 +21,7 @@
 #include "utils.h"
 #include "mspace.h"
 #include "quic.h"
-#include "lookup3.h"
+#include "../common/murmur_hash2a.h"
 #include "surface.h"
 
 #if (WINVER < 0x0501)
@@ -1339,32 +1339,36 @@ static _inline UINT32 GetHash(UINT8 *src, INT32 width, 
INT32 height, UINT8 forma
     int row;
 
     if (color_trans && color_trans->flXlate == XO_TABLE) {
-        hash_value = hashlittle(color_trans->pulXlate,
-                                sizeof(*color_trans->pulXlate) * 
color_trans->cEntries, hash_value);
-    }
-    for (row = 0; row < height; row++) {
-#ifdef ADAPTIVE_HASH
-        if (format ==  BITMAP_FMT_32BIT) {
-            for (i = 0; i < line_size; i += 4) {
-                hash_value = hashlittle(row_buf + i, 3, hash_value);
-            }
-        } else {
-            if (format == BITMAP_FMT_4BIT_BE && (width & 0x1)) {
-                last_byte = row_buf[line_size - 1] & 0xF0;
-            } else if (format == BITMAP_FMT_1BIT_BE && (reminder = width & 
0x7)) {
-                last_byte = row_buf[line_size - 1] & ~((1 << (8 - reminder)) - 
1);
-            }
-            if (last_byte) {
-                hash_value = hashlittle(row_buf, line_size - 1, hash_value);
-                hash_value = hashlittle(&last_byte, 1, hash_value);
+        hash_value = murmurhash2a(color_trans->pulXlate,
+                                  sizeof(*color_trans->pulXlate) * 
color_trans->cEntries,
+                                  hash_value);
+    }
+
+    if (format == BITMAP_FMT_32BIT && stride == line_size) {
+        hash_value = murmurhash2ajump3(row_buf, line_size * height, 
hash_value);
+    } else {
+        for (row = 0; row < height; row++) {
+    #ifdef ADAPTIVE_HASH
+            if (format ==  BITMAP_FMT_32BIT) {
+                hash_value = murmurhash2ajump3(row_buf, line_size, hash_value);
             } else {
-                hash_value = hashlittle(row_buf, line_size, hash_value);
+                if (format == BITMAP_FMT_4BIT_BE && (width & 0x1)) {
+                    last_byte = row_buf[line_size - 1] & 0xF0;
+                } else if (format == BITMAP_FMT_1BIT_BE && (reminder = width & 
0x7)) {
+                    last_byte = row_buf[line_size - 1] & ~((1 << (8 - 
reminder)) - 1);
+                }
+                if (last_byte) {
+                    hash_value = murmurhash2a(row_buf, line_size - 1, 
hash_value);
+                    hash_value = murmurhash2a(&last_byte, 1, hash_value);
+                } else {
+                    hash_value = murmurhash2a(row_buf, line_size, hash_value);
+                }
             }
+    #else
+            hash_value = murmurhash2a(row_buf, line_size, hash_value);
+    #endif
+            row_buf += stride;
         }
-#else
-        hash_value = hashlittle(row_buf, line_size, hash_value);
-#endif
-        row_buf += stride;
     }
     return hash_value;
 }
diff --git a/win/display/sources b/win/display/sources
index c31fea9..6c1d5c7 100644
--- a/win/display/sources
+++ b/win/display/sources
@@ -29,7 +29,6 @@ SOURCES=driver.c        \
         brush.c         \
         mspace.c        \
         quic.c          \
-        lookup3.c       \
         surface.c       \
         driver.rc
 
-- 
1.6.5.2


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Spice-space-devel mailing list
Spice-space-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spice-space-devel

Reply via email to