Commit 815e95fb authored by Jingning Han's avatar Jingning Han

Make intra predictor support rectangular blocks

The intra predictor supports configurable block sizes. It can handle
intra prediction down to 4x4 sizes, when enabled in BLOCK_SIZE_TYPE.

Change-Id: I7399ec2512393aa98aadda9813ca0c83e19af854
parent 2f19cd03
......@@ -237,6 +237,15 @@ static INLINE int mb_height_log2(BLOCK_SIZE_TYPE sb_type) {
}
}
// parse block dimension in the unit of 4x4 blocks
static INLINE int b_width_log2(BLOCK_SIZE_TYPE sb_type) {
return mb_width_log2(sb_type) + 2;
}
static INLINE int b_height_log2(BLOCK_SIZE_TYPE sb_type) {
return mb_height_log2(sb_type) + 2;
}
typedef enum {
BLOCK_4X4_LG2 = 0,
BLOCK_8X8_LG2 = 2,
......
This diff is collapsed.
......@@ -86,33 +86,18 @@ specialize vp9_recon_sby_s
prototype void vp9_recon_sbuv_s "struct macroblockd *x, uint8_t *udst, uint8_t *vdst, enum BLOCK_SIZE_TYPE bsize"
specialize void vp9_recon_sbuv_s
prototype void vp9_build_intra_predictors_mby_s "struct macroblockd *x"
specialize vp9_build_intra_predictors_mby_s
prototype void vp9_build_intra_predictors_sby_s "struct macroblockd *x"
prototype void vp9_build_intra_predictors_sby_s "struct macroblockd *x, enum BLOCK_SIZE_TYPE bsize"
specialize vp9_build_intra_predictors_sby_s;
prototype void vp9_build_intra_predictors_sbuv_s "struct macroblockd *x"
prototype void vp9_build_intra_predictors_sbuv_s "struct macroblockd *x, enum BLOCK_SIZE_TYPE bsize"
specialize vp9_build_intra_predictors_sbuv_s;
prototype void vp9_build_intra_predictors_mby "struct macroblockd *x"
specialize vp9_build_intra_predictors_mby;
prototype void vp9_build_intra_predictors_mby_s "struct macroblockd *x"
specialize vp9_build_intra_predictors_mby_s;
prototype void vp9_build_intra_predictors_mbuv "struct macroblockd *x"
specialize vp9_build_intra_predictors_mbuv;
prototype void vp9_build_intra_predictors_mbuv_s "struct macroblockd *x"
specialize vp9_build_intra_predictors_mbuv_s;
prototype void vp9_build_intra_predictors_sb64y_s "struct macroblockd *x"
specialize vp9_build_intra_predictors_sb64y_s;
prototype void vp9_build_intra_predictors_sb64uv_s "struct macroblockd *x"
specialize vp9_build_intra_predictors_sb64uv_s;
prototype void vp9_intra4x4_predict "struct macroblockd *xd, struct blockd *x, int b_mode, uint8_t *predictor, int pre_stride"
specialize vp9_intra4x4_predict;
......
......@@ -183,25 +183,15 @@ static void propagate_nzcs(VP9_COMMON *cm, MACROBLOCKD *xd) {
}
#endif
/* skip_recon_mb() is Modified: Instead of writing the result to predictor buffer and then copying it
* to dst buffer, we can write the result directly to dst buffer. This eliminates unnecessary copy.
*/
static void skip_recon_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
int mb_row, int mb_col) {
static void skip_recon_sb(VP9D_COMP *pbi, MACROBLOCKD *xd,
int mb_row, int mb_col,
BLOCK_SIZE_TYPE bsize) {
MODE_INFO *m = xd->mode_info_context;
BLOCK_SIZE_TYPE sb_type = m->mbmi.sb_type;
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) {
if (sb_type == BLOCK_SIZE_SB64X64) {
vp9_build_intra_predictors_sb64uv_s(xd);
vp9_build_intra_predictors_sb64y_s(xd);
} else if (sb_type == BLOCK_SIZE_SB32X32) {
vp9_build_intra_predictors_sbuv_s(xd);
vp9_build_intra_predictors_sby_s(xd);
} else {
vp9_build_intra_predictors_mbuv_s(xd);
vp9_build_intra_predictors_mby_s(xd);
}
vp9_build_intra_predictors_sbuv_s(xd, bsize);
vp9_build_intra_predictors_sby_s(xd, bsize);
} else {
if (sb_type == BLOCK_SIZE_SB64X64) {
vp9_build_inter64x64_predictors_sb(xd, mb_row, mb_col);
......@@ -409,7 +399,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
if (!xd->mode_info_context->mbmi.mb_skip_coeff)
vp9_decode_mb_tokens_4x4_uv(pbi, xd, bc);
#endif
vp9_build_intra_predictors_mbuv_s(xd);
vp9_build_intra_predictors_sbuv_s(xd, BLOCK_SIZE_MB16X16);
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant,
xd->dst.u_buffer, xd->dst.uv_stride, xd->dst.u_buffer,
xd->dst.uv_stride, xd->plane[1].eobs);
......@@ -709,27 +699,21 @@ static void decode_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb_col,
// Special case: Force the loopfilter to skip when eobtotal and
// mb_skip_coeff are zero.
skip_recon_mb(pbi, xd, mb_row, mb_col);
skip_recon_sb(pbi, xd, mb_row, mb_col, bsize);
return;
}
// TODO(jingning): need to combine intra/inter predictor functions and
// TODO(jingning): need to combine inter predictor functions and
// make them block size independent.
// generate prediction
if (bsize == BLOCK_SIZE_SB64X64) {
assert(bsize == BLOCK_SIZE_SB64X64);
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) {
vp9_build_intra_predictors_sb64y_s(xd);
vp9_build_intra_predictors_sb64uv_s(xd);
} else {
vp9_build_inter64x64_predictors_sb(xd, mb_row, mb_col);
}
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) {
vp9_build_intra_predictors_sby_s(xd, bsize);
vp9_build_intra_predictors_sbuv_s(xd, bsize);
} else {
assert(bsize == BLOCK_SIZE_SB32X32);
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) {
vp9_build_intra_predictors_sby_s(xd);
vp9_build_intra_predictors_sbuv_s(xd);
if (bsize == BLOCK_SIZE_SB64X64) {
vp9_build_inter64x64_predictors_sb(xd, mb_row, mb_col);
} else {
assert(bsize == BLOCK_SIZE_SB32X32);
vp9_build_inter32x32_predictors_sb(xd, mb_row, mb_col);
}
}
......@@ -804,7 +788,7 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
// Special case: Force the loopfilter to skip when eobtotal and
// mb_skip_coeff are zero.
xd->mode_info_context->mbmi.mb_skip_coeff = 1;
skip_recon_mb(pbi, xd, mb_row, mb_col);
skip_recon_sb(pbi, xd, mb_row, mb_col, BLOCK_SIZE_MB16X16);
return;
}
#if 0 // def DEC_DEBUG
......@@ -819,9 +803,9 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
// do prediction
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) {
if (mode != I8X8_PRED) {
vp9_build_intra_predictors_mbuv_s(xd);
vp9_build_intra_predictors_sbuv_s(xd, BLOCK_SIZE_MB16X16);
if (mode != B_PRED)
vp9_build_intra_predictors_mby_s(xd);
vp9_build_intra_predictors_sby_s(xd, BLOCK_SIZE_MB16X16);
}
} else {
#if 0 // def DEC_DEBUG
......
......@@ -2184,13 +2184,8 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t,
}
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) {
if (bsize == BLOCK_SIZE_SB32X32) {
vp9_build_intra_predictors_sby_s(&x->e_mbd);
vp9_build_intra_predictors_sbuv_s(&x->e_mbd);
} else {
vp9_build_intra_predictors_sb64y_s(&x->e_mbd);
vp9_build_intra_predictors_sb64uv_s(&x->e_mbd);
}
vp9_build_intra_predictors_sby_s(&x->e_mbd, bsize);
vp9_build_intra_predictors_sbuv_s(&x->e_mbd, bsize);
if (output_enabled)
sum_intra_stats(cpi, x);
} else {
......
......@@ -1113,11 +1113,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
x->e_mbd.mode_info_context->mbmi.mode = mode;
if (bsize == BLOCK_SIZE_MB16X16) {
vp9_build_intra_predictors_mby(&x->e_mbd);
} else if (bsize == BLOCK_SIZE_SB32X32) {
vp9_build_intra_predictors_sby_s(&x->e_mbd);
} else {
assert(bsize == BLOCK_SIZE_SB64X64);
vp9_build_intra_predictors_sb64y_s(&x->e_mbd);
vp9_build_intra_predictors_sby_s(&x->e_mbd, bsize);
}
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion, &s,
......@@ -1627,14 +1624,10 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x,
for (mode = DC_PRED; mode <= TM_PRED; mode++) {
x->e_mbd.mode_info_context->mbmi.uv_mode = mode;
if (bsize == BLOCK_SIZE_MB16X16) {
if (bsize == BLOCK_SIZE_MB16X16)
vp9_build_intra_predictors_mbuv(&x->e_mbd);
} else if (bsize == BLOCK_SIZE_SB32X32) {
vp9_build_intra_predictors_sbuv_s(&x->e_mbd);
} else {
assert(bsize == BLOCK_SIZE_SB64X64);
vp9_build_intra_predictors_sb64uv_s(&x->e_mbd);
}
else
vp9_build_intra_predictors_sbuv_s(&x->e_mbd, bsize);
super_block_uvrd(&cpi->common, x, &this_rate_tokenonly,
&this_distortion, &s, bsize);
......@@ -4616,13 +4609,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (ref_frame == INTRA_FRAME) {
TX_SIZE uv_tx;
if (bsize == BLOCK_SIZE_SB64X64) {
vp9_build_intra_predictors_sb64y_s(xd);
} else {
assert(bsize == BLOCK_SIZE_SB32X32);
vp9_build_intra_predictors_sby_s(xd);
}
vp9_build_intra_predictors_sby_s(xd, bsize);
super_block_yrd(cpi, x, &rate_y, &distortion_y, &skippable,
bsize, txfm_cache);
......
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