Merge "Use consistent partition context setup in enc/dec" into experimental
This commit is contained in:
@@ -306,6 +306,13 @@ static int mi_cols_aligned_to_sb(VP9_COMMON *cm) {
|
|||||||
return 2 * ((cm->mb_cols + 3) & ~3);
|
return 2 * ((cm->mb_cols + 3) & ~3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static INLINE void set_partition_seg_context(VP9_COMMON *cm,
|
||||||
|
MACROBLOCKD *xd,
|
||||||
|
int mi_row, int mi_col) {
|
||||||
|
xd->above_seg_context = cm->above_seg_context + mi_col;
|
||||||
|
xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
static void set_mi_row_col(VP9_COMMON *cm, MACROBLOCKD *xd,
|
static void set_mi_row_col(VP9_COMMON *cm, MACROBLOCKD *xd,
|
||||||
int mi_row, int bh,
|
int mi_row, int bh,
|
||||||
int mi_col, int bw) {
|
int mi_col, int bw) {
|
||||||
|
|||||||
@@ -476,12 +476,11 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col,
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
// update partition context
|
// update partition context
|
||||||
if ((partition == PARTITION_SPLIT) && (bsize > BLOCK_SIZE_MB16X16))
|
if (bsize > BLOCK_SIZE_SB8X8 &&
|
||||||
return;
|
(bsize == BLOCK_SIZE_MB16X16 || partition != PARTITION_SPLIT)) {
|
||||||
|
set_partition_seg_context(pc, xd, mi_row, mi_col);
|
||||||
xd->left_seg_context = pc->left_seg_context + (mi_row & MI_MASK);
|
update_partition_context(xd, subsize, bsize);
|
||||||
xd->above_seg_context = pc->above_seg_context + mi_col;
|
}
|
||||||
update_partition_context(xd, subsize, bsize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_token_decoder(VP9D_COMP *pbi,
|
static void setup_token_decoder(VP9D_COMP *pbi,
|
||||||
|
|||||||
@@ -915,12 +915,11 @@ static void write_modes_sb(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update partition context
|
// update partition context
|
||||||
if ((partition == PARTITION_SPLIT) && (bsize > BLOCK_SIZE_MB16X16))
|
if (bsize > BLOCK_SIZE_SB8X8 &&
|
||||||
return;
|
(bsize == BLOCK_SIZE_MB16X16 || partition != PARTITION_SPLIT)) {
|
||||||
|
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||||
xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK);
|
update_partition_context(xd, subsize, bsize);
|
||||||
xd->above_seg_context = cm->above_seg_context + mi_col;
|
}
|
||||||
update_partition_context(xd, subsize, bsize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_modes(VP9_COMP *cpi, vp9_writer* const bc,
|
static void write_modes(VP9_COMP *cpi, vp9_writer* const bc,
|
||||||
|
|||||||
@@ -539,15 +539,6 @@ void vp9_setup_src_planes(MACROBLOCK *x,
|
|||||||
x->e_mbd.plane[2].subsampling_y);
|
x->e_mbd.plane[2].subsampling_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void set_partition_seg_context(VP9_COMP *cpi,
|
|
||||||
int mi_row, int mi_col) {
|
|
||||||
VP9_COMMON *const cm = &cpi->common;
|
|
||||||
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
|
|
||||||
|
|
||||||
xd->above_seg_context = cm->above_seg_context + mi_col;
|
|
||||||
xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set_offsets(VP9_COMP *cpi,
|
static void set_offsets(VP9_COMP *cpi,
|
||||||
int mi_row, int mi_col, BLOCK_SIZE_TYPE bsize) {
|
int mi_row, int mi_col, BLOCK_SIZE_TYPE bsize) {
|
||||||
MACROBLOCK *const x = &cpi->mb;
|
MACROBLOCK *const x = &cpi->mb;
|
||||||
@@ -571,7 +562,7 @@ static void set_offsets(VP9_COMP *cpi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// partition contexts
|
// partition contexts
|
||||||
set_partition_seg_context(cpi, mi_row, mi_col);
|
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||||
|
|
||||||
// Activity map pointer
|
// Activity map pointer
|
||||||
x->mb_activity_ptr = &cpi->mb_activity_map[idx_map];
|
x->mb_activity_ptr = &cpi->mb_activity_map[idx_map];
|
||||||
@@ -850,7 +841,7 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (bsize > BLOCK_SIZE_SB8X8) {
|
if (bsize > BLOCK_SIZE_SB8X8) {
|
||||||
set_partition_seg_context(cpi, mi_row, mi_col);
|
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||||
pl = partition_plane_context(xd, bsize);
|
pl = partition_plane_context(xd, bsize);
|
||||||
c1 = *(get_sb_partitioning(x, bsize));
|
c1 = *(get_sb_partitioning(x, bsize));
|
||||||
}
|
}
|
||||||
@@ -899,7 +890,7 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp,
|
|||||||
|
|
||||||
if (bsize > BLOCK_SIZE_SB8X8 &&
|
if (bsize > BLOCK_SIZE_SB8X8 &&
|
||||||
(bsize == BLOCK_SIZE_MB16X16 || bsl == bwl || bsl == bhl)) {
|
(bsize == BLOCK_SIZE_MB16X16 || bsl == bwl || bsl == bhl)) {
|
||||||
set_partition_seg_context(cpi, mi_row, mi_col);
|
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||||
update_partition_context(xd, c1, bsize);
|
update_partition_context(xd, c1, bsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -960,7 +951,7 @@ static void rd_pick_partition(VP9_COMP *cpi, TOKENEXTRA **tp,
|
|||||||
r4 += r;
|
r4 += r;
|
||||||
d4 += d;
|
d4 += d;
|
||||||
}
|
}
|
||||||
set_partition_seg_context(cpi, mi_row, mi_col);
|
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||||
pl = partition_plane_context(xd, bsize);
|
pl = partition_plane_context(xd, bsize);
|
||||||
r4 += x->partition_cost[pl][PARTITION_SPLIT];
|
r4 += x->partition_cost[pl][PARTITION_SPLIT];
|
||||||
|
|
||||||
@@ -992,7 +983,7 @@ static void rd_pick_partition(VP9_COMP *cpi, TOKENEXTRA **tp,
|
|||||||
if (mi_row + (ms >> 1) != cm->mi_rows)
|
if (mi_row + (ms >> 1) != cm->mi_rows)
|
||||||
mb_skip = 1;
|
mb_skip = 1;
|
||||||
}
|
}
|
||||||
set_partition_seg_context(cpi, mi_row, mi_col);
|
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||||
pl = partition_plane_context(xd, bsize);
|
pl = partition_plane_context(xd, bsize);
|
||||||
r2 += x->partition_cost[pl][PARTITION_HORZ];
|
r2 += x->partition_cost[pl][PARTITION_HORZ];
|
||||||
|
|
||||||
@@ -1027,7 +1018,7 @@ static void rd_pick_partition(VP9_COMP *cpi, TOKENEXTRA **tp,
|
|||||||
if (mi_col + (ms >> 1) != cm->mi_cols)
|
if (mi_col + (ms >> 1) != cm->mi_cols)
|
||||||
mb_skip = 1;
|
mb_skip = 1;
|
||||||
}
|
}
|
||||||
set_partition_seg_context(cpi, mi_row, mi_col);
|
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||||
pl = partition_plane_context(xd, bsize);
|
pl = partition_plane_context(xd, bsize);
|
||||||
r2 += x->partition_cost[pl][PARTITION_VERT];
|
r2 += x->partition_cost[pl][PARTITION_VERT];
|
||||||
|
|
||||||
@@ -1046,7 +1037,7 @@ static void rd_pick_partition(VP9_COMP *cpi, TOKENEXTRA **tp,
|
|||||||
pick_sb_modes(cpi, mi_row, mi_col, tp, &r, &d, bsize,
|
pick_sb_modes(cpi, mi_row, mi_col, tp, &r, &d, bsize,
|
||||||
get_block_context(x, bsize));
|
get_block_context(x, bsize));
|
||||||
if (bsize >= BLOCK_SIZE_MB16X16) {
|
if (bsize >= BLOCK_SIZE_MB16X16) {
|
||||||
set_partition_seg_context(cpi, mi_row, mi_col);
|
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||||
pl = partition_plane_context(xd, bsize);
|
pl = partition_plane_context(xd, bsize);
|
||||||
r += x->partition_cost[pl][PARTITION_NONE];
|
r += x->partition_cost[pl][PARTITION_NONE];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user