OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "vp9/common/vp9_tile_common.h" | 11 #include "vp9/common/vp9_tile_common.h" |
12 | 12 |
| 13 #include "vp9/common/vp9_onyxc_int.h" |
| 14 |
13 #define MIN_TILE_WIDTH_B64 4 | 15 #define MIN_TILE_WIDTH_B64 4 |
14 #define MAX_TILE_WIDTH_B64 64 | 16 #define MAX_TILE_WIDTH_B64 64 |
15 | 17 |
16 static int to_sbs(n_mis) { | 18 static int to_sbs(n_mis) { |
17 return mi_cols_aligned_to_sb(n_mis) >> MI_BLOCK_SIZE_LOG2; | 19 return mi_cols_aligned_to_sb(n_mis) >> MI_BLOCK_SIZE_LOG2; |
18 } | 20 } |
19 | 21 |
20 static void vp9_get_tile_offsets(int *min_tile_off, int *max_tile_off, | 22 static void get_tile_offsets(int *min_tile_off, int *max_tile_off, |
21 int tile_idx, int log2_n_tiles, int n_mis) { | 23 int tile_idx, int log2_n_tiles, int n_mis) { |
22 const int n_sbs = to_sbs(n_mis); | 24 const int n_sbs = to_sbs(n_mis); |
23 const int sb_off1 = (tile_idx * n_sbs) >> log2_n_tiles; | 25 const int sb_off1 = (tile_idx * n_sbs) >> log2_n_tiles; |
24 const int sb_off2 = ((tile_idx + 1) * n_sbs) >> log2_n_tiles; | 26 const int sb_off2 = ((tile_idx + 1) * n_sbs) >> log2_n_tiles; |
25 | 27 |
26 *min_tile_off = MIN(sb_off1 << 3, n_mis); | 28 *min_tile_off = MIN(sb_off1 << 3, n_mis); |
27 *max_tile_off = MIN(sb_off2 << 3, n_mis); | 29 *max_tile_off = MIN(sb_off2 << 3, n_mis); |
28 } | 30 } |
29 | 31 |
30 void vp9_get_tile_col_offsets(VP9_COMMON *cm, int tile_col_idx) { | 32 void vp9_tile_init(TileInfo *tile, const VP9_COMMON *cm, |
31 vp9_get_tile_offsets(&cm->cur_tile_mi_col_start, &cm->cur_tile_mi_col_end, | 33 int row_idx, int col_idx) { |
32 tile_col_idx, cm->log2_tile_cols, cm->mi_cols); | 34 get_tile_offsets(&tile->mi_row_start, &tile->mi_row_end, |
| 35 row_idx, cm->log2_tile_rows, cm->mi_rows); |
| 36 get_tile_offsets(&tile->mi_col_start, &tile->mi_col_end, |
| 37 col_idx, cm->log2_tile_cols, cm->mi_cols); |
33 } | 38 } |
34 | 39 |
35 void vp9_get_tile_row_offsets(VP9_COMMON *cm, int tile_row_idx) { | |
36 vp9_get_tile_offsets(&cm->cur_tile_mi_row_start, &cm->cur_tile_mi_row_end, | |
37 tile_row_idx, cm->log2_tile_rows, cm->mi_rows); | |
38 } | |
39 | |
40 | |
41 void vp9_get_tile_n_bits(int mi_cols, | 40 void vp9_get_tile_n_bits(int mi_cols, |
42 int *min_log2_tile_cols, int *max_log2_tile_cols) { | 41 int *min_log2_tile_cols, int *max_log2_tile_cols) { |
43 const int sb_cols = to_sbs(mi_cols); | 42 const int sb_cols = to_sbs(mi_cols); |
44 int min_log2_n_tiles, max_log2_n_tiles; | 43 int min_log2_n_tiles, max_log2_n_tiles; |
45 | 44 |
46 for (max_log2_n_tiles = 0; | 45 for (max_log2_n_tiles = 0; |
47 (sb_cols >> max_log2_n_tiles) >= MIN_TILE_WIDTH_B64; | 46 (sb_cols >> max_log2_n_tiles) >= MIN_TILE_WIDTH_B64; |
48 max_log2_n_tiles++) {} | 47 max_log2_n_tiles++) {} |
49 max_log2_n_tiles--; | 48 max_log2_n_tiles--; |
50 if (max_log2_n_tiles < 0) | 49 if (max_log2_n_tiles < 0) |
51 max_log2_n_tiles = 0; | 50 max_log2_n_tiles = 0; |
52 | 51 |
53 for (min_log2_n_tiles = 0; | 52 for (min_log2_n_tiles = 0; |
54 (MAX_TILE_WIDTH_B64 << min_log2_n_tiles) < sb_cols; | 53 (MAX_TILE_WIDTH_B64 << min_log2_n_tiles) < sb_cols; |
55 min_log2_n_tiles++) {} | 54 min_log2_n_tiles++) {} |
56 | 55 |
57 assert(min_log2_n_tiles <= max_log2_n_tiles); | 56 assert(min_log2_n_tiles <= max_log2_n_tiles); |
58 | 57 |
59 *min_log2_tile_cols = min_log2_n_tiles; | 58 *min_log2_tile_cols = min_log2_n_tiles; |
60 *max_log2_tile_cols = max_log2_n_tiles; | 59 *max_log2_tile_cols = max_log2_n_tiles; |
61 } | 60 } |
OLD | NEW |