Commit 83eb1975 authored by Jim Bankoski's avatar Jim Bankoski
Browse files

partition context update speedup

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

Change-Id: I365e6f5607ece85190cb21443988816dfa510ce3
parent 5ae4ba57
...@@ -143,4 +143,24 @@ const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = { ...@@ -143,4 +143,24 @@ const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = {
{{BLOCK_64X64, BLOCK_64X32}, {BLOCK_32X64, BLOCK_32X32}}, {{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
};
...@@ -38,6 +38,11 @@ ...@@ -38,6 +38,11 @@
#define NUM_FRAME_CONTEXTS_LOG2 2 #define NUM_FRAME_CONTEXTS_LOG2 2
#define NUM_FRAME_CONTEXTS (1 << NUM_FRAME_CONTEXTS_LOG2) #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 { typedef struct frame_contexts {
vp9_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1]; vp9_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1];
vp9_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1]; vp9_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
...@@ -305,20 +310,12 @@ static INLINE void update_partition_context( ...@@ -305,20 +310,12 @@ static INLINE void update_partition_context(
PARTITION_CONTEXT *left_ctx = left_seg_context + (mi_row & MI_MASK); 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 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 // 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, pcvalue[bwl == bsl], bs); vpx_memset(above_ctx, partition_context_lookup[sb_type].above, bs);
vpx_memset(left_ctx, pcvalue[bhl == bsl], bs); vpx_memset(left_ctx, partition_context_lookup[sb_type].left, bs);
} }
static INLINE int partition_plane_context( static INLINE int partition_plane_context(
......
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