ref: 65cee2f01a5c0cfd606938082dd224271cb6bf3f
parent: 86b629efb6f23248ed8cb8ee85c1f1b818131f25
parent: f6ec323906d403fdc5ae681a4a84aeb88844c207
author: Dmitry Kovalev <[email protected]>
date: Tue Nov 19 10:09:01 EST 2013
Merge "Simplifying partition context calculation."
--- a/vp9/common/vp9_common_data.c
+++ b/vp9/common/vp9_common_data.c
@@ -123,8 +123,6 @@
TX_32X32, // TX_MODE_SELECT
};
-
-
const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
@@ -144,23 +142,23 @@
};
// Generates 4 bit field in which each bit set to 1 represents
-// a blocksize partition 1111 means we split 8x8, 16x16, 32x32
-// and 64x64. 0001 means we just split the 64x64...
+// a blocksize partition 1111 means we split 64x64, 32x32, 16x16
+// and 8x8. 1000 means we just split the 64x64 to 32x32
const struct {
PARTITION_CONTEXT above;
PARTITION_CONTEXT left;
} partition_context_lookup[BLOCK_SIZES]= {
- {15, 15}, // 4X4
- {15, 7}, // 4X8
- {7, 15}, // 8X4
- {7, 7}, // 8X8
- {7, 3}, // 8X16
- {3, 7}, // 16X8
- {3, 3}, // 16X16
- {3, 1}, // 16X32
- {1, 3}, // 32X16
- {1, 1}, // 32X32
- {1, 0}, // 32X64
- {0, 1}, // 64X32
- {0, 0}, // 64X64
+ {15, 15}, // 4X4 - {0b1111, 0b1111}
+ {15, 14}, // 4X8 - {0b1111, 0b1110}
+ {14, 15}, // 8X4 - {0b1110, 0b1111}
+ {14, 14}, // 8X8 - {0b1110, 0b1110}
+ {14, 12}, // 8X16 - {0b1110, 0b1100}
+ {12, 14}, // 16X8 - {0b1100, 0b1110}
+ {12, 12}, // 16X16 - {0b1100, 0b1100}
+ {12, 8 }, // 16X32 - {0b1100, 0b1000}
+ {8, 12}, // 32X16 - {0b1000, 0b1100}
+ {8, 8 }, // 32X32 - {0b1000, 0b1000}
+ {8, 0 }, // 32X64 - {0b1000, 0b0000}
+ {0, 8 }, // 64X32 - {0b0000, 0b1000}
+ {0, 0 }, // 64X64 - {0b0000, 0b0000}
};
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -303,43 +303,40 @@
static INLINE void update_partition_context(
PARTITION_CONTEXT *above_seg_context,
PARTITION_CONTEXT left_seg_context[8],
- int mi_row, int mi_col,
- BLOCK_SIZE sb_type,
- BLOCK_SIZE sb_size) {
- PARTITION_CONTEXT *above_ctx = above_seg_context + mi_col;
- PARTITION_CONTEXT *left_ctx = left_seg_context + (mi_row & MI_MASK);
+ int mi_row, int mi_col, BLOCK_SIZE subsize, BLOCK_SIZE bsize) {
+ PARTITION_CONTEXT *const above_ctx = above_seg_context + mi_col;
+ PARTITION_CONTEXT *const left_ctx = left_seg_context + (mi_row & MI_MASK);
- const int bsl = b_width_log2(sb_size), bs = (1 << bsl) / 2;
+ // num_4x4_blocks_wide_lookup[bsize] / 2
+ const int bs = num_8x8_blocks_wide_lookup[bsize];
// update the partition context at the end notes. set partition bits
// of block sizes larger than the current one to be one, and partition
// bits of smaller block sizes to be zero.
- vpx_memset(above_ctx, partition_context_lookup[sb_type].above, bs);
- vpx_memset(left_ctx, partition_context_lookup[sb_type].left, bs);
+ vpx_memset(above_ctx, partition_context_lookup[subsize].above, bs);
+ vpx_memset(left_ctx, partition_context_lookup[subsize].left, bs);
}
static INLINE int partition_plane_context(
const PARTITION_CONTEXT *above_seg_context,
const PARTITION_CONTEXT left_seg_context[8],
- int mi_row, int mi_col,
- BLOCK_SIZE sb_type) {
+ int mi_row, int mi_col, BLOCK_SIZE bsize) {
const PARTITION_CONTEXT *above_ctx = above_seg_context + mi_col;
const PARTITION_CONTEXT *left_ctx = left_seg_context + (mi_row & MI_MASK);
- int bsl = mi_width_log2(sb_type), bs = 1 << bsl;
+ const int bsl = mi_width_log2(bsize);
+ const int bs = 1 << bsl;
int above = 0, left = 0, i;
- int boffset = mi_width_log2(BLOCK_64X64) - bsl;
- assert(mi_width_log2(sb_type) == mi_height_log2(sb_type));
+ assert(mi_width_log2(bsize) == mi_height_log2(bsize));
assert(bsl >= 0);
- assert(boffset >= 0);
for (i = 0; i < bs; i++) {
above |= above_ctx[i];
left |= left_ctx[i];
}
- above = (above & (1 << boffset)) > 0;
- left = (left & (1 << boffset)) > 0;
+ above = (above & bs) > 0;
+ left = (left & bs) > 0;
return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
}