diff options
author | Ronald S. Bultje <rbultje@google.com> | 2013-02-06 15:30:21 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2013-02-12 10:33:34 -0800 |
commit | f496f601fb2e48390c822f89df60c6b2398026ab (patch) | |
tree | b186833c71ad1a6b741a567894ea5be2d5ddb35c /vp9/common/vp9_tile_common.c | |
parent | cb00be1fa20c1a3955d62c1939646f4fd5d31224 (diff) | |
download | libvpx-f496f601fb2e48390c822f89df60c6b2398026ab.tar libvpx-f496f601fb2e48390c822f89df60c6b2398026ab.tar.gz libvpx-f496f601fb2e48390c822f89df60c6b2398026ab.tar.bz2 libvpx-f496f601fb2e48390c822f89df60c6b2398026ab.zip |
Add tile column size limits (256 pixels min, 4096 pixels max).
This is after discussion with the hardware team. Update the unit test
to take these sizes into account. Split out some duplicate code into
a separate file so it can be shared.
Change-Id: I8311d11b0191d8bb37e8eb4ac962beb217e1bff5
Diffstat (limited to 'vp9/common/vp9_tile_common.c')
-rw-r--r-- | vp9/common/vp9_tile_common.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vp9/common/vp9_tile_common.c b/vp9/common/vp9_tile_common.c new file mode 100644 index 000000000..02e0d1461 --- /dev/null +++ b/vp9/common/vp9_tile_common.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "vp9/common/vp9_tile_common.h" + +void vp9_get_tile_offsets(VP9_COMMON *cm, int *min_tile_off, + int *max_tile_off) { + const int log2_n_tiles = cm->log2_tile_columns; + const int tile_idx = cm->cur_tile_idx; + const int mb_cols = cm->mb_cols; + const int sb_cols = (mb_cols + 3) >> 2; + const int sb_off1 = (tile_idx * sb_cols) >> log2_n_tiles; + const int sb_off2 = ((tile_idx + 1) * sb_cols) >> log2_n_tiles; + + *min_tile_off = (sb_off1 << 2) > mb_cols ? mb_cols : (sb_off1 << 2); + *max_tile_off = (sb_off2 << 2) > mb_cols ? mb_cols : (sb_off2 << 2); +} + +#define MIN_TILE_WIDTH_SBS (MIN_TILE_WIDTH >> 6) +#define MAX_TILE_WIDTH_SBS (MAX_TILE_WIDTH >> 6) + +void vp9_get_tile_n_bits(VP9_COMMON *cm, int *min_log2_n_tiles_ptr, + int *delta_log2_n_tiles) { + const int sb_cols = (cm->mb_cols + 3) >> 2; + int min_log2_n_tiles, max_log2_n_tiles; + + for (max_log2_n_tiles = 0; + (sb_cols >> max_log2_n_tiles) >= MIN_TILE_WIDTH_SBS; + max_log2_n_tiles++) {} + for (min_log2_n_tiles = 0; + (MAX_TILE_WIDTH_SBS << min_log2_n_tiles) < sb_cols; + min_log2_n_tiles++) {} + + *min_log2_n_tiles_ptr = min_log2_n_tiles; + *delta_log2_n_tiles = max_log2_n_tiles - min_log2_n_tiles; +} |