clean up bw, bh
many structures use bw and bh and they have different meanings. This cl attempts to start this clean up and remove unneccessary 2 step look up log and then shift operations... also removed partition type multiple operation code in bitstream.c. Change-Id: I7e03e552bdfc0939738e430862e3073d30fdd5db
This commit is contained in:
parent
7c134bc0cd
commit
86a9dec73c
@ -17,11 +17,54 @@ const int b_width_log2_lookup[BLOCK_SIZE_TYPES] =
|
||||
{0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4};
|
||||
const int b_height_log2_lookup[BLOCK_SIZE_TYPES] =
|
||||
{0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4};
|
||||
const int num_4x4_blocks_wide_lookup[BLOCK_SIZE_TYPES] =
|
||||
{1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16};
|
||||
const int num_4x4_blocks_high_lookup[BLOCK_SIZE_TYPES] =
|
||||
{1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16};
|
||||
// Log 2 conversion lookup tables for modeinfo width and height
|
||||
const int mi_width_log2_lookup[BLOCK_SIZE_TYPES] =
|
||||
{0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3};
|
||||
const int num_8x8_blocks_wide_lookup[BLOCK_SIZE_TYPES] =
|
||||
{1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8};
|
||||
const int mi_height_log2_lookup[BLOCK_SIZE_TYPES] =
|
||||
{0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3};
|
||||
const int num_8x8_blocks_high_lookup[BLOCK_SIZE_TYPES] =
|
||||
{1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8};
|
||||
|
||||
const PARTITION_TYPE partition_lookup[][BLOCK_SIZE_TYPES] = {
|
||||
{ // 4X4
|
||||
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
||||
PARTITION_NONE, PARTITION_INVALID, PARTITION_INVALID,
|
||||
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
||||
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
||||
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
||||
PARTITION_INVALID
|
||||
}, { // 8X8
|
||||
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
||||
PARTITION_SPLIT, PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE,
|
||||
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
||||
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
||||
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID
|
||||
}, { // 16X16
|
||||
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
||||
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
|
||||
PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, PARTITION_INVALID,
|
||||
PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID,
|
||||
PARTITION_INVALID, PARTITION_INVALID
|
||||
}, { // 32X32
|
||||
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
||||
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
|
||||
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_VERT,
|
||||
PARTITION_HORZ, PARTITION_NONE, PARTITION_INVALID,
|
||||
PARTITION_INVALID, PARTITION_INVALID
|
||||
}, { // 64X64
|
||||
// 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
|
||||
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
|
||||
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT,
|
||||
PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_VERT, PARTITION_HORZ,
|
||||
PARTITION_NONE
|
||||
}
|
||||
};
|
||||
|
||||
const BLOCK_SIZE_TYPE subsize_lookup[PARTITION_TYPES][BLOCK_SIZE_TYPES] = {
|
||||
{ // PARTITION_NONE
|
||||
|
@ -17,6 +17,14 @@ extern const int b_width_log2_lookup[BLOCK_SIZE_TYPES];
|
||||
extern const int b_height_log2_lookup[BLOCK_SIZE_TYPES];
|
||||
extern const int mi_width_log2_lookup[BLOCK_SIZE_TYPES];
|
||||
extern const int mi_height_log2_lookup[BLOCK_SIZE_TYPES];
|
||||
extern const int num_8x8_blocks_wide_lookup[BLOCK_SIZE_TYPES];
|
||||
extern const int num_8x8_blocks_high_lookup[BLOCK_SIZE_TYPES];
|
||||
extern const int num_4x4_blocks_high_lookup[BLOCK_SIZE_TYPES];
|
||||
extern const int num_4x4_blocks_wide_lookup[BLOCK_SIZE_TYPES];
|
||||
extern const PARTITION_TYPE
|
||||
partition_lookup[][BLOCK_SIZE_TYPES];
|
||||
|
||||
|
||||
extern const BLOCK_SIZE_TYPE subsize_lookup[PARTITION_TYPES][BLOCK_SIZE_TYPES];
|
||||
extern const TX_SIZE max_txsize_lookup[BLOCK_SIZE_TYPES];
|
||||
extern const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZE_TYPES];
|
||||
|
@ -35,7 +35,7 @@ typedef enum BLOCK_SIZE_TYPE {
|
||||
BLOCK_SIZE_SB32X64, BLOCK_32X64 = BLOCK_SIZE_SB32X64,
|
||||
BLOCK_SIZE_SB64X32, BLOCK_64X32 = BLOCK_SIZE_SB64X32,
|
||||
BLOCK_SIZE_SB64X64, BLOCK_64X64 = BLOCK_SIZE_SB64X64,
|
||||
BLOCK_SIZE_TYPES, BLOCK_MAX_SB_SEGMENTS = BLOCK_SIZE_TYPES,
|
||||
BLOCK_SIZE_TYPES, BLOCK_MAX_SB_SEGMENTS = BLOCK_SIZE_TYPES
|
||||
} BLOCK_SIZE_TYPE;
|
||||
|
||||
typedef enum PARTITION_TYPE {
|
||||
@ -43,7 +43,7 @@ typedef enum PARTITION_TYPE {
|
||||
PARTITION_HORZ,
|
||||
PARTITION_VERT,
|
||||
PARTITION_SPLIT,
|
||||
PARTITION_TYPES
|
||||
PARTITION_TYPES, PARTITION_INVALID = PARTITION_TYPES
|
||||
} PARTITION_TYPE;
|
||||
|
||||
#define PARTITION_PLOFFSET 4 // number of probability models per block size
|
||||
|
@ -459,10 +459,10 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
|
||||
write_intra_mode(bc, mode, pc->fc.y_mode_prob[MIN(3, bsl)]);
|
||||
} else {
|
||||
int idx, idy;
|
||||
int bw = 1 << b_width_log2(mi->sb_type);
|
||||
int bh = 1 << b_height_log2(mi->sb_type);
|
||||
for (idy = 0; idy < 2; idy += bh)
|
||||
for (idx = 0; idx < 2; idx += bw) {
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mi->sb_type];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[mi->sb_type];
|
||||
for (idy = 0; idy < 2; idy += num_4x4_blocks_high)
|
||||
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
|
||||
const MB_PREDICTION_MODE bm = m->bmi[idy * 2 + idx].as_mode;
|
||||
write_intra_mode(bc, bm, pc->fc.y_mode_prob[0]);
|
||||
}
|
||||
@ -498,11 +498,11 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
|
||||
int j;
|
||||
MB_PREDICTION_MODE blockmode;
|
||||
int_mv blockmv;
|
||||
int bwl = b_width_log2(mi->sb_type), bw = 1 << bwl;
|
||||
int bhl = b_height_log2(mi->sb_type), bh = 1 << bhl;
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mi->sb_type];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[mi->sb_type];
|
||||
int idx, idy;
|
||||
for (idy = 0; idy < 2; idy += bh) {
|
||||
for (idx = 0; idx < 2; idx += bw) {
|
||||
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
|
||||
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
|
||||
j = idy * 2 + idx;
|
||||
blockmode = cpi->mb.partition_info->bmi[j].mode;
|
||||
blockmv = m->bmi[j].as_mv[0];
|
||||
@ -563,10 +563,10 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
|
||||
write_intra_mode(bc, ym, vp9_kf_y_mode_prob[A][L]);
|
||||
} else {
|
||||
int idx, idy;
|
||||
int bw = 1 << b_width_log2(m->mbmi.sb_type);
|
||||
int bh = 1 << b_height_log2(m->mbmi.sb_type);
|
||||
for (idy = 0; idy < 2; idy += bh) {
|
||||
for (idx = 0; idx < 2; idx += bw) {
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[m->mbmi.sb_type];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[m->mbmi.sb_type];
|
||||
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
|
||||
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
|
||||
int i = idy * 2 + idx;
|
||||
const MB_PREDICTION_MODE A = above_block_mode(m, i, mis);
|
||||
const MB_PREDICTION_MODE L = (xd->left_available || idx) ?
|
||||
@ -619,7 +619,6 @@ static void write_modes_sb(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc,
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
MACROBLOCKD *xd = &cpi->mb.e_mbd;
|
||||
const int mis = cm->mode_info_stride;
|
||||
int bwl, bhl;
|
||||
int bsl = b_width_log2(bsize);
|
||||
int bs = (1 << bsl) / 4; // mode_info step for subsize
|
||||
int n;
|
||||
@ -629,20 +628,7 @@ static void write_modes_sb(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc,
|
||||
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
|
||||
return;
|
||||
|
||||
bwl = b_width_log2(m->mbmi.sb_type);
|
||||
bhl = b_height_log2(m->mbmi.sb_type);
|
||||
|
||||
// parse the partition type
|
||||
if ((bwl == bsl) && (bhl == bsl))
|
||||
partition = PARTITION_NONE;
|
||||
else if ((bwl == bsl) && (bhl < bsl))
|
||||
partition = PARTITION_HORZ;
|
||||
else if ((bwl < bsl) && (bhl == bsl))
|
||||
partition = PARTITION_VERT;
|
||||
else if ((bwl < bsl) && (bhl < bsl))
|
||||
partition = PARTITION_SPLIT;
|
||||
else
|
||||
assert(0);
|
||||
partition = partition_lookup[bsl][m->mbmi.sb_type];
|
||||
|
||||
if (bsize < BLOCK_SIZE_SB8X8)
|
||||
if (xd->ab_index > 0)
|
||||
|
@ -323,7 +323,8 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
|
||||
|
||||
int mb_mode_index = ctx->best_mode_index;
|
||||
const int mis = cpi->common.mode_info_stride;
|
||||
const int bh = 1 << mi_height_log2(bsize), bw = 1 << mi_width_log2(bsize);
|
||||
const int mi_height = num_8x8_blocks_high_lookup[bsize];
|
||||
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
|
||||
|
||||
assert(mi->mbmi.mode < MB_MODE_COUNT);
|
||||
assert(mb_mode_index < MAX_MODES);
|
||||
@ -333,10 +334,10 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
|
||||
|
||||
// Restore the coding context of the MB to that that was in place
|
||||
// when the mode was picked for it
|
||||
for (y = 0; y < bh; y++) {
|
||||
for (x_idx = 0; x_idx < bw; x_idx++) {
|
||||
if ((xd->mb_to_right_edge >> (3 + LOG2_MI_SIZE)) + bw > x_idx
|
||||
&& (xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE)) + bh > y) {
|
||||
for (y = 0; y < mi_height; y++) {
|
||||
for (x_idx = 0; x_idx < mi_width; x_idx++) {
|
||||
if ((xd->mb_to_right_edge >> (3 + LOG2_MI_SIZE)) + mi_width > x_idx
|
||||
&& (xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE)) + mi_height > y) {
|
||||
MODE_INFO *mi_addr = xd->mode_info_context + x_idx + y * mis;
|
||||
*mi_addr = *mi;
|
||||
}
|
||||
@ -412,10 +413,10 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
|
||||
|
||||
if (bsize > BLOCK_SIZE_SB8X8 && mbmi->mode == NEWMV) {
|
||||
int i, j;
|
||||
for (j = 0; j < bh; ++j)
|
||||
for (i = 0; i < bw; ++i)
|
||||
if ((xd->mb_to_right_edge >> (3 + LOG2_MI_SIZE)) + bw > i
|
||||
&& (xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE)) + bh > j)
|
||||
for (j = 0; j < mi_height; ++j)
|
||||
for (i = 0; i < mi_width; ++i)
|
||||
if ((xd->mb_to_right_edge >> (3 + LOG2_MI_SIZE)) + mi_width > i
|
||||
&& (xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE)) + mi_height > j)
|
||||
xd->mode_info_context[mis * j + i].mbmi = *mbmi;
|
||||
}
|
||||
|
||||
@ -459,7 +460,8 @@ static void set_offsets(VP9_COMP *cpi, int mi_row, int mi_col,
|
||||
MB_MODE_INFO *mbmi;
|
||||
const int dst_fb_idx = cm->new_fb_idx;
|
||||
const int idx_str = xd->mode_info_stride * mi_row + mi_col;
|
||||
const int bw = 1 << mi_width_log2(bsize), bh = 1 << mi_height_log2(bsize);
|
||||
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
|
||||
const int mi_height = num_8x8_blocks_high_lookup[bsize];
|
||||
const int mb_row = mi_row >> 1;
|
||||
const int mb_col = mi_col >> 1;
|
||||
const int idx_map = mb_row * cm->mb_cols + mb_col;
|
||||
@ -496,13 +498,13 @@ static void set_offsets(VP9_COMP *cpi, int mi_row, int mi_col,
|
||||
x->mv_row_min = -((mi_row * MI_SIZE)+ VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
|
||||
x->mv_col_min = -((mi_col * MI_SIZE)+ VP9BORDERINPIXELS - VP9_INTERP_EXTEND);
|
||||
x->mv_row_max = ((cm->mi_rows - mi_row) * MI_SIZE
|
||||
+ (VP9BORDERINPIXELS - MI_SIZE * bh - VP9_INTERP_EXTEND));
|
||||
+ (VP9BORDERINPIXELS - MI_SIZE * mi_height - VP9_INTERP_EXTEND));
|
||||
x->mv_col_max = ((cm->mi_cols - mi_col) * MI_SIZE
|
||||
+ (VP9BORDERINPIXELS - MI_SIZE * bw - VP9_INTERP_EXTEND));
|
||||
+ (VP9BORDERINPIXELS - MI_SIZE * mi_width - VP9_INTERP_EXTEND));
|
||||
|
||||
// Set up distance of MB to edge of frame in 1/8th pel units
|
||||
assert(!(mi_col & (bw - 1)) && !(mi_row & (bh - 1)));
|
||||
set_mi_row_col(cm, xd, mi_row, bh, mi_col, bw);
|
||||
assert(!(mi_col & (mi_width - 1)) && !(mi_row & (mi_height - 1)));
|
||||
set_mi_row_col(cm, xd, mi_row, mi_height, mi_col, mi_width);
|
||||
|
||||
/* set up source buffers */
|
||||
vp9_setup_src_planes(x, cpi->Source, mi_row, mi_col);
|
||||
@ -676,23 +678,27 @@ static void restore_context(VP9_COMP *cpi, int mi_row, int mi_col,
|
||||
MACROBLOCK * const x = &cpi->mb;
|
||||
MACROBLOCKD * const xd = &x->e_mbd;
|
||||
int p;
|
||||
int bwl = b_width_log2(bsize), bw = 1 << bwl;
|
||||
int bhl = b_height_log2(bsize), bh = 1 << bhl;
|
||||
int mwl = mi_width_log2(bsize), mw = 1 << mwl;
|
||||
int mhl = mi_height_log2(bsize), mh = 1 << mhl;
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
|
||||
int mi_width = num_8x8_blocks_wide_lookup[bsize];
|
||||
int mi_height = num_8x8_blocks_high_lookup[bsize];
|
||||
for (p = 0; p < MAX_MB_PLANE; p++) {
|
||||
vpx_memcpy(
|
||||
cm->above_context[p] + ((mi_col * 2) >> xd->plane[p].subsampling_x),
|
||||
a + bw * p, sizeof(ENTROPY_CONTEXT) * bw >> xd->plane[p].subsampling_x);
|
||||
a + num_4x4_blocks_wide * p,
|
||||
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_wide) >>
|
||||
xd->plane[p].subsampling_x);
|
||||
vpx_memcpy(
|
||||
cm->left_context[p]
|
||||
+ ((mi_row & MI_MASK)* 2 >> xd->plane[p].subsampling_y),l + bh * p,
|
||||
sizeof(ENTROPY_CONTEXT) * bh >> xd->plane[p].subsampling_y);
|
||||
}
|
||||
+ ((mi_row & MI_MASK) * 2 >> xd->plane[p].subsampling_y),
|
||||
l + num_4x4_blocks_high * p,
|
||||
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >>
|
||||
xd->plane[p].subsampling_y);
|
||||
}
|
||||
vpx_memcpy(cm->above_seg_context + mi_col, sa,
|
||||
sizeof(PARTITION_CONTEXT) * mw);
|
||||
sizeof(PARTITION_CONTEXT) * mi_width);
|
||||
vpx_memcpy(cm->left_seg_context + (mi_row & MI_MASK), sl,
|
||||
sizeof(PARTITION_CONTEXT) * mh);
|
||||
sizeof(PARTITION_CONTEXT) * mi_height);
|
||||
}
|
||||
static void save_context(VP9_COMP *cpi, int mi_row, int mi_col,
|
||||
ENTROPY_CONTEXT a[16 * MAX_MB_PLANE],
|
||||
@ -703,27 +709,30 @@ static void save_context(VP9_COMP *cpi, int mi_row, int mi_col,
|
||||
MACROBLOCK * const x = &cpi->mb;
|
||||
MACROBLOCKD * const xd = &x->e_mbd;
|
||||
int p;
|
||||
int bwl = b_width_log2(bsize), bw = 1 << bwl;
|
||||
int bhl = b_height_log2(bsize), bh = 1 << bhl;
|
||||
int mwl = mi_width_log2(bsize), mw = 1 << mwl;
|
||||
int mhl = mi_height_log2(bsize), mh = 1 << mhl;
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
|
||||
int mi_width = num_8x8_blocks_wide_lookup[bsize];
|
||||
int mi_height = num_8x8_blocks_high_lookup[bsize];
|
||||
|
||||
// buffer the above/left context information of the block in search.
|
||||
for (p = 0; p < MAX_MB_PLANE; ++p) {
|
||||
vpx_memcpy(
|
||||
a + bw * p,
|
||||
a + num_4x4_blocks_wide * p,
|
||||
cm->above_context[p] + (mi_col * 2 >> xd->plane[p].subsampling_x),
|
||||
sizeof(ENTROPY_CONTEXT) * bw >> xd->plane[p].subsampling_x);
|
||||
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_wide) >>
|
||||
xd->plane[p].subsampling_x);
|
||||
vpx_memcpy(
|
||||
l + bh * p,
|
||||
l + num_4x4_blocks_high * p,
|
||||
cm->left_context[p]
|
||||
+ ((mi_row & MI_MASK)* 2 >> xd->plane[p].subsampling_y),sizeof(ENTROPY_CONTEXT) * bh >> xd->plane[p].subsampling_y);
|
||||
}
|
||||
+ ((mi_row & MI_MASK) * 2 >> xd->plane[p].subsampling_y),
|
||||
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >>
|
||||
xd->plane[p].subsampling_y);
|
||||
}
|
||||
vpx_memcpy(sa, cm->above_seg_context + mi_col,
|
||||
sizeof(PARTITION_CONTEXT) * mw);
|
||||
sizeof(PARTITION_CONTEXT) * mi_width);
|
||||
vpx_memcpy(sl, cm->left_seg_context + (mi_row & MI_MASK),
|
||||
sizeof(PARTITION_CONTEXT) * mh)
|
||||
;}
|
||||
sizeof(PARTITION_CONTEXT) * mi_height);
|
||||
}
|
||||
|
||||
static void encode_b(VP9_COMP *cpi, TOKENEXTRA **tp, int mi_row, int mi_col,
|
||||
int output_enabled, BLOCK_SIZE_TYPE bsize, int sub_index) {
|
||||
@ -759,8 +768,10 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp, int mi_row, int mi_col,
|
||||
MACROBLOCKD * const xd = &x->e_mbd;
|
||||
BLOCK_SIZE_TYPE c1 = BLOCK_SIZE_SB8X8;
|
||||
const int bsl = b_width_log2(bsize), bs = (1 << bsl) / 4;
|
||||
int bwl, bhl;
|
||||
int UNINITIALIZED_IS_SAFE(pl);
|
||||
PARTITION_TYPE partition;
|
||||
BLOCK_SIZE_TYPE subsize;
|
||||
int i;
|
||||
|
||||
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
|
||||
return;
|
||||
@ -771,44 +782,46 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp, int mi_row, int mi_col,
|
||||
pl = partition_plane_context(xd, bsize);
|
||||
c1 = *(get_sb_partitioning(x, bsize));
|
||||
}
|
||||
partition = partition_lookup[bsl][c1];
|
||||
|
||||
bwl = b_width_log2(c1), bhl = b_height_log2(c1);
|
||||
switch (partition) {
|
||||
case PARTITION_NONE:
|
||||
if (output_enabled && bsize >= BLOCK_SIZE_SB8X8)
|
||||
cpi->partition_count[pl][PARTITION_NONE]++;
|
||||
encode_b(cpi, tp, mi_row, mi_col, output_enabled, c1, -1);
|
||||
break;
|
||||
case PARTITION_VERT:
|
||||
if (output_enabled)
|
||||
cpi->partition_count[pl][PARTITION_VERT]++;
|
||||
encode_b(cpi, tp, mi_row, mi_col, output_enabled, c1, 0);
|
||||
encode_b(cpi, tp, mi_row, mi_col + bs, output_enabled, c1, 1);
|
||||
break;
|
||||
case PARTITION_HORZ:
|
||||
if (output_enabled)
|
||||
cpi->partition_count[pl][PARTITION_HORZ]++;
|
||||
encode_b(cpi, tp, mi_row, mi_col, output_enabled, c1, 0);
|
||||
encode_b(cpi, tp, mi_row + bs, mi_col, output_enabled, c1, 1);
|
||||
break;
|
||||
case PARTITION_SPLIT:
|
||||
subsize = get_subsize(bsize, PARTITION_SPLIT);
|
||||
|
||||
if (bsl == bwl && bsl == bhl) {
|
||||
if (output_enabled && bsize >= BLOCK_SIZE_SB8X8)
|
||||
cpi->partition_count[pl][PARTITION_NONE]++;
|
||||
encode_b(cpi, tp, mi_row, mi_col, output_enabled, c1, -1);
|
||||
} else if (bsl == bhl && bsl > bwl) {
|
||||
if (output_enabled)
|
||||
cpi->partition_count[pl][PARTITION_VERT]++;
|
||||
encode_b(cpi, tp, mi_row, mi_col, output_enabled, c1, 0);
|
||||
encode_b(cpi, tp, mi_row, mi_col + bs, output_enabled, c1, 1);
|
||||
} else if (bsl == bwl && bsl > bhl) {
|
||||
if (output_enabled)
|
||||
cpi->partition_count[pl][PARTITION_HORZ]++;
|
||||
encode_b(cpi, tp, mi_row, mi_col, output_enabled, c1, 0);
|
||||
encode_b(cpi, tp, mi_row + bs, mi_col, output_enabled, c1, 1);
|
||||
} else {
|
||||
BLOCK_SIZE_TYPE subsize;
|
||||
int i;
|
||||
if (output_enabled)
|
||||
cpi->partition_count[pl][PARTITION_SPLIT]++;
|
||||
|
||||
assert(bwl < bsl && bhl < bsl);
|
||||
subsize = get_subsize(bsize, PARTITION_SPLIT);
|
||||
for (i = 0; i < 4; i++) {
|
||||
const int x_idx = i & 1, y_idx = i >> 1;
|
||||
|
||||
if (output_enabled)
|
||||
cpi->partition_count[pl][PARTITION_SPLIT]++;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
const int x_idx = i & 1, y_idx = i >> 1;
|
||||
|
||||
*(get_sb_index(xd, subsize)) = i;
|
||||
encode_sb(cpi, tp, mi_row + y_idx * bs, mi_col + x_idx * bs,
|
||||
output_enabled, subsize);
|
||||
}
|
||||
*(get_sb_index(xd, subsize)) = i;
|
||||
encode_sb(cpi, tp, mi_row + y_idx * bs, mi_col + x_idx * bs,
|
||||
output_enabled, subsize);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (bsize >= BLOCK_SIZE_SB8X8
|
||||
&& (bsize == BLOCK_SIZE_SB8X8 || bsl == bwl || bsl == bhl)) {
|
||||
if (partition != PARTITION_SPLIT || bsize == BLOCK_SIZE_SB8X8) {
|
||||
set_partition_seg_context(cm, xd, mi_row, mi_col);
|
||||
update_partition_context(xd, c1, bsize);
|
||||
}
|
||||
@ -1159,13 +1172,11 @@ static void rd_use_partition(VP9_COMP *cpi, MODE_INFO *m, TOKENEXTRA **tp,
|
||||
MACROBLOCK * const x = &cpi->mb;
|
||||
MACROBLOCKD *xd = &cpi->mb.e_mbd;
|
||||
const int mis = cm->mode_info_stride;
|
||||
int bwl = b_width_log2(m->mbmi.sb_type);
|
||||
int bhl = b_height_log2(m->mbmi.sb_type);
|
||||
int bsl = b_width_log2(bsize);
|
||||
int bs = (1 << bsl);
|
||||
int bh = (1 << bhl);
|
||||
int ms = bs / 2;
|
||||
int mh = bh / 2;
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
|
||||
int ms = num_4x4_blocks_wide / 2;
|
||||
int mh = num_4x4_blocks_high / 2;
|
||||
int bss = (1 << bsl) / 4;
|
||||
int i, pl;
|
||||
PARTITION_TYPE partition = PARTITION_NONE;
|
||||
@ -1187,17 +1198,7 @@ static void rd_use_partition(VP9_COMP *cpi, MODE_INFO *m, TOKENEXTRA **tp,
|
||||
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
|
||||
return;
|
||||
|
||||
// parse the partition type
|
||||
if ((bwl == bsl) && (bhl == bsl))
|
||||
partition = PARTITION_NONE;
|
||||
else if ((bwl == bsl) && (bhl < bsl))
|
||||
partition = PARTITION_HORZ;
|
||||
else if ((bwl < bsl) && (bhl == bsl))
|
||||
partition = PARTITION_VERT;
|
||||
else if ((bwl < bsl) && (bhl < bsl))
|
||||
partition = PARTITION_SPLIT;
|
||||
else
|
||||
assert(0);
|
||||
partition = partition_lookup[bsl][bs_type];
|
||||
|
||||
subsize = get_subsize(bsize, partition);
|
||||
|
||||
@ -1340,8 +1341,8 @@ static void rd_use_partition(VP9_COMP *cpi, MODE_INFO *m, TOKENEXTRA **tp,
|
||||
|
||||
// Split partition.
|
||||
for (i = 0; i < 4; i++) {
|
||||
int x_idx = (i & 1) * (bs >> 2);
|
||||
int y_idx = (i >> 1) * (bs >> 2);
|
||||
int x_idx = (i & 1) * (num_4x4_blocks_wide >> 2);
|
||||
int y_idx = (i >> 1) * (num_4x4_blocks_wide >> 2);
|
||||
int rt = 0;
|
||||
int64_t dt = 0;
|
||||
ENTROPY_CONTEXT l[16 * MAX_MB_PLANE], a[16 * MAX_MB_PLANE];
|
||||
@ -2468,10 +2469,12 @@ static void sum_intra_stats(VP9_COMP *cpi, MACROBLOCK *x) {
|
||||
++cpi->y_mode_count[MIN(bsl, 3)][m];
|
||||
} else {
|
||||
int idx, idy;
|
||||
int bw = 1 << b_width_log2(xd->mode_info_context->mbmi.sb_type);
|
||||
int bh = 1 << b_height_log2(xd->mode_info_context->mbmi.sb_type);
|
||||
for (idy = 0; idy < 2; idy += bh) {
|
||||
for (idx = 0; idx < 2; idx += bw) {
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[
|
||||
xd->mode_info_context->mbmi.sb_type];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[
|
||||
xd->mode_info_context->mbmi.sb_type];
|
||||
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
|
||||
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
|
||||
int m = xd->mode_info_context->bmi[idy * 2 + idx].as_mode;
|
||||
++cpi->y_mode_count[0][m];
|
||||
}
|
||||
@ -2509,8 +2512,8 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
|
||||
MB_MODE_INFO *mbmi = &mi->mbmi;
|
||||
unsigned int segment_id = mbmi->segment_id;
|
||||
const int mis = cm->mode_info_stride;
|
||||
const int bwl = mi_width_log2(bsize);
|
||||
const int bw = 1 << bwl, bh = 1 << mi_height_log2(bsize);
|
||||
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
|
||||
const int mi_height = num_8x8_blocks_high_lookup[bsize];
|
||||
x->rd_search = 0;
|
||||
x->skip_encode = (!output_enabled && cpi->sf.skip_encode_frame &&
|
||||
xd->q_index < QIDX_SKIP_THRESH);
|
||||
@ -2635,8 +2638,8 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
|
||||
sz = TX_4X4;
|
||||
}
|
||||
|
||||
for (y = 0; y < bh; y++) {
|
||||
for (x = 0; x < bw; x++) {
|
||||
for (y = 0; y < mi_height; y++) {
|
||||
for (x = 0; x < mi_width; x++) {
|
||||
if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows) {
|
||||
mi[mis * y + x].mbmi.txfm_size = sz;
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ void xform_quant(int plane, int block, BLOCK_SIZE_TYPE bsize,
|
||||
TX_TYPE tx_type;
|
||||
const int16_t *scan, *iscan;
|
||||
uint16_t *eob = &pd->eobs[block];
|
||||
const int bwl = b_width_log2(bsize) - pd->subsampling_x, bw = 1 << bwl;
|
||||
const int bwl = plane_block_width_log2by4(bsize, pd), bw = 1 << bwl;
|
||||
const int twl = bwl - tx_size, twmask = (1 << twl) - 1;
|
||||
int xoff, yoff;
|
||||
int16_t *src_diff;
|
||||
|
@ -513,14 +513,14 @@ void vp9_update_nmv_count(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
MODE_INFO *mi = x->e_mbd.mode_info_context;
|
||||
MB_MODE_INFO *const mbmi = &mi->mbmi;
|
||||
MV diff;
|
||||
const int bw = 1 << b_width_log2(mbmi->sb_type);
|
||||
const int bh = 1 << b_height_log2(mbmi->sb_type);
|
||||
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type];
|
||||
const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[mbmi->sb_type];
|
||||
int idx, idy;
|
||||
|
||||
if (mbmi->sb_type < BLOCK_SIZE_SB8X8) {
|
||||
PARTITION_INFO *pi = x->partition_info;
|
||||
for (idy = 0; idy < 2; idy += bh) {
|
||||
for (idx = 0; idx < 2; idx += bw) {
|
||||
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
|
||||
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
|
||||
const int i = idy * 2 + idx;
|
||||
if (pi->bmi[i].mode == NEWMV) {
|
||||
diff.row = mi->bmi[i].as_mv[0].as_mv.row - best_ref_mv->as_mv.row;
|
||||
|
@ -461,10 +461,8 @@ static void model_rd_for_sb_y_tx(VP9_COMP *cpi, BLOCK_SIZE_TYPE bsize,
|
||||
BLOCK_SIZE_TYPE bs = BLOCK_SIZE_AB4X4;
|
||||
struct macroblock_plane *const p = &x->plane[0];
|
||||
struct macroblockd_plane *const pd = &xd->plane[0];
|
||||
const int bwl = plane_block_width_log2by4(bsize, pd);
|
||||
const int bhl = plane_block_height_log2by4(bsize, pd);
|
||||
const int bw = 4 << bwl;
|
||||
const int bh = 4 << bhl;
|
||||
const int width = plane_block_width(bsize, pd);
|
||||
const int height = plane_block_height(bsize, pd);
|
||||
int rate_sum = 0;
|
||||
int64_t dist_sum = 0;
|
||||
|
||||
@ -483,10 +481,9 @@ static void model_rd_for_sb_y_tx(VP9_COMP *cpi, BLOCK_SIZE_TYPE bsize,
|
||||
} else {
|
||||
assert(0);
|
||||
}
|
||||
assert(bs <= get_block_size(bwl, bhl));
|
||||
*out_skip = 1;
|
||||
for (j = 0; j < bh; j+=t) {
|
||||
for (k = 0; k < bw; k+=t) {
|
||||
for (j = 0; j < height; j += t) {
|
||||
for (k = 0; k < width; k += t) {
|
||||
int rate;
|
||||
int64_t dist;
|
||||
unsigned int sse;
|
||||
@ -709,8 +706,8 @@ static void rate_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
|
||||
static int rdcost_plane(VP9_COMMON * const cm, MACROBLOCK *x, int plane,
|
||||
BLOCK_SIZE_TYPE bsize, TX_SIZE tx_size) {
|
||||
MACROBLOCKD * const xd = &x->e_mbd;
|
||||
const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
|
||||
const int bhl = b_height_log2(bsize) - xd->plane[plane].subsampling_y;
|
||||
const int bwl = plane_block_width_log2by4(bsize, &xd->plane[plane]);
|
||||
const int bhl = plane_block_height_log2by4(bsize, &xd->plane[plane]);
|
||||
const int bw = 1 << bwl, bh = 1 << bhl;
|
||||
struct rdcost_block_args args = { cm, x, { 0 }, { 0 }, tx_size, bw, bh,
|
||||
0, 0, 0, INT64_MAX, 0 };
|
||||
@ -800,8 +797,8 @@ static void super_block_yrd_for_txfm(VP9_COMMON *const cm, MACROBLOCK *x,
|
||||
BLOCK_SIZE_TYPE bsize, TX_SIZE tx_size) {
|
||||
MACROBLOCKD *const xd = &x->e_mbd;
|
||||
struct macroblockd_plane *const pd = &xd->plane[0];
|
||||
const int bwl = b_width_log2(bsize) - xd->plane[0].subsampling_x;
|
||||
const int bhl = b_height_log2(bsize) - xd->plane[0].subsampling_y;
|
||||
const int bwl = plane_block_width_log2by4(bsize, pd);
|
||||
const int bhl = plane_block_height_log2by4(bsize, pd);
|
||||
const int bw = 1 << bwl, bh = 1 << bhl;
|
||||
struct rdcost_block_args args = { cm, x, { 0 }, { 0 }, tx_size, bw, bh,
|
||||
0, 0, 0, ref_best_rd, 0 };
|
||||
@ -1183,8 +1180,8 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
|
||||
ENTROPY_CONTEXT tl[2], templ[2];
|
||||
TX_TYPE tx_type = DCT_DCT;
|
||||
TX_TYPE best_tx_type = DCT_DCT;
|
||||
int bw = 1 << b_width_log2(bsize);
|
||||
int bh = 1 << b_height_log2(bsize);
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
|
||||
int idx, idy, block;
|
||||
DECLARE_ALIGNED(16, int16_t, best_dqcoeff[4][16]);
|
||||
|
||||
@ -1210,8 +1207,8 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
|
||||
vpx_memcpy(tempa, ta, sizeof(ta));
|
||||
vpx_memcpy(templ, tl, sizeof(tl));
|
||||
|
||||
for (idy = 0; idy < bh; ++idy) {
|
||||
for (idx = 0; idx < bw; ++idx) {
|
||||
for (idy = 0; idy < num_4x4_blocks_high; ++idy) {
|
||||
for (idx = 0; idx < num_4x4_blocks_wide; ++idx) {
|
||||
int64_t ssz;
|
||||
|
||||
block = ib + idy * 2 + idx;
|
||||
@ -1268,8 +1265,8 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
|
||||
best_tx_type = tx_type;
|
||||
vpx_memcpy(a, tempa, sizeof(tempa));
|
||||
vpx_memcpy(l, templ, sizeof(templ));
|
||||
for (idy = 0; idy < bh; ++idy) {
|
||||
for (idx = 0; idx < bw; ++idx) {
|
||||
for (idy = 0; idy < num_4x4_blocks_high; ++idy) {
|
||||
for (idx = 0; idx < num_4x4_blocks_wide; ++idx) {
|
||||
block = ib + idy * 2 + idx;
|
||||
vpx_memcpy(best_dqcoeff[idy * 2 + idx],
|
||||
BLOCK_OFFSET(pd->dqcoeff, block, 16),
|
||||
@ -1282,8 +1279,8 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
|
||||
if (x->skip_encode)
|
||||
return best_rd;
|
||||
|
||||
for (idy = 0; idy < bh; ++idy) {
|
||||
for (idx = 0; idx < bw; ++idx) {
|
||||
for (idy = 0; idy < num_4x4_blocks_high; ++idy) {
|
||||
for (idx = 0; idx < num_4x4_blocks_wide; ++idx) {
|
||||
block = ib + idy * 2 + idx;
|
||||
xd->mode_info_context->bmi[block].as_mode = *best_mode;
|
||||
src = raster_block_offset_uint8(xd, BLOCK_SIZE_SB8X8, 0, block,
|
||||
@ -1315,8 +1312,8 @@ static int64_t rd_pick_intra4x4mby_modes(VP9_COMP *cpi, MACROBLOCK *mb,
|
||||
int i, j;
|
||||
MACROBLOCKD *const xd = &mb->e_mbd;
|
||||
BLOCK_SIZE_TYPE bsize = xd->mode_info_context->mbmi.sb_type;
|
||||
int bw = 1 << b_width_log2(bsize);
|
||||
int bh = 1 << b_height_log2(bsize);
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
|
||||
int idx, idy;
|
||||
int cost = 0;
|
||||
int64_t distortion = 0;
|
||||
@ -1331,8 +1328,8 @@ static int64_t rd_pick_intra4x4mby_modes(VP9_COMP *cpi, MACROBLOCK *mb,
|
||||
|
||||
bmode_costs = mb->mbmode_cost;
|
||||
|
||||
for (idy = 0; idy < 2; idy += bh) {
|
||||
for (idx = 0; idx < 2; idx += bw) {
|
||||
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
|
||||
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
|
||||
const int mis = xd->mode_info_stride;
|
||||
MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
|
||||
int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(ry);
|
||||
@ -1355,9 +1352,9 @@ static int64_t rd_pick_intra4x4mby_modes(VP9_COMP *cpi, MACROBLOCK *mb,
|
||||
tot_rate_y += ry;
|
||||
|
||||
mic->bmi[i].as_mode = best_mode;
|
||||
for (j = 1; j < bh; ++j)
|
||||
for (j = 1; j < num_4x4_blocks_high; ++j)
|
||||
mic->bmi[i + j * 2].as_mode = best_mode;
|
||||
for (j = 1; j < bw; ++j)
|
||||
for (j = 1; j < num_4x4_blocks_wide; ++j)
|
||||
mic->bmi[i + j].as_mode = best_mode;
|
||||
|
||||
if (total_rd >= best_rd)
|
||||
@ -1597,8 +1594,8 @@ static int labels2mode(MACROBLOCK *x, int i,
|
||||
MB_MODE_INFO * mbmi = &mic->mbmi;
|
||||
int cost = 0, thismvcost = 0;
|
||||
int idx, idy;
|
||||
int bw = 1 << b_width_log2(mbmi->sb_type);
|
||||
int bh = 1 << b_height_log2(mbmi->sb_type);
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[mbmi->sb_type];
|
||||
|
||||
/* We have to be careful retrieving previously-encoded motion vectors.
|
||||
Ones from this macroblock have to be pulled from the BLOCKD array
|
||||
@ -1648,8 +1645,8 @@ static int labels2mode(MACROBLOCK *x, int i,
|
||||
mic->bmi[i].as_mv[1].as_int = this_second_mv->as_int;
|
||||
|
||||
x->partition_info->bmi[i].mode = m;
|
||||
for (idy = 0; idy < bh; ++idy)
|
||||
for (idx = 0; idx < bw; ++idx)
|
||||
for (idy = 0; idy < num_4x4_blocks_high; ++idy)
|
||||
for (idx = 0; idx < num_4x4_blocks_wide; ++idx)
|
||||
vpx_memcpy(&mic->bmi[i + idy * 2 + idx],
|
||||
&mic->bmi[i], sizeof(mic->bmi[i]));
|
||||
|
||||
@ -1669,10 +1666,8 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi,
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
MACROBLOCKD *xd = &x->e_mbd;
|
||||
BLOCK_SIZE_TYPE bsize = xd->mode_info_context->mbmi.sb_type;
|
||||
const int bwl = plane_block_width_log2by4(bsize, &xd->plane[0]);
|
||||
const int bhl = plane_block_height_log2by4(bsize, &xd->plane[0]);
|
||||
const int bw = 4 << bwl;
|
||||
const int bh = 4 << bhl;
|
||||
const int width = plane_block_width(bsize, &xd->plane[0]);
|
||||
const int height = plane_block_height(bsize, &xd->plane[0]);
|
||||
int idx, idy;
|
||||
const int src_stride = x->plane[0].src.stride;
|
||||
uint8_t* const src = raster_block_offset_uint8(xd, BLOCK_SIZE_SB8X8, 0, i,
|
||||
@ -1696,7 +1691,7 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi,
|
||||
xd->plane[0].dst.stride,
|
||||
&xd->mode_info_context->bmi[i].as_mv[0],
|
||||
&xd->scale_factor[0],
|
||||
bw, bh, 0 /* no avg */, &xd->subpix,
|
||||
width, height, 0, &xd->subpix,
|
||||
MV_PRECISION_Q3);
|
||||
|
||||
if (xd->mode_info_context->mbmi.ref_frame[1] > 0) {
|
||||
@ -1707,17 +1702,18 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi,
|
||||
vp9_build_inter_predictor(second_pre, xd->plane[0].pre[1].stride,
|
||||
dst, xd->plane[0].dst.stride,
|
||||
&xd->mode_info_context->bmi[i].as_mv[1],
|
||||
&xd->scale_factor[1], bw, bh, 1,
|
||||
&xd->scale_factor[1],
|
||||
width, height, 1,
|
||||
&xd->subpix, MV_PRECISION_Q3);
|
||||
}
|
||||
|
||||
vp9_subtract_block(bh, bw, src_diff, 8,
|
||||
vp9_subtract_block(height, width, src_diff, 8,
|
||||
src, src_stride,
|
||||
dst, xd->plane[0].dst.stride);
|
||||
|
||||
k = i;
|
||||
for (idy = 0; idy < bh / 4; ++idy) {
|
||||
for (idx = 0; idx < bw / 4; ++idx) {
|
||||
for (idy = 0; idy < height / 4; ++idy) {
|
||||
for (idx = 0; idx < width / 4; ++idx) {
|
||||
int64_t ssz, rd, rd1, rd2;
|
||||
|
||||
k += (idy * 2 + idx);
|
||||
@ -1823,8 +1819,8 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
int label_mv_thresh;
|
||||
int segmentyrate = 0;
|
||||
BLOCK_SIZE_TYPE bsize = mbmi->sb_type;
|
||||
int bwl = b_width_log2(bsize), bw = 1 << bwl;
|
||||
int bhl = b_height_log2(bsize), bh = 1 << bhl;
|
||||
int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
|
||||
int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
|
||||
vp9_variance_fn_ptr_t *v_fn_ptr;
|
||||
ENTROPY_CONTEXT t_above[2], t_left[2];
|
||||
BEST_SEG_INFO *bsi = bsi_buf + filter_idx;
|
||||
@ -1834,7 +1830,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
vpx_memcpy(t_above, x->e_mbd.plane[0].above_context, sizeof(t_above));
|
||||
vpx_memcpy(t_left, x->e_mbd.plane[0].left_context, sizeof(t_left));
|
||||
|
||||
v_fn_ptr = &cpi->fn_ptr[get_block_size(bwl, bhl)];
|
||||
v_fn_ptr = &cpi->fn_ptr[bsize];
|
||||
|
||||
// 64 makes this threshold really big effectively
|
||||
// making it so that we very rarely check mvs on
|
||||
@ -1843,8 +1839,8 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
label_mv_thresh = 1 * bsi->mvthresh / label_count;
|
||||
|
||||
// Segmentation method overheads
|
||||
for (idy = 0; idy < 2; idy += bh) {
|
||||
for (idx = 0; idx < 2; idx += bw) {
|
||||
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
|
||||
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
|
||||
// TODO(jingning,rbultje): rewrite the rate-distortion optimization
|
||||
// loop for 4x4/4x8/8x4 block coding. to be replaced with new rd loop
|
||||
int_mv mode_mv[MB_MODE_COUNT], second_mode_mv[MB_MODE_COUNT];
|
||||
@ -2036,19 +2032,19 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
x->mvcost, cpi);
|
||||
|
||||
bsi->rdstat[i][mode_idx].mvs[0].as_int = mode_mv[this_mode].as_int;
|
||||
if (bw > 1)
|
||||
if (num_4x4_blocks_wide > 1)
|
||||
bsi->rdstat[i + 1][mode_idx].mvs[0].as_int =
|
||||
mode_mv[this_mode].as_int;
|
||||
if (bh > 1)
|
||||
if (num_4x4_blocks_high > 1)
|
||||
bsi->rdstat[i + 2][mode_idx].mvs[0].as_int =
|
||||
mode_mv[this_mode].as_int;
|
||||
if (mbmi->ref_frame[1] > 0) {
|
||||
bsi->rdstat[i][mode_idx].mvs[1].as_int =
|
||||
second_mode_mv[this_mode].as_int;
|
||||
if (bw > 1)
|
||||
if (num_4x4_blocks_wide > 1)
|
||||
bsi->rdstat[i + 1][mode_idx].mvs[1].as_int =
|
||||
second_mode_mv[this_mode].as_int;
|
||||
if (bh > 1)
|
||||
if (num_4x4_blocks_high > 1)
|
||||
bsi->rdstat[i + 2][mode_idx].mvs[1].as_int =
|
||||
second_mode_mv[this_mode].as_int;
|
||||
}
|
||||
@ -2149,11 +2145,11 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
return;
|
||||
}
|
||||
|
||||
for (j = 1; j < bh; ++j)
|
||||
for (j = 1; j < num_4x4_blocks_high; ++j)
|
||||
vpx_memcpy(&x->partition_info->bmi[i + j * 2],
|
||||
&x->partition_info->bmi[i],
|
||||
sizeof(x->partition_info->bmi[i]));
|
||||
for (j = 1; j < bw; ++j)
|
||||
for (j = 1; j < num_4x4_blocks_wide; ++j)
|
||||
vpx_memcpy(&x->partition_info->bmi[i + j],
|
||||
&x->partition_info->bmi[i],
|
||||
sizeof(x->partition_info->bmi[i]));
|
||||
|
Loading…
x
Reference in New Issue
Block a user