Commit 3d005e4c authored by Angie Chiang's avatar Angie Chiang

Add av1_predict_intra_block_facade

A simpler interface for intra block prediction

Change-Id: I97e3f385746928d87999e6862b1d71a197df0302
parent 19407b52
......@@ -2249,6 +2249,21 @@ static void predict_square_intra_block(const MACROBLOCKD *xd, int wpx, int hpx,
plane);
}
void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane,
int block_raster_idx, int blk_col,
int blk_row, TX_SIZE tx_size) {
struct macroblockd_plane *const pd = &xd->plane[plane];
const int dst_stride = pd->dst.stride;
uint8_t *dst =
&pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
PREDICTION_MODE mode =
(plane == 0) ? get_y_mode(xd->mi[0], block_raster_idx) : mbmi->uv_mode;
av1_predict_intra_block(xd, pd->width, pd->height, txsize_to_bsize[tx_size],
mode, dst, dst_stride, dst, dst_stride, blk_col,
blk_row, plane);
}
void av1_predict_intra_block(const MACROBLOCKD *xd, int wpx, int hpx,
BLOCK_SIZE bsize, PREDICTION_MODE mode,
const uint8_t *ref, int ref_stride, uint8_t *dst,
......
......@@ -20,7 +20,9 @@ extern "C" {
#endif
void av1_init_intra_predictors(void);
void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane,
int block_raster_idx, int blk_col,
int blk_row, TX_SIZE tx_size);
void av1_predict_intra_block(const MACROBLOCKD *xd, int bw, int bh,
BLOCK_SIZE bsize, PREDICTION_MODE mode,
const uint8_t *ref, int ref_stride, uint8_t *dst,
......
......@@ -538,27 +538,17 @@ static int av1_pvq_decode_helper2(AV1_COMMON *cm, MACROBLOCKD *const xd,
static void predict_and_reconstruct_intra_block(
AV1_COMMON *cm, MACROBLOCKD *const xd, aom_reader *const r,
MB_MODE_INFO *const mbmi, int plane, int row, int col, TX_SIZE tx_size) {
struct macroblockd_plane *const pd = &xd->plane[plane];
PREDICTION_MODE mode = (plane == 0) ? mbmi->mode : mbmi->uv_mode;
PLANE_TYPE plane_type = get_plane_type(plane);
uint8_t *dst;
const int block_idx = (row << 1) + col;
#if CONFIG_PVQ
(void)r;
#endif
dst = &pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
#if !CONFIG_CB4X4
if (mbmi->sb_type < BLOCK_8X8)
if (plane == 0) mode = xd->mi[0]->bmi[block_idx].as_mode;
#endif
av1_predict_intra_block(xd, pd->width, pd->height, txsize_to_bsize[tx_size],
mode, dst, pd->dst.stride, dst, pd->dst.stride, col,
row, plane);
av1_predict_intra_block_facade(xd, plane, block_idx, col, row, tx_size);
if (!mbmi->skip) {
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
#if !CONFIG_PVQ
struct macroblockd_plane *const pd = &xd->plane[plane];
#if CONFIG_LV_MAP
int16_t max_scan_line = 0;
int eob;
......@@ -571,9 +561,12 @@ static void predict_and_reconstruct_intra_block(
av1_decode_block_tokens(cm, xd, plane, scan_order, col, row, tx_size,
tx_type, &max_scan_line, r, mbmi->segment_id);
#endif // CONFIG_LV_MAP
if (eob)
if (eob) {
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
max_scan_line, eob);
}
#else
av1_pvq_decode_helper2(cm, xd, mbmi, plane, row, col, tx_size, tx_type);
#endif
......
......@@ -1082,7 +1082,6 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block);
const TX_TYPE tx_type =
get_tx_type(plane_type, xd, block_raster_idx, tx_size);
PREDICTION_MODE mode;
const int diff_stride = block_size_wide[plane_bsize];
uint8_t *src, *dst;
int16_t *src_diff;
......@@ -1098,15 +1097,13 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
int i, j;
#endif
av1_predict_intra_block_facade(xd, plane, block_raster_idx, blk_col, blk_row,
tx_size);
dst = &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
src = &p->src.buf[(blk_row * src_stride + blk_col) << tx_size_wide_log2[0]];
src_diff =
&p->src_diff[(blk_row * diff_stride + blk_col) << tx_size_wide_log2[0]];
mode = (plane == 0) ? get_y_mode(xd->mi[0], block_raster_idx) : mbmi->uv_mode;
av1_predict_intra_block(xd, pd->width, pd->height, txsize_to_bsize[tx_size],
mode, dst, dst_stride, dst, dst_stride, blk_col,
blk_row, plane);
subtract_block(xd, tx1d_height, tx1d_width, src_diff, diff_stride, src,
src_stride, dst, dst_stride);
......
......@@ -2401,14 +2401,15 @@ static int64_t intra_model_yrd(const AV1_COMP *const cpi, MACROBLOCK *const x,
const int max_blocks_high = max_block_high(xd, bsize, 0);
mbmi->tx_size = tx_size;
// Prediction.
const int step = stepr * stepc;
int block = 0;
for (row = 0; row < max_blocks_high; row += stepr) {
for (col = 0; col < max_blocks_wide; col += stepc) {
struct macroblockd_plane *const pd = &xd->plane[0];
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
av1_predict_intra_block(xd, pd->width, pd->height,
txsize_to_bsize[tx_size], mbmi->mode, dst,
pd->dst.stride, dst, pd->dst.stride, col, row, 0);
const int block_raster_idx =
av1_block_index_to_raster_order(tx_size, block);
av1_predict_intra_block_facade(xd, 0, block_raster_idx, col, row,
tx_size);
block += step;
}
}
// RD estimation.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment