| OLD | NEW |
| 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 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 VP8_BD_VALUE value = br->value; | 40 VP8_BD_VALUE value = br->value; |
| 41 int count = br->count; | 41 int count = br->count; |
| 42 int shift = VP8_BD_VALUE_SIZE - 8 - (count + 8); | 42 int shift = VP8_BD_VALUE_SIZE - 8 - (count + 8); |
| 43 size_t bytes_left = br->user_buffer_end - bufptr; | 43 size_t bytes_left = br->user_buffer_end - bufptr; |
| 44 size_t bits_left = bytes_left * CHAR_BIT; | 44 size_t bits_left = bytes_left * CHAR_BIT; |
| 45 int x = (int)(shift + CHAR_BIT - bits_left); | 45 int x = (int)(shift + CHAR_BIT - bits_left); |
| 46 int loop_end = 0; | 46 int loop_end = 0; |
| 47 unsigned char decrypted[sizeof(VP8_BD_VALUE) + 1]; | 47 unsigned char decrypted[sizeof(VP8_BD_VALUE) + 1]; |
| 48 | 48 |
| 49 if (br->decrypt_cb) { | 49 if (br->decrypt_cb) { |
| 50 int n = bytes_left > sizeof(decrypted) ? sizeof(decrypted) : bytes_left; | 50 size_t n = bytes_left > sizeof(decrypted) ? sizeof(decrypted) : bytes_le
ft; |
| 51 br->decrypt_cb(br->decrypt_state, bufptr, decrypted, n); | 51 br->decrypt_cb(br->decrypt_state, bufptr, decrypted, (int)n); |
| 52 bufptr = decrypted; | 52 bufptr = decrypted; |
| 53 } | 53 } |
| 54 | 54 |
| 55 if(x >= 0) | 55 if(x >= 0) |
| 56 { | 56 { |
| 57 count += VP8_LOTS_OF_BITS; | 57 count += VP8_LOTS_OF_BITS; |
| 58 loop_end = x; | 58 loop_end = x; |
| 59 } | 59 } |
| 60 | 60 |
| 61 if (x < 0 || bits_left) | 61 if (x < 0 || bits_left) |
| 62 { | 62 { |
| 63 while(shift >= loop_end) | 63 while(shift >= loop_end) |
| 64 { | 64 { |
| 65 count += CHAR_BIT; | 65 count += CHAR_BIT; |
| 66 value |= (VP8_BD_VALUE)*bufptr << shift; | 66 value |= (VP8_BD_VALUE)*bufptr << shift; |
| 67 ++bufptr; | 67 ++bufptr; |
| 68 ++br->user_buffer; | 68 ++br->user_buffer; |
| 69 shift -= CHAR_BIT; | 69 shift -= CHAR_BIT; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 br->value = value; | 73 br->value = value; |
| 74 br->count = count; | 74 br->count = count; |
| 75 } | 75 } |
| OLD | NEW |