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

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

Issue 812033011: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 5 years, 11 months 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_dthread.h ('k') | source/libvpx/vp9/decoder/vp9_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp9/decoder/vp9_read_bit_buffer.c
===================================================================
--- source/libvpx/vp9/decoder/vp9_read_bit_buffer.c (revision 293588)
+++ source/libvpx/vp9/decoder/vp9_read_bit_buffer.c (working copy)
@@ -10,20 +10,20 @@
#include "vp9/decoder/vp9_read_bit_buffer.h"
size_t vp9_rb_bytes_read(struct vp9_read_bit_buffer *rb) {
- return (rb->bit_offset + CHAR_BIT - 1) / CHAR_BIT;
+ return (rb->bit_offset + 7) >> 3;
}
int vp9_rb_read_bit(struct vp9_read_bit_buffer *rb) {
const size_t off = rb->bit_offset;
- const size_t p = off / CHAR_BIT;
- const int q = CHAR_BIT - 1 - (int)off % CHAR_BIT;
- if (rb->bit_buffer + p >= rb->bit_buffer_end) {
+ const size_t p = off >> 3;
+ const int q = 7 - (int)(off & 0x7);
+ if (rb->bit_buffer + p < rb->bit_buffer_end) {
+ const int bit = (rb->bit_buffer[p] >> q) & 1;
+ rb->bit_offset = off + 1;
+ return bit;
+ } else {
rb->error_handler(rb->error_handler_data);
return 0;
- } else {
- const int bit = (rb->bit_buffer[p] & (1 << q)) >> q;
- rb->bit_offset = off + 1;
- return bit;
}
}
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_dthread.h ('k') | source/libvpx/vp9/decoder/vp9_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698