partition context update speedup

This removes a lot of operations in setting partition context...

Change-Id: I365e6f5607ece85190cb21443988816dfa510ce3
This commit is contained in:
Jim Bankoski 2013-11-17 06:58:08 -08:00
parent 5ae4ba5774
commit 83eb1975df
2 changed files with 28 additions and 11 deletions

View File

@ -143,4 +143,24 @@ const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
{{BLOCK_64X64, BLOCK_64X32}, {BLOCK_32X64, BLOCK_32X32}},
};
// 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...
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
};

View File

@ -38,6 +38,11 @@
#define NUM_FRAME_CONTEXTS_LOG2 2
#define NUM_FRAME_CONTEXTS (1 << NUM_FRAME_CONTEXTS_LOG2)
extern const struct {
PARTITION_CONTEXT above;
PARTITION_CONTEXT left;
} partition_context_lookup[BLOCK_SIZES];
typedef struct frame_contexts {
vp9_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1];
vp9_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
@ -305,20 +310,12 @@ static INLINE void update_partition_context(
PARTITION_CONTEXT *left_ctx = left_seg_context + (mi_row & MI_MASK);
const int bsl = b_width_log2(sb_size), bs = (1 << bsl) / 2;
const int bwl = b_width_log2(sb_type);
const int bhl = b_height_log2(sb_type);
const int boffset = b_width_log2(BLOCK_64X64) - bsl;
const char pcval0 = ~(0xe << boffset);
const char pcval1 = ~(0xf << boffset);
const char pcvalue[2] = {pcval0, pcval1};
assert(MAX(bwl, bhl) <= bsl);
// 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, pcvalue[bwl == bsl], bs);
vpx_memset(left_ctx, pcvalue[bhl == bsl], bs);
vpx_memset(above_ctx, partition_context_lookup[sb_type].above, bs);
vpx_memset(left_ctx, partition_context_lookup[sb_type].left, bs);
}
static INLINE int partition_plane_context(