Commit 88a10abe authored by Dmitry Kovalev's avatar Dmitry Kovalev

Removing source & source_sz from VP9Decompressor struct.

Change-Id: If4c1a48c60e8b27dd021a83170289ccc5467c6de
parent 03781ff2
......@@ -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;
......
......@@ -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"
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment