Refactor selected partition size coding for rtc
This commit makes a refactoring of the rtc_use_partition. It allows the encoder to take a preferred block size for non-RD mode decision. The boundary blocks are handled such that smaller block sizes that fit in the boundary size will be used instread. In rtc mode, the coding performance of speed -6 for pedestrian_1080p goes from 158980 b/f, 38.934 dB, 22721 ms to 159008 b/f, 40.064 dB, 23721 ms. For rtc set, the speed -6 compression performance is improved by 26%. Still about 2dB behind speed -5 at this point. Change-Id: If0944f0880eaf1ad340bc325d97cea8d0f9dd53f
This commit is contained in:
@@ -2261,15 +2261,17 @@ static void rtc_use_partition(VP9_COMP *cpi,
|
|||||||
VP9_COMMON *const cm = &cpi->common;
|
VP9_COMMON *const cm = &cpi->common;
|
||||||
MACROBLOCK *const x = &cpi->mb;
|
MACROBLOCK *const x = &cpi->mb;
|
||||||
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
|
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
|
||||||
|
int mis = cm->mode_info_stride;
|
||||||
|
int br, bc;
|
||||||
int i, j;
|
int i, j;
|
||||||
int chosen_rate = INT_MAX;
|
int chosen_rate = INT_MAX;
|
||||||
int64_t chosen_dist = INT_MAX;
|
int64_t chosen_dist = INT_MAX;
|
||||||
MB_PREDICTION_MODE mode = DC_PRED;
|
MB_PREDICTION_MODE mode = DC_PRED;
|
||||||
int row8x8_remaining = MIN(MI_BLOCK_SIZE, tile->mi_row_end - mi_row);
|
int rows = MIN(MI_BLOCK_SIZE, tile->mi_row_end - mi_row);
|
||||||
int col8x8_remaining = MIN(MI_BLOCK_SIZE, tile->mi_col_end - mi_col);
|
int cols = MIN(MI_BLOCK_SIZE, tile->mi_col_end - mi_col);
|
||||||
|
|
||||||
int rows = mi_row + row8x8_remaining;
|
int mi_8x8_width = num_8x8_blocks_wide_lookup[bsize];
|
||||||
int cols = mi_col + col8x8_remaining;
|
int mi_8x8_hight = num_8x8_blocks_high_lookup[bsize];
|
||||||
|
|
||||||
int brate;
|
int brate;
|
||||||
int64_t bdist;
|
int64_t bdist;
|
||||||
@@ -2277,17 +2279,27 @@ static void rtc_use_partition(VP9_COMP *cpi,
|
|||||||
*dist = 0;
|
*dist = 0;
|
||||||
|
|
||||||
// find prediction mode for each 8x8 block
|
// find prediction mode for each 8x8 block
|
||||||
for (j = mi_row; j < rows; ++j) {
|
for (br = 0; br < rows; br += mi_8x8_hight) {
|
||||||
for (i = mi_col; i < cols; ++i) {
|
for (bc = 0; bc < cols; bc += mi_8x8_width) {
|
||||||
set_offsets(cpi, tile, j, i, BLOCK_8X8);
|
int row = mi_row + br;
|
||||||
|
int col = mi_col + bc;
|
||||||
|
int bh = 0, bw = 0;
|
||||||
|
BLOCK_SIZE bs = find_partition_size(bsize, rows - br, cols - bc,
|
||||||
|
&bh, &bw);
|
||||||
|
|
||||||
|
set_offsets(cpi, tile, row, col, bs);
|
||||||
|
|
||||||
if (cm->frame_type != KEY_FRAME)
|
if (cm->frame_type != KEY_FRAME)
|
||||||
vp9_pick_inter_mode(cpi, x, tile, j, i, &brate, &bdist, BLOCK_8X8);
|
vp9_pick_inter_mode(cpi, x, tile, row, col, &brate, &bdist, bs);
|
||||||
else
|
else
|
||||||
set_mode_info(&xd->mi_8x8[0]->mbmi, BLOCK_8X8, mode, j, i);
|
set_mode_info(&xd->mi_8x8[0]->mbmi, bs, mode, row, col);
|
||||||
|
|
||||||
*rate += brate;
|
*rate += brate;
|
||||||
*dist += bdist;
|
*dist += bdist;
|
||||||
|
|
||||||
|
for (j = 0; j < bh; ++j)
|
||||||
|
for (i = 0; i < bw; ++i)
|
||||||
|
xd->mi_8x8[j * mis + i] = xd->mi_8x8[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2316,7 +2328,7 @@ static void encode_rtc_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
|
|||||||
MODE_INFO **mi_8x8 = cm->mi_grid_visible + idx_str;
|
MODE_INFO **mi_8x8 = cm->mi_grid_visible + idx_str;
|
||||||
cpi->mb.source_variance = UINT_MAX;
|
cpi->mb.source_variance = UINT_MAX;
|
||||||
|
|
||||||
rtc_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64,
|
rtc_use_partition(cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_16X16,
|
||||||
&dummy_rate, &dummy_dist, 1);
|
&dummy_rate, &dummy_dist, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -272,7 +272,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
if (best_rd > inter_mode_thresh) {
|
if (best_rd > inter_mode_thresh) {
|
||||||
struct macroblock_plane *const p = &x->plane[0];
|
struct macroblock_plane *const p = &x->plane[0];
|
||||||
struct macroblockd_plane *const pd = &xd->plane[0];
|
struct macroblockd_plane *const pd = &xd->plane[0];
|
||||||
for (this_mode = DC_PRED; this_mode <= H_PRED; ++this_mode) {
|
for (this_mode = DC_PRED; this_mode <= DC_PRED; ++this_mode) {
|
||||||
vp9_predict_intra_block(xd, 0, b_width_log2(bsize),
|
vp9_predict_intra_block(xd, 0, b_width_log2(bsize),
|
||||||
mbmi->tx_size, this_mode,
|
mbmi->tx_size, this_mode,
|
||||||
&p->src.buf[0], p->src.stride,
|
&p->src.buf[0], p->src.stride,
|
||||||
|
Reference in New Issue
Block a user