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

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

Issue 17009012: libvpx: Pull from upstream (Closed) Base URL: http://src.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 6 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/decodframe.c » ('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 207064)
+++ source/libvpx/vp8/decoder/dboolhuff.c (working copy)
@@ -14,16 +14,16 @@
int vp8dx_start_decode(BOOL_DECODER *br,
const unsigned char *source,
unsigned int source_sz,
- const unsigned char *origin,
- const unsigned char *key)
+ vp8_decrypt_cb *decrypt_cb,
+ void *decrypt_state)
{
br->user_buffer_end = source+source_sz;
br->user_buffer = source;
br->value = 0;
br->count = -8;
br->range = 255;
- br->origin = origin;
- br->key = key;
+ br->decrypt_cb = decrypt_cb;
+ br->decrypt_state = decrypt_state;
if (source_sz && !source)
return 1;
@@ -37,14 +37,21 @@
void vp8dx_bool_decoder_fill(BOOL_DECODER *br)
{
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;
+ size_t bytes_left = br->user_buffer_end - bufptr;
+ size_t bits_left = bytes_left * CHAR_BIT;
int x = (int)(shift + CHAR_BIT - bits_left);
int loop_end = 0;
+ unsigned char decrypted[sizeof(VP8_BD_VALUE) + 1];
+ if (br->decrypt_cb) {
+ int n = bytes_left > sizeof(decrypted) ? sizeof(decrypted) : bytes_left;
+ br->decrypt_cb(br->decrypt_state, bufptr, decrypted, n);
+ bufptr = decrypted;
+ }
+
if(x >= 0)
{
count += VP8_LOTS_OF_BITS;
@@ -56,14 +63,13 @@
while(shift >= loop_end)
{
count += CHAR_BIT;
- value |= ((VP8_BD_VALUE)decrypt_byte(bufptr, br->origin,
- br->key)) << shift;
+ value |= (VP8_BD_VALUE)*bufptr << shift;
++bufptr;
+ ++br->user_buffer;
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/decodframe.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698