Merge "Segment Skip Flag" into experimental

This commit is contained in:
Paul Wilkins
2013-01-29 09:29:26 -08:00
committed by Gerrit Code Review
10 changed files with 88 additions and 158 deletions

View File

@@ -125,10 +125,9 @@ typedef enum {
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer .... SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
SEG_LVL_ALT_LF = 1, // Use alternate loop filter value... SEG_LVL_ALT_LF = 1, // Use alternate loop filter value...
SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
SEG_LVL_MODE = 3, // Optional Segment mode SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode
SEG_LVL_EOB = 4, // EOB end stop marker. SEG_LVL_TRANSFORM = 4, // Block transform size.
SEG_LVL_TRANSFORM = 5, // Block transform size. SEG_LVL_MAX = 5 // Number of MB level features supported
SEG_LVL_MAX = 6 // Number of MB level features supported
} SEG_LVL_FEATURES; } SEG_LVL_FEATURES;
// Segment level features. // Segment level features.

View File

@@ -12,9 +12,9 @@
#include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_seg_common.h" #include "vp9/common/vp9_seg_common.h"
static const int segfeaturedata_signed[SEG_LVL_MAX] = { 1, 1, 0, 0, 0, 0 }; static const int segfeaturedata_signed[SEG_LVL_MAX] = { 1, 1, 0, 0, 0 };
static const int seg_feature_data_max[SEG_LVL_MAX] = static const int seg_feature_data_max[SEG_LVL_MAX] =
{ MAXQ, 63, 0xf, MB_MODE_COUNT - 1, 255, TX_SIZE_MAX_SB - 1}; { MAXQ, 63, 0xf, 0xf, TX_SIZE_MAX_SB - 1};
// These functions provide access to new segment level features. // These functions provide access to new segment level features.
// Eventually these function may be "optimized out" but for the moment, // Eventually these function may be "optimized out" but for the moment,

View File

@@ -140,17 +140,13 @@ static void kfread_modes(VP9D_COMP *pbi,
m->mbmi.mb_skip_coeff = 0; m->mbmi.mb_skip_coeff = 0;
if (pbi->common.mb_no_coeff_skip && if (pbi->common.mb_no_coeff_skip &&
(!vp9_segfeature_active(&pbi->mb, (!vp9_segfeature_active(&pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB) || m->mbmi.segment_id, SEG_LVL_SKIP))) {
(vp9_get_segdata(&pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB) != 0))) {
MACROBLOCKD *const xd = &pbi->mb; MACROBLOCKD *const xd = &pbi->mb;
m->mbmi.mb_skip_coeff = m->mbmi.mb_skip_coeff =
vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP)); vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
} else { } else {
if (vp9_segfeature_active(&pbi->mb, if (vp9_segfeature_active(&pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB) && m->mbmi.segment_id, SEG_LVL_SKIP)) {
(vp9_get_segdata(&pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB) == 0)) {
m->mbmi.mb_skip_coeff = 1; m->mbmi.mb_skip_coeff = 1;
} else } else
m->mbmi.mb_skip_coeff = 0; m->mbmi.mb_skip_coeff = 0;
@@ -697,26 +693,18 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
read_mb_segment_id(pbi, mb_row, mb_col, bc); read_mb_segment_id(pbi, mb_row, mb_col, bc);
if (pbi->common.mb_no_coeff_skip && if (pbi->common.mb_no_coeff_skip &&
(!vp9_segfeature_active(xd, (!vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_SKIP))) {
mbmi->segment_id, SEG_LVL_EOB) ||
(vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_EOB) != 0))) {
// Read the macroblock coeff skip flag if this feature is in use, // Read the macroblock coeff skip flag if this feature is in use,
// else default to 0 // else default to 0
mbmi->mb_skip_coeff = vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP)); mbmi->mb_skip_coeff = vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
} else { } else {
if (vp9_segfeature_active(xd, if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_SKIP)) {
mbmi->segment_id, SEG_LVL_EOB) &&
(vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_EOB) == 0)) {
mbmi->mb_skip_coeff = 1; mbmi->mb_skip_coeff = 1;
} else } else
mbmi->mb_skip_coeff = 0; mbmi->mb_skip_coeff = 0;
} }
// Read the reference frame // Read the reference frame
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE)
&& vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE) < NEARESTMV)
mbmi->ref_frame = INTRA_FRAME;
else
mbmi->ref_frame = read_ref_frame(pbi, bc, mbmi->segment_id); mbmi->ref_frame = read_ref_frame(pbi, bc, mbmi->segment_id);
/* /*
@@ -775,10 +763,9 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
} }
*/ */
// Is the segment level mode feature enabled for this segment // Is the segment level skip mode enabled
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE)) { if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_SKIP)) {
mbmi->mode = mbmi->mode = ZEROMV;
vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE);
} else { } else {
if (mbmi->sb_type) if (mbmi->sb_type)
mbmi->mode = read_sb_mv_ref(bc, mv_ref_p); mbmi->mode = read_sb_mv_ref(bc, mv_ref_p);
@@ -1114,10 +1101,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
/* required for left and above block mv */ /* required for left and above block mv */
mbmi->mv[0].as_int = 0; mbmi->mv[0].as_int = 0;
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE)) { if (mbmi->sb_type) {
mbmi->mode = (MB_PREDICTION_MODE)
vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE);
} else if (mbmi->sb_type) {
mbmi->mode = (MB_PREDICTION_MODE) mbmi->mode = (MB_PREDICTION_MODE)
read_sb_ymode(bc, pbi->common.fc.sb_ymode_prob); read_sb_ymode(bc, pbi->common.fc.sb_ymode_prob);
pbi->common.fc.sb_ymode_counts[mbmi->mode]++; pbi->common.fc.sb_ymode_counts[mbmi->mode]++;

View File

@@ -239,11 +239,13 @@ SKIP_START:
} }
static int get_eob(MACROBLOCKD* const xd, int segment_id, int eob_max) { static int get_eob(MACROBLOCKD* const xd, int segment_id, int eob_max) {
int active = vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB); int eob;
int eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
if (!active || eob > eob_max) if (vp9_get_segdata(xd, segment_id, SEG_LVL_SKIP)) {
eob = 0;
} else {
eob = eob_max; eob = eob_max;
}
return eob; return eob;
} }

