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

Unified Diff: source/libvpx/vp8/decoder/dboolhuff.c

Issue 13042014: Description: (Closed) Base URL: https://src.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: libvpx: Pull from upstream Created 7 years, 9 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/vp8/decoder/dboolhuff.h ('k') | source/libvpx/vp8/decoder/decodemv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp8/decoder/dboolhuff.c
===================================================================
--- source/libvpx/vp8/decoder/dboolhuff.c (revision 191025)
+++ source/libvpx/vp8/decoder/dboolhuff.c (working copy)
@@ -10,8 +10,6 @@
#include "dboolhuff.h"
-#include "vpx_ports/mem.h"
-#include "vpx_mem/vpx_mem.h"
int vp8dx_start_decode(BOOL_DECODER *br,
const unsigned char *source,
@@ -32,20 +30,33 @@
return 0;
}
-
void vp8dx_bool_decoder_fill(BOOL_DECODER *br)
{
- const unsigned char *bufptr;
- const unsigned char *bufend;
- VP8_BD_VALUE value;
- int count;
- bufend = br->user_buffer_end;
- bufptr = br->user_buffer;
- value = br->value;
- count = br->count;
+ const unsigned char *bufptr = br->user_buffer;
+ const unsigned char *bufend = br->user_buffer_end;
+ VP8_BD_VALUE value = br->value;
+ int count = br->count;
+ int shift = VP8_BD_VALUE_SIZE - 8 - (count + 8);
+ size_t bits_left = (bufend - bufptr)*CHAR_BIT;
+ int x = (int)(shift + CHAR_BIT - bits_left);
+ int loop_end = 0;
- VP8DX_BOOL_DECODER_FILL(count, value, bufptr, bufend);
+ if(x >= 0)
+ {
+ count += VP8_LOTS_OF_BITS;
+ loop_end = x;
+ }
+ if (x < 0 || bits_left)
+ {
+ while(shift >= loop_end)
+ {
+ count += CHAR_BIT;
+ value |= (VP8_BD_VALUE)*bufptr++ << shift;
+ shift -= CHAR_BIT;
+ }
+ }
+
br->user_buffer = bufptr;
br->value = value;
br->count = count;
« no previous file with comments | « source/libvpx/vp8/decoder/dboolhuff.h ('k') | source/libvpx/vp8/decoder/decodemv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698