Commit 0449ee0f authored by Yaowu Xu's avatar Yaowu Xu

Fix a off-by-one bug

in the calculation of maximum number of tiles in log2 scale.

Change-Id: Id283d6e51a8b926015fd3fc631cdbfb4b8268d4a
parent 9068bce4
......@@ -49,10 +49,15 @@ void vp9_get_tile_n_bits(VP9_COMMON *cm, int *min_log2_n_tiles_ptr,
for (max_log2_n_tiles = 0;
(sb_cols >> max_log2_n_tiles) >= MIN_TILE_WIDTH_SBS;
max_log2_n_tiles++) {}
max_log2_n_tiles--;
if (max_log2_n_tiles < 0)
max_log2_n_tiles = 0;
for (min_log2_n_tiles = 0;
(MAX_TILE_WIDTH_SBS << min_log2_n_tiles) < sb_cols;
min_log2_n_tiles++) {}
assert(max_log2_n_tiles >= 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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment