diff vp56.h @ 12385:d0b25641338b libavcodec

VP5/6/8: ~7% faster arithmetic decoding Grab from the bitstream in 16-bit chunks instead of 8-bit chunks. TODO: grab in 32-bit chunks on 64-bit systems.
author darkshikari
date Thu, 12 Aug 2010 01:11:32 +0000
parents 7c54834209f6
children
line wrap: on
line diff
--- a/vp56.h	Wed Aug 11 14:18:52 2010 +0000
+++ b/vp56.h	Thu Aug 12 01:11:32 2010 +0000
@@ -194,8 +194,8 @@
     code_word <<= shift;
     bits       += shift;
     if(bits >= 0 && c->buffer < c->end) {
-        code_word |= *c->buffer++ << bits;
-        bits -= 8;
+        code_word |= bytestream_get_be16(&c->buffer) << bits;
+        bits -= 16;
     }
     c->bits = bits;
     return code_word;
@@ -211,7 +211,7 @@
 {
     unsigned int code_word = vp56_rac_renorm(c);
     unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
-    unsigned int low_shift = low << 8;
+    unsigned int low_shift = low << 16;
     int bit = code_word >= low_shift;
 
     c->high = bit ? c->high - low : low;
@@ -226,7 +226,7 @@
 {
     unsigned long code_word = vp56_rac_renorm(c);
     unsigned low = 1 + (((c->high - 1) * prob) >> 8);
-    unsigned low_shift = low << 8;
+    unsigned low_shift = low << 16;
 
     if (code_word >= low_shift) {
         c->high     -= low;
@@ -244,7 +244,7 @@
     unsigned int code_word = vp56_rac_renorm(c);
     /* equiprobable */
     int low = (c->high + 1) >> 1;
-    unsigned int low_shift = low << 8;
+    unsigned int low_shift = low << 16;
     int bit = code_word >= low_shift;
     if (bit) {
         c->high   -= low;