diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 69266575b8de300f5c862264f586405986a71238..54ae568c34fe10d93ba35dd4882686d23daa07aa 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -830,7 +830,9 @@ typedef struct TileBuffer { int col; // only used with multi-threaded decoding } TileBuffer; -static const uint8_t *decode_tiles(VP9D_COMP *pbi, const uint8_t *data) { +static const uint8_t *decode_tiles(VP9D_COMP *pbi, + const uint8_t *data, + const uint8_t *data_end) { VP9_COMMON *const cm = &pbi->common; MACROBLOCKD *const xd = &pbi->mb; const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols); @@ -838,7 +840,6 @@ static const uint8_t *decode_tiles(VP9D_COMP *pbi, const uint8_t *data) { const int tile_rows = 1 << cm->log2_tile_rows; TileBuffer tile_buffers[4][1 << 6]; int tile_row, tile_col; - const uint8_t *const data_end = pbi->source + pbi->source_sz; const uint8_t *end = NULL; vp9_reader r; @@ -931,10 +932,11 @@ static int compare_tile_buffers(const void *a, const void *b) { } } -static const uint8_t *decode_tiles_mt(VP9D_COMP *pbi, const uint8_t *data) { +static const uint8_t *decode_tiles_mt(VP9D_COMP *pbi, + const uint8_t *data, + const uint8_t *data_end) { VP9_COMMON *const cm = &pbi->common; const uint8_t *bit_reader_end = NULL; - const uint8_t *const data_end = pbi->source + pbi->source_sz; const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols); const int tile_cols = 1 << cm->log2_tile_cols; const int tile_rows = 1 << cm->log2_tile_rows; @@ -1314,14 +1316,13 @@ static void debug_check_frame_counts(const VP9_COMMON *const cm) { } #endif // NDEBUG -int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) { +int vp9_decode_frame(VP9D_COMP *pbi, + const uint8_t *data, const uint8_t *data_end, + const uint8_t **p_data_end) { int i; VP9_COMMON *const cm = &pbi->common; MACROBLOCKD *const xd = &pbi->mb; - const uint8_t *data = pbi->source; - const uint8_t *const data_end = pbi->source + pbi->source_sz; - struct vp9_read_bit_buffer rb = { data, data_end, 0, cm, error_handler }; const size_t first_partition_size = read_uncompressed_header(pbi, &rb); const int keyframe = cm->frame_type == KEY_FRAME; @@ -1378,9 +1379,9 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) { // single-frame tile decoding. if (pbi->oxcf.max_threads > 1 && tile_rows == 1 && tile_cols > 1 && cm->frame_parallel_decoding_mode) { - *p_data_end = decode_tiles_mt(pbi, data + first_partition_size); + *p_data_end = decode_tiles_mt(pbi, data + first_partition_size, data_end); } else { - *p_data_end = decode_tiles(pbi, data + first_partition_size); + *p_data_end = decode_tiles(pbi, data + first_partition_size, data_end); } new_fb->corrupted |= xd->corrupted; diff --git a/vp9/decoder/vp9_decodeframe.h b/vp9/decoder/vp9_decodeframe.h index 4537bc82484298b50350c7238b93c224eb523b7a..e474db495bae33857af2a624ed91bc9812e49eca 100644 --- a/vp9/decoder/vp9_decodeframe.h +++ b/vp9/decoder/vp9_decodeframe.h @@ -20,7 +20,10 @@ struct VP9Common; struct VP9Decompressor; void vp9_init_dequantizer(struct VP9Common *cm); -int vp9_decode_frame(struct VP9Decompressor *cpi, const uint8_t **p_data_end); + +int vp9_decode_frame(struct VP9Decompressor *pbi, + const uint8_t *data, const uint8_t *data_end, + const uint8_t **p_data_end); #ifdef __cplusplus } // extern "C" diff --git a/vp9/decoder/vp9_decoder.c b/vp9/decoder/vp9_decoder.c index ebb329cdb0fef10b8efa6b2205a8dc8dfe536a00..acdaafb4d9b338a8adfdeaeb0735c8a75aecb703 100644 --- a/vp9/decoder/vp9_decoder.c +++ b/vp9/decoder/vp9_decoder.c @@ -323,10 +323,7 @@ int vp9_receive_compressed_data(VP9D_COMP *pbi, cm = &pbi->common; cm->error.error_code = VPX_CODEC_OK; - pbi->source = source; - pbi->source_sz = size; - - if (pbi->source_sz == 0) { + if (size == 0) { /* This is used to signal that we are missing frames. * We do not know if the missing frame(s) was supposed to update * any of the reference buffers, but we act conservative and @@ -368,7 +365,7 @@ int vp9_receive_compressed_data(VP9D_COMP *pbi, cm->error.setjmp = 1; - retcode = vp9_decode_frame(pbi, psource); + retcode = vp9_decode_frame(pbi, source, source + size, psource); if (retcode < 0) { cm->error.error_code = VPX_CODEC_ERROR; @@ -430,7 +427,6 @@ int vp9_receive_compressed_data(VP9D_COMP *pbi, pbi->ready_for_new_data = 0; pbi->last_time_stamp = time_stamp; - pbi->source_sz = 0; cm->error.setjmp = 0; return retcode; diff --git a/vp9/decoder/vp9_decoder.h b/vp9/decoder/vp9_decoder.h index 4cbff451643608f61414d0d6ee4ee5e075167d46..c9859d774ce455d10d72dfe48657c47b37be3672 100644 --- a/vp9/decoder/vp9_decoder.h +++ b/vp9/decoder/vp9_decoder.h @@ -52,9 +52,6 @@ typedef struct VP9Decompressor { VP9D_CONFIG oxcf; - const uint8_t *source; - size_t source_sz; - int64_t last_time_stamp; int ready_for_new_data;