View File

@@ -729,8 +729,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
if (!pc->mb_no_coeff_skip) { if (!pc->mb_no_coeff_skip) {
skip_coeff = 0; skip_coeff = 0;
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) && } else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) {
skip_coeff = 1; skip_coeff = 1;
} else { } else {
const int nmbs = mb_size; const int nmbs = mb_size;
@@ -750,24 +749,18 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
} }
// Encode the reference frame. // Encode the reference frame.
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)
|| vp9_get_segdata(xd, segment_id, SEG_LVL_MODE) >= NEARESTMV) {
encode_ref_frame(bc, pc, xd, segment_id, rf); encode_ref_frame(bc, pc, xd, segment_id, rf);
} else {
assert(rf == INTRA_FRAME);
}
if (rf == INTRA_FRAME) { if (rf == INTRA_FRAME) {
#ifdef ENTROPY_STATS #ifdef ENTROPY_STATS
active_section = 6; active_section = 6;
#endif #endif
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
if (m->mbmi.sb_type) if (m->mbmi.sb_type)
write_sb_ymode(bc, mode, pc->fc.sb_ymode_prob); write_sb_ymode(bc, mode, pc->fc.sb_ymode_prob);
else else
write_ymode(bc, mode, pc->fc.ymode_prob); write_ymode(bc, mode, pc->fc.ymode_prob);
}
if (mode == B_PRED) { if (mode == B_PRED) {
int j = 0; int j = 0;
do { do {
@@ -798,8 +791,8 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
active_section = 3; active_section = 3;
#endif #endif
// Is the segment coding of mode enabled // Is segment skip is not enabled code the mode.
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) { if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
if (mi->sb_type) { if (mi->sb_type) {
write_sb_mv_ref(bc, mode, mv_ref_p); write_sb_mv_ref(bc, mode, mv_ref_p);
} else { } else {
@@ -942,8 +935,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
mi->partitioning == PARTITIONING_4X4))) && mi->partitioning == PARTITIONING_4X4))) &&
pc->txfm_mode == TX_MODE_SELECT && pc->txfm_mode == TX_MODE_SELECT &&
!((pc->mb_no_coeff_skip && skip_coeff) || !((pc->mb_no_coeff_skip && skip_coeff) ||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) && (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
TX_SIZE sz = mi->txfm_size; TX_SIZE sz = mi->txfm_size;
// FIXME(rbultje) code ternary symbol once all experiments are merged // FIXME(rbultje) code ternary symbol once all experiments are merged
vp9_write(bc, sz != TX_4X4, pc->prob_tx[0]); vp9_write(bc, sz != TX_4X4, pc->prob_tx[0]);
@@ -972,8 +964,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
if (!c->mb_no_coeff_skip) { if (!c->mb_no_coeff_skip) {
skip_coeff = 0; skip_coeff = 0;
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) && } else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) {
skip_coeff = 1; skip_coeff = 1;
} else { } else {
const int nmbs = 1 << m->mbmi.sb_type; const int nmbs = 1 << m->mbmi.sb_type;
@@ -1032,8 +1023,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
if (ym <= I8X8_PRED && c->txfm_mode == TX_MODE_SELECT && if (ym <= I8X8_PRED && c->txfm_mode == TX_MODE_SELECT &&
!((c->mb_no_coeff_skip && skip_coeff) || !((c->mb_no_coeff_skip && skip_coeff) ||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) && (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
TX_SIZE sz = m->mbmi.txfm_size; TX_SIZE sz = m->mbmi.txfm_size;
// FIXME(rbultje) code ternary symbol once all experiments are merged // FIXME(rbultje) code ternary symbol once all experiments are merged
vp9_write(bc, sz != TX_4X4, c->prob_tx[0]); vp9_write(bc, sz != TX_4X4, c->prob_tx[0]);

View File

@@ -488,8 +488,7 @@ static void update_state(VP9_COMP *cpi,
{ {
int segment_id = mbmi->segment_id; int segment_id = mbmi->segment_id;
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) || if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB)) {
for (i = 0; i < NB_TXFM_MODES; i++) { for (i = 0; i < NB_TXFM_MODES; i++) {
cpi->rd_tx_select_diff[i] += ctx->txfm_rd_diff[i]; cpi->rd_tx_select_diff[i] += ctx->txfm_rd_diff[i];
} }
@@ -1388,8 +1387,7 @@ static void reset_skip_txfm_size_mb(VP9_COMP *cpi,
const int segment_id = mbmi->segment_id; const int segment_id = mbmi->segment_id;
xd->mode_info_context = mi; xd->mode_info_context = mi;
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) && assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) ||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) ||
(cm->mb_no_coeff_skip && mbmi->mb_skip_coeff)); (cm->mb_no_coeff_skip && mbmi->mb_skip_coeff));
mbmi->txfm_size = txfm_max; mbmi->txfm_size = txfm_max;
} }
@@ -1433,8 +1431,7 @@ static void reset_skip_txfm_size_sb32(VP9_COMP *cpi, MODE_INFO *mi,
const int xmbs = MIN(2, mb_cols_left); const int xmbs = MIN(2, mb_cols_left);
xd->mode_info_context = mi; xd->mode_info_context = mi;
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) && assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) ||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) ||
(cm->mb_no_coeff_skip && get_skip_flag(mi, mis, ymbs, xmbs))); (cm->mb_no_coeff_skip && get_skip_flag(mi, mis, ymbs, xmbs)));
set_txfm_flag(mi, mis, ymbs, xmbs, txfm_max); set_txfm_flag(mi, mis, ymbs, xmbs, txfm_max);
} }
@@ -1454,8 +1451,7 @@ static void reset_skip_txfm_size_sb64(VP9_COMP *cpi, MODE_INFO *mi,
const int xmbs = MIN(4, mb_cols_left); const int xmbs = MIN(4, mb_cols_left);
xd->mode_info_context = mi; xd->mode_info_context = mi;
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) && assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) ||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) ||
(cm->mb_no_coeff_skip && get_skip_flag(mi, mis, ymbs, xmbs))); (cm->mb_no_coeff_skip && get_skip_flag(mi, mis, ymbs, xmbs)));
set_txfm_flag(mi, mis, ymbs, xmbs, txfm_max); set_txfm_flag(mi, mis, ymbs, xmbs, txfm_max);
} }
@@ -2227,8 +2223,7 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
int segment_id = mbmi->segment_id; int segment_id = mbmi->segment_id;
if (cpi->common.txfm_mode == TX_MODE_SELECT && if (cpi->common.txfm_mode == TX_MODE_SELECT &&
!((cpi->common.mb_no_coeff_skip && mbmi->mb_skip_coeff) || !((cpi->common.mb_no_coeff_skip && mbmi->mb_skip_coeff) ||
(vp9_segfeature_active(&x->e_mbd, segment_id, SEG_LVL_EOB) && (vp9_segfeature_active(&x->e_mbd, segment_id, SEG_LVL_SKIP)))) {
vp9_get_segdata(&x->e_mbd, segment_id, SEG_LVL_EOB) == 0))) {
assert(mbmi->txfm_size <= TX_16X16); assert(mbmi->txfm_size <= TX_16X16);
if (mbmi->mode != B_PRED && mbmi->mode != I8X8_PRED && if (mbmi->mode != B_PRED && mbmi->mode != I8X8_PRED &&
mbmi->mode != SPLITMV) { mbmi->mode != SPLITMV) {
@@ -2465,8 +2460,7 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
if (output_enabled) { if (output_enabled) {
if (cm->txfm_mode == TX_MODE_SELECT && if (cm->txfm_mode == TX_MODE_SELECT &&
!((cm->mb_no_coeff_skip && skip[0] && skip[1] && skip[2] && skip[3]) || !((cm->mb_no_coeff_skip && skip[0] && skip[1] && skip[2] && skip[3]) ||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) && (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
cpi->txfm_count_32x32p[mi->mbmi.txfm_size]++; cpi->txfm_count_32x32p[mi->mbmi.txfm_size]++;
} else { } else {
TX_SIZE sz = (cm->txfm_mode == TX_MODE_SELECT) ? TX_SIZE sz = (cm->txfm_mode == TX_MODE_SELECT) ?
@@ -2729,8 +2723,7 @@ static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t,
skip[4] && skip[5] && skip[6] && skip[7] && skip[4] && skip[5] && skip[6] && skip[7] &&
skip[8] && skip[9] && skip[10] && skip[11] && skip[8] && skip[9] && skip[10] && skip[11] &&
skip[12] && skip[13] && skip[14] && skip[15]))) || skip[12] && skip[13] && skip[14] && skip[15]))) ||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) && (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
cpi->txfm_count_32x32p[mi->mbmi.txfm_size]++; cpi->txfm_count_32x32p[mi->mbmi.txfm_size]++;
} else { } else {
int x, y; int x, y;

View File

@@ -446,7 +446,7 @@ static void init_seg_features(VP9_COMP *cpi) {
else if (xd->segmentation_enabled) { else if (xd->segmentation_enabled) {
// First normal frame in a valid gf or alt ref group // First normal frame in a valid gf or alt ref group
if (cpi->common.frames_since_golden == 0) { if (cpi->common.frames_since_golden == 0) {
// Set up segment features for normal frames in an af group // Set up segment features for normal frames in an arf group
if (cpi->source_alt_ref_active) { if (cpi->source_alt_ref_active) {
xd->update_mb_segmentation_map = 0; xd->update_mb_segmentation_map = 0;
xd->update_mb_segmentation_data = 1; xd->update_mb_segmentation_data = 1;
@@ -463,16 +463,9 @@ static void init_seg_features(VP9_COMP *cpi) {
// Segment coding disabled for compred testing // Segment coding disabled for compred testing
if (high_q || (cpi->static_mb_pct == 100)) { if (high_q || (cpi->static_mb_pct == 100)) {
// set_segref(xd, 1, LAST_FRAME);
vp9_set_segref(xd, 1, ALTREF_FRAME); vp9_set_segref(xd, 1, ALTREF_FRAME);
vp9_enable_segfeature(xd, 1, SEG_LVL_REF_FRAME); vp9_enable_segfeature(xd, 1, SEG_LVL_REF_FRAME);
vp9_enable_segfeature(xd, 1, SEG_LVL_SKIP);
vp9_set_segdata(xd, 1, SEG_LVL_MODE, ZEROMV);
vp9_enable_segfeature(xd, 1, SEG_LVL_MODE);
// EOB segment coding not fixed for 8x8 yet
vp9_set_segdata(xd, 1, SEG_LVL_EOB, 0);
vp9_enable_segfeature(xd, 1, SEG_LVL_EOB);
} }
} }
// Disable segmentation and clear down features if alt ref // Disable segmentation and clear down features if alt ref
@@ -491,29 +484,23 @@ static void init_seg_features(VP9_COMP *cpi) {
} }
// Special case where we are coding over the top of a previous // Special case where we are coding over the top of a previous
// alt ref frame // alt ref frame.
// Segment coding disabled for compred testing // Segment coding disabled for compred testing
else if (cpi->is_src_frame_alt_ref) { else if (cpi->is_src_frame_alt_ref) {
// Enable mode and ref frame features for segment 0 as well // Enable ref frame features for segment 0 as well
vp9_enable_segfeature(xd, 0, SEG_LVL_REF_FRAME); vp9_enable_segfeature(xd, 0, SEG_LVL_REF_FRAME);
vp9_enable_segfeature(xd, 0, SEG_LVL_MODE);
vp9_enable_segfeature(xd, 1, SEG_LVL_REF_FRAME); vp9_enable_segfeature(xd, 1, SEG_LVL_REF_FRAME);
vp9_enable_segfeature(xd, 1, SEG_LVL_MODE);
// All mbs should use ALTREF_FRAME, ZEROMV exclusively // All mbs should use ALTREF_FRAME
vp9_clear_segref(xd, 0); vp9_clear_segref(xd, 0);
vp9_set_segref(xd, 0, ALTREF_FRAME); vp9_set_segref(xd, 0, ALTREF_FRAME);
vp9_clear_segref(xd, 1); vp9_clear_segref(xd, 1);
vp9_set_segref(xd, 1, ALTREF_FRAME); vp9_set_segref(xd, 1, ALTREF_FRAME);
vp9_set_segdata(xd, 0, SEG_LVL_MODE, ZEROMV);
vp9_set_segdata(xd, 1, SEG_LVL_MODE, ZEROMV);
// Skip all MBs if high Q // Skip all MBs if high Q (0,0 mv and skip coeffs)
if (high_q) { if (high_q) {
vp9_enable_segfeature(xd, 0, SEG_LVL_EOB); vp9_enable_segfeature(xd, 0, SEG_LVL_SKIP);
vp9_set_segdata(xd, 0, SEG_LVL_EOB, 0); vp9_enable_segfeature(xd, 1, SEG_LVL_SKIP);
vp9_enable_segfeature(xd, 1, SEG_LVL_EOB);
vp9_set_segdata(xd, 1, SEG_LVL_EOB, 0);
} }
// Enable data udpate // Enable data udpate
xd->update_mb_segmentation_data = 1; xd->update_mb_segmentation_data = 1;

View File

@@ -556,16 +556,12 @@ void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) {
x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[QIndex]; x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[QIndex];
x->block[i].zbin_extra = (int16_t)zbin_extra; x->block[i].zbin_extra = (int16_t)zbin_extra;
// Segment max eob offset feature. // Segment skip feature.
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) { if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
x->block[i].eob_max_offset = x->block[i].eob_max_offset = 0;
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB); x->block[i].eob_max_offset_8x8 = 0;
x->block[i].eob_max_offset_8x8 = x->block[i].eob_max_offset_16x16 = 0;
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB); x->block[i].eob_max_offset_32x32 = 0;
x->block[i].eob_max_offset_16x16 =
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
x->block[i].eob_max_offset_32x32 =
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
} else { } else {
x->block[i].eob_max_offset = 16; x->block[i].eob_max_offset = 16;
x->block[i].eob_max_offset_8x8 = 64; x->block[i].eob_max_offset_8x8 = 64;
@@ -590,14 +586,11 @@ void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) {
x->block[i].zbin_extra = (int16_t)zbin_extra; x->block[i].zbin_extra = (int16_t)zbin_extra;
// Segment max eob offset feature. // Segment skip feature.
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) { if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
x->block[i].eob_max_offset = x->block[i].eob_max_offset = 0;
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB); x->block[i].eob_max_offset_8x8 = 0;
x->block[i].eob_max_offset_8x8 = x->block[i].eob_max_offset_16x16 = 0;
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
x->block[i].eob_max_offset_16x16 =
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
} else { } else {
x->block[i].eob_max_offset = 16; x->block[i].eob_max_offset = 16;
x->block[i].eob_max_offset_8x8 = 64; x->block[i].eob_max_offset_8x8 = 64;
@@ -620,12 +613,10 @@ void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) {
x->block[24].zbin_extra = (int16_t)zbin_extra; x->block[24].zbin_extra = (int16_t)zbin_extra;
// TBD perhaps not use for Y2 // TBD perhaps not use for Y2
// Segment max eob offset feature. // Segment skip feature.
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) { if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
x->block[24].eob_max_offset = x->block[24].eob_max_offset = 0;
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB); x->block[24].eob_max_offset_8x8 = 0;
x->block[24].eob_max_offset_8x8 =
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
} else { } else {
x->block[24].eob_max_offset = 16; x->block[24].eob_max_offset = 16;
x->block[24].eob_max_offset_8x8 = 4; x->block[24].eob_max_offset_8x8 = 4;

View File

@@ -498,8 +498,8 @@ static int cost_coeffs(MACROBLOCK *mb,
pn = pt; pn = pt;
#endif #endif
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB); seg_eob = 0;
if (tx_type != DCT_DCT) { if (tx_type != DCT_DCT) {
for (; c < eob; c++) { for (; c < eob; c++) {
@@ -2076,12 +2076,8 @@ int vp9_cost_mv_ref(VP9_COMP *cpi,
MACROBLOCKD *xd = &cpi->mb.e_mbd; MACROBLOCKD *xd = &cpi->mb.e_mbd;
int segment_id = xd->mode_info_context->mbmi.segment_id; int segment_id = xd->mode_info_context->mbmi.segment_id;
// If the mode coding is done entirely at the segment level // Dont account for mode here if segment skip is enabled.
// we should not account for it at the per mb level in rd code. if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
// Note that if the segment level coding is expanded from single mode
// to multiple mode masks as per reference frame coding we will need
// to do something different here.
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
VP9_COMMON *pc = &cpi->common; VP9_COMMON *pc = &cpi->common;
vp9_prob p [VP9_MVREFS - 1]; vp9_prob p [VP9_MVREFS - 1];
@@ -3689,18 +3685,16 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) && if (vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!vp9_check_segref(xd, segment_id, mbmi->ref_frame)) { !vp9_check_segref(xd, segment_id, mbmi->ref_frame)) {
continue; continue;
// If the segment mode feature is enabled.... // If the segment skip feature is enabled....
// then do nothing if the current mode is not allowed.. // then do nothing if the current mode is not allowed..
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE) && } else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP) &&
(this_mode != (this_mode != ZEROMV)) {
vp9_get_segdata(xd, segment_id, SEG_LVL_MODE))) {
continue; continue;
// Disable this drop out case if either the mode or ref frame // Disable this drop out case if the ref frame segment
// segment level feature is enabled for this segment. This is to // level feature is enabled for this segment. This is to
// prevent the possibility that the we end up unable to pick any mode. // prevent the possibility that the we end up unable to pick any mode.
} else if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) && } else if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME)) {
!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) { // Only consider ZEROMV/ALTREF_FRAME for alt ref frame overlay,
// Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
// unless ARNR filtering is enabled in which case we want // unless ARNR filtering is enabled in which case we want
// an unfiltered alternative // an unfiltered alternative
if (cpi->is_src_frame_alt_ref && (cpi->oxcf.arnr_max_frames == 0)) { if (cpi->is_src_frame_alt_ref && (cpi->oxcf.arnr_max_frames == 0)) {
@@ -3990,10 +3984,8 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (cpi->common.mb_no_coeff_skip) { if (cpi->common.mb_no_coeff_skip) {
int mb_skip_allowed; int mb_skip_allowed;
// Is Mb level skip allowed for this mb. // Is Mb level skip allowed (i.e. not coded at segment level).
mb_skip_allowed = mb_skip_allowed = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
if (skippable) { if (skippable) {
mbmi->mb_skip_coeff = 1; mbmi->mb_skip_coeff = 1;
@@ -4199,12 +4191,11 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
cpi->rd_thresh_mult[best_mode_index]; cpi->rd_thresh_mult[best_mode_index];
} }
// This code force Altref,0,0 and skip for the frame that overlays a // This code forces Altref,0,0 and skip for the frame that overlays a
// an alrtef unless Altref is filtered. However, this is unsafe if // an alrtef unless Altref is filtered. However, this is unsafe if
// segment level coding of ref frame or mode is enabled for this // segment level coding of ref frame is enabled for this
// segment. // segment.
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) && if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
cpi->is_src_frame_alt_ref && cpi->is_src_frame_alt_ref &&
(cpi->oxcf.arnr_max_frames == 0) && (cpi->oxcf.arnr_max_frames == 0) &&
(best_mbmode.mode != ZEROMV || best_mbmode.ref_frame != ALTREF_FRAME)) { (best_mbmode.mode != ZEROMV || best_mbmode.ref_frame != ALTREF_FRAME)) {
@@ -4667,16 +4658,15 @@ static int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) && if (vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!vp9_check_segref(xd, segment_id, ref_frame)) { !vp9_check_segref(xd, segment_id, ref_frame)) {
continue; continue;
// If the segment mode feature is enabled.... // If the segment skip feature is enabled....
// then do nothing if the current mode is not allowed.. // then do nothing if the current mode is not allowed..
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE) && } else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP) &&
(this_mode != vp9_get_segdata(xd, segment_id, SEG_LVL_MODE))) { (this_mode != ZEROMV)) {
continue; continue;
// Disable this drop out case if either the mode or ref frame // Disable this drop out case if the ref frame
// segment level feature is enabled for this segment. This is to // segment level feature is enabled for this segment. This is to
// prevent the possibility that we end up unable to pick any mode. // prevent the possibility that we end up unable to pick any mode.
} else if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) && } else if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME)) {
!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
// Only consider ZEROMV/ALTREF_FRAME for alt ref frame, // Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
// unless ARNR filtering is enabled in which case we want // unless ARNR filtering is enabled in which case we want
// an unfiltered alternative // an unfiltered alternative
@@ -4765,10 +4755,8 @@ static int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (cpi->common.mb_no_coeff_skip) { if (cpi->common.mb_no_coeff_skip) {
int mb_skip_allowed; int mb_skip_allowed;
// Is Mb level skip allowed for this mb. // Is Mb level skip allowed (i.e. not coded at segment level).
mb_skip_allowed = mb_skip_allowed = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
if (skippable) { if (skippable) {
// Back out the coefficient coding costs // Back out the coefficient coding costs
@@ -4952,10 +4940,8 @@ static int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
// This code forces Altref,0,0 and skip for the frame that overlays a // This code forces Altref,0,0 and skip for the frame that overlays a
// an alrtef unless Altref is filtered. However, this is unsafe if // an alrtef unless Altref is filtered. However, this is unsafe if
// segment level coding of ref frame or mode is enabled for this // segment level coding of ref frame is enabled for this segment.
// segment.
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) && if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
cpi->is_src_frame_alt_ref && cpi->is_src_frame_alt_ref &&
(cpi->oxcf.arnr_max_frames == 0) && (cpi->oxcf.arnr_max_frames == 0) &&
(best_mbmode.mode != ZEROMV || best_mbmode.ref_frame != ALTREF_FRAME)) { (best_mbmode.mode != ZEROMV || best_mbmode.ref_frame != ALTREF_FRAME)) {

View File

@@ -233,8 +233,8 @@ static void tokenize_b(VP9_COMP *cpi,
pn = pt; pn = pt;
#endif #endif
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB); seg_eob = 0;
do { do {
const int band = bands[c]; const int band = bands[c];
@@ -390,8 +390,7 @@ void vp9_tokenize_sb(VP9_COMP *cpi,
(ENTROPY_CONTEXT *) (xd->left_context + 1), }; (ENTROPY_CONTEXT *) (xd->left_context + 1), };
const int mb_skip_context = vp9_get_pred_context(cm, xd, PRED_MBSKIP); const int mb_skip_context = vp9_get_pred_context(cm, xd, PRED_MBSKIP);
const int segment_id = mbmi->segment_id; const int segment_id = mbmi->segment_id;
const int skip_inc = !vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) || const int skip_inc = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
(vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) != 0);
int b; int b;
mbmi->mb_skip_coeff = sb_is_skippable_32x32(xd); mbmi->mb_skip_coeff = sb_is_skippable_32x32(xd);
@@ -441,8 +440,7 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
int skip_inc; int skip_inc;
int segment_id = xd->mode_info_context->mbmi.segment_id; int segment_id = xd->mode_info_context->mbmi.segment_id;
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) || if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
(vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) != 0)) {
skip_inc = 1; skip_inc = 1;
} else } else
skip_inc = 0; skip_inc = 0;