seg_common: give all exported symbols a vp9_ prefix.

Change-Id: Ie8ba934a757acec1c80ac37ab9307c9a2783254e
This commit is contained in:
Ronald S. Bultje 2012-10-29 22:15:27 -07:00
Родитель d36cc98ee3
Коммит b066bb4306
14 изменённых файлов: 321 добавлений и 344 удалений

Просмотреть файл

@ -122,12 +122,12 @@ void vp8_loop_filter_frame_init(VP8_COMMON *cm,
// Set the baseline filter values for each segment
if (segfeature_active(xd, seg, SEG_LVL_ALT_LF)) {
if (vp9_segfeature_active(xd, seg, SEG_LVL_ALT_LF)) {
/* Abs value */
if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
lvl_seg = get_segdata(xd, seg, SEG_LVL_ALT_LF);
lvl_seg = vp9_get_segdata(xd, seg, SEG_LVL_ALT_LF);
} else { /* Delta Value */
lvl_seg += get_segdata(xd, seg, SEG_LVL_ALT_LF);;
lvl_seg += vp9_get_segdata(xd, seg, SEG_LVL_ALT_LF);
lvl_seg = (lvl_seg > 0) ? ((lvl_seg > 63) ? 63 : lvl_seg) : 0;
}
}
@ -476,7 +476,7 @@ void vp8_loop_filter_frame_segment(VP8_COMMON *cm, MACROBLOCKD *xd,
// TODO: Make this work for when segment 0 has the alt lv enabled
if (filter_level
&& (seg == segment
|| (!segfeature_active(xd, seg, SEG_LVL_ALT_LF)
|| (!vp9_segfeature_active(xd, seg, SEG_LVL_ALT_LF)
&& segment == 0))) {
if (cm->filter_type == NORMAL_LOOPFILTER) {
const int hev_index =
@ -576,12 +576,12 @@ void vp8_loop_filter_partial_frame
for (i = 0; i < MAX_MB_SEGMENTS; i++) {
/* Abs value */
if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA) {
lvl_seg[i] = get_segdata(xd, i, SEG_LVL_ALT_LF);
lvl_seg[i] = vp9_get_segdata(xd, i, SEG_LVL_ALT_LF);
}
/* Delta Value */
else {
lvl_seg[i] = default_filt_lvl +
get_segdata(xd, i, SEG_LVL_ALT_LF);
vp9_get_segdata(xd, i, SEG_LVL_ALT_LF);
lvl_seg[i] = (lvl_seg[i] > 0) ?
((lvl_seg[i] > 63) ? 63 : lvl_seg[i]) : 0;
}

Просмотреть файл

@ -326,7 +326,7 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP8_COMMON *const cm,
unsigned char above_left_in_image;
// Is segment coding ennabled
seg_ref_active = segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
seg_ref_active = vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
// Special case treatment if segment coding is enabled.
// Dont allow prediction of a reference frame that the segment
@ -334,7 +334,7 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP8_COMMON *const cm,
if (seg_ref_active) {
for (i = 0; i < MAX_REF_FRAMES; i++) {
frame_allowed[i] =
check_segref(xd, segment_id, i);
vp9_check_segref(xd, segment_id, i);
// Score set to 0 if ref frame not allowed
ref_score[i] = cm->ref_scores[i] * frame_allowed[i];

Просмотреть файл

@ -19,77 +19,78 @@ const int vp8_seg_feature_data_bits[SEG_LVL_MAX] =
// the coding mechanism is still subject to change so these provide a
// convenient single point of change.
int segfeature_active(const MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
int vp9_segfeature_active(const MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
// Return true if mask bit set and segmentation enabled.
return (xd->segmentation_enabled &&
(xd->segment_feature_mask[segment_id] &
(0x01 << feature_id)));
}
void clearall_segfeatures(MACROBLOCKD *xd) {
void vp9_clearall_segfeatures(MACROBLOCKD *xd) {
vpx_memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
vpx_memset(xd->segment_feature_mask, 0, sizeof(xd->segment_feature_mask));
}
void enable_segfeature(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
void vp9_enable_segfeature(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
xd->segment_feature_mask[segment_id] |= (0x01 << feature_id);
}
void disable_segfeature(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
void vp9_disable_segfeature(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
xd->segment_feature_mask[segment_id] &= ~(1 << feature_id);
}
int seg_feature_data_bits(SEG_LVL_FEATURES feature_id) {
int vp9_seg_feature_data_bits(SEG_LVL_FEATURES feature_id) {
return vp8_seg_feature_data_bits[feature_id];
}
int is_segfeature_signed(SEG_LVL_FEATURES feature_id) {
int vp9_is_segfeature_signed(SEG_LVL_FEATURES feature_id) {
return (segfeaturedata_signed[feature_id]);
}
void clear_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
void vp9_clear_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
xd->segment_feature_data[segment_id][feature_id] = 0;
}
void set_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id,
int seg_data) {
void vp9_set_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id,
int seg_data) {
xd->segment_feature_data[segment_id][feature_id] = seg_data;
}
int get_segdata(const MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
int vp9_get_segdata(const MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
return xd->segment_feature_data[segment_id][feature_id];
}
#if CONFIG_FEATUREUPDATES
int old_segfeature_active(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
int vp9_old_segfeature_active(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
// Return true if mask bit set and segmentation enabled.
return (xd->segmentation_enabled &&
(xd->old_segment_feature_mask[segment_id] &
(0x01 << feature_id)));
}
int get_old_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
int vp9_get_old_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
return xd->old_segment_feature_data[segment_id][feature_id];
}
int segfeature_changed(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
int vp9_segfeature_changed(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id) {
// Return true if mask bit or data is different from last time
return
(xd->segmentation_enabled &&
@ -102,7 +103,7 @@ int segfeature_changed(MACROBLOCKD *xd,
);
}
void save_segment_info(MACROBLOCKD *xd) {
void vp9_save_segment_info(MACROBLOCKD *xd) {
int i, j;
for (i = 0; i < MAX_MB_SEGMENTS; i++) {
xd->old_segment_feature_mask[i] = xd->segment_feature_mask[i];
@ -115,32 +116,32 @@ void save_segment_info(MACROBLOCKD *xd) {
}
}
#endif
void clear_segref(MACROBLOCKD *xd, int segment_id) {
void vp9_clear_segref(MACROBLOCKD *xd, int segment_id) {
xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] = 0;
}
void set_segref(MACROBLOCKD *xd,
int segment_id,
MV_REFERENCE_FRAME ref_frame) {
void vp9_set_segref(MACROBLOCKD *xd,
int segment_id,
MV_REFERENCE_FRAME ref_frame) {
xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] |=
(1 << ref_frame);
}
int check_segref(const MACROBLOCKD *xd,
int segment_id,
MV_REFERENCE_FRAME ref_frame) {
int vp9_check_segref(const MACROBLOCKD *xd,
int segment_id,
MV_REFERENCE_FRAME ref_frame) {
return (xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] &
(1 << ref_frame)) ? 1 : 0;
}
int check_segref_inter(MACROBLOCKD *xd, int segment_id) {
int vp9_check_segref_inter(MACROBLOCKD *xd, int segment_id) {
return (xd->segment_feature_data[segment_id][SEG_LVL_REF_FRAME] &
~(1 << INTRA_FRAME)) ? 1 : 0;
}
int get_seg_tx_type(MACROBLOCKD *xd, int segment_id) {
if (segfeature_active(xd, segment_id, SEG_LVL_TRANSFORM))
return get_segdata(xd, segment_id, SEG_LVL_TRANSFORM);
int vp9_get_seg_tx_type(MACROBLOCKD *xd, int segment_id) {
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_TRANSFORM))
return vp9_get_segdata(xd, segment_id, SEG_LVL_TRANSFORM);
else
return TX_4X4;
}

Просмотреть файл

@ -15,71 +15,71 @@
#ifndef __INC_SEG_COMMON_H__
#define __INC_SEG_COMMON_H__ 1
int segfeature_active(const MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
void clearall_segfeatures(MACROBLOCKD *xd);
void enable_segfeature(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
void disable_segfeature(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
int seg_feature_data_bits(SEG_LVL_FEATURES feature_id);
int is_segfeature_signed(SEG_LVL_FEATURES feature_id);
void clear_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
void set_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id,
int seg_data);
int get_segdata(const MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
#if CONFIG_FEATUREUPDATES
int old_segfeature_active(MACROBLOCKD *xd,
int vp9_segfeature_active(const MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
int get_old_segdata(MACROBLOCKD *xd,
void vp9_clearall_segfeatures(MACROBLOCKD *xd);
void vp9_enable_segfeature(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
void vp9_disable_segfeature(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
int vp9_seg_feature_data_bits(SEG_LVL_FEATURES feature_id);
int vp9_is_segfeature_signed(SEG_LVL_FEATURES feature_id);
void vp9_clear_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
void vp9_set_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id,
int seg_data);
int vp9_get_segdata(const MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
void save_segment_info(MACROBLOCKD *xd);
#if CONFIG_FEATUREUPDATES
int segfeature_changed(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
int vp9_old_segfeature_active(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
int vp9_get_old_segdata(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
void vp9_save_segment_info(MACROBLOCKD *xd);
int vp9_segfeature_changed(MACROBLOCKD *xd,
int segment_id,
SEG_LVL_FEATURES feature_id);
#endif
void clear_segref(MACROBLOCKD *xd, int segment_id);
void vp9_clear_segref(MACROBLOCKD *xd, int segment_id);
void set_segref(MACROBLOCKD *xd,
int segment_id,
MV_REFERENCE_FRAME ref_frame);
void vp9_set_segref(MACROBLOCKD *xd,
int segment_id,
MV_REFERENCE_FRAME ref_frame);
int check_segref(const MACROBLOCKD *xd,
int segment_id,
MV_REFERENCE_FRAME ref_frame);
int vp9_check_segref(const MACROBLOCKD *xd,
int segment_id,
MV_REFERENCE_FRAME ref_frame);
int check_segref_inter(MACROBLOCKD *xd, int segment_id);
int vp9_check_segref_inter(MACROBLOCKD *xd, int segment_id);
int get_seg_tx_type(MACROBLOCKD *xd, int segment_id);
int vp9_get_seg_tx_type(MACROBLOCKD *xd, int segment_id);
#endif /* __INC_SEG_COMMON_H__ */

Просмотреть файл

@ -110,18 +110,18 @@ static void kfread_modes(VP8D_COMP *pbi,
m->mbmi.mb_skip_coeff = 0;
if (pbi->common.mb_no_coeff_skip &&
(!segfeature_active(&pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB) ||
(get_segdata(&pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB) != 0))) {
(!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))) {
MACROBLOCKD *const xd = &pbi->mb;
m->mbmi.mb_skip_coeff =
vp8_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
} else {
if (segfeature_active(&pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB) &&
(get_segdata(&pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB) == 0)) {
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.mb_skip_coeff = 1;
} else
m->mbmi.mb_skip_coeff = 0;
@ -363,17 +363,17 @@ static MV_REFERENCE_FRAME read_ref_frame(VP8D_COMP *pbi,
VP8_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
seg_ref_active = segfeature_active(xd,
segment_id,
SEG_LVL_REF_FRAME);
seg_ref_active = vp9_segfeature_active(xd,
segment_id,
SEG_LVL_REF_FRAME);
// If segment coding enabled does the segment allow for more than one
// possible reference frame
if (seg_ref_active) {
seg_ref_count = check_segref(xd, segment_id, INTRA_FRAME) +
check_segref(xd, segment_id, LAST_FRAME) +
check_segref(xd, segment_id, GOLDEN_FRAME) +
check_segref(xd, segment_id, ALTREF_FRAME);
seg_ref_count = vp9_check_segref(xd, segment_id, INTRA_FRAME) +
vp9_check_segref(xd, segment_id, LAST_FRAME) +
vp9_check_segref(xd, segment_id, GOLDEN_FRAME) +
vp9_check_segref(xd, segment_id, ALTREF_FRAME);
}
// Segment reference frame features not available or allows for
@ -410,12 +410,12 @@ static MV_REFERENCE_FRAME read_ref_frame(VP8D_COMP *pbi,
// setting the branch probability to 0.
if (seg_ref_active) {
mod_refprobs[INTRA_FRAME] *=
check_segref(xd, segment_id, INTRA_FRAME);
vp9_check_segref(xd, segment_id, INTRA_FRAME);
mod_refprobs[LAST_FRAME] *=
check_segref(xd, segment_id, LAST_FRAME);
vp9_check_segref(xd, segment_id, LAST_FRAME);
mod_refprobs[GOLDEN_FRAME] *=
(check_segref(xd, segment_id, GOLDEN_FRAME) *
check_segref(xd, segment_id, ALTREF_FRAME));
(vp9_check_segref(xd, segment_id, GOLDEN_FRAME) *
vp9_check_segref(xd, segment_id, ALTREF_FRAME));
}
// Default to INTRA_FRAME (value 0)
@ -441,7 +441,7 @@ static MV_REFERENCE_FRAME read_ref_frame(VP8D_COMP *pbi,
else {
if (seg_ref_active) {
if ((pred_ref == GOLDEN_FRAME) ||
!check_segref(xd, segment_id, GOLDEN_FRAME)) {
!vp9_check_segref(xd, segment_id, GOLDEN_FRAME)) {
ref_frame = ALTREF_FRAME;
} else
ref_frame = GOLDEN_FRAME;
@ -689,16 +689,16 @@ static void read_mb_modes_mv(VP8D_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 &&
(!segfeature_active(xd,
mbmi->segment_id, SEG_LVL_EOB) ||
(get_segdata(xd, mbmi->segment_id, SEG_LVL_EOB) != 0))) {
(!vp9_segfeature_active(xd,
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,
// else default to 0
mbmi->mb_skip_coeff = vp8_read(bc, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
} else {
if (segfeature_active(xd,
mbmi->segment_id, SEG_LVL_EOB) &&
(get_segdata(xd, mbmi->segment_id, SEG_LVL_EOB) == 0)) {
if (vp9_segfeature_active(xd,
mbmi->segment_id, SEG_LVL_EOB) &&
(vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_EOB) == 0)) {
mbmi->mb_skip_coeff = 1;
} else
mbmi->mb_skip_coeff = 0;
@ -762,9 +762,9 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
vp8_mv_ref_probs(&pbi->common, mv_ref_p, rct);
// Is the segment level mode feature enabled for this segment
if (segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE)) {
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE)) {
mbmi->mode =
get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE);
vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE);
} else {
#if CONFIG_SUPERBLOCKS
if (mbmi->encoded_as_sb) {
@ -1077,9 +1077,9 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
/* required for left and above block mv */
mbmi->mv[0].as_int = 0;
if (segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE))
if (vp9_segfeature_active(xd, mbmi->segment_id, SEG_LVL_MODE))
mbmi->mode = (MB_PREDICTION_MODE)
get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE);
vp9_get_segdata(xd, mbmi->segment_id, SEG_LVL_MODE);
else {
// FIXME write using SB mode tree
mbmi->mode = (MB_PREDICTION_MODE)

Просмотреть файл

@ -102,15 +102,15 @@ static void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd) {
int segment_id = xd->mode_info_context->mbmi.segment_id;
// Set the Q baseline allowing for any segment level adjustment
if (segfeature_active(xd, segment_id, SEG_LVL_ALT_Q)) {
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_ALT_Q)) {
/* Abs Value */
if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA)
QIndex = get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
QIndex = vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
/* Delta Value */
else {
QIndex = pc->base_qindex +
get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0; /* Clamp to valid range */
}
} else
@ -754,7 +754,7 @@ static void init_frame(VP8D_COMP *pbi) {
// Reset the segment feature data to the default stats:
// Features disabled, 0, with delta coding (Default state).
clearall_segfeatures(xd);
vp9_clearall_segfeatures(xd);
xd->mb_segment_abs_delta = SEGMENT_DELTADATA;
@ -1036,7 +1036,7 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
xd->mb_segment_abs_delta = (unsigned char)vp8_read_bit(&header_bc);
clearall_segfeatures(xd);
vp9_clearall_segfeatures(xd);
// For each segmentation...
for (i = 0; i < MAX_MB_SEGMENTS; i++) {
@ -1048,46 +1048,46 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
if (vp8_read_bit(&header_bc)) {
int active = 1;
if (segfeature_active(xd, i, j))
if (vp9_segfeature_active(xd, i, j))
active = vp8_read_bit(&header_bc);
// Is the feature enabled
if (active) {
// Update the feature data and mask
enable_segfeature(xd, i, j);
vp9_enable_segfeature(xd, i, j);
data = (signed char)vp8_read_literal(
&header_bc, seg_feature_data_bits(j));
&header_bc, vp9_seg_feature_data_bits(j));
// Is the segment data signed..
if (is_segfeature_signed(j)) {
if (vp9_is_segfeature_signed(j)) {
if (vp8_read_bit(&header_bc))
data = - data;
}
} else
data = 0;
set_segdata(xd, i, j, data);
vp9_set_segdata(xd, i, j, data);
}
#else
// Is the feature enabled
if (vp8_read_bit(&header_bc)) {
// Update the feature data and mask
enable_segfeature(xd, i, j);
vp9_enable_segfeature(xd, i, j);
data = (signed char)vp8_read_literal(
&header_bc, seg_feature_data_bits(j));
&header_bc, vp9_seg_feature_data_bits(j));
// Is the segment data signed..
if (is_segfeature_signed(j)) {
if (vp9_is_segfeature_signed(j)) {
if (vp8_read_bit(&header_bc))
data = - data;
}
} else
data = 0;
set_segdata(xd, i, j, data);
vp9_set_segdata(xd, i, j, data);
#endif
}
}

Просмотреть файл

@ -423,14 +423,14 @@ int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd,
PLANE_TYPE type;
int c, i, eobtotal = 0, seg_eob;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_active = segfeature_active(xd, segment_id, SEG_LVL_EOB);
const int seg_active = vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB);
INT16 *qcoeff_ptr = &xd->qcoeff[0];
TX_TYPE tx_type = get_tx_type(xd, &xd->block[0]);
type = PLANE_TYPE_Y_WITH_DC;
if (seg_active)
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
else
seg_eob = 256;
@ -453,7 +453,7 @@ int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd,
type = PLANE_TYPE_UV;
tx_type = DCT_DCT;
if (seg_active)
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
else
seg_eob = 64;
for (i = 16; i < 24; i += 4) {
@ -486,7 +486,7 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd,
PLANE_TYPE type;
int c, i, eobtotal = 0, seg_eob;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_active = segfeature_active(xd, segment_id, SEG_LVL_EOB);
const int seg_active = vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB);
INT16 *qcoeff_ptr = &xd->qcoeff[0];
TX_TYPE tx_type = DCT_DCT;
@ -501,7 +501,7 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd,
type = PLANE_TYPE_Y2;
if (seg_active)
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
else
seg_eob = 4;
c = decode_coefs(pbi, xd, bc, a, l, type,
@ -517,7 +517,7 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd,
type = PLANE_TYPE_Y_WITH_DC;
if (seg_active)
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
else
seg_eob = 64;
@ -583,8 +583,8 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *xd,
INT16 *qcoeff_ptr = &xd->qcoeff[0];
int segment_id = xd->mode_info_context->mbmi.segment_id;
if (segfeature_active(xd, segment_id, SEG_LVL_EOB))
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB))
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
if (xd->mode_info_context->mbmi.mode != B_PRED &&
xd->mode_info_context->mbmi.mode != I8X8_PRED &&

Просмотреть файл

@ -795,15 +795,15 @@ static void encode_ref_frame(vp8_writer *const bc,
MV_REFERENCE_FRAME rf) {
int seg_ref_active;
int seg_ref_count = 0;
seg_ref_active = segfeature_active(xd,
segment_id,
SEG_LVL_REF_FRAME);
seg_ref_active = vp9_segfeature_active(xd,
segment_id,
SEG_LVL_REF_FRAME);
if (seg_ref_active) {
seg_ref_count = check_segref(xd, segment_id, INTRA_FRAME) +
check_segref(xd, segment_id, LAST_FRAME) +
check_segref(xd, segment_id, GOLDEN_FRAME) +
check_segref(xd, segment_id, ALTREF_FRAME);
seg_ref_count = vp9_check_segref(xd, segment_id, INTRA_FRAME) +
vp9_check_segref(xd, segment_id, LAST_FRAME) +
vp9_check_segref(xd, segment_id, GOLDEN_FRAME) +
vp9_check_segref(xd, segment_id, ALTREF_FRAME);
}
// If segment level coding of this signal is disabled...
@ -838,12 +838,12 @@ static void encode_ref_frame(vp8_writer *const bc,
// setting the branch probability to 0.
if (seg_ref_active) {
mod_refprobs[INTRA_FRAME] *=
check_segref(xd, segment_id, INTRA_FRAME);
vp9_check_segref(xd, segment_id, INTRA_FRAME);
mod_refprobs[LAST_FRAME] *=
check_segref(xd, segment_id, LAST_FRAME);
vp9_check_segref(xd, segment_id, LAST_FRAME);
mod_refprobs[GOLDEN_FRAME] *=
(check_segref(xd, segment_id, GOLDEN_FRAME) *
check_segref(xd, segment_id, ALTREF_FRAME));
(vp9_check_segref(xd, segment_id, GOLDEN_FRAME) *
vp9_check_segref(xd, segment_id, ALTREF_FRAME));
}
if (mod_refprobs[0]) {
@ -986,8 +986,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) {
}
if (pc->mb_no_coeff_skip &&
(!segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
(get_segdata(xd, segment_id, SEG_LVL_EOB) != 0))) {
(!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
(vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) != 0))) {
int skip_coeff = mi->mb_skip_coeff;
#if CONFIG_SUPERBLOCKS
if (mi->encoded_as_sb) {
@ -1010,7 +1010,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) {
// TODO(rbultje) write using SB tree structure
if (!segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
write_ymode(bc, mode, pc->fc.ymode_prob);
}
@ -1084,7 +1084,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) {
#endif
// Is the segment coding of mode enabled
if (!segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
#if CONFIG_SUPERBLOCKS
if (mi->encoded_as_sb) {
write_sb_mv_ref(bc, mode, mv_ref_p);
@ -1268,8 +1268,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) {
mi->partitioning == PARTITIONING_4X4))) &&
pc->txfm_mode == TX_MODE_SELECT &&
!((pc->mb_no_coeff_skip && mi->mb_skip_coeff) ||
(segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
TX_SIZE sz = mi->txfm_size;
// FIXME(rbultje) code ternary symbol once all experiments are merged
vp8_write(bc, sz != TX_4X4, pc->prob_tx[0]);
@ -1333,8 +1333,8 @@ static void write_mb_modes_kf(const VP8_COMMON *c,
}
if (c->mb_no_coeff_skip &&
(!segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
(get_segdata(xd, segment_id, SEG_LVL_EOB) != 0))) {
(!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
(vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) != 0))) {
int skip_coeff = m->mbmi.mb_skip_coeff;
#if CONFIG_SUPERBLOCKS
if (m->mbmi.encoded_as_sb) {
@ -1410,8 +1410,8 @@ static void write_mb_modes_kf(const VP8_COMMON *c,
#endif
ym <= I8X8_PRED && c->txfm_mode == TX_MODE_SELECT &&
!((c->mb_no_coeff_skip && m->mbmi.mb_skip_coeff) ||
(segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
(vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0))) {
TX_SIZE sz = m->mbmi.txfm_size;
// FIXME(rbultje) code ternary symbol once all experiments are merged
vp8_write(bc, sz != TX_4X4, c->prob_tx[0]);
@ -1855,8 +1855,8 @@ static void segment_reference_frames(VP8_COMP *cpi) {
mb_index++;
}
for (i = 0; i < MAX_MB_SEGMENTS; i++) {
enable_segfeature(xd, i, SEG_LVL_REF_FRAME);
set_segdata(xd, i, SEG_LVL_REF_FRAME, ref[i]);
vp9_enable_segfeature(xd, i, SEG_LVL_REF_FRAME);
vp9_set_segdata(xd, i, SEG_LVL_REF_FRAME, ref[i]);
}
}
@ -1972,43 +1972,42 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
for (i = 0; i < MAX_MB_SEGMENTS; i++) {
// For each segmentation codable feature...
for (j = 0; j < SEG_LVL_MAX; j++) {
Data = get_segdata(xd, i, j);
Data = vp9_get_segdata(xd, i, j);
#if CONFIG_FEATUREUPDATES
// check if there's an update
if (segfeature_changed(xd, i, j)) {
if (vp9_segfeature_changed(xd, i, j)) {
vp8_write_bit(&header_bc, 1);
if (segfeature_active(xd, i, j)) {
if (vp9_segfeature_active(xd, i, j)) {
// this bit is to say we are still
// active/ if we were inactive
// this is unnecessary
if (old_segfeature_active(xd, i, j)) {
if (vp9_old_segfeature_active(xd, i, j)) {
vp8_write_bit(&header_bc, 1);
}
// Is the segment data signed..
if (is_segfeature_signed(j)) {
if (vp9_is_segfeature_signed(j)) {
// Encode the relevant feature data
if (Data < 0) {
Data = - Data;
vp8_write_literal(&header_bc, Data,
seg_feature_data_bits(j));
vp9_seg_feature_data_bits(j));
vp8_write_bit(&header_bc, 1);
} else {
vp8_write_literal(&header_bc, Data,
seg_feature_data_bits(j));
vp9_seg_feature_data_bits(j));
vp8_write_bit(&header_bc, 0);
}
}
// Unsigned data element so no sign bit needed
else
vp8_write_literal(&header_bc, Data,
seg_feature_data_bits(j));
}
// feature is inactive now
else if (old_segfeature_active(xd, i, j)) {
vp9_seg_feature_data_bits(j));
} else if (vp9_old_segfeature_active(xd, i, j)) {
// feature is inactive now
vp8_write_bit(&header_bc, 0);
}
} else {
@ -2017,27 +2016,27 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
#else
// If the feature is enabled...
if (segfeature_active(xd, i, j)) {
if (vp9_segfeature_active(xd, i, j)) {
vp8_write_bit(&header_bc, 1);
// Is the segment data signed..
if (is_segfeature_signed(j)) {
if (vp9_is_segfeature_signed(j)) {
// Encode the relevant feature data
if (Data < 0) {
Data = - Data;
vp8_write_literal(&header_bc, Data,
seg_feature_data_bits(j));
vp9_seg_feature_data_bits(j));
vp8_write_bit(&header_bc, 1);
} else {
vp8_write_literal(&header_bc, Data,
seg_feature_data_bits(j));
vp9_seg_feature_data_bits(j));
vp8_write_bit(&header_bc, 0);
}
}
// Unsigned data element so no sign bit needed
else
vp8_write_literal(&header_bc, Data,
seg_feature_data_bits(j));
vp9_seg_feature_data_bits(j));
} else
vp8_write_bit(&header_bc, 0);
#endif
@ -2047,7 +2046,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
#if CONFIG_FEATUREUPDATES
// save the segment info for updates next frame
save_segment_info(xd);
vp9_save_segment_info(xd);
#endif
}

Просмотреть файл

@ -419,8 +419,8 @@ static void update_state(VP8_COMP *cpi, MACROBLOCK *x, PICK_MODE_CONTEXT *ctx) {
{
int segment_id = mbmi->segment_id;
if (!segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
get_segdata(xd, segment_id, SEG_LVL_EOB)) {
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB)) {
for (i = 0; i < NB_TXFM_MODES; i++) {
cpi->rd_tx_select_diff[i] += ctx->txfm_rd_diff[i];
}
@ -639,12 +639,12 @@ static void pick_mb_modes(VP8_COMP *cpi,
int seg_id, r, d;
if (xd->segmentation_enabled && cpi->seg0_cnt > 0 &&
!segfeature_active(xd, 0, SEG_LVL_REF_FRAME) &&
segfeature_active(xd, 1, SEG_LVL_REF_FRAME) &&
check_segref(xd, 1, INTRA_FRAME) +
check_segref(xd, 1, LAST_FRAME) +
check_segref(xd, 1, GOLDEN_FRAME) +
check_segref(xd, 1, ALTREF_FRAME) == 1) {
!vp9_segfeature_active(xd, 0, SEG_LVL_REF_FRAME) &&
vp9_segfeature_active(xd, 1, SEG_LVL_REF_FRAME) &&
vp9_check_segref(xd, 1, INTRA_FRAME) +
vp9_check_segref(xd, 1, LAST_FRAME) +
vp9_check_segref(xd, 1, GOLDEN_FRAME) +
vp9_check_segref(xd, 1, ALTREF_FRAME) == 1) {
cpi->seg0_progress = (cpi->seg0_idx << 16) / cpi->seg0_cnt;
} else {
cpi->seg0_progress = (((mb_col & ~1) * 2 + (mb_row & ~1) * cm->mb_cols + i) << 16) / cm->MBs;
@ -664,11 +664,11 @@ static void pick_mb_modes(VP8_COMP *cpi,
cpi->seg0_idx++;
}
if (!xd->segmentation_enabled ||
!segfeature_active(xd, seg_id, SEG_LVL_REF_FRAME) ||
check_segref(xd, seg_id, INTRA_FRAME) +
check_segref(xd, seg_id, LAST_FRAME) +
check_segref(xd, seg_id, GOLDEN_FRAME) +
check_segref(xd, seg_id, ALTREF_FRAME) > 1) {
!vp9_segfeature_active(xd, seg_id, SEG_LVL_REF_FRAME) ||
vp9_check_segref(xd, seg_id, INTRA_FRAME) +
vp9_check_segref(xd, seg_id, LAST_FRAME) +
vp9_check_segref(xd, seg_id, GOLDEN_FRAME) +
vp9_check_segref(xd, seg_id, ALTREF_FRAME) > 1) {
// Get the prediction context and status
int pred_flag = vp9_get_pred_flag(xd, PRED_REF);
int pred_context = vp9_get_pred_context(cm, xd, PRED_REF);
@ -818,21 +818,16 @@ static void pick_sb_modes (VP8_COMP *cpi,
/* Save the coding context */
vpx_memcpy(&x->sb_context[0].mic, xd->mode_info_context,
sizeof(MODE_INFO));
}
else
{
} else {
if (xd->segmentation_enabled && cpi->seg0_cnt > 0 &&
!segfeature_active( xd, 0, SEG_LVL_REF_FRAME ) &&
segfeature_active( xd, 1, SEG_LVL_REF_FRAME ) &&
check_segref(xd, 1, INTRA_FRAME) +
check_segref(xd, 1, LAST_FRAME) +
check_segref(xd, 1, GOLDEN_FRAME) +
check_segref(xd, 1, ALTREF_FRAME) == 1)
{
!vp9_segfeature_active(xd, 0, SEG_LVL_REF_FRAME) &&
vp9_segfeature_active(xd, 1, SEG_LVL_REF_FRAME) &&
vp9_check_segref(xd, 1, INTRA_FRAME) +
vp9_check_segref(xd, 1, LAST_FRAME) +
vp9_check_segref(xd, 1, GOLDEN_FRAME) +
vp9_check_segref(xd, 1, ALTREF_FRAME) == 1) {
cpi->seg0_progress = (cpi->seg0_idx << 16) / cpi->seg0_cnt;
}
else
{
} else {
cpi->seg0_progress =
(((mb_col & ~1) * 2 + (mb_row & ~1) * cm->mb_cols) << 16) / cm->MBs;
}
@ -1044,12 +1039,13 @@ static void encode_sb(VP8_COMP *cpi,
// for the reference frame coding for each segment but this is a
// possible future action.
segment_id = &mbmi->segment_id;
seg_ref_active = segfeature_active(xd, *segment_id, SEG_LVL_REF_FRAME);
seg_ref_active = vp9_segfeature_active(xd, *segment_id,
SEG_LVL_REF_FRAME);
if (!seg_ref_active ||
((check_segref(xd, *segment_id, INTRA_FRAME) +
check_segref(xd, *segment_id, LAST_FRAME) +
check_segref(xd, *segment_id, GOLDEN_FRAME) +
check_segref(xd, *segment_id, ALTREF_FRAME)) > 1)) {
((vp9_check_segref(xd, *segment_id, INTRA_FRAME) +
vp9_check_segref(xd, *segment_id, LAST_FRAME) +
vp9_check_segref(xd, *segment_id, GOLDEN_FRAME) +
vp9_check_segref(xd, *segment_id, ALTREF_FRAME)) > 1)) {
{
cpi->count_mb_ref_frame_usage[mbmi->ref_frame]++;
}
@ -1427,15 +1423,15 @@ static int check_dual_ref_flags(VP8_COMP *cpi) {
MACROBLOCKD *xd = &cpi->mb.e_mbd;
int ref_flags = cpi->ref_frame_flags;
if (segfeature_active(xd, 1, SEG_LVL_REF_FRAME)) {
if (vp9_segfeature_active(xd, 1, SEG_LVL_REF_FRAME)) {
if ((ref_flags & (VP8_LAST_FLAG | VP8_GOLD_FLAG)) == (VP8_LAST_FLAG | VP8_GOLD_FLAG) &&
check_segref(xd, 1, LAST_FRAME))
vp9_check_segref(xd, 1, LAST_FRAME))
return 1;
if ((ref_flags & (VP8_GOLD_FLAG | VP8_ALT_FLAG)) == (VP8_GOLD_FLAG | VP8_ALT_FLAG) &&
check_segref(xd, 1, GOLDEN_FRAME))
vp9_check_segref(xd, 1, GOLDEN_FRAME))
return 1;
if ((ref_flags & (VP8_ALT_FLAG | VP8_LAST_FLAG)) == (VP8_ALT_FLAG | VP8_LAST_FLAG) &&
check_segref(xd, 1, ALTREF_FRAME))
vp9_check_segref(xd, 1, ALTREF_FRAME))
return 1;
return 0;
} else {
@ -1474,8 +1470,8 @@ static void reset_skip_txfm_size(VP8_COMP *cpi, TX_SIZE txfm_max) {
mbmi->txfm_size > txfm_max) {
segment_id = mbmi->segment_id;
xd->mode_info_context = mi;
assert((segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) ||
assert((vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) &&
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) == 0) ||
(cm->mb_no_coeff_skip && mbmi->mb_skip_coeff));
mbmi->txfm_size = txfm_max;
}
@ -1961,8 +1957,8 @@ void vp8cx_encode_intra_macro_block(VP8_COMP *cpi,
if (cpi->common.txfm_mode == TX_MODE_SELECT &&
!((cpi->common.mb_no_coeff_skip && mbmi->mb_skip_coeff) ||
(segfeature_active(&x->e_mbd, segment_id, SEG_LVL_EOB) &&
get_segdata(&x->e_mbd, segment_id, SEG_LVL_EOB) == 0))) {
(vp9_segfeature_active(&x->e_mbd, segment_id, SEG_LVL_EOB) &&
vp9_get_segdata(&x->e_mbd, segment_id, SEG_LVL_EOB) == 0))) {
if (mbmi->mode != B_PRED && mbmi->mode != I8X8_PRED) {
cpi->txfm_count[mbmi->txfm_size]++;
} else if (mbmi->mode == I8X8_PRED) {
@ -2030,7 +2026,7 @@ void vp8cx_encode_inter_macroblock (VP8_COMP *cpi, MACROBLOCK *x,
vp8_update_zbin_extra(cpi, x);
}
seg_ref_active = segfeature_active(xd, *segment_id, SEG_LVL_REF_FRAME);
seg_ref_active = vp9_segfeature_active(xd, *segment_id, SEG_LVL_REF_FRAME);
// SET VARIOUS PREDICTION FLAGS
@ -2149,8 +2145,8 @@ void vp8cx_encode_inter_macroblock (VP8_COMP *cpi, MACROBLOCK *x,
int segment_id = mbmi->segment_id;
if (cpi->common.txfm_mode == TX_MODE_SELECT &&
!((cpi->common.mb_no_coeff_skip && mbmi->mb_skip_coeff) ||
(segfeature_active(&x->e_mbd, segment_id, SEG_LVL_EOB) &&
get_segdata(&x->e_mbd, segment_id, SEG_LVL_EOB) == 0))) {
(vp9_segfeature_active(&x->e_mbd, segment_id, SEG_LVL_EOB) &&
vp9_get_segdata(&x->e_mbd, segment_id, SEG_LVL_EOB) == 0))) {
if (mbmi->mode != B_PRED && mbmi->mode != I8X8_PRED &&
mbmi->mode != SPLITMV) {
cpi->txfm_count[mbmi->txfm_size]++;
@ -2225,7 +2221,7 @@ void vp8cx_encode_inter_superblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t,
vp8_update_zbin_extra(cpi, x);
}
seg_ref_active = segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
seg_ref_active = vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
// SET VARIOUS PREDICTION FLAGS

Просмотреть файл

@ -337,7 +337,7 @@ static void setup_features(VP8_COMP *cpi) {
xd->update_mb_segmentation_data = 0;
vpx_memset(xd->mb_segment_tree_probs, 255, sizeof(xd->mb_segment_tree_probs));
clearall_segfeatures(xd);
vp9_clearall_segfeatures(xd);
xd->mode_ref_lf_delta_enabled = 0;
xd->mode_ref_lf_delta_update = 0;
@ -455,7 +455,7 @@ static void init_seg_features(VP8_COMP *cpi) {
vp8_disable_segmentation((VP8_PTR)cpi);
// Clear down the segment features.
clearall_segfeatures(xd);
vp9_clearall_segfeatures(xd);
}
// If this is an alt ref frame
@ -468,7 +468,7 @@ static void init_seg_features(VP8_COMP *cpi) {
// Disable segmentation and individual segment features by default
vp8_disable_segmentation((VP8_PTR)cpi);
clearall_segfeatures(xd);
vp9_clearall_segfeatures(xd);
// Scan frames from current to arf frame.
// This function re-enables segmentation if appropriate.
@ -481,11 +481,11 @@ static void init_seg_features(VP8_COMP *cpi) {
xd->update_mb_segmentation_data = 1;
qi_delta = compute_qdelta(cpi, cpi->avg_q, (cpi->avg_q * 0.875));
set_segdata(xd, 1, SEG_LVL_ALT_Q, (qi_delta - 2));
set_segdata(xd, 1, SEG_LVL_ALT_LF, -2);
vp9_set_segdata(xd, 1, SEG_LVL_ALT_Q, (qi_delta - 2));
vp9_set_segdata(xd, 1, SEG_LVL_ALT_LF, -2);
enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
enable_segfeature(xd, 1, SEG_LVL_ALT_LF);
vp9_enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
vp9_enable_segfeature(xd, 1, SEG_LVL_ALT_LF);
// Where relevant assume segment data is delta data
xd->mb_segment_abs_delta = SEGMENT_DELTADATA;
@ -494,21 +494,6 @@ static void init_seg_features(VP8_COMP *cpi) {
}
// All other frames if segmentation has been enabled
else if (xd->segmentation_enabled) {
/*
int i;
// clears prior frame seg lev refs
for (i = 0; i < MAX_MB_SEGMENTS; i++)
{
// only do it if the force drop the background stuff is off
if(!segfeature_active(xd, i, SEG_LVL_MODE))
{
disable_segfeature(xd,i,SEG_LVL_REF_FRAME);
set_segdata( xd,i, SEG_LVL_REF_FRAME, 0xffffff);
}
}
*/
// 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
@ -519,25 +504,25 @@ static void init_seg_features(VP8_COMP *cpi) {
qi_delta = compute_qdelta(cpi, cpi->avg_q,
(cpi->avg_q * 1.125));
set_segdata(xd, 1, SEG_LVL_ALT_Q, (qi_delta + 2));
set_segdata(xd, 1, SEG_LVL_ALT_Q, 0);
enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
vp9_set_segdata(xd, 1, SEG_LVL_ALT_Q, (qi_delta + 2));
vp9_set_segdata(xd, 1, SEG_LVL_ALT_Q, 0);
vp9_enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
set_segdata(xd, 1, SEG_LVL_ALT_LF, -2);
enable_segfeature(xd, 1, SEG_LVL_ALT_LF);
vp9_set_segdata(xd, 1, SEG_LVL_ALT_LF, -2);
vp9_enable_segfeature(xd, 1, SEG_LVL_ALT_LF);
// Segment coding disabled for compred testing
if (high_q || (cpi->static_mb_pct == 100)) {
// set_segref(xd, 1, LAST_FRAME);
set_segref(xd, 1, ALTREF_FRAME);
enable_segfeature(xd, 1, SEG_LVL_REF_FRAME);
vp9_set_segref(xd, 1, ALTREF_FRAME);
vp9_enable_segfeature(xd, 1, SEG_LVL_REF_FRAME);
set_segdata(xd, 1, SEG_LVL_MODE, ZEROMV);
enable_segfeature(xd, 1, SEG_LVL_MODE);
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
set_segdata(xd, 1, SEG_LVL_EOB, 0);
enable_segfeature(xd, 1, SEG_LVL_EOB);
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
@ -551,7 +536,7 @@ static void init_seg_features(VP8_COMP *cpi) {
xd->update_mb_segmentation_map = 0;
xd->update_mb_segmentation_data = 0;
clearall_segfeatures(xd);
vp9_clearall_segfeatures(xd);
}
}
@ -560,25 +545,25 @@ static void init_seg_features(VP8_COMP *cpi) {
// 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_segfeature(xd, 0, SEG_LVL_REF_FRAME);
enable_segfeature(xd, 0, SEG_LVL_MODE);
enable_segfeature(xd, 1, SEG_LVL_REF_FRAME);
enable_segfeature(xd, 1, SEG_LVL_MODE);
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
clear_segref(xd, 0);
set_segref(xd, 0, ALTREF_FRAME);
clear_segref(xd, 1);
set_segref(xd, 1, ALTREF_FRAME);
set_segdata(xd, 0, SEG_LVL_MODE, ZEROMV);
set_segdata(xd, 1, SEG_LVL_MODE, ZEROMV);
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
if (high_q) {
enable_segfeature(xd, 0, SEG_LVL_EOB);
set_segdata(xd, 0, SEG_LVL_EOB, 0);
enable_segfeature(xd, 1, SEG_LVL_EOB);
set_segdata(xd, 1, SEG_LVL_EOB, 0);
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);
}
// Enable data udpate
xd->update_mb_segmentation_data = 1;
@ -4405,14 +4390,14 @@ int vp8_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned
// Enable the loop and quant changes in the feature mask
for (i = 0; i < 4; i++) {
if (delta_q[i])
enable_segfeature(xd, i, SEG_LVL_ALT_Q);
vp9_enable_segfeature(xd, i, SEG_LVL_ALT_Q);
else
disable_segfeature(xd, i, SEG_LVL_ALT_Q);
vp9_disable_segfeature(xd, i, SEG_LVL_ALT_Q);
if (delta_lf[i])
enable_segfeature(xd, i, SEG_LVL_ALT_LF);
vp9_enable_segfeature(xd, i, SEG_LVL_ALT_LF);
else
disable_segfeature(xd, i, SEG_LVL_ALT_LF);
vp9_disable_segfeature(xd, i, SEG_LVL_ALT_LF);
}
// Initialise the feature data structure

Просмотреть файл

@ -437,8 +437,8 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) {
// pick the loop filter for each segment after segment 0
for (i = 1; i < MAX_MB_SEGMENTS; i++) {
// if the segment loop filter is active
if (segfeature_active(xd, i, SEG_LVL_ALT_LF)) {
set_segdata(xd, i, SEG_LVL_ALT_LF, 0);
if (vp9_segfeature_active(xd, i, SEG_LVL_ALT_LF)) {
vp9_set_segdata(xd, i, SEG_LVL_ALT_LF, 0);
vp8cx_pick_filter_level_sg(sd, cpi, i);
filt_lev[i] = oci->filter_level;
}
@ -450,17 +450,17 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) {
// TODO : Fix the code if segment 0 is the one with seg_lvl_alt_lf on
// right now assumes segment 0 gets base loop filter and the rest are
// deltas off of segment 0.
set_segdata(xd, 0, SEG_LVL_ALT_LF, 0);
vp9_set_segdata(xd, 0, SEG_LVL_ALT_LF, 0);
vp8cx_pick_filter_level_sg(sd, cpi, 0);
filt_lev[0] = oci->filter_level;
// convert the best filter level for the mbs of the segment to
// a delta from 0
for (i = 1; i < MAX_MB_SEGMENTS; i++)
if (segfeature_active(xd, i, SEG_LVL_ALT_LF)) {
set_segdata(xd, i, SEG_LVL_ALT_LF, filt_lev[i] - filt_lev[0]);
if (vp9_segfeature_active(xd, i, SEG_LVL_ALT_LF)) {
vp9_set_segdata(xd, i, SEG_LVL_ALT_LF, filt_lev[i] - filt_lev[0]);
xd->update_mb_segmentation_data !=
segfeature_changed(xd, i, SEG_LVL_ALT_LF);
vp9_segfeature_changed(xd, i, SEG_LVL_ALT_LF);
}
}
#else

Просмотреть файл

@ -538,15 +538,15 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) {
int segment_id = xd->mode_info_context->mbmi.segment_id;
// Select the baseline MB Q index allowing for any segment level change.
if (segfeature_active(xd, segment_id, SEG_LVL_ALT_Q)) {
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_ALT_Q)) {
// Abs Value
if (xd->mb_segment_abs_delta == SEGMENT_ABSDATA)
QIndex = get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
QIndex = vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
// Delta Value
else {
QIndex = cpi->common.base_qindex +
get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
vp9_get_segdata(xd, segment_id, SEG_LVL_ALT_Q);
// Clamp to valid range
QIndex = (QIndex >= 0) ? ((QIndex <= MAXQ) ? QIndex : MAXQ) : 0;
@ -574,13 +574,13 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) {
x->block[i].zbin_extra = (short)zbin_extra;
// Segment max eob offset feature.
if (segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
x->block[i].eob_max_offset =
get_segdata(xd, segment_id, SEG_LVL_EOB);
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
x->block[i].eob_max_offset_8x8 =
get_segdata(xd, segment_id, SEG_LVL_EOB);
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
x->block[i].eob_max_offset_16x16 =
get_segdata(xd, segment_id, SEG_LVL_EOB);
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
} else {
x->block[i].eob_max_offset = 16;
x->block[i].eob_max_offset_8x8 = 64;
@ -609,11 +609,11 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) {
x->block[i].zbin_extra = (short)zbin_extra;
// Segment max eob offset feature.
if (segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
x->block[i].eob_max_offset =
get_segdata(xd, segment_id, SEG_LVL_EOB);
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
x->block[i].eob_max_offset_8x8 =
get_segdata(xd, segment_id, SEG_LVL_EOB);
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
} else {
x->block[i].eob_max_offset = 16;
x->block[i].eob_max_offset_8x8 = 64;
@ -640,11 +640,11 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) {
// TBD perhaps not use for Y2
// Segment max eob offset feature.
if (segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB)) {
x->block[24].eob_max_offset =
get_segdata(xd, segment_id, SEG_LVL_EOB);
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
x->block[24].eob_max_offset_8x8 =
get_segdata(xd, segment_id, SEG_LVL_EOB);
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
} else {
x->block[24].eob_max_offset = 16;
x->block[24].eob_max_offset_8x8 = 4;

Просмотреть файл

@ -634,8 +634,8 @@ static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, PLANE_TYPE type,
default:
break;
}
if (segfeature_active(&mb->e_mbd, segment_id, SEG_LVL_EOB))
seg_eob = get_segdata(&mb->e_mbd, segment_id, SEG_LVL_EOB);
if (vp9_segfeature_active(&mb->e_mbd, segment_id, SEG_LVL_EOB))
seg_eob = vp9_get_segdata(&mb->e_mbd, segment_id, SEG_LVL_EOB);
else
seg_eob = default_eob;
@ -1954,7 +1954,7 @@ int vp8_cost_mv_ref(VP8_COMP *cpi,
// 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 (!segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE)) {
VP8_COMMON *pc = &cpi->common;
vp8_prob p [VP8_MVREFS - 1];
@ -3108,15 +3108,15 @@ static void vp8_estimate_ref_frame_costs(VP8_COMP *cpi, int segment_id, unsigned
vp8_prob pred_prob, new_pred_prob;
int seg_ref_active;
int seg_ref_count = 0;
seg_ref_active = segfeature_active(xd,
segment_id,
SEG_LVL_REF_FRAME);
seg_ref_active = vp9_segfeature_active(xd,
segment_id,
SEG_LVL_REF_FRAME);
if (seg_ref_active) {
seg_ref_count = check_segref(xd, segment_id, INTRA_FRAME) +
check_segref(xd, segment_id, LAST_FRAME) +
check_segref(xd, segment_id, GOLDEN_FRAME) +
check_segref(xd, segment_id, ALTREF_FRAME);
seg_ref_count = vp9_check_segref(xd, segment_id, INTRA_FRAME) +
vp9_check_segref(xd, segment_id, LAST_FRAME) +
vp9_check_segref(xd, segment_id, GOLDEN_FRAME) +
vp9_check_segref(xd, segment_id, ALTREF_FRAME);
}
// Get the predicted reference for this mb
@ -3698,22 +3698,20 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
// If the segment reference frame feature is enabled....
// then do nothing if the current ref frame is not allowed..
if (segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!check_segref(xd, segment_id, mbmi->ref_frame)) {
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....
// then do nothing if the current mode is not allowed..
else if (segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
(this_mode !=
get_segdata(xd, segment_id, SEG_LVL_MODE))) {
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
(this_mode !=
vp9_get_segdata(xd, segment_id, SEG_LVL_MODE))) {
continue;
}
// Disable this drop out case if either the mode or 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 (!segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!segfeature_active(xd, segment_id, SEG_LVL_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,
// unless ARNR filtering is enabled in which case we want
// an unfiltered alternative
@ -4001,8 +3999,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
// Is Mb level skip allowed for this mb.
mb_skip_allowed =
!segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
get_segdata(xd, segment_id, SEG_LVL_EOB);
!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
if (skippable) {
mbmi->mb_skip_coeff = 1;
@ -4205,8 +4203,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
// an alrtef unless Altref is filtered. However, this is unsafe if
// segment level coding of ref frame or mode is enabled for this
// segment.
if (!segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
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)) {
@ -4578,21 +4576,19 @@ int64_t vp8_rd_pick_inter_mode_sb(VP8_COMP *cpi, MACROBLOCK *x,
// If the segment reference frame feature is enabled....
// then do nothing if the current ref frame is not allowed..
if (segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!check_segref(xd, segment_id, ref_frame)) {
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....
// then do nothing if the current mode is not allowed..
else if (segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
(this_mode != get_segdata(xd, segment_id, SEG_LVL_MODE))) {
} else if (vp9_segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
(this_mode != vp9_get_segdata(xd, segment_id, SEG_LVL_MODE))) {
continue;
}
// Disable this drop out case if either the mode or 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 (!segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!segfeature_active(xd, segment_id, SEG_LVL_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,
// unless ARNR filtering is enabled in which case we want
// an unfiltered alternative
@ -4631,8 +4627,8 @@ int64_t vp8_rd_pick_inter_mode_sb(VP8_COMP *cpi, MACROBLOCK *x,
// Is Mb level skip allowed for this mb.
mb_skip_allowed =
!segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
get_segdata(xd, segment_id, SEG_LVL_EOB);
!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
if (skippable) {
// Back out the coefficient coding costs
@ -4777,8 +4773,8 @@ int64_t vp8_rd_pick_inter_mode_sb(VP8_COMP *cpi, MACROBLOCK *x,
// an alrtef unless Altref is filtered. However, this is unsafe if
// segment level coding of ref frame or mode is enabled for this
// segment.
if (!segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME) &&
!segfeature_active(xd, segment_id, SEG_LVL_MODE) &&
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)) {

Просмотреть файл

@ -183,8 +183,8 @@ static void tokenize_b(VP8_COMP *cpi,
break;
}
if (segfeature_active(xd, segment_id, SEG_LVL_EOB))
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
if (vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB))
seg_eob = vp9_get_segdata(xd, segment_id, SEG_LVL_EOB);
do {
const int band = bands[c];
@ -305,8 +305,8 @@ void vp8_tokenize_mb(VP8_COMP *cpi,
int skip_inc;
int segment_id = xd->mode_info_context->mbmi.segment_id;
if (!segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
(get_segdata(xd, segment_id, SEG_LVL_EOB) != 0)) {
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_EOB) ||
(vp9_get_segdata(xd, segment_id, SEG_LVL_EOB) != 0)) {
skip_inc = 1;
} else
skip_inc = 0;