From: Jonathan Rosser <[EMAIL PROTECTED]>
Signed-off-by: David Flynn <[EMAIL PROTECTED]>
---
schroedinger/schroarith.c | 6 +++---
schroedinger/schroarith.h | 16 +++++++++-------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/schroedinger/schroarith.c b/schroedinger/schroarith.c
index e5c9847..224c34b 100644
--- a/schroedinger/schroarith.c
+++ b/schroedinger/schroarith.c
@@ -153,10 +153,10 @@ schro_arith_decode_init (SchroArith *arith, SchroBuffer
*buffer)
size = arith->buffer->length;
arith->dataptr = arith->buffer->data;
- arith->code = ((size > 0) ? arith->dataptr[0] : 0xff) << 8;
- arith->code |= ((size > 1) ? arith->dataptr[1] : 0xff);
+ arith->code = ((size > 0) ? arith->dataptr[0] : 0xff) << 16;
+ arith->code |= ((size > 1) ? arith->dataptr[1] : 0xff) << 8;
+ arith->code |= ((size > 2) ? arith->dataptr[2] : 0xff);
arith->offset = 2;
- arith->shift = (size > 2) ? arith->dataptr[2] : 0xff;
for(i=0;i<SCHRO_CTX_LAST;i++){
arith->contexts[i].next = next_list[i];
diff --git a/schroedinger/schroarith.h b/schroedinger/schroarith.h
index 7d346ea..42f6ca7 100644
--- a/schroedinger/schroarith.h
+++ b/schroedinger/schroarith.h
@@ -156,26 +156,27 @@ _schro_arith_decode_bit (SchroArith *arith, unsigned int
i)
unsigned int range_x_prob;
unsigned int value;
unsigned int lut_index;
+ unsigned int code16=arith->code >> 8;
while (arith->range[1] <= 0x4000) {
arith->range[0] <<= 1;
arith->range[1] <<= 1;
arith->code <<= 1;
- arith->code |= (arith->shift >> (arith->cntr-1))&1;
if (!--arith->cntr) {
arith->offset++;
if (arith->offset < arith->buffer->length) {
- arith->shift = arith->dataptr[arith->offset];
+ arith->code |= arith->dataptr[arith->offset];
} else {
- arith->shift = 0xff;
+ arith->code |= 0xff;
}
arith->range[0] &= 0xffff;
- arith->code &= 0xffff;
+ arith->code &= 0xffffff;
+ code16 = arith->code >> 8;
- if (arith->code < arith->range[0]) {
- arith->code |= (1<<16);
+ if (code16 < arith->range[0]) {
+ arith->code |= (1<<24);
}
arith->cntr = 8;
}
@@ -184,7 +185,8 @@ _schro_arith_decode_bit (SchroArith *arith, unsigned int i)
range_x_prob = (arith->range[1] * arith->probabilities[i]) >> 16;
lut_index = arith->probabilities[i]>>7 & ~1;
- value = (arith->code - arith->range[0] >= range_x_prob);
+ code16 = arith->code >> 8;
+ value = (code16 - arith->range[0] >= range_x_prob);
arith->probabilities[i] += arith->lut[lut_index | value];
if (value) {
--
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