obu: Use correct tile for CDF adaptation
Move the "largest tile size" value from read_tile_buffers()
into the AV1_COMMON structure, so that it can be preserved across
calls. Additionally, only reset the largest tile id once per frame,
rather than once per tile group.
BUG=aomedia:1245
Change-Id: Ia9b96047bcd4e72b1bed24f78d2914505686262c
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 3cfd3db..d8d3ed0 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -249,7 +249,9 @@
// support additional planes.
int subsampling_x;
int subsampling_y;
+
int largest_tile_id;
+ size_t largest_tile_size;
// Scale of the current frame with respect to itself.
struct scale_factors sf_identity;
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 2602c28..d2d5ae7 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1838,8 +1838,11 @@
int tile_group_start_row = 0;
#endif
- size_t max_tile_size = 0;
- cm->largest_tile_id = 0;
+ if (startTile == 0) {
+ cm->largest_tile_size = 0;
+ cm->largest_tile_id = 0;
+ }
+
for (int r = 0; r < tile_rows; ++r) {
for (int c = 0; c < tile_cols; ++c, ++tc) {
TileBufferDec *const buf = &tile_buffers[r][c];
@@ -1884,8 +1887,8 @@
cm->tile_group_start_row[r][c] = tile_group_start_row;
cm->tile_group_start_col[r][c] = tile_group_start_col;
#endif
- if (buf->size > max_tile_size) {
- max_tile_size = buf->size;
+ if (buf->size > cm->largest_tile_size) {
+ cm->largest_tile_size = buf->size;
cm->largest_tile_id = r * tile_cols + c;
}
}