Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: source/libvpx/vp9/decoder/vp9_dboolhuff.c

Issue 111463005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_dboolhuff.h ('k') | source/libvpx/vp9/decoder/vp9_decodeframe.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp9/decoder/vp9_dboolhuff.c
===================================================================
--- source/libvpx/vp9/decoder/vp9_dboolhuff.c (revision 240950)
+++ source/libvpx/vp9/decoder/vp9_dboolhuff.c (working copy)
@@ -18,32 +18,28 @@
// Even relatively modest values like 100 would work fine.
#define LOTS_OF_BITS 0x40000000
-
int vp9_reader_init(vp9_reader *r, const uint8_t *buffer, size_t size) {
- int marker_bit;
-
- r->buffer_end = buffer + size;
- r->buffer = buffer;
- r->value = 0;
- r->count = -8;
- r->range = 255;
-
- if (size && !buffer)
+ if (size && !buffer) {
return 1;
-
- vp9_reader_fill(r);
- marker_bit = vp9_read_bit(r);
- return marker_bit != 0;
+ } else {
+ r->buffer_end = buffer + size;
+ r->buffer = buffer;
+ r->value = 0;
+ r->count = -8;
+ r->range = 255;
+ vp9_reader_fill(r);
+ return vp9_read_bit(r) != 0; // marker bit
+ }
}
void vp9_reader_fill(vp9_reader *r) {
const uint8_t *const buffer_end = r->buffer_end;
const uint8_t *buffer = r->buffer;
- VP9_BD_VALUE value = r->value;
+ BD_VALUE value = r->value;
int count = r->count;
- int shift = BD_VALUE_SIZE - 8 - (count + 8);
+ int shift = BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT);
int loop_end = 0;
- const int bits_left = (int)((buffer_end - buffer)*CHAR_BIT);
+ const int bits_left = (int)((buffer_end - buffer) * CHAR_BIT);
const int x = shift + CHAR_BIT - bits_left;
if (x >= 0) {
@@ -54,7 +50,7 @@
if (x < 0 || bits_left) {
while (shift >= loop_end) {
count += CHAR_BIT;
- value |= (VP9_BD_VALUE)*buffer++ << shift;
+ value |= (BD_VALUE)*buffer++ << shift;
shift -= CHAR_BIT;
}
}
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_dboolhuff.h ('k') | source/libvpx/vp9/decoder/vp9_decodeframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698