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);
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;
}
}
-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;
}
#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;
// 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;
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
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;
pbi->ready_for_new_data = 0;
pbi->last_time_stamp = time_stamp;
- pbi->source_sz = 0;
cm->error.setjmp = 0;
return retcode;