Refactor per block rate distortion estimate
Move the rate-distortion estimate function outside the recursion as an individual operating module. Change-Id: I662199223c256664bcd312084b3aebffb8a8034b
This commit is contained in:
parent
d4b8dd76c4
commit
0451c6b6dd
@ -1136,32 +1136,13 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
return best_rd;
|
return best_rd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tx_block_rd(const VP9_COMP *cpi, MACROBLOCK *x,
|
static void tx_block_rd_b(MACROBLOCK *x, TX_SIZE tx_size,
|
||||||
int blk_row, int blk_col, int plane, int block,
|
int blk_row, int blk_col, int plane, int block,
|
||||||
TX_SIZE tx_size, BLOCK_SIZE plane_bsize,
|
int plane_bsize, ENTROPY_CONTEXT *above_ctx,
|
||||||
ENTROPY_CONTEXT *above_ctx, ENTROPY_CONTEXT *left_ctx,
|
ENTROPY_CONTEXT *left_ctx,
|
||||||
int *rate, int64_t *dist, int64_t *bsse, int *skip) {
|
int *rate, int64_t *dist, int64_t *bsse, int *skip) {
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
|
|
||||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||||
int tx_idx = (blk_row >> (1 - pd->subsampling_y)) * 8 +
|
|
||||||
(blk_col >> (1 - pd->subsampling_x));
|
|
||||||
TX_SIZE plane_tx_size = plane ?
|
|
||||||
get_uv_tx_size_impl(mbmi->inter_tx_size[tx_idx], plane_bsize, 0, 0) :
|
|
||||||
mbmi->inter_tx_size[tx_idx];
|
|
||||||
|
|
||||||
int max_blocks_high = num_4x4_blocks_high_lookup[plane_bsize];
|
|
||||||
int max_blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize];
|
|
||||||
|
|
||||||
if (xd->mb_to_bottom_edge < 0)
|
|
||||||
max_blocks_high += xd->mb_to_bottom_edge >> (5 + pd->subsampling_y);
|
|
||||||
if (xd->mb_to_right_edge < 0)
|
|
||||||
max_blocks_wide += xd->mb_to_right_edge >> (5 + pd->subsampling_x);
|
|
||||||
|
|
||||||
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (tx_size == plane_tx_size) {
|
|
||||||
const int ss_txfrm_size = tx_size << 1;
|
const int ss_txfrm_size = tx_size << 1;
|
||||||
const struct macroblock_plane *const p = &x->plane[plane];
|
const struct macroblock_plane *const p = &x->plane[plane];
|
||||||
int64_t this_sse;
|
int64_t this_sse;
|
||||||
@ -1213,6 +1194,36 @@ static void tx_block_rd(const VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
tl[i] = tl[0];
|
tl[i] = tl[0];
|
||||||
}
|
}
|
||||||
*skip &= (p->eobs[block] == 0);
|
*skip &= (p->eobs[block] == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void tx_block_rd(const VP9_COMP *cpi, MACROBLOCK *x,
|
||||||
|
int blk_row, int blk_col, int plane, int block,
|
||||||
|
TX_SIZE tx_size, BLOCK_SIZE plane_bsize,
|
||||||
|
ENTROPY_CONTEXT *above_ctx, ENTROPY_CONTEXT *left_ctx,
|
||||||
|
int *rate, int64_t *dist, int64_t *bsse, int *skip) {
|
||||||
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
|
||||||
|
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||||
|
int tx_idx = (blk_row >> (1 - pd->subsampling_y)) * 8 +
|
||||||
|
(blk_col >> (1 - pd->subsampling_x));
|
||||||
|
TX_SIZE plane_tx_size = plane ?
|
||||||
|
get_uv_tx_size_impl(mbmi->inter_tx_size[tx_idx], plane_bsize, 0, 0) :
|
||||||
|
mbmi->inter_tx_size[tx_idx];
|
||||||
|
|
||||||
|
int max_blocks_high = num_4x4_blocks_high_lookup[plane_bsize];
|
||||||
|
int max_blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize];
|
||||||
|
|
||||||
|
if (xd->mb_to_bottom_edge < 0)
|
||||||
|
max_blocks_high += xd->mb_to_bottom_edge >> (5 + pd->subsampling_y);
|
||||||
|
if (xd->mb_to_right_edge < 0)
|
||||||
|
max_blocks_wide += xd->mb_to_right_edge >> (5 + pd->subsampling_x);
|
||||||
|
|
||||||
|
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (tx_size == plane_tx_size) {
|
||||||
|
tx_block_rd_b(x, tx_size, blk_row, blk_col, plane, block,
|
||||||
|
plane_bsize, above_ctx, left_ctx, rate, dist, bsse, skip);
|
||||||
} else {
|
} else {
|
||||||
BLOCK_SIZE bsize = txsize_to_bsize[tx_size];
|
BLOCK_SIZE bsize = txsize_to_bsize[tx_size];
|
||||||
int bh = num_4x4_blocks_high_lookup[bsize];
|
int bh = num_4x4_blocks_high_lookup[bsize];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user