| 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 |
| 11 | 11 |
| 12 #include "dboolhuff.h" | 12 #include "dboolhuff.h" |
| 13 | 13 |
| 14 int vp8dx_start_decode(BOOL_DECODER *br, | 14 int vp8dx_start_decode(BOOL_DECODER *br, |
| 15 const unsigned char *source, | 15 const unsigned char *source, |
| 16 unsigned int source_sz) | 16 unsigned int source_sz, |
| 17 const unsigned char *origin, |
| 18 const unsigned char *key) |
| 17 { | 19 { |
| 18 br->user_buffer_end = source+source_sz; | 20 br->user_buffer_end = source+source_sz; |
| 19 br->user_buffer = source; | 21 br->user_buffer = source; |
| 20 br->value = 0; | 22 br->value = 0; |
| 21 br->count = -8; | 23 br->count = -8; |
| 22 br->range = 255; | 24 br->range = 255; |
| 25 br->origin = origin; |
| 26 br->key = key; |
| 23 | 27 |
| 24 if (source_sz && !source) | 28 if (source_sz && !source) |
| 25 return 1; | 29 return 1; |
| 26 | 30 |
| 27 /* Populate the buffer */ | 31 /* Populate the buffer */ |
| 28 vp8dx_bool_decoder_fill(br); | 32 vp8dx_bool_decoder_fill(br); |
| 29 | 33 |
| 30 return 0; | 34 return 0; |
| 31 } | 35 } |
| 32 | 36 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 45 { | 49 { |
| 46 count += VP8_LOTS_OF_BITS; | 50 count += VP8_LOTS_OF_BITS; |
| 47 loop_end = x; | 51 loop_end = x; |
| 48 } | 52 } |
| 49 | 53 |
| 50 if (x < 0 || bits_left) | 54 if (x < 0 || bits_left) |
| 51 { | 55 { |
| 52 while(shift >= loop_end) | 56 while(shift >= loop_end) |
| 53 { | 57 { |
| 54 count += CHAR_BIT; | 58 count += CHAR_BIT; |
| 55 value |= (VP8_BD_VALUE)*bufptr++ << shift; | 59 value |= ((VP8_BD_VALUE)decrypt_byte(bufptr, br->origin, |
| 60 br->key)) << shift; |
| 61 ++bufptr; |
| 56 shift -= CHAR_BIT; | 62 shift -= CHAR_BIT; |
| 57 } | 63 } |
| 58 } | 64 } |
| 59 | 65 |
| 60 br->user_buffer = bufptr; | 66 br->user_buffer = bufptr; |
| 61 br->value = value; | 67 br->value = value; |
| 62 br->count = count; | 68 br->count = count; |
| 63 } | 69 } |
| OLD | NEW |