Merge "Segment Skip Flag" into experimental
This commit is contained in:
commit
5d1c62c639
@ -125,10 +125,9 @@ typedef enum {
|
||||
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
|
||||
SEG_LVL_ALT_LF = 1, // Use alternate loop filter value...
|
||||
SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
|
||||
SEG_LVL_MODE = 3, // Optional Segment mode
|
||||
SEG_LVL_EOB = 4, // EOB end stop marker.
|
||||
SEG_LVL_TRANSFORM = 5, // Block transform size.
|
||||
SEG_LVL_MAX = 6 // Number of MB level features supported
|
||||
SEG_LVL_SKIP = 3, // Optional Segment (0,0) + skip mode
|
||||
SEG_LVL_TRANSFORM = 4, // Block transform size.
|
||||
SEG_LVL_MAX = 5 // Number of MB level features supported
|
||||
} SEG_LVL_FEATURES;
|
||||
|
||||
// Segment level features.
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include "vp9/common/vp9_blockd.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] =
|
||||
{ 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.
|
||||
// Eventually these function may be "optimized out" but for the moment,
|
||||
|
@ -140,17 +140,13 @@ static void kfread_modes(VP9D_COMP *pbi,
|
||||
m->mbmi.mb_skip_coeff = 0;
|
||||
if (pbi->common.mb_no_coeff_skip &&
|
||||
(!vp9_segfeature_active(&pbi->mb,
|
||||
m->mbmi.segment_id, SEG_LVL_EOB) ||
|
||||
(vp9_get_segdata(&pbi->mb,
|
||||
m->mbmi.segment_id, SEG_LVL_EOB) != 0))) {
|
||||
m->mbmi.segment_id, SEG_LVL_SKIP))) {
|
||||
MACROBLOCKD *const xd = &pbi->mb;
|
||||
m->mbmi.mb_skip_coeff =
|
||||
vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
|
||||
} else {
|
||||
if (vp9_segfeature_active(&pbi->mb,
|
||||
m->mbmi.segment_id, SEG_LVL_EOB) &&
|
||||
(vp9_get_segdata(&pbi->mb,
|
||||
m->mbmi.segment_id, SEG_LVL_EOB) == 0)) {
|
||||
m->mbmi.segment_id, SEG_LVL_SKIP)) {
|
||||
m->mbmi.mb_skip_coeff = 1;
|
||||
} else
|
||||
m->mbmi.mb_skip_coeff = 0;
|
||||
@ -697,27 +693,19 @@ 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);
|
||||
|
||||
if (pbi->common.mb_no_coeff_skip &&
|
||||
(!vp9_segfeature_active(xd,
|
||||
mbmi->segment_id, SEG_LVL_EOB) ||
|
||||
(vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_EOB) != 0))) {
|
||||
(!vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_SKIP))) {
|
||||
// Read the macroblock coeff skip flag if this feature is in use,
|
||||
// else default to 0
|
||||
mbmi->mb_skip_coeff = vp9_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
|
||||
} else {
|
||||
if (vp9_segfeature_active(xd,
|
||||
mbmi->segment_id, SEG_LVL_EOB) &&
|
||||
(vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_EOB) == 0)) {
|
||||
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_SKIP)) {
|
||||
mbmi->mb_skip_coeff = 1;
|
||||
} else
|
||||
mbmi->mb_skip_coeff = 0;
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
/*
|
||||
if (pbi->common.current_video_frame == 1)
|
||||
@ -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
|
||||
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE)) {
|
||||
mbmi->mode =
|
||||
vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE);
|
||||
// Is the segment level skip mode enabled
|
||||
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_SKIP)) {
|
||||
mbmi->mode = ZEROMV;
|
||||
} else {
|
||||
if (mbmi->sb_type)
|
||||
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 */
|
||||
mbmi->mv[0].as_int = 0;
|
||||
|
||||
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE)) {
|
||||
mbmi->mode = (MB_PREDICTION_MODE)
|
||||
vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE);
|
||||
} else if (mbmi->sb_type) {
|
||||
if (mbmi->sb_type) {
|
||||
mbmi->mode = (MB_PREDICTION_MODE)
|
||||
read_sb_ymode(bc, pbi->common.fc.sb_ymode_prob);
|
||||
pbi->common.fc.sb_ymode_counts[mbmi->mode]++;
|
||||
|
@ -239,11 +239,13 @@ SKIP_START:
|
||||
}
|
||||
|
||||
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 = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
int eob;
|
||||
|
||||
if (!active || eob > eob_max)
|
||||
if (vp9_get_segdata(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
eob = 0;
|
||||
} else {
|
||||
eob = eob_max;
|
||||
}
|
||||
return eob;
|
||||
}
|
||||
|
||||
|
@ -729,8 +729,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
|
||||
|
||||
if (!pc->mb_no_coeff_skip) {
|
||||
skip_coeff = 0;
|
||||
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) {
|
||||
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
skip_coeff = 1;
|
||||
} else {
|
||||
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.
|
||||
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);
|
||||
} else {
|
||||
assert(rf == INTRA_FRAME);
|
||||
}
|
||||
encode_ref_frame(bc, pc, xd, segment_id, rf);
|
||||
|
||||
if (rf == INTRA_FRAME) {
|
||||
#ifdef ENTROPY_STATS
|
||||
active_section = 6;
|
||||
#endif
|
||||
|
||||
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
|
||||
if (m->mbmi.sb_type)
|
||||
write_sb_ymode(bc, mode, pc->fc.sb_ymode_prob);
|
||||
else
|
||||
write_ymode(bc, mode, pc->fc.ymode_prob);
|
||||
}
|
||||
if (m->mbmi.sb_type)
|
||||
write_sb_ymode(bc, mode, pc->fc.sb_ymode_prob);
|
||||
else
|
||||
write_ymode(bc, mode, pc->fc.ymode_prob);
|
||||
|
||||
if (mode == B_PRED) {
|
||||
int j = 0;
|
||||
do {
|
||||
@ -798,8 +791,8 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
|
||||
active_section = 3;
|
||||
#endif
|
||||
|
||||
// Is the segment coding of mode enabled
|
||||
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
|
||||
// Is segment skip is not enabled code the mode.
|
||||
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
if (mi->sb_type) {
|
||||
write_sb_mv_ref(bc, mode, mv_ref_p);
|
||||
} else {
|
||||
@ -942,8 +935,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
|
||||
mi->partitioning == PARTITIONING_4X4))) &&
|
||||
pc->txfm_mode == TX_MODE_SELECT &&
|
||||
!((pc->mb_no_coeff_skip && skip_coeff) ||
|
||||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
|
||||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
|
||||
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]);
|
||||
@ -972,8 +964,7 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
|
||||
|
||||
if (!c->mb_no_coeff_skip) {
|
||||
skip_coeff = 0;
|
||||
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) {
|
||||
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
skip_coeff = 1;
|
||||
} else {
|
||||
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 &&
|
||||
!((c->mb_no_coeff_skip && skip_coeff) ||
|
||||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
|
||||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
|
||||
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]);
|
||||
|
@ -488,8 +488,7 @@ static void update_state(VP9_COMP *cpi,
|
||||
|
||||
{
|
||||
int segment_id = mbmi->segment_id;
|
||||
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB)) {
|
||||
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
for (i = 0; i < NB_TXFM_MODES; 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;
|
||||
|
||||
xd->mode_info_context = mi;
|
||||
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) ||
|
||||
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) ||
|
||||
(cm->mb_no_coeff_skip && mbmi->mb_skip_coeff));
|
||||
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);
|
||||
|
||||
xd->mode_info_context = mi;
|
||||
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) ||
|
||||
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) ||
|
||||
(cm->mb_no_coeff_skip && get_skip_flag(mi, mis, ymbs, xmbs)));
|
||||
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);
|
||||
|
||||
xd->mode_info_context = mi;
|
||||
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) ||
|
||||
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) ||
|
||||
(cm->mb_no_coeff_skip && get_skip_flag(mi, mis, ymbs, xmbs)));
|
||||
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;
|
||||
if (cpi->common.txfm_mode == TX_MODE_SELECT &&
|
||||
!((cpi->common.mb_no_coeff_skip && mbmi->mb_skip_coeff) ||
|
||||
(vp9_segfeature_active(&x->e_mbd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(&x->e_mbd, segment_id, SEG_LVL_EOB) == 0))) {
|
||||
(vp9_segfeature_active(&x->e_mbd, segment_id, SEG_LVL_SKIP)))) {
|
||||
assert(mbmi->txfm_size <= TX_16X16);
|
||||
if (mbmi->mode != B_PRED && mbmi->mode != I8X8_PRED &&
|
||||
mbmi->mode != SPLITMV) {
|
||||
@ -2465,8 +2460,7 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
|
||||
if (output_enabled) {
|
||||
if (cm->txfm_mode == TX_MODE_SELECT &&
|
||||
!((cm->mb_no_coeff_skip && skip[0] && skip[1] && skip[2] && skip[3]) ||
|
||||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
|
||||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
|
||||
cpi->txfm_count_32x32p[mi->mbmi.txfm_size]++;
|
||||
} else {
|
||||
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[8] && skip[9] && skip[10] && skip[11] &&
|
||||
skip[12] && skip[13] && skip[14] && skip[15]))) ||
|
||||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
|
||||
(vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
|
||||
cpi->txfm_count_32x32p[mi->mbmi.txfm_size]++;
|
||||
} else {
|
||||
int x, y;
|
||||
|
@ -446,7 +446,7 @@ static void init_seg_features(VP9_COMP *cpi) {
|
||||
else if (xd->segmentation_enabled) {
|
||||
// First normal frame in a valid gf or alt ref group
|
||||
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) {
|
||||
xd->update_mb_segmentation_map = 0;
|
||||
xd->update_mb_segmentation_data = 1;
|
||||
@ -463,16 +463,9 @@ static void init_seg_features(VP9_COMP *cpi) {
|
||||
|
||||
// Segment coding disabled for compred testing
|
||||
if (high_q || (cpi->static_mb_pct == 100)) {
|
||||
// set_segref(xd, 1, LAST_FRAME);
|
||||
vp9_set_segref(xd, 1, ALTREF_FRAME);
|
||||
vp9_enable_segfeature(xd, 1, SEG_LVL_REF_FRAME);
|
||||
|
||||
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);
|
||||
vp9_enable_segfeature(xd, 1, SEG_LVL_SKIP);
|
||||
}
|
||||
}
|
||||
// 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
|
||||
// alt ref frame
|
||||
// alt ref frame.
|
||||
// Segment coding disabled for compred testing
|
||||
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_MODE);
|
||||
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_set_segref(xd, 0, ALTREF_FRAME);
|
||||
vp9_clear_segref(xd, 1);
|
||||
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) {
|
||||
vp9_enable_segfeature(xd, 0, SEG_LVL_EOB);
|
||||
vp9_set_segdata(xd, 0, SEG_LVL_EOB, 0);
|
||||
vp9_enable_segfeature(xd, 1, SEG_LVL_EOB);
|
||||
vp9_set_segdata(xd, 1, SEG_LVL_EOB, 0);
|
||||
vp9_enable_segfeature(xd, 0, SEG_LVL_SKIP);
|
||||
vp9_enable_segfeature(xd, 1, SEG_LVL_SKIP);
|
||||
}
|
||||
// Enable data udpate
|
||||
xd->update_mb_segmentation_data = 1;
|
||||
|
@ -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].zbin_extra = (int16_t)zbin_extra;
|
||||
|
||||
// Segment max eob offset feature.
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
|
||||
x->block[i].eob_max_offset =
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
x->block[i].eob_max_offset_8x8 =
|
||||
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);
|
||||
x->block[i].eob_max_offset_32x32 =
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
// Segment skip feature.
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
x->block[i].eob_max_offset = 0;
|
||||
x->block[i].eob_max_offset_8x8 = 0;
|
||||
x->block[i].eob_max_offset_16x16 = 0;
|
||||
x->block[i].eob_max_offset_32x32 = 0;
|
||||
} else {
|
||||
x->block[i].eob_max_offset = 16;
|
||||
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;
|
||||
|
||||
// Segment max eob offset feature.
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
|
||||
x->block[i].eob_max_offset =
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
x->block[i].eob_max_offset_8x8 =
|
||||
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);
|
||||
// Segment skip feature.
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
x->block[i].eob_max_offset = 0;
|
||||
x->block[i].eob_max_offset_8x8 = 0;
|
||||
x->block[i].eob_max_offset_16x16 = 0;
|
||||
} else {
|
||||
x->block[i].eob_max_offset = 16;
|
||||
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;
|
||||
|
||||
// TBD perhaps not use for Y2
|
||||
// Segment max eob offset feature.
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
|
||||
x->block[24].eob_max_offset =
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
x->block[24].eob_max_offset_8x8 =
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
// Segment skip feature.
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
x->block[24].eob_max_offset = 0;
|
||||
x->block[24].eob_max_offset_8x8 = 0;
|
||||
} else {
|
||||
x->block[24].eob_max_offset = 16;
|
||||
x->block[24].eob_max_offset_8x8 = 4;
|
||||
|
@ -498,8 +498,8 @@ static int cost_coeffs(MACROBLOCK *mb,
|
||||
pn = pt;
|
||||
#endif
|
||||
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB))
|
||||
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))
|
||||
seg_eob = 0;
|
||||
|
||||
if (tx_type != DCT_DCT) {
|
||||
for (; c < eob; c++) {
|
||||
@ -2076,12 +2076,8 @@ int vp9_cost_mv_ref(VP9_COMP *cpi,
|
||||
MACROBLOCKD *xd = &cpi->mb.e_mbd;
|
||||
int segment_id = xd->mode_info_context->mbmi.segment_id;
|
||||
|
||||
// If the mode coding is done entirely at the segment level
|
||||
// we should not account for it at the per mb level in rd code.
|
||||
// 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)) {
|
||||
// Dont account for mode here if segment skip is enabled.
|
||||
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
VP9_COMMON *pc = &cpi->common;
|
||||
|
||||
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) &&
|
||||
!vp9_check_segref(xd, segment_id, mbmi->ref_frame)) {
|
||||
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..
|
||||
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
|
||||
(this_mode !=
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_MODE))) {
|
||||
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP) &&
|
||||
(this_mode != ZEROMV)) {
|
||||
continue;
|
||||
// Disable this drop out case if either the mode or ref frame
|
||||
// segment level feature is enabled for this segment. This is to
|
||||
// Disable this drop out case if the ref frame segment
|
||||
// level feature is enabled for this segment. This is to
|
||||
// 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) &&
|
||||
!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
|
||||
// Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
|
||||
} else if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME)) {
|
||||
// Only consider ZEROMV/ALTREF_FRAME for alt ref frame overlay,
|
||||
// unless ARNR filtering is enabled in which case we want
|
||||
// an unfiltered alternative
|
||||
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) {
|
||||
int mb_skip_allowed;
|
||||
|
||||
// Is Mb level skip allowed for this mb.
|
||||
mb_skip_allowed =
|
||||
!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
// Is Mb level skip allowed (i.e. not coded at segment level).
|
||||
mb_skip_allowed = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
|
||||
|
||||
if (skippable) {
|
||||
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];
|
||||
}
|
||||
|
||||
// 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
|
||||
// segment level coding of ref frame or mode is enabled for this
|
||||
// segment level coding of ref frame is enabled for this
|
||||
// segment.
|
||||
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->oxcf.arnr_max_frames == 0) &&
|
||||
(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) &&
|
||||
!vp9_check_segref(xd, segment_id, ref_frame)) {
|
||||
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..
|
||||
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
|
||||
(this_mode != vp9_get_segdata(xd, segment_id, SEG_LVL_MODE))) {
|
||||
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP) &&
|
||||
(this_mode != ZEROMV)) {
|
||||
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
|
||||
// prevent the possibility that we end up unable to pick any mode.
|
||||
} else if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
|
||||
!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
|
||||
} else if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME)) {
|
||||
// Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
|
||||
// unless ARNR filtering is enabled in which case we want
|
||||
// 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) {
|
||||
int mb_skip_allowed;
|
||||
|
||||
// Is Mb level skip allowed for this mb.
|
||||
mb_skip_allowed =
|
||||
!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
|
||||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
// Is Mb level skip allowed (i.e. not coded at segment level).
|
||||
mb_skip_allowed = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
|
||||
|
||||
if (skippable) {
|
||||
// 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
|
||||
// an alrtef unless Altref is filtered. However, this is unsafe if
|
||||
// segment level coding of ref frame or mode is enabled for this
|
||||
// segment.
|
||||
// segment level coding of ref frame is enabled for this segment.
|
||||
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->oxcf.arnr_max_frames == 0) &&
|
||||
(best_mbmode.mode != ZEROMV || best_mbmode.ref_frame != ALTREF_FRAME)) {
|
||||
|
@ -233,8 +233,8 @@ static void tokenize_b(VP9_COMP *cpi,
|
||||
pn = pt;
|
||||
#endif
|
||||
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB))
|
||||
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
|
||||
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))
|
||||
seg_eob = 0;
|
||||
|
||||
do {
|
||||
const int band = bands[c];
|
||||
@ -390,8 +390,7 @@ void vp9_tokenize_sb(VP9_COMP *cpi,
|
||||
(ENTROPY_CONTEXT *) (xd->left_context + 1), };
|
||||
const int mb_skip_context = vp9_get_pred_context(cm, xd, PRED_MBSKIP);
|
||||
const int segment_id = mbmi->segment_id;
|
||||
const int skip_inc = !vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
|
||||
(vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) != 0);
|
||||
const int skip_inc = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
|
||||
int b;
|
||||
|
||||
mbmi->mb_skip_coeff = sb_is_skippable_32x32(xd);
|
||||
@ -441,8 +440,7 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
|
||||
int skip_inc;
|
||||
int segment_id = xd->mode_info_context->mbmi.segment_id;
|
||||
|
||||
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
|
||||
(vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) != 0)) {
|
||||
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) {
|
||||
skip_inc = 1;
|
||||
} else
|
||||
skip_inc = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user