ref: 276a1106e6db3d880e9b009725df81eacc2b316b
parent: a21359cbead9a68ba3b2e15088c925824d620406
parent: 5ba98ebcf15ab91f9c54370ab020f7d5e3a8d8d4
author: Ronald S. Bultje <[email protected]>
date: Tue Apr 23 11:29:19 EDT 2013
Merge changes I54acef34,I72d42971 into experimental * changes: Make some sb_type comparisons independent of literal enum values. Make loopfilter aware of rectangular blocks.
--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -281,36 +281,37 @@
uint8_t *y_ptr, uint8_t *u_ptr, uint8_t *v_ptr,
int y_stride, int uv_stride,
int y_only, int dering) {
- BLOCK_SIZE_TYPE sb_type = mode_info_context->mbmi.sb_type;
- TX_SIZE tx_size = mode_info_context->mbmi.txfm_size;
- int do_left_v, do_above_h;
- int do_left_v_mbuv, do_above_h_mbuv;
- int mis = cm->mode_info_stride;
- const MODE_INFO *mi;
+ BLOCK_SIZE_TYPE sb_type = mode_info_context->mbmi.sb_type;
+ const int wbl = b_width_log2(sb_type), hbl = b_height_log2(sb_type);
+ TX_SIZE tx_size = mode_info_context->mbmi.txfm_size;
+ int do_left_v, do_above_h;
+ int do_left_v_mbuv, do_above_h_mbuv;
+ int mis = cm->mode_info_stride;
+ const MODE_INFO *mi;
- // process 1st MB top-left
- mi = mode_info_context;
- do_left_v = (mb_col > 0);
- do_above_h = (mb_row > 0);
- do_left_v_mbuv = !(sb_type >= BLOCK_SIZE_SB64X64 &&
+ // process 1st MB top-left
+ mi = mode_info_context;
+ do_left_v = (mb_col > 0);
+ do_above_h = (mb_row > 0);
+ do_left_v_mbuv = !(sb_type >= BLOCK_SIZE_SB64X64 &&
tx_size >= TX_32X32 && (mb_col & 2));
- do_above_h_mbuv = !(sb_type >= BLOCK_SIZE_SB64X64 &&
+ do_above_h_mbuv = !(sb_type >= BLOCK_SIZE_SB64X64 &&
tx_size >= TX_32X32 && (mb_row & 2));
- lpf_mb(cm, mi, do_left_v, do_above_h,
+ lpf_mb(cm, mi, do_left_v, do_above_h,
do_left_v_mbuv, do_above_h_mbuv,
y_ptr,
y_only? 0 : u_ptr,
y_only? 0 : v_ptr,
y_stride, uv_stride, dering);
- // process 2nd MB top-right
- mi = mode_info_context + 1;
- do_left_v = !(sb_type && (tx_size >= TX_32X32 ||
+ // process 2nd MB top-right
+ mi = mode_info_context + 1;
+ do_left_v = !(wbl >= 3 /* 32x16 or >=32x32 */ && (tx_size >= TX_32X32 ||
sb_mb_lf_skip(mode_info_context, mi)));
- do_above_h = (mb_row > 0);
- do_left_v_mbuv = do_left_v;
- do_above_h_mbuv = !(sb_type >= BLOCK_SIZE_SB64X64 &&
+ do_above_h = (mb_row > 0);
+ do_left_v_mbuv = do_left_v;
+ do_above_h_mbuv = !(sb_type >= BLOCK_SIZE_SB64X64 &&
tx_size >= TX_32X32 && (mb_row & 2));
- lpf_mb(cm, mi, do_left_v, do_above_h,
+ lpf_mb(cm, mi, do_left_v, do_above_h,
do_left_v_mbuv, do_above_h_mbuv,
y_ptr + 16,
y_only ? 0 : (u_ptr + 8),
@@ -317,15 +318,15 @@
y_only ? 0 : (v_ptr + 8),
y_stride, uv_stride, dering);
- // process 3rd MB bottom-left
- mi = mode_info_context + mis;
- do_left_v = (mb_col > 0);
- do_above_h =!(sb_type && (tx_size >= TX_32X32 ||
+ // process 3rd MB bottom-left
+ mi = mode_info_context + mis;
+ do_left_v = (mb_col > 0);
+ do_above_h = !(hbl >= 3 /* 16x32 or >=32x32 */ && (tx_size >= TX_32X32 ||
sb_mb_lf_skip(mode_info_context, mi)));
- do_left_v_mbuv = !(sb_type >= BLOCK_SIZE_SB64X64 &&
+ do_left_v_mbuv = !(sb_type >= BLOCK_SIZE_SB64X64 &&
tx_size >= TX_32X32 && (mb_col & 2));
- do_above_h_mbuv = do_above_h;
- lpf_mb(cm, mi, do_left_v, do_above_h,
+ do_above_h_mbuv = do_above_h;
+ lpf_mb(cm, mi, do_left_v, do_above_h,
do_left_v_mbuv, do_above_h_mbuv,
y_ptr + 16 * y_stride,
y_only ? 0 : (u_ptr + 8 * uv_stride),
@@ -332,15 +333,15 @@
y_only ? 0 : (v_ptr + 8 * uv_stride),
y_stride, uv_stride, dering);
- // process 4th MB bottom right
- mi = mode_info_context + mis + 1;
- do_left_v = !(sb_type && (tx_size >= TX_32X32 ||
+ // process 4th MB bottom right
+ mi = mode_info_context + mis + 1;
+ do_left_v = !(wbl >= 3 /* 32x16 or >=32x32 */ && (tx_size >= TX_32X32 ||
sb_mb_lf_skip(mi - 1, mi)));
- do_above_h =!(sb_type && (tx_size >= TX_32X32 ||
+ do_above_h = !(hbl >= 3 /* 16x32 or >=32x32 */ && (tx_size >= TX_32X32 ||
sb_mb_lf_skip(mode_info_context + 1, mi)));
- do_left_v_mbuv = do_left_v;
- do_above_h_mbuv = do_above_h;
- lpf_mb(cm, mi, do_left_v, do_above_h,
+ do_left_v_mbuv = do_left_v;
+ do_above_h_mbuv = do_above_h;
+ lpf_mb(cm, mi, do_left_v, do_above_h,
do_left_v_mbuv, do_above_h_mbuv,
y_ptr + 16 * y_stride + 16,
y_only ? 0 : (u_ptr + 8 * uv_stride + 8),
--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -230,7 +230,7 @@
int vp9_get_pred_mb_segid(VP9_COMMON *cm, BLOCK_SIZE_TYPE sb_type,
int mb_row, int mb_col) {
const int mb_index = mb_row * cm->mb_cols + mb_col;
- if (sb_type) {
+ if (sb_type > BLOCK_SIZE_MB16X16) {
const int bw = 1 << mb_width_log2(sb_type);
const int bh = 1 << mb_height_log2(sb_type);
const int ymbs = MIN(cm->mb_rows - mb_row, bh);
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -98,7 +98,7 @@
int mb_row, int mb_col, int segment_id) {
const int mb_index = mb_row * cm->mb_cols + mb_col;
const BLOCK_SIZE_TYPE sb_type = mbmi->sb_type;
- if (sb_type) {
+ if (sb_type > BLOCK_SIZE_MB16X16) {
const int bw = 1 << mb_width_log2(sb_type);
const int bh = 1 << mb_height_log2(sb_type);
const int ymbs = MIN(cm->mb_rows - mb_row, bh);
@@ -149,7 +149,7 @@
m->mbmi.mb_skip_coeff = vp9_read(r, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
// luma mode
- m->mbmi.mode = m->mbmi.sb_type ?
+ m->mbmi.mode = m->mbmi.sb_type > BLOCK_SIZE_MB16X16 ?
read_kf_sb_ymode(r, cm->sb_kf_ymode_prob[cm->kf_ymode_probs_index]):
read_kf_mb_ymode(r, cm->kf_ymode_prob[cm->kf_ymode_probs_index]);
@@ -677,7 +677,8 @@
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_SKIP)) {
mbmi->mode = ZEROMV;
} else {
- mbmi->mode = mbmi->sb_type ? read_sb_mv_ref(r, mv_ref_p)
+ mbmi->mode = mbmi->sb_type > BLOCK_SIZE_MB16X16 ?
+ read_sb_mv_ref(r, mv_ref_p)
: read_mv_ref(r, mv_ref_p);
vp9_accum_mv_refs(cm, mbmi->mode, mbmi->mb_mode_context[ref_frame]);
}
@@ -941,7 +942,7 @@
// required for left and above block mv
mv0->as_int = 0;
- if (mbmi->sb_type) {
+ if (mbmi->sb_type > BLOCK_SIZE_MB16X16) {
mbmi->mode = read_sb_ymode(r, cm->fc.sb_ymode_prob);
cm->fc.sb_ymode_counts[mbmi->mode]++;
} else {
@@ -1039,7 +1040,7 @@
cm->active_ref_scale);
}
- if (mbmi->sb_type) {
+ if (mbmi->sb_type > BLOCK_SIZE_MB16X16) {
const int bw = 1 << mb_width_log2(mbmi->sb_type);
const int bh = 1 << mb_height_log2(mbmi->sb_type);
const int y_mbs = MIN(bh, cm->mb_rows - mb_row);
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -663,7 +663,7 @@
const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
const int tx_size = xd->mode_info_context->mbmi.txfm_size;
- assert(!xd->mode_info_context->mbmi.sb_type);
+ assert(xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_MB16X16);
//mode = xd->mode_info_context->mbmi.mode;
if (pbi->common.frame_type != KEY_FRAME)
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -748,7 +748,7 @@
active_section = 6;
#endif
- if (m->mbmi.sb_type)
+ if (m->mbmi.sb_type > BLOCK_SIZE_MB16X16)
write_sb_ymode(bc, mode, pc->fc.sb_ymode_prob);
else
write_ymode(bc, mode, pc->fc.ymode_prob);
@@ -784,7 +784,7 @@
// If segment skip is not enabled code the mode.
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
- if (mi->sb_type) {
+ if (mi->sb_type > BLOCK_SIZE_MB16X16) {
write_sb_mv_ref(bc, mode, mv_ref_p);
} else {
write_mv_ref(bc, mode, mv_ref_p);
@@ -945,7 +945,7 @@
vp9_get_pred_prob(c, xd, PRED_MBSKIP));
}
- if (m->mbmi.sb_type) {
+ if (m->mbmi.sb_type > BLOCK_SIZE_MB16X16) {
sb_kfwrite_ymode(bc, ym,
c->sb_kf_ymode_prob[c->kf_ymode_probs_index]);
} else {
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -1828,7 +1828,7 @@
}
#endif
- if (xd->mode_info_context->mbmi.sb_type) {
+ if (xd->mode_info_context->mbmi.sb_type > BLOCK_SIZE_MB16X16) {
++cpi->sb_ymode_count[m];
} else {
++cpi->ymode_count[m];
@@ -1884,7 +1884,7 @@
MB_MODE_INFO *const mbmi = &mi->mbmi;
const int mis = cm->mode_info_stride;
- assert(!xd->mode_info_context->mbmi.sb_type);
+ assert(xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_MB16X16);
#ifdef ENC_DEBUG
enc_debug = (cpi->common.current_video_frame == 11 && cm->show_frame &&