summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_bitstream.c
diff options
context:
space:
mode:
authorJingning Han <jingning@google.com>2013-05-10 17:06:37 -0700
committerJingning Han <jingning@google.com>2013-05-14 12:39:56 -0700
commit1f26840fbfbef085ed53016bfc91705f148916fd (patch)
tree3bf7dd8aa5bb896cd180681b0d5571198a3ac90a /vp9/encoder/vp9_bitstream.c
parentdee12bdf8fb4b67af5f90f737cf949a239911867 (diff)
downloadlibvpx-1f26840fbfbef085ed53016bfc91705f148916fd.tar
libvpx-1f26840fbfbef085ed53016bfc91705f148916fd.tar.gz
libvpx-1f26840fbfbef085ed53016bfc91705f148916fd.tar.bz2
libvpx-1f26840fbfbef085ed53016bfc91705f148916fd.zip
Enable recursive partition down to 4x4
This commit allows the rate-distortion optimization recursion at encoder to go down to 4x4 block size. It deprecates the use of I4X4_PRED and SPLITMV syntax elements from bit-stream writing/reading. Will remove the unused probability models in the next patch. The partition type search and bit-stream are now capable of supporting the rectangular partition of 8x8 block, i.e., 8x4 and 4x8. Need to revise the rate-distortion parts to get these two partition tested in the rd loop. Change-Id: I0dfe3b90a1507ad6138db10cc58e6e237a06a9d6
Diffstat (limited to 'vp9/encoder/vp9_bitstream.c')
-rw-r--r--vp9/encoder/vp9_bitstream.c56
1 files changed, 55 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index ac29a8e0c..398545136 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -629,12 +629,21 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
active_section = 6;
#endif
+#if CONFIG_AB4X4
+ if (m->mbmi.sb_type >= BLOCK_SIZE_SB8X8)
+ write_sb_ymode(bc, mode, pc->fc.sb_ymode_prob);
+#else
if (m->mbmi.sb_type > BLOCK_SIZE_SB8X8)
write_sb_ymode(bc, mode, pc->fc.sb_ymode_prob);
else
write_ymode(bc, mode, pc->fc.ymode_prob);
+#endif
+#if CONFIG_AB4X4
+ if (m->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
+#else
if (mode == I4X4_PRED) {
+#endif
int j = 0;
do {
write_bmode(bc, m->bmi[j].as_mode.first,
@@ -654,11 +663,16 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
// If segment skip is not enabled code the mode.
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
+#if CONFIG_AB4X4
+ if (mi->sb_type >= BLOCK_SIZE_SB8X8)
+ write_sb_mv_ref(bc, mode, mv_ref_p);
+#else
if (mi->sb_type > BLOCK_SIZE_SB8X8) {
write_sb_mv_ref(bc, mode, mv_ref_p);
} else {
write_mv_ref(bc, mode, mv_ref_p);
}
+#endif
vp9_accum_mv_refs(&cpi->common, mode, mi->mb_mode_context[rf]);
}
@@ -744,11 +758,20 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
}
}
+#if CONFIG_AB4X4
+ if (((rf == INTRA_FRAME && mi->sb_type >= BLOCK_SIZE_SB8X8) ||
+ (rf != INTRA_FRAME && mi->sb_type >= BLOCK_SIZE_SB8X8)) &&
+ pc->txfm_mode == TX_MODE_SELECT &&
+ !(skip_coeff || vp9_segfeature_active(xd, segment_id,
+ SEG_LVL_SKIP)))
+#else
if (((rf == INTRA_FRAME && mode != I4X4_PRED) ||
(rf != INTRA_FRAME && mode != SPLITMV)) &&
pc->txfm_mode == TX_MODE_SELECT &&
!(skip_coeff || vp9_segfeature_active(xd, segment_id,
- SEG_LVL_SKIP))) {
+ SEG_LVL_SKIP)))
+#endif
+ {
TX_SIZE sz = mi->txfm_size;
// FIXME(rbultje) code ternary symbol once all experiments are merged
vp9_write(bc, sz != TX_4X4, pc->prob_tx[0]);
@@ -780,12 +803,21 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
vp9_write(bc, skip_coeff, vp9_get_pred_prob(c, xd, PRED_MBSKIP));
}
+#if CONFIG_AB4X4
+ if (m->mbmi.sb_type >= BLOCK_SIZE_SB8X8)
+ sb_kfwrite_ymode(bc, ym, c->sb_kf_ymode_prob[c->kf_ymode_probs_index]);
+#else
if (m->mbmi.sb_type > BLOCK_SIZE_SB8X8)
sb_kfwrite_ymode(bc, ym, c->sb_kf_ymode_prob[c->kf_ymode_probs_index]);
else
kfwrite_ymode(bc, ym, c->kf_ymode_prob[c->kf_ymode_probs_index]);
+#endif
+#if CONFIG_AB4X4
+ if (m->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
+#else
if (ym == I4X4_PRED) {
+#endif
int i = 0;
do {
const B_PREDICTION_MODE a = above_block_mode(m, i, mis);
@@ -803,8 +835,13 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
write_uv_mode(bc, m->mbmi.uv_mode, c->kf_uv_mode_prob[ym]);
+#if CONFIG_AB4X4
+ if (m->mbmi.sb_type >= BLOCK_SIZE_SB8X8 && c->txfm_mode == TX_MODE_SELECT &&
+ !(skip_coeff || vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))) {
+#else
if (ym != I4X4_PRED && c->txfm_mode == TX_MODE_SELECT &&
!(skip_coeff || vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))) {
+#endif
TX_SIZE sz = m->mbmi.txfm_size;
// FIXME(rbultje) code ternary symbol once all experiments are merged
vp9_write(bc, sz != TX_4X4, c->prob_tx[0]);
@@ -876,7 +913,19 @@ static void write_modes_sb(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc,
else
assert(0);
+#if CONFIG_AB4X4
+ if (bsize == BLOCK_SIZE_SB8X8 && m->mbmi.sb_type < BLOCK_SIZE_SB8X8)
+ partition = PARTITION_SPLIT;
+ if (bsize < BLOCK_SIZE_SB8X8)
+ if (xd->ab_index != 0)
+ return;
+#endif
+
+#if CONFIG_AB4X4
+ if (bsize >= BLOCK_SIZE_SB8X8) {
+#else
if (bsize > BLOCK_SIZE_SB8X8) {
+#endif
int pl;
xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK);
xd->above_seg_context = cm->above_seg_context + mi_col;
@@ -915,8 +964,13 @@ static void write_modes_sb(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc,
}
// update partition context
+#if CONFIG_AB4X4
+ if (bsize >= BLOCK_SIZE_SB8X8 &&
+ (bsize == BLOCK_SIZE_SB8X8 || partition != PARTITION_SPLIT)) {
+#else
if (bsize > BLOCK_SIZE_SB8X8 &&
(bsize == BLOCK_SIZE_MB16X16 || partition != PARTITION_SPLIT)) {
+#endif
set_partition_seg_context(cm, xd, mi_row, mi_col);
update_partition_context(xd, subsize, bsize);
}