From: David Flynn <[EMAIL PROTECTED]>
Changing the LUT to be interleaved should:
- reduce number of instructions required to calculate LUT index
- improve cache performance (we could prefetch the entry we are
after, we'll only ever be wrong by one entry, which means the
odds of fetching the wrong line are sizeof(lutentry)/64.
Signed-off-by: David Flynn <[EMAIL PROTECTED]>
---
schroedinger/schroarith.c | 4 ++--
schroedinger/schroarith.h | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/schroedinger/schroarith.c b/schroedinger/schroarith.c
index c8cd587..5d3ead4 100644
--- a/schroedinger/schroarith.c
+++ b/schroedinger/schroarith.c
@@ -163,8 +163,8 @@ schro_arith_decode_init (SchroArith *arith, SchroBuffer
*buffer)
}
for(i=0;i<256;i++){
- arith->lut[i] = lut[255-i];
- arith->lut[256+i] = -lut[i];
+ arith->lut[2*i] = lut[255-i];
+ arith->lut[2*i+1] = -lut[i];
}
}
diff --git a/schroedinger/schroarith.h b/schroedinger/schroarith.h
index 229783d..58ed48b 100644
--- a/schroedinger/schroarith.h
+++ b/schroedinger/schroarith.h
@@ -158,10 +158,11 @@ _schro_arith_decode_bit (SchroArith *arith, int i)
unsigned int lut_index;
range_x_prob = (arith->range[1] * arith->probabilities[i]) >> 16;
- lut_index = arith->probabilities[i]>>8;
+ lut_index = arith->probabilities[i]>>7 & ~1;
value = (arith->code - arith->range[0] >= range_x_prob);
- arith->probabilities[i] += arith->lut[(value<<8) | lut_index];
+ arith->probabilities[i] += arith->lut[lut_index | value];
+
if (value) {
arith->range[0] += range_x_prob;
arith->range[1] -= 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