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

Side by Side Diff: source/libvpx/vpx_dsp/bitreader.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/vpx_dsp/arm/vpx_convolve_neon.c ('k') | source/libvpx/vpx_dsp/fastssim.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 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 30 matching lines...) Expand all
41 const uint8_t *const buffer_end = r->buffer_end; 41 const uint8_t *const buffer_end = r->buffer_end;
42 const uint8_t *buffer = r->buffer; 42 const uint8_t *buffer = r->buffer;
43 const uint8_t *buffer_start = buffer; 43 const uint8_t *buffer_start = buffer;
44 BD_VALUE value = r->value; 44 BD_VALUE value = r->value;
45 int count = r->count; 45 int count = r->count;
46 const size_t bytes_left = buffer_end - buffer; 46 const size_t bytes_left = buffer_end - buffer;
47 const size_t bits_left = bytes_left * CHAR_BIT; 47 const size_t bits_left = bytes_left * CHAR_BIT;
48 int shift = BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT); 48 int shift = BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT);
49 49
50 if (r->decrypt_cb) { 50 if (r->decrypt_cb) {
51 size_t n = MIN(sizeof(r->clear_buffer), bytes_left); 51 size_t n = VPXMIN(sizeof(r->clear_buffer), bytes_left);
52 r->decrypt_cb(r->decrypt_state, buffer, r->clear_buffer, (int)n); 52 r->decrypt_cb(r->decrypt_state, buffer, r->clear_buffer, (int)n);
53 buffer = r->clear_buffer; 53 buffer = r->clear_buffer;
54 buffer_start = r->clear_buffer; 54 buffer_start = r->clear_buffer;
55 } 55 }
56 if (bits_left > BD_VALUE_SIZE) { 56 if (bits_left > BD_VALUE_SIZE) {
57 const int bits = (shift & 0xfffffff8) + CHAR_BIT; 57 const int bits = (shift & 0xfffffff8) + CHAR_BIT;
58 BD_VALUE nv; 58 BD_VALUE nv;
59 BD_VALUE big_endian_values; 59 BD_VALUE big_endian_values;
60 memcpy(&big_endian_values, buffer, sizeof(BD_VALUE)); 60 memcpy(&big_endian_values, buffer, sizeof(BD_VALUE));
61 #if SIZE_MAX == 0xffffffffffffffffULL 61 #if SIZE_MAX == 0xffffffffffffffffULL
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 const uint8_t *vpx_reader_find_end(vpx_reader *r) { 95 const uint8_t *vpx_reader_find_end(vpx_reader *r) {
96 // Find the end of the coded buffer 96 // Find the end of the coded buffer
97 while (r->count > CHAR_BIT && r->count < BD_VALUE_SIZE) { 97 while (r->count > CHAR_BIT && r->count < BD_VALUE_SIZE) {
98 r->count -= CHAR_BIT; 98 r->count -= CHAR_BIT;
99 r->buffer--; 99 r->buffer--;
100 } 100 }
101 return r->buffer; 101 return r->buffer;
102 } 102 }
OLDNEW
« no previous file with comments | « source/libvpx/vpx_dsp/arm/vpx_convolve_neon.c ('k') | source/libvpx/vpx_dsp/fastssim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698