diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 4ad90c65d11baa8c573d3ad1d7aa1dbd6c3eae67..28942f7d66bd3a30717934e8dd806ddf58607531 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -2261,15 +2261,17 @@ static void rtc_use_partition(VP9_COMP *cpi, VP9_COMMON *const cm = &cpi->common; MACROBLOCK *const x = &cpi->mb; MACROBLOCKD *const xd = &cpi->mb.e_mbd; + int mis = cm->mode_info_stride; + int br, bc; int i, j; int chosen_rate = INT_MAX; int64_t chosen_dist = INT_MAX; MB_PREDICTION_MODE mode = DC_PRED; - int row8x8_remaining = MIN(MI_BLOCK_SIZE, tile->mi_row_end - mi_row); - int col8x8_remaining = MIN(MI_BLOCK_SIZE, tile->mi_col_end - mi_col); + int rows = MIN(MI_BLOCK_SIZE, tile->mi_row_end - mi_row); + int cols = MIN(MI_BLOCK_SIZE, tile->mi_col_end - mi_col); - int rows = mi_row + row8x8_remaining; - int cols = mi_col + col8x8_remaining; + int mi_8x8_width = num_8x8_blocks_wide_lookup[bsize]; + int mi_8x8_hight = num_8x8_blocks_high_lookup[bsize]; int brate; int64_t bdist; @@ -2277,17 +2279,27 @@ static void rtc_use_partition(VP9_COMP *cpi, *dist = 0; // find prediction mode for each 8x8 block - for (j = mi_row; j < rows; ++j) { - for (i = mi_col; i < cols; ++i) { - set_offsets(cpi, tile, j, i, BLOCK_8X8); + for (br = 0; br < rows; br += mi_8x8_hight) { + for (bc = 0; bc < cols; bc += mi_8x8_width) { + 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) - 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 - 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; *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; 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); } } diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index dbb6ea710a78fd6f878a7baecd330836d4a49ff9..a4e11d6d00a46021d458e56d78a8397d2b3e9ad2 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -272,7 +272,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (best_rd > inter_mode_thresh) { struct macroblock_plane *const p = &x->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), mbmi->tx_size, this_mode, &p->src.buf[0], p->src.stride,