diff options
author | Joey Parrish <joeyparrish@google.com> | 2014-04-15 14:10:58 -0700 |
---|---|---|
committer | Joey Parrish <joeyparrish@google.com> | 2014-04-23 16:11:54 -0700 |
commit | 18c08607e0a216962fd3df4f7926ce288ee81b9b (patch) | |
tree | 471f1eafca2091dc47a18288b6999165d5ac2a7b /vp8/decoder | |
parent | dddc3c6906f0d840935214ab0b26ea9a6e06cc27 (diff) | |
download | libvpx-18c08607e0a216962fd3df4f7926ce288ee81b9b.tar libvpx-18c08607e0a216962fd3df4f7926ce288ee81b9b.tar.gz libvpx-18c08607e0a216962fd3df4f7926ce288ee81b9b.tar.bz2 libvpx-18c08607e0a216962fd3df4f7926ce288ee81b9b.zip |
Add VPXD_SET_DECRYPTOR support to the VP9 decoder.
Change-Id: I88f86c8ff9af34e0b6531028b691921b54c2fc48
Diffstat (limited to 'vp8/decoder')
-rw-r--r-- | vp8/decoder/dboolhuff.c | 7 | ||||
-rw-r--r-- | vp8/decoder/dboolhuff.h | 11 | ||||
-rw-r--r-- | vp8/decoder/decodeframe.c | 4 | ||||
-rw-r--r-- | vp8/decoder/error_concealment.c | 4 | ||||
-rw-r--r-- | vp8/decoder/onyxd_int.h | 2 |
5 files changed, 11 insertions, 17 deletions
diff --git a/vp8/decoder/dboolhuff.c b/vp8/decoder/dboolhuff.c index 0007d7a7a..b874d4c46 100644 --- a/vp8/decoder/dboolhuff.c +++ b/vp8/decoder/dboolhuff.c @@ -10,11 +10,12 @@ #include "dboolhuff.h" +#include "vp8/common/common.h" int vp8dx_start_decode(BOOL_DECODER *br, const unsigned char *source, unsigned int source_sz, - vp8_decrypt_cb *decrypt_cb, + vpx_decrypt_cb decrypt_cb, void *decrypt_state) { br->user_buffer_end = source+source_sz; @@ -39,7 +40,7 @@ void vp8dx_bool_decoder_fill(BOOL_DECODER *br) const unsigned char *bufptr = br->user_buffer; VP8_BD_VALUE value = br->value; int count = br->count; - int shift = VP8_BD_VALUE_SIZE - 8 - (count + 8); + int shift = VP8_BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT); size_t bytes_left = br->user_buffer_end - bufptr; size_t bits_left = bytes_left * CHAR_BIT; int x = (int)(shift + CHAR_BIT - bits_left); @@ -47,7 +48,7 @@ void vp8dx_bool_decoder_fill(BOOL_DECODER *br) unsigned char decrypted[sizeof(VP8_BD_VALUE) + 1]; if (br->decrypt_cb) { - size_t n = bytes_left > sizeof(decrypted) ? sizeof(decrypted) : bytes_left; + size_t n = MIN(sizeof(decrypted), bytes_left); br->decrypt_cb(br->decrypt_state, bufptr, decrypted, (int)n); bufptr = decrypted; } diff --git a/vp8/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h index 36af7eed5..51c5adc28 100644 --- a/vp8/decoder/dboolhuff.h +++ b/vp8/decoder/dboolhuff.h @@ -17,6 +17,7 @@ #include "vpx_config.h" #include "vpx_ports/mem.h" +#include "vpx/vp8dx.h" #include "vpx/vpx_integer.h" #ifdef __cplusplus @@ -32,12 +33,6 @@ typedef size_t VP8_BD_VALUE; Even relatively modest values like 100 would work fine.*/ #define VP8_LOTS_OF_BITS (0x40000000) -/*Decrypt n bytes of data from input -> output, using the decrypt_state - passed in VP8D_SET_DECRYPTOR. -*/ -typedef void (vp8_decrypt_cb)(void *decrypt_state, const unsigned char *input, - unsigned char *output, int count); - typedef struct { const unsigned char *user_buffer_end; @@ -45,7 +40,7 @@ typedef struct VP8_BD_VALUE value; int count; unsigned int range; - vp8_decrypt_cb *decrypt_cb; + vpx_decrypt_cb decrypt_cb; void *decrypt_state; } BOOL_DECODER; @@ -54,7 +49,7 @@ DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); int vp8dx_start_decode(BOOL_DECODER *br, const unsigned char *source, unsigned int source_sz, - vp8_decrypt_cb *decrypt_cb, + vpx_decrypt_cb decrypt_cb, void *decrypt_state); void vp8dx_bool_decoder_fill(BOOL_DECODER *br); diff --git a/vp8/decoder/decodeframe.c b/vp8/decoder/decodeframe.c index 14f611ad9..e7cf0d9b9 100644 --- a/vp8/decoder/decodeframe.c +++ b/vp8/decoder/decodeframe.c @@ -17,6 +17,7 @@ #include "vp8/common/reconintra4x4.h" #include "vp8/common/reconinter.h" #include "detokenize.h" +#include "vp8/common/common.h" #include "vp8/common/invtrans.h" #include "vp8/common/alloccommon.h" #include "vp8/common/entropymode.h" @@ -1018,8 +1019,7 @@ int vp8_decode_frame(VP8D_COMP *pbi) const unsigned char *clear = data; if (pbi->decrypt_cb) { - int n = (int)(data_end - data); - if (n > 10) n = 10; + int n = (int)MIN(sizeof(clear_buffer), data_end - data); pbi->decrypt_cb(pbi->decrypt_state, data, clear_buffer, n); clear = clear_buffer; } diff --git a/vp8/decoder/error_concealment.c b/vp8/decoder/error_concealment.c index 0b58c98fd..4b304c83c 100644 --- a/vp8/decoder/error_concealment.c +++ b/vp8/decoder/error_concealment.c @@ -15,9 +15,7 @@ #include "decodemv.h" #include "vpx_mem/vpx_mem.h" #include "vp8/common/findnearmv.h" - -#define MIN(x,y) (((x)<(y))?(x):(y)) -#define MAX(x,y) (((x)>(y))?(x):(y)) +#include "vp8/common/common.h" #define FLOOR(x,q) ((x) & -(1 << (q))) diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h index 8ef489403..aa2cc57f7 100644 --- a/vp8/decoder/onyxd_int.h +++ b/vp8/decoder/onyxd_int.h @@ -126,7 +126,7 @@ typedef struct VP8D_COMP int independent_partitions; int frame_corrupt_residual; - vp8_decrypt_cb *decrypt_cb; + vpx_decrypt_cb decrypt_cb; void *decrypt_state; } VP8D_COMP; |