From: Jonathan Rosser <[EMAIL PROTECTED]>

no direct speedup but there looks like mmx type optimisations are now possible
as range and code and range_x_prob are now all bit aligned.

Signed-off-by: David Flynn <[EMAIL PROTECTED]>
---
 schroedinger/schroarith.c |    2 +-
 schroedinger/schroarith.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/schroedinger/schroarith.c b/schroedinger/schroarith.c
index f251507..957ee66 100644
--- a/schroedinger/schroarith.c
+++ b/schroedinger/schroarith.c
@@ -144,7 +144,7 @@ schro_arith_decode_init (SchroArith *arith, SchroBuffer 
*buffer)
 
   memset(arith, 0, sizeof(SchroArith));
   arith->range[0] = 0;
-  arith->range[1] = 0xffff;
+  arith->range[1] = 0xffff0000;
   arith->range_size = arith->range[1] - arith->range[0];
   arith->code = 0;
   arith->cntr = 16;
diff --git a/schroedinger/schroarith.h b/schroedinger/schroarith.h
index 42f92c6..5f6c498 100644
--- a/schroedinger/schroarith.h
+++ b/schroedinger/schroarith.h
@@ -159,7 +159,7 @@ _schro_arith_decode_bit (SchroArith *arith, unsigned int i)
   register unsigned int range = arith->range[1];
   register unsigned int code_minus_low = arith->code;
 
-  while (range <= 0x4000) {
+  while (range <= 0x40000000) {
 
     range <<= 1;
     code_minus_low <<= 1;
@@ -183,14 +183,14 @@ _schro_arith_decode_bit (SchroArith *arith, unsigned int 
i)
     }
   }
 
-  range_x_prob = (range * arith->probabilities[i]) >> 16;
+  range_x_prob = ((range >> 16) * arith->probabilities[i]) & 0xFFFF0000;
   lut_index = arith->probabilities[i]>>7 & ~1;
 
-  value = ((code_minus_low >> 16) >= range_x_prob);
+  value = (code_minus_low  >= range_x_prob);
   arith->probabilities[i] += arith->lut[lut_index | value];
 
   if (value) {
-    code_minus_low -= range_x_prob << 16;
+    code_minus_low -= range_x_prob;
     range -= range_x_prob;
   } else {
     range = range_x_prob;
-- 
1.5.5




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Schrodinger-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/schrodinger-devel

Reply via email to