Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Side by Side Diff: source/libvpx/vp9/common/vp9_tile_common.c

Issue 111463005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/common/vp9_tile_common.h ('k') | source/libvpx/vp9/common/vp9_treecoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 13 #include "vp9/common/vp9_onyxc_int.h"
14 14
15 #define MIN_TILE_WIDTH_B64 4 15 #define MIN_TILE_WIDTH_B64 4
16 #define MAX_TILE_WIDTH_B64 64 16 #define MAX_TILE_WIDTH_B64 64
17 17
18 static int to_sbs(n_mis) { 18 static int get_tile_offset(int idx, int mis, int log2) {
19 return mi_cols_aligned_to_sb(n_mis) >> MI_BLOCK_SIZE_LOG2; 19 const int sb_cols = mi_cols_aligned_to_sb(mis) >> MI_BLOCK_SIZE_LOG2;
20 const int offset = ((idx * sb_cols) >> log2) << MI_BLOCK_SIZE_LOG2;
21 return MIN(offset, mis);
20 } 22 }
21 23
22 static void get_tile_offsets(int *min_tile_off, int *max_tile_off, 24 void vp9_tile_init(TileInfo *tile, const VP9_COMMON *cm, int row, int col) {
23 int tile_idx, int log2_n_tiles, int n_mis) { 25 tile->mi_row_start = get_tile_offset(row, cm->mi_rows, cm->log2_tile_rows);
24 const int n_sbs = to_sbs(n_mis); 26 tile->mi_row_end = get_tile_offset(row + 1, cm->mi_rows, cm->log2_tile_rows);
25 const int sb_off1 = (tile_idx * n_sbs) >> log2_n_tiles; 27 tile->mi_col_start = get_tile_offset(col, cm->mi_cols, cm->log2_tile_cols);
26 const int sb_off2 = ((tile_idx + 1) * n_sbs) >> log2_n_tiles; 28 tile->mi_col_end = get_tile_offset(col + 1, cm->mi_cols, cm->log2_tile_cols);
27
28 *min_tile_off = MIN(sb_off1 << 3, n_mis);
29 *max_tile_off = MIN(sb_off2 << 3, n_mis);
30 }
31
32 void vp9_tile_init(TileInfo *tile, const VP9_COMMON *cm,
33 int row_idx, int col_idx) {
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);
38 } 29 }
39 30
40 void vp9_get_tile_n_bits(int mi_cols, 31 void vp9_get_tile_n_bits(int mi_cols,
41 int *min_log2_tile_cols, int *max_log2_tile_cols) { 32 int *min_log2_tile_cols, int *max_log2_tile_cols) {
42 const int sb_cols = to_sbs(mi_cols); 33 const int sb_cols = mi_cols_aligned_to_sb(mi_cols) >> MI_BLOCK_SIZE_LOG2;
43 int min_log2_n_tiles, max_log2_n_tiles; 34 int min_log2 = 0, max_log2 = 0;
44 35
45 for (max_log2_n_tiles = 0; 36 // max
46 (sb_cols >> max_log2_n_tiles) >= MIN_TILE_WIDTH_B64; 37 while ((sb_cols >> max_log2) >= MIN_TILE_WIDTH_B64)
47 max_log2_n_tiles++) {} 38 ++max_log2;
48 max_log2_n_tiles--; 39 --max_log2;
49 if (max_log2_n_tiles < 0) 40 if (max_log2 < 0)
50 max_log2_n_tiles = 0; 41 max_log2 = 0;
51 42
52 for (min_log2_n_tiles = 0; 43 // min
53 (MAX_TILE_WIDTH_B64 << min_log2_n_tiles) < sb_cols; 44 while ((MAX_TILE_WIDTH_B64 << min_log2) < sb_cols)
54 min_log2_n_tiles++) {} 45 ++min_log2;
55 46
56 assert(min_log2_n_tiles <= max_log2_n_tiles); 47 assert(min_log2 <= max_log2);
57 48
58 *min_log2_tile_cols = min_log2_n_tiles; 49 *min_log2_tile_cols = min_log2;
59 *max_log2_tile_cols = max_log2_n_tiles; 50 *max_log2_tile_cols = max_log2;
60 } 51 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_tile_common.h ('k') | source/libvpx/vp9/common/vp9_treecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698