ref: 88a10abe7c1a6835c0b3f5be561d083d56615170
parent: 03781ff22da8e32fe67ce124ba07c3173f2d1fc0
author: Dmitry Kovalev <dkovalev@google.com>
date: Thu Mar 20 11:01:37 EDT 2014
Removing source & source_sz from VP9Decompressor struct. Change-Id: If4c1a48c60e8b27dd021a83170289ccc5467c6de
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -830,7 +830,9 @@
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 @@
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 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 @@
}
#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 @@
// 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;
--- a/vp9/decoder/vp9_decodeframe.h
+++ b/vp9/decoder/vp9_decodeframe.h
@@ -20,7 +20,10 @@
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"
--- a/vp9/decoder/vp9_decoder.c
+++ b/vp9/decoder/vp9_decoder.c
@@ -323,10 +323,7 @@
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 @@
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 @@
pbi->ready_for_new_data = 0;
pbi->last_time_stamp = time_stamp;
- pbi->source_sz = 0;
cm->error.setjmp = 0;
return retcode;
--- a/vp9/decoder/vp9_decoder.h
+++ b/vp9/decoder/vp9_decoder.h
@@ -52,9 +52,6 @@
VP9D_CONFIG oxcf;
- const uint8_t *source;
- size_t source_sz;
-
int64_t last_time_stamp;
int ready_for_new_data;
--
⑨