| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 typedef size_t VP8_BD_VALUE; | 22 typedef size_t VP8_BD_VALUE; |
| 23 | 23 |
| 24 #define VP8_BD_VALUE_SIZE ((int)sizeof(VP8_BD_VALUE)*CHAR_BIT) | 24 #define VP8_BD_VALUE_SIZE ((int)sizeof(VP8_BD_VALUE)*CHAR_BIT) |
| 25 | 25 |
| 26 /*This is meant to be a large, positive constant that can still be efficiently | 26 /*This is meant to be a large, positive constant that can still be efficiently |
| 27 loaded as an immediate (on platforms like ARM, for example). | 27 loaded as an immediate (on platforms like ARM, for example). |
| 28 Even relatively modest values like 100 would work fine.*/ | 28 Even relatively modest values like 100 would work fine.*/ |
| 29 #define VP8_LOTS_OF_BITS (0x40000000) | 29 #define VP8_LOTS_OF_BITS (0x40000000) |
| 30 | 30 |
| 31 static unsigned char decrypt_byte(const unsigned char *ch, |
| 32 const unsigned char *origin, |
| 33 const unsigned char *key) |
| 34 { |
| 35 #if CONFIG_DECRYPT |
| 36 const int offset = (int)(ch - origin); |
| 37 return *ch ^ key[offset % 32]; // VP8_DECRYPT_KEY_SIZE |
| 38 #else |
| 39 return *ch; |
| 40 #endif |
| 41 } |
| 42 |
| 31 typedef struct | 43 typedef struct |
| 32 { | 44 { |
| 33 const unsigned char *user_buffer_end; | 45 const unsigned char *user_buffer_end; |
| 34 const unsigned char *user_buffer; | 46 const unsigned char *user_buffer; |
| 35 VP8_BD_VALUE value; | 47 VP8_BD_VALUE value; |
| 36 int count; | 48 int count; |
| 37 unsigned int range; | 49 unsigned int range; |
| 50 const unsigned char *origin; |
| 51 const unsigned char *key; |
| 38 } BOOL_DECODER; | 52 } BOOL_DECODER; |
| 39 | 53 |
| 40 DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); | 54 DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); |
| 41 | 55 |
| 42 int vp8dx_start_decode(BOOL_DECODER *br, | 56 int vp8dx_start_decode(BOOL_DECODER *br, |
| 43 const unsigned char *source, | 57 const unsigned char *source, |
| 44 unsigned int source_sz); | 58 unsigned int source_sz, |
| 59 const unsigned char *origin, |
| 60 const unsigned char *key); |
| 45 | 61 |
| 46 void vp8dx_bool_decoder_fill(BOOL_DECODER *br); | 62 void vp8dx_bool_decoder_fill(BOOL_DECODER *br); |
| 47 | 63 |
| 48 | 64 |
| 49 static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) { | 65 static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) { |
| 50 unsigned int bit = 0; | 66 unsigned int bit = 0; |
| 51 VP8_BD_VALUE value; | 67 VP8_BD_VALUE value; |
| 52 unsigned int split; | 68 unsigned int split; |
| 53 VP8_BD_VALUE bigsplit; | 69 VP8_BD_VALUE bigsplit; |
| 54 int count; | 70 int count; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 * stream was encountered. | 135 * stream was encountered. |
| 120 */ | 136 */ |
| 121 return 1; | 137 return 1; |
| 122 } | 138 } |
| 123 | 139 |
| 124 /* No error. */ | 140 /* No error. */ |
| 125 return 0; | 141 return 0; |
| 126 } | 142 } |
| 127 | 143 |
| 128 #endif // DBOOLHUFF_H_ | 144 #endif // DBOOLHUFF_H_ |
| OLD | NEW |