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

Side by Side Diff: source/libvpx/vp8/decoder/dboolhuff.c

Issue 1302353004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « source/libvpx/vp8/decoder/dboolhuff.h ('k') | source/libvpx/vp8/decoder/decodeframe.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 11
12 #include "dboolhuff.h" 12 #include "dboolhuff.h"
13 #include "vp8/common/common.h" 13 #include "vp8/common/common.h"
14 #include "vpx_dsp/vpx_dsp_common.h"
14 15
15 int vp8dx_start_decode(BOOL_DECODER *br, 16 int vp8dx_start_decode(BOOL_DECODER *br,
16 const unsigned char *source, 17 const unsigned char *source,
17 unsigned int source_sz, 18 unsigned int source_sz,
18 vpx_decrypt_cb decrypt_cb, 19 vpx_decrypt_cb decrypt_cb,
19 void *decrypt_state) 20 void *decrypt_state)
20 { 21 {
21 br->user_buffer_end = source+source_sz; 22 br->user_buffer_end = source+source_sz;
22 br->user_buffer = source; 23 br->user_buffer = source;
23 br->value = 0; 24 br->value = 0;
(...skipping 17 matching lines...) Expand all
41 VP8_BD_VALUE value = br->value; 42 VP8_BD_VALUE value = br->value;
42 int count = br->count; 43 int count = br->count;
43 int shift = VP8_BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT); 44 int shift = VP8_BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT);
44 size_t bytes_left = br->user_buffer_end - bufptr; 45 size_t bytes_left = br->user_buffer_end - bufptr;
45 size_t bits_left = bytes_left * CHAR_BIT; 46 size_t bits_left = bytes_left * CHAR_BIT;
46 int x = (int)(shift + CHAR_BIT - bits_left); 47 int x = (int)(shift + CHAR_BIT - bits_left);
47 int loop_end = 0; 48 int loop_end = 0;
48 unsigned char decrypted[sizeof(VP8_BD_VALUE) + 1]; 49 unsigned char decrypted[sizeof(VP8_BD_VALUE) + 1];
49 50
50 if (br->decrypt_cb) { 51 if (br->decrypt_cb) {
51 size_t n = MIN(sizeof(decrypted), bytes_left); 52 size_t n = VPXMIN(sizeof(decrypted), bytes_left);
52 br->decrypt_cb(br->decrypt_state, bufptr, decrypted, (int)n); 53 br->decrypt_cb(br->decrypt_state, bufptr, decrypted, (int)n);
53 bufptr = decrypted; 54 bufptr = decrypted;
54 } 55 }
55 56
56 if(x >= 0) 57 if(x >= 0)
57 { 58 {
58 count += VP8_LOTS_OF_BITS; 59 count += VP8_LOTS_OF_BITS;
59 loop_end = x; 60 loop_end = x;
60 } 61 }
61 62
62 if (x < 0 || bits_left) 63 if (x < 0 || bits_left)
63 { 64 {
64 while(shift >= loop_end) 65 while(shift >= loop_end)
65 { 66 {
66 count += CHAR_BIT; 67 count += CHAR_BIT;
67 value |= (VP8_BD_VALUE)*bufptr << shift; 68 value |= (VP8_BD_VALUE)*bufptr << shift;
68 ++bufptr; 69 ++bufptr;
69 ++br->user_buffer; 70 ++br->user_buffer;
70 shift -= CHAR_BIT; 71 shift -= CHAR_BIT;
71 } 72 }
72 } 73 }
73 74
74 br->value = value; 75 br->value = value;
75 br->count = count; 76 br->count = count;
76 } 77 }
OLDNEW
« no previous file with comments | « source/libvpx/vp8/decoder/dboolhuff.h ('k') | source/libvpx/vp8/decoder/decodeframe.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698