| 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, | 31 /*Decrypt n bytes of data from input -> output, using the decrypt_state |
| 32 const unsigned char *origin, | 32 passed in VP8D_SET_DECRYPTOR. |
| 33 const unsigned char *key) | 33 */ |
| 34 { | 34 typedef void (vp8_decrypt_cb)(void *decrypt_state, const unsigned char *input, |
| 35 #if CONFIG_DECRYPT | 35 unsigned char *output, int count); |
| 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 | 36 |
| 43 typedef struct | 37 typedef struct |
| 44 { | 38 { |
| 45 const unsigned char *user_buffer_end; | 39 const unsigned char *user_buffer_end; |
| 46 const unsigned char *user_buffer; | 40 const unsigned char *user_buffer; |
| 47 VP8_BD_VALUE value; | 41 VP8_BD_VALUE value; |
| 48 int count; | 42 int count; |
| 49 unsigned int range; | 43 unsigned int range; |
| 50 const unsigned char *origin; | 44 vp8_decrypt_cb *decrypt_cb; |
| 51 const unsigned char *key; | 45 void *decrypt_state; |
| 52 } BOOL_DECODER; | 46 } BOOL_DECODER; |
| 53 | 47 |
| 54 DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); | 48 DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); |
| 55 | 49 |
| 56 int vp8dx_start_decode(BOOL_DECODER *br, | 50 int vp8dx_start_decode(BOOL_DECODER *br, |
| 57 const unsigned char *source, | 51 const unsigned char *source, |
| 58 unsigned int source_sz, | 52 unsigned int source_sz, |
| 59 const unsigned char *origin, | 53 vp8_decrypt_cb *decrypt_cb, |
| 60 const unsigned char *key); | 54 void *decrypt_state); |
| 61 | 55 |
| 62 void vp8dx_bool_decoder_fill(BOOL_DECODER *br); | 56 void vp8dx_bool_decoder_fill(BOOL_DECODER *br); |
| 63 | 57 |
| 64 | 58 |
| 65 static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) { | 59 static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) { |
| 66 unsigned int bit = 0; | 60 unsigned int bit = 0; |
| 67 VP8_BD_VALUE value; | 61 VP8_BD_VALUE value; |
| 68 unsigned int split; | 62 unsigned int split; |
| 69 VP8_BD_VALUE bigsplit; | 63 VP8_BD_VALUE bigsplit; |
| 70 int count; | 64 int count; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 * stream was encountered. | 129 * stream was encountered. |
| 136 */ | 130 */ |
| 137 return 1; | 131 return 1; |
| 138 } | 132 } |
| 139 | 133 |
| 140 /* No error. */ | 134 /* No error. */ |
| 141 return 0; | 135 return 0; |
| 142 } | 136 } |
| 143 | 137 |
| 144 #endif // DBOOLHUFF_H_ | 138 #endif // DBOOLHUFF_H_ |
| OLD | NEW |