Simplifying partition context calculation.
Reversing bit order of partition_context_lookup, and modifying accordingly update_partition_context() and partition_plane_context(). Change-Id: I64a11f1a94962a3bf217de2f50698cb781db71a5
This commit is contained in:
parent
953b1e9683
commit
f6ec323906
@ -123,8 +123,6 @@ const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
|
|||||||
TX_32X32, // TX_MODE_SELECT
|
TX_32X32, // TX_MODE_SELECT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
|
const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
|
||||||
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
|
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
|
||||||
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
|
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
|
||||||
@ -144,23 +142,23 @@ const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Generates 4 bit field in which each bit set to 1 represents
|
// Generates 4 bit field in which each bit set to 1 represents
|
||||||
// a blocksize partition 1111 means we split 8x8, 16x16, 32x32
|
// a blocksize partition 1111 means we split 64x64, 32x32, 16x16
|
||||||
// and 64x64. 0001 means we just split the 64x64...
|
// and 8x8. 1000 means we just split the 64x64 to 32x32
|
||||||
const struct {
|
const struct {
|
||||||
PARTITION_CONTEXT above;
|
PARTITION_CONTEXT above;
|
||||||
PARTITION_CONTEXT left;
|
PARTITION_CONTEXT left;
|
||||||
} partition_context_lookup[BLOCK_SIZES]= {
|
} partition_context_lookup[BLOCK_SIZES]= {
|
||||||
{15, 15}, // 4X4
|
{15, 15}, // 4X4 - {0b1111, 0b1111}
|
||||||
{15, 7}, // 4X8
|
{15, 14}, // 4X8 - {0b1111, 0b1110}
|
||||||
{7, 15}, // 8X4
|
{14, 15}, // 8X4 - {0b1110, 0b1111}
|
||||||
{7, 7}, // 8X8
|
{14, 14}, // 8X8 - {0b1110, 0b1110}
|
||||||
{7, 3}, // 8X16
|
{14, 12}, // 8X16 - {0b1110, 0b1100}
|
||||||
{3, 7}, // 16X8
|
{12, 14}, // 16X8 - {0b1100, 0b1110}
|
||||||
{3, 3}, // 16X16
|
{12, 12}, // 16X16 - {0b1100, 0b1100}
|
||||||
{3, 1}, // 16X32
|
{12, 8 }, // 16X32 - {0b1100, 0b1000}
|
||||||
{1, 3}, // 32X16
|
{8, 12}, // 32X16 - {0b1000, 0b1100}
|
||||||
{1, 1}, // 32X32
|
{8, 8 }, // 32X32 - {0b1000, 0b1000}
|
||||||
{1, 0}, // 32X64
|
{8, 0 }, // 32X64 - {0b1000, 0b0000}
|
||||||
{0, 1}, // 64X32
|
{0, 8 }, // 64X32 - {0b0000, 0b1000}
|
||||||
{0, 0}, // 64X64
|
{0, 0 }, // 64X64 - {0b0000, 0b0000}
|
||||||
};
|
};
|
||||||
|
@ -303,43 +303,40 @@ static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) {
|
|||||||
static INLINE void update_partition_context(
|
static INLINE void update_partition_context(
|
||||||
PARTITION_CONTEXT *above_seg_context,
|
PARTITION_CONTEXT *above_seg_context,
|
||||||
PARTITION_CONTEXT left_seg_context[8],
|
PARTITION_CONTEXT left_seg_context[8],
|
||||||
int mi_row, int mi_col,
|
int mi_row, int mi_col, BLOCK_SIZE subsize, BLOCK_SIZE bsize) {
|
||||||
BLOCK_SIZE sb_type,
|
PARTITION_CONTEXT *const above_ctx = above_seg_context + mi_col;
|
||||||
BLOCK_SIZE sb_size) {
|
PARTITION_CONTEXT *const left_ctx = left_seg_context + (mi_row & MI_MASK);
|
||||||
PARTITION_CONTEXT *above_ctx = above_seg_context + mi_col;
|
|
||||||
PARTITION_CONTEXT *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
|
// update the partition context at the end notes. set partition bits
|
||||||
// of block sizes larger than the current one to be one, and partition
|
// of block sizes larger than the current one to be one, and partition
|
||||||
// bits of smaller block sizes to be zero.
|
// bits of smaller block sizes to be zero.
|
||||||
vpx_memset(above_ctx, partition_context_lookup[sb_type].above, bs);
|
vpx_memset(above_ctx, partition_context_lookup[subsize].above, bs);
|
||||||
vpx_memset(left_ctx, partition_context_lookup[sb_type].left, bs);
|
vpx_memset(left_ctx, partition_context_lookup[subsize].left, bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE int partition_plane_context(
|
static INLINE int partition_plane_context(
|
||||||
const PARTITION_CONTEXT *above_seg_context,
|
const PARTITION_CONTEXT *above_seg_context,
|
||||||
const PARTITION_CONTEXT left_seg_context[8],
|
const PARTITION_CONTEXT left_seg_context[8],
|
||||||
int mi_row, int mi_col,
|
int mi_row, int mi_col, BLOCK_SIZE bsize) {
|
||||||
BLOCK_SIZE sb_type) {
|
|
||||||
const PARTITION_CONTEXT *above_ctx = above_seg_context + mi_col;
|
const PARTITION_CONTEXT *above_ctx = above_seg_context + mi_col;
|
||||||
const PARTITION_CONTEXT *left_ctx = left_seg_context + (mi_row & MI_MASK);
|
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 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(bsl >= 0);
|
||||||
assert(boffset >= 0);
|
|
||||||
|
|
||||||
for (i = 0; i < bs; i++) {
|
for (i = 0; i < bs; i++) {
|
||||||
above |= above_ctx[i];
|
above |= above_ctx[i];
|
||||||
left |= left_ctx[i];
|
left |= left_ctx[i];
|
||||||
}
|
}
|
||||||
above = (above & (1 << boffset)) > 0;
|
above = (above & bs) > 0;
|
||||||
left = (left & (1 << boffset)) > 0;
|
left = (left & bs) > 0;
|
||||||
|
|
||||||
return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
|
return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user