unistd_h
"
EXPERIMENT_LIST="
- dualpred
extend_qrange
segmentation
segfeatures
vp8_default_bmode_probs(oci->fc.bmode_prob);
oci->mb_no_coeff_skip = 1;
-#if CONFIG_DUALPRED
oci->dual_pred_mode = HYBRID_PREDICTION;
-#endif /* CONFIG_DUALPRED */
oci->no_lpf = 0;
oci->filter_type = NORMAL_LOOPFILTER;
oci->use_bilinear_mc_filter = 0;
typedef struct
{
MB_PREDICTION_MODE mode, uv_mode;
- MV_REFERENCE_FRAME ref_frame;
+ MV_REFERENCE_FRAME ref_frame, second_ref_frame;
#if CONFIG_T8X8
TX_SIZE txfm_size;
#endif
- int_mv mv;
-#if CONFIG_DUALPRED
- MV_REFERENCE_FRAME second_ref_frame;
- int_mv second_mv;
-#endif
+ int_mv mv, second_mv;
unsigned char partitioning;
unsigned char mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
unsigned char need_to_clamp_mvs;
int fullpixel_mask;
YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */
-#if CONFIG_DUALPRED
struct {
uint8_t *y_buffer, *u_buffer, *v_buffer;
} second_pre;
-#endif /* CONFIG_DUALPRED */
YV12_BUFFER_CONFIG dst;
MODE_INFO *prev_mode_info_context;
vp8_subpix_fn_t subpixel_predict8x4;
vp8_subpix_fn_t subpixel_predict8x8;
vp8_subpix_fn_t subpixel_predict16x16;
-#if CONFIG_DUALPRED
vp8_subpix_fn_t subpixel_predict_avg8x8;
vp8_subpix_fn_t subpixel_predict_avg16x16;
-#endif /* CONFIG_DUALPRED */
void *current_bc;
}
}
-#if CONFIG_DUALPRED
/*
* The only functional difference between filter_block2d_second_pass()
* and this function is that filter_block2d_second_pass() does a sixtap
output_ptr += output_pitch;
}
}
-#endif /* CONFIG_DUALPRED */
static void filter_block2d
(
}
-#if CONFIG_DUALPRED
void vp8_sixtap_predict_avg8x8_c
(
unsigned char *src_ptr,
/* then filter verticaly... */
filter_block2d_second_pass_avg(FData + 8*(INTERP_EXTEND-1), dst_ptr, dst_pitch, 8, 8, 8, 8, VFilter);
}
-#endif /* CONFIG_DUALPRED */
void vp8_sixtap_predict8x4_c
(
}
-#if CONFIG_DUALPRED
void vp8_sixtap_predict_avg16x16_c
(
unsigned char *src_ptr,
filter_block2d_second_pass_avg(FData + 16*(INTERP_EXTEND-1), dst_ptr, dst_pitch,
16, 16, 16, 16, VFilter);
}
-#endif /* CONFIG_DUALPRED */
/****************************************************************************
*
}
}
-#if CONFIG_DUALPRED
/*
* As before for filter_block2d_second_pass_avg(), the functional difference
* between filter_block2d_bil_second_pass() and filter_block2d_bil_second_pass_avg()
dst_ptr += dst_pitch;
}
}
-#endif /* CONFIG_DUALPRED */
/****************************************************************************
*
filter_block2d_bil_second_pass(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
}
-#if CONFIG_DUALPRED
static void filter_block2d_bil_avg
(
unsigned char *src_ptr,
/* then 1-D vertically... */
filter_block2d_bil_second_pass_avg(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
}
-#endif /* CONFIG_DUALPRED */
void vp8_bilinear_predict4x4_c
(
}
-#if CONFIG_DUALPRED
void vp8_bilinear_predict_avg8x8_c
(
unsigned char *src_ptr,
filter_block2d_bil_avg(src_ptr, dst_ptr, src_pixels_per_line,
dst_pitch, HFilter, VFilter, 8, 8);
}
-#endif /* CONFIG_DUALPRED */
void vp8_bilinear_predict8x4_c
(
filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
}
-#if CONFIG_DUALPRED
void vp8_bilinear_predict_avg16x16_c
(
unsigned char *src_ptr,
filter_block2d_bil_avg(src_ptr, dst_ptr, src_pixels_per_line,
dst_pitch, HFilter, VFilter, 16, 16);
}
-#endif /* CONFIG_DUALPRED */
#endif
rtcd->recon.copy16x16 = vp8_copy_mem16x16_c;
rtcd->recon.copy8x8 = vp8_copy_mem8x8_c;
-#if CONFIG_DUALPRED
rtcd->recon.avg16x16 = vp8_avg_mem16x16_c;
rtcd->recon.avg8x8 = vp8_avg_mem8x8_c;
-#endif /* CONFIG_DUALPRED */
rtcd->recon.copy8x4 = vp8_copy_mem8x4_c;
rtcd->recon.recon = vp8_recon_b_c;
rtcd->recon.recon_uv = vp8_recon_uv_b_c;
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_c;
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_c;
-#if CONFIG_DUALPRED
rtcd->subpix.sixtap_avg16x16 = vp8_sixtap_predict_avg16x16_c;
rtcd->subpix.sixtap_avg8x8 = vp8_sixtap_predict_avg8x8_c;
-#endif /* CONFIG_DUALPRED */
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_c;
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_c;
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_c;
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_c;
-#if CONFIG_DUALPRED
rtcd->subpix.bilinear_avg16x16 = vp8_bilinear_predict_avg16x16_c;
rtcd->subpix.bilinear_avg8x8 = vp8_bilinear_predict_avg8x8_c;
-#endif /* CONFIG_DUALPRED */
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_c;
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_c;
#define MAX_PARTITIONS 9
-#if CONFIG_DUALPRED
#define DUAL_PRED_CONTEXTS 2
-#endif /* CONFIG_DUALPRED */
typedef struct frame_contexts
{
BILINEAR = 1
} INTERPOLATIONFILTERTYPE;
-#if CONFIG_DUALPRED
typedef enum
{
SINGLE_PREDICTION_ONLY = 0,
HYBRID_PREDICTION = 2,
NB_PREDICTION_TYPES = 3,
} DUALPREDMODE_TYPE;
-#endif /* CONFIG_DUALPRED */
typedef struct VP8_COMMON_RTCD
{
/* profile settings */
int experimental;
int mb_no_coeff_skip;
-#if CONFIG_DUALPRED
DUALPREDMODE_TYPE dual_pred_mode;
-#endif /* CONFIG_DUALPRED */
int no_lpf;
int use_bilinear_mc_filter;
int full_pixel;
vp8_prob ref_pred_probs[PREDICTION_PROBS];
vp8_prob mod_refprobs[MAX_REF_FRAMES][PREDICTION_PROBS];
-#if CONFIG_DUALPRED
vp8_prob prob_dualpred[DUAL_PRED_CONTEXTS];
-#endif /* CONFIG_DUALPRED */
FRAME_CONTEXT lfc_a; /* last alt ref entropy */
FRAME_CONTEXT lfc; /* last frame entropy */
#endif
extern prototype_copy_block(vp8_recon_copy8x8);
-#if CONFIG_DUALPRED
#ifndef vp8_recon_avg16x16
#define vp8_recon_avg16x16 vp8_avg_mem16x16_c
#endif
#define vp8_recon_avg8x8 vp8_avg_mem8x8_c
#endif
extern prototype_copy_block(vp8_recon_avg8x8);
-#endif /* CONFIG_DUALPRED */
#ifndef vp8_recon_copy8x4
#define vp8_recon_copy8x4 vp8_copy_mem8x4_c
{
vp8_copy_block_fn_t copy16x16;
vp8_copy_block_fn_t copy8x8;
-#if CONFIG_DUALPRED
vp8_copy_block_fn_t avg16x16;
vp8_copy_block_fn_t avg8x8;
-#endif /* CONFIG_DUALPRED */
vp8_copy_block_fn_t copy8x4;
vp8_recon_fn_t recon;
vp8_recon_fn_t recon_uv;
}
-#if CONFIG_DUALPRED
void vp8_avg_mem16x16_c(
unsigned char *src,
int src_stride,
dst += dst_stride;
}
}
-#endif /* CONFIG_DUALPRED */
void vp8_copy_mem8x8_c(
unsigned char *src,
}
-#if CONFIG_DUALPRED
void vp8_avg_mem8x8_c(
unsigned char *src,
int src_stride,
dst += dst_stride;
}
}
-#endif /* CONFIG_DUALPRED */
void vp8_copy_mem8x4_c(
unsigned char *src,
}
-#if CONFIG_DUALPRED
/*
* This function should be called after an initial call to
* vp8_build_inter16x16_predictors_mb() or _mby()/_mbuv().
RECON_INVOKE(&x->rtcd->recon, avg8x8)(vptr, pre_stride, dst_v, dst_uvstride);
}
}
-#endif /* CONFIG_DUALPRED */
static void build_inter4x4_predictors_mb(MACROBLOCKD *x)
{
{
vp8_build_inter16x16_predictors_mb(x, x->predictor, &x->predictor[256],
&x->predictor[320], 16, 8);
-#if CONFIG_DUALPRED
+
if (x->mode_info_context->mbmi.second_ref_frame)
{
/* 256 = offset of U plane in Y+U+V buffer;
&x->predictor[256],
&x->predictor[320], 16, 8);
}
-#endif /* CONFIG_DUALPRED */
}
else
{
#endif
extern prototype_subpixel_predict(vp8_subpix_sixtap8x8);
-#if CONFIG_DUALPRED
#ifndef vp8_subpix_sixtap_avg16x16
#define vp8_subpix_sixtap_avg16x16 vp8_sixtap_predict_avg16x16_c
#endif
#define vp8_subpix_sixtap_avg8x8 vp8_sixtap_predict_avg8x8_c
#endif
extern prototype_subpixel_predict(vp8_subpix_sixtap_avg8x8);
-#endif /* CONFIG_DUALPRED */
-
#ifndef vp8_subpix_sixtap8x4
#define vp8_subpix_sixtap8x4 vp8_sixtap_predict8x4_c
#endif
#endif
extern prototype_subpixel_predict(vp8_subpix_bilinear8x8);
-#if CONFIG_DUALPRED
#ifndef vp8_subpix_bilinear_avg16x16
#define vp8_subpix_bilinear_avg16x16 vp8_bilinear_predict_avg16x16_c
#endif
#define vp8_subpix_bilinear_avg8x8 vp8_bilinear_predict_avg8x8_c
#endif
extern prototype_subpixel_predict(vp8_subpix_bilinear_avg8x8);
-#endif /* CONFIG_DUALPRED */
#ifndef vp8_subpix_bilinear8x4
#define vp8_subpix_bilinear8x4 vp8_bilinear_predict8x4_c
{
vp8_subpix_fn_t sixtap16x16;
vp8_subpix_fn_t sixtap8x8;
-#if CONFIG_DUALPRED
vp8_subpix_fn_t sixtap_avg16x16;
vp8_subpix_fn_t sixtap_avg8x8;
-#endif /* CONFIG_DUALPRED */
vp8_subpix_fn_t sixtap8x4;
vp8_subpix_fn_t sixtap4x4;
vp8_subpix_fn_t bilinear16x16;
vp8_subpix_fn_t bilinear8x8;
-#if CONFIG_DUALPRED
vp8_subpix_fn_t bilinear_avg16x16;
vp8_subpix_fn_t bilinear_avg8x8;
-#endif /* CONFIG_DUALPRED */
vp8_subpix_fn_t bilinear8x4;
vp8_subpix_fn_t bilinear4x4;
} vp8_subpix_rtcd_vtable_t;
// frame prediction fails.
compute_mod_refprobs( cm );
-#if CONFIG_DUALPRED
pbi->common.dual_pred_mode = vp8_read(bc, 128);
if (cm->dual_pred_mode)
cm->dual_pred_mode += vp8_read(bc, 128);
for ( i = 0; i < DUAL_PRED_CONTEXTS; i++ )
cm->prob_dualpred[i] = (vp8_prob)vp8_read_literal(bc, 8);
}
-#endif /* CONFIG_DUALPRED */
if (vp8_read_bit(bc))
{
mb_to_top_edge -= LEFT_TOP_MARGIN;
mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
mbmi->need_to_clamp_mvs = 0;
-#if CONFIG_DUALPRED
mbmi->second_ref_frame = 0;
-#endif /* CONFIG_DUALPRED */
/* Distance of Mb to the various image edges.
* These specified to 8th pel as they are always compared to MV values that are in 1/8th pel units
*/
propagate_mv: /* same MV throughout */
-#if CONFIG_DUALPRED
if ( cm->dual_pred_mode == DUAL_PREDICTION_ONLY ||
(cm->dual_pred_mode == HYBRID_PREDICTION &&
vp8_read(bc, get_pred_prob( cm, xd, PRED_DUAL ))) )
break;
}
}
-#endif /* CONFIG_DUALPRED */
#if CONFIG_ERROR_CONCEALMENT
if(pbi->ec_enabled)
vp8_build_inter16x16_predictors_mb(xd, xd->dst.y_buffer,
xd->dst.u_buffer, xd->dst.v_buffer,
xd->dst.y_stride, xd->dst.uv_stride);
-#if CONFIG_DUALPRED
+
if (xd->mode_info_context->mbmi.second_ref_frame)
{
vp8_build_2nd_inter16x16_predictors_mb(xd, xd->dst.y_buffer,
xd->dst.u_buffer, xd->dst.v_buffer,
xd->dst.y_stride, xd->dst.uv_stride);
}
-#endif /* CONFIG_DUALPRED */
}
#ifdef DEC_DEBUG
if (dec_debug) {
xd->pre.u_buffer = pc->yv12_fb[ref_fb_idx].u_buffer +recon_uvoffset;
xd->pre.v_buffer = pc->yv12_fb[ref_fb_idx].v_buffer +recon_uvoffset;
-#if CONFIG_DUALPRED
if (xd->mode_info_context->mbmi.second_ref_frame)
{
int second_ref_fb_idx;
xd->second_pre.v_buffer =
pc->yv12_fb[second_ref_fb_idx].v_buffer + recon_uvoffset;
}
-#endif /* CONFIG_DUALPRED */
if (xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME)
{
xd->pre.u_buffer = pc->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
xd->pre.v_buffer = pc->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
-#if CONFIG_DUALPRED
if (xd->mode_info_context->mbmi.second_ref_frame)
{
int second_ref_fb_idx;
xd->second_pre.u_buffer = pc->yv12_fb[second_ref_fb_idx].u_buffer + recon_uvoffset;
xd->second_pre.v_buffer = pc->yv12_fb[second_ref_fb_idx].v_buffer + recon_uvoffset;
}
-#endif /* CONFIG_DUALPRED */
if (xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME)
{
xd->subpixel_predict8x4 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), sixtap8x4);
xd->subpixel_predict8x8 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), sixtap8x8);
xd->subpixel_predict16x16 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), sixtap16x16);
-#if CONFIG_DUALPRED
xd->subpixel_predict_avg8x8 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), sixtap_avg8x8);
xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), sixtap_avg16x16);
-#endif /* CONFIG_DUALPRED */
}
else
{
xd->subpixel_predict8x4 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), bilinear8x4);
xd->subpixel_predict8x8 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), bilinear8x8);
xd->subpixel_predict16x16 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), bilinear16x16);
-#if CONFIG_DUALPRED
xd->subpixel_predict_avg8x8 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), bilinear_avg8x8);
xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), bilinear_avg16x16);
-#endif /* CONFIG_DUALPRED */
}
if (pbi->decoded_key_frame && pbi->ec_enabled && !pbi->ec_active)
mbd->subpixel_predict8x4 = xd->subpixel_predict8x4;
mbd->subpixel_predict8x8 = xd->subpixel_predict8x8;
mbd->subpixel_predict16x16 = xd->subpixel_predict16x16;
-#if CONFIG_DUALPRED
mbd->subpixel_predict_avg8x8 = xd->subpixel_predict_avg8x8;
mbd->subpixel_predict_avg16x16 = xd->subpixel_predict_avg16x16;
-#endif /* CONFIG_DUALPRED */
mbd->mode_info_context = pc->mi + pc->mode_info_stride * (i + 1);
mbd->mode_info_stride = pc->mode_info_stride;
const MV_CONTEXT *mvc = pc->fc.mvc;
MACROBLOCKD *xd = &cpi->mb.e_mbd;
-#if CONFIG_DUALPRED
int i;
-#endif
int pred_context;
MODE_INFO *m = pc->mi;
vp8_write_literal(w, pc->prob_last_coded, 8);
vp8_write_literal(w, pc->prob_gf_coded, 8);
-#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
vp8_write(w, 1, 128);
vp8_write(w, 1, 128);
vp8_write(w, 0, 128);
}
-#endif /* CONFIG_DUALPRED */
update_mbintra_mode_probs(cpi);
#endif
write_mv(w, &mi->mv.as_mv, &best_mv, mvc);
-#if CONFIG_DUALPRED
+
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
vp8_write(w,
cpi->common.ref_frame_sign_bias);
write_mv(w, &mi->second_mv.as_mv, &best_mv, mvc);
}
-#endif /* CONFIG_DUALPRED */
break;
case SPLITMV:
}
break;
default:
-#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
vp8_write(w,
mi->second_ref_frame != INTRA_FRAME,
get_pred_prob( pc, xd, PRED_DUAL ) );
}
-#endif /* CONFIG_DUALPRED */
break;
}
}
const MV_CONTEXT *mvc = pc->fc.mvc;
MACROBLOCKD *xd = &cpi->mb.e_mbd;
-#if CONFIG_DUALPRED
int i;
-#endif
int pred_context;
vp8_write_literal(w, pc->prob_last_coded, 8);
vp8_write_literal(w, pc->prob_gf_coded, 8);
-#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
vp8_write(w, 1, 128);
vp8_write(w, 1, 128);
vp8_write(w, 0, 128);
}
-#endif /* CONFIG_DUALPRED */
update_mbintra_mode_probs(cpi);
#endif
write_mv(w, &mi->mv.as_mv, &best_mv, mvc);
-#if CONFIG_DUALPRED
+
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
cpi->common.ref_frame_sign_bias);
write_mv(w, &mi->second_mv.as_mv, &best_mv, mvc);
}
-#endif /* CONFIG_DUALPRED */
break;
case SPLITMV:
{
}
break;
default:
-#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
get_pred_prob( pc, xd, PRED_DUAL ) );
}
-#endif /* CONFIG_DUALPRED */
break;
}
}
&cpi->common.rtcd.subpix, sixtap8x8);
xd->subpixel_predict16x16 = SUBPIX_INVOKE(
&cpi->common.rtcd.subpix, sixtap16x16);
-#if CONFIG_DUALPRED
xd->subpixel_predict_avg8x8 = SUBPIX_INVOKE(
&cpi->common.rtcd.subpix, sixtap_avg8x8);
xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE(
&cpi->common.rtcd.subpix, sixtap_avg16x16);
-#endif /* CONFIG_DUALPRED */
}
else
{
&cpi->common.rtcd.subpix, bilinear8x8);
xd->subpixel_predict16x16 = SUBPIX_INVOKE(
&cpi->common.rtcd.subpix, bilinear16x16);
-#if CONFIG_DUALPRED
xd->subpixel_predict_avg8x8 = SUBPIX_INVOKE(
&cpi->common.rtcd.subpix, bilinear_avg8x8);
xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE(
&cpi->common.rtcd.subpix, bilinear_avg16x16);
-#endif /* CONFIG_DUALPRED */
}
// Reset frame count of inter 0,0 motion vector usage.
// re-initencode frame context.
init_encode_frame_mb_context(cpi);
-#if CONFIG_DUALPRED
+
cpi->rd_single_diff = cpi->rd_dual_diff = cpi->rd_hybrid_diff = 0;
vpx_memset(cpi->single_pred_count, 0, sizeof(cpi->single_pred_count));
vpx_memset(cpi->dual_pred_count, 0, sizeof(cpi->dual_pred_count));
-#endif /* CONFIG_DUALPRED */
{
struct vpx_usec_timer emr_timer;
void vp8_encode_frame(VP8_COMP *cpi)
{
-#if CONFIG_DUALPRED
if (cpi->sf.RD)
{
int frame_type, pred_type;
}
}
else
-#endif /* CONFIG_DUALPRED */
{
encode_frame_internal(cpi);
}
}
vp8_rd_pick_inter_mode(cpi, x, recon_yoffset, recon_uvoffset, &rate,
&distortion, &intra_error, &single, &dual, &hybrid);
-#if CONFIG_DUALPRED
+
cpi->rd_single_diff += single;
cpi->rd_dual_diff += dual;
cpi->rd_hybrid_diff += hybrid;
else
cpi->dual_pred_count[pred_context]++;
}
-#endif /* CONFIG_DUALPRED */
/* switch back to the regular quantizer for the encode */
if (cpi->sf.improved_quant)
xd->pre.u_buffer = cpi->common.yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
xd->pre.v_buffer = cpi->common.yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
-#if CONFIG_DUALPRED
if (xd->mode_info_context->mbmi.second_ref_frame) {
int second_ref_fb_idx;
xd->second_pre.v_buffer = cpi->common.yv12_fb[second_ref_fb_idx].v_buffer +
recon_uvoffset;
}
-#endif /* CONFIG_DUALPRED */
if (!x->skip)
{
zd->subpixel_predict8x4 = xd->subpixel_predict8x4;
zd->subpixel_predict8x8 = xd->subpixel_predict8x8;
zd->subpixel_predict16x16 = xd->subpixel_predict16x16;
-#if CONFIG_DUALPRED
zd->subpixel_predict_avg8x8 = xd->subpixel_predict_avg8x8;
zd->subpixel_predict_avg16x16 = xd->subpixel_predict_avg16x16;
-#endif /* CONFIG_DUALPRED */
zd->segmentation_enabled = xd->segmentation_enabled;
zd->mb_segement_abs_delta = xd->mb_segement_abs_delta;
mbd->subpixel_predict8x4 = xd->subpixel_predict8x4;
mbd->subpixel_predict8x8 = xd->subpixel_predict8x8;
mbd->subpixel_predict16x16 = xd->subpixel_predict16x16;
-#if CONFIG_DUALPRED
mbd->subpixel_predict_avg8x8 = xd->subpixel_predict_avg8x8;
mbd->subpixel_predict_avg16x16 = xd->subpixel_predict_avg16x16;
-#endif /* CONFIG_DUALPRED */
#if CONFIG_RUNTIME_CPU_DETECT
mbd->rtcd = xd->rtcd;
#endif
sf->thresh_mult[THR_SPLITG ] = 5000;
sf->thresh_mult[THR_SPLITA ] = 5000;
-#if CONFIG_DUALPRED
sf->thresh_mult[THR_DUAL_ZEROLG ] = 0;
sf->thresh_mult[THR_DUAL_NEARESTLG] = 0;
sf->thresh_mult[THR_DUAL_NEARLG ] = 0;
sf->thresh_mult[THR_DUAL_NEWLG ] = 1000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 1000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 1000;
-#endif /* CONFIG_DUALPRED */
sf->first_step = 0;
sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
sf->thresh_mult[THR_SPLITG ] = 4500;
sf->thresh_mult[THR_SPLITA ] = 4500;
-#if CONFIG_DUALPRED
sf->thresh_mult[THR_DUAL_ZEROLG ] = 0;
sf->thresh_mult[THR_DUAL_NEARESTLG] = 0;
sf->thresh_mult[THR_DUAL_NEARLG ] = 0;
sf->thresh_mult[THR_DUAL_NEWLG ] = 1000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 1000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 1000;
-#endif /* CONFIG_DUALPRED */
#else
sf->thresh_mult[THR_NEWMV ] = 1500;
sf->thresh_mult[THR_NEWG ] = 1500;
sf->thresh_mult[THR_SPLITA ] = 20000;
}
-#if CONFIG_DUALPRED
sf->thresh_mult[THR_DUAL_ZEROLG ] = 1500;
sf->thresh_mult[THR_DUAL_NEARESTLG] = 1500;
sf->thresh_mult[THR_DUAL_NEARLG ] = 1500;
sf->thresh_mult[THR_DUAL_NEWLG ] = 2000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 2000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 2000;
-#endif /* CONFIG_DUALPRED */
}
if (Speed > 2)
sf->thresh_mult[THR_SPLITA ] = 50000;
}
-#if CONFIG_DUALPRED
sf->thresh_mult[THR_DUAL_ZEROLG ] = 2000;
sf->thresh_mult[THR_DUAL_NEARESTLG] = 2000;
sf->thresh_mult[THR_DUAL_NEARLG ] = 2000;
sf->thresh_mult[THR_DUAL_NEWLG ] = 2500;
sf->thresh_mult[THR_DUAL_NEWLA ] = 2500;
sf->thresh_mult[THR_DUAL_NEWGA ] = 2500;
-#endif /* CONFIG_DUALPRED */
sf->improved_quant = 0;
sf->improved_dct = 0;
cpi->mode_check_freq[THR_NEWA] = 4;
}
-#if CONFIG_DUALPRED
cpi->mode_check_freq[THR_DUAL_NEARLG ] = 2;
cpi->mode_check_freq[THR_DUAL_NEARLA ] = 2;
cpi->mode_check_freq[THR_DUAL_NEARGA ] = 2;
cpi->mode_check_freq[THR_DUAL_NEWLG ] = 4;
cpi->mode_check_freq[THR_DUAL_NEWLA ] = 4;
cpi->mode_check_freq[THR_DUAL_NEWGA ] = 4;
-#endif /* CONFIG_DUALPRED */
if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
{
sf->thresh_mult[THR_NEWA ] = 4000;
}
-#if CONFIG_DUALPRED
sf->thresh_mult[THR_DUAL_NEWLG ] = 4000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 4000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 4000;
-#endif /* CONFIG_DUALPRED */
}
break;
sf->thresh_mult[THR_SPLITA ] = 10000;
sf->search_method = NSTEP;
-#if CONFIG_DUALPRED
sf->thresh_mult[THR_DUAL_ZEROLG ] = 1000;
sf->thresh_mult[THR_DUAL_NEARESTLG] = 1000;
sf->thresh_mult[THR_DUAL_NEARLG ] = 1000;
sf->thresh_mult[THR_DUAL_NEWLG ] = 2000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 2000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 2000;
-#endif /* CONFIG_DUALPRED */
if (Speed > 0)
{
sf->thresh_mult[THR_SPLITA ] = 50000;
}
-#if CONFIG_DUALPRED
sf->thresh_mult[THR_DUAL_ZEROLG ] = 2000;
sf->thresh_mult[THR_DUAL_NEARESTLG] = 2000;
sf->thresh_mult[THR_DUAL_NEARLG ] = 2000;
sf->thresh_mult[THR_DUAL_NEWLG ] = 2500;
sf->thresh_mult[THR_DUAL_NEWLA ] = 2500;
sf->thresh_mult[THR_DUAL_NEWGA ] = 2500;
-#endif /* CONFIG_DUALPRED */
}
if (Speed > 2)
cpi->mode_check_freq[THR_NEWA] = 4;
}
-#if CONFIG_DUALPRED
cpi->mode_check_freq[THR_DUAL_NEARLG ] = 2;
cpi->mode_check_freq[THR_DUAL_NEARLA ] = 2;
cpi->mode_check_freq[THR_DUAL_NEARGA ] = 2;
cpi->mode_check_freq[THR_DUAL_NEWLG ] = 4;
cpi->mode_check_freq[THR_DUAL_NEWLA ] = 4;
cpi->mode_check_freq[THR_DUAL_NEWGA ] = 4;
-#endif /* CONFIG_DUALPRED */
sf->thresh_mult[THR_SPLITMV ] = INT_MAX;
sf->thresh_mult[THR_SPLITG ] = INT_MAX;
sf->thresh_mult[THR_NEWA ] = 4000;
}
-#if CONFIG_DUALPRED
sf->thresh_mult[THR_DUAL_NEWLG ] = 4000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 4000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 4000;
-#endif /* CONFIG_DUALPRED */
}
if (Speed > 5)
sf->thresh_mult[THR_NEARA ] = thresh;
}
-#if CONFIG_DUALPRED
sf->thresh_mult[THR_DUAL_ZEROLG ] = thresh;
sf->thresh_mult[THR_DUAL_NEARESTLG] = thresh;
sf->thresh_mult[THR_DUAL_NEARLG ] = thresh;
sf->thresh_mult[THR_DUAL_NEWLG ] = thresh << 1;
sf->thresh_mult[THR_DUAL_NEWLA ] = thresh << 1;
sf->thresh_mult[THR_DUAL_NEWGA ] = thresh << 1;
-#endif /* CONFIG_DUALPRED */
// Disable other intra prediction modes
sf->thresh_mult[THR_TM] = INT_MAX;
cpi->mode_check_freq[THR_NEWA] = 1 << (Tmp + 1);
}
-#if CONFIG_DUALPRED
cpi->mode_check_freq[THR_DUAL_ZEROLG ] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_DUAL_NEARESTLG] = 1 << (Tmp - 1);
cpi->mode_check_freq[THR_DUAL_NEARLG ] = 1 << Tmp;
cpi->mode_check_freq[THR_DUAL_NEWLG ] = 1 << (Tmp + 1);
cpi->mode_check_freq[THR_DUAL_NEWLA ] = 1 << (Tmp + 1);
cpi->mode_check_freq[THR_DUAL_NEWGA ] = 1 << (Tmp + 1);
-#endif /* CONFIG_DUALPRED */
cpi->mode_check_freq[THR_NEWMV] = 1 << (Tmp - 1);
}
sf->thresh_mult[THR_SPLITA ] = INT_MAX;
}
-#if CONFIG_DUALPRED
if ((cpi->ref_frame_flags & (VP8_LAST_FLAG | VP8_GOLD_FLAG)) != (VP8_LAST_FLAG | VP8_GOLD_FLAG))
{
sf->thresh_mult[THR_DUAL_ZEROLG ] = INT_MAX;
sf->thresh_mult[THR_DUAL_NEARGA ] = INT_MAX;
sf->thresh_mult[THR_DUAL_NEWGA ] = INT_MAX;
}
-#endif /* CONFIG_DUALPRED */
// Slow quant, dct and trellis not worthwhile for first pass
// so make sure they are always turned off.
cm->prob_last_coded = 128;
cm->prob_gf_coded = 128;
cm->prob_intra_coded = 63;
-#if CONFIG_DUALPRED
for ( i = 0; i < DUAL_PRED_CONTEXTS; i++ )
cm->prob_dualpred[i] = 128;
-#endif /* CONFIG_DUALPRED */
// Prime the recent reference frame useage counters.
// Hereafter they will be maintained as a sort of moving average
#define AF_THRESH 25
#define AF_THRESH2 100
#define ARF_DECAY_THRESH 12
-#if CONFIG_DUALPRED
#define MAX_MODES 33
-#else /* CONFIG_DUALPRED */
-#define MAX_MODES 21
-#endif /* CONFIG_DUALPRED */
#define MIN_THRESHMULT 32
#define MAX_THRESHMULT 512
THR_B_PRED = 19,
THR_I8X8_PRED = 20,
-#if CONFIG_DUALPRED
THR_DUAL_ZEROLG = 21,
THR_DUAL_NEARESTLG = 22,
THR_DUAL_NEARLG = 23,
THR_DUAL_NEWLG = 30,
THR_DUAL_NEWLA = 31,
THR_DUAL_NEWGA = 32,
-#endif /* CONFIG_DUALPRED */
}
THR_MODES;
int rd_thresh_mult[MAX_MODES];
int rd_baseline_thresh[MAX_MODES];
int rd_threshes[MAX_MODES];
-#if CONFIG_DUALPRED
int rd_single_diff, rd_dual_diff, rd_hybrid_diff;
int rd_prediction_type_threshes[4][NB_PREDICTION_TYPES];
int dual_pred_count[DUAL_PRED_CONTEXTS];
int single_pred_count[DUAL_PRED_CONTEXTS];
-#endif /* CONFIG_DUALPRED */
int RDMULT;
int RDDIV ;
if (best_rd <= cpi->rd_threshes[mode_index])
continue;
-#if CONFIG_DUALPRED
if (vp8_second_ref_frame_order[mode_index])
continue;
-#endif /* CONFIG_DUALPRED */
x->e_mbd.mode_info_context->mbmi.ref_frame = vp8_ref_frame_order[mode_index];
B_PRED,
I8X8_PRED,
-#if CONFIG_DUALPRED
/* dual prediction modes */
ZEROMV,
NEARESTMV,
NEWMV,
NEWMV,
NEWMV,
-#endif /* CONFIG_DUALPRED */
};
const MV_REFERENCE_FRAME vp8_ref_frame_order[MAX_MODES] =
INTRA_FRAME,
INTRA_FRAME,
-#if CONFIG_DUALPRED
/* dual prediction modes */
LAST_FRAME,
LAST_FRAME,
LAST_FRAME,
ALTREF_FRAME,
GOLDEN_FRAME,
-#endif /* CONFIG_DUALPRED */
};
-#if CONFIG_DUALPRED
const MV_REFERENCE_FRAME vp8_second_ref_frame_order[MAX_MODES] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
LAST_FRAME,
ALTREF_FRAME,
};
-#endif /* CONFIG_DUALPRED */
static void fill_token_costs(
unsigned int c [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS],
int distortion;
int best_rd = INT_MAX;
int best_intra_rd = INT_MAX;
-#if CONFIG_DUALPRED
int best_dual_rd = INT_MAX;
int best_single_rd = INT_MAX;
int best_hybrid_rd = INT_MAX;
-#endif /* CONFIG_DUALPRED */
int rate2, distortion2;
int uv_intra_rate, uv_intra_distortion, uv_intra_rate_tokenonly;
int rate_y, UNINITIALIZED_IS_SAFE(rate_uv);
int_mv frame_nearest_mv[4];
int_mv frame_near_mv[4];
int_mv frame_best_ref_mv[4];
-#if CONFIG_DUALPRED
int_mv mc_search_result[4];
-#endif /* CONFIG_DUALPRED */
int frame_mdcounts[4][4];
unsigned char *y_buffer[4];
unsigned char *u_buffer[4];
vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
vpx_memset(&best_bmodes, 0, sizeof(best_bmodes));
-#if CONFIG_DUALPRED
for (i = 0; i < 4; i++)
{
#define INVALID_MV 0x80008000
mc_search_result[i].as_int = INVALID_MV;
}
-#endif /* CONFIG_DUALPRED */
if (cpi->ref_frame_flags & VP8_LAST_FLAG)
{
int this_rd = INT_MAX;
int disable_skip = 0;
int other_cost = 0;
-#if CONFIG_DUALPRED
int dualmode_cost = 0;
int mode_excluded = 0;
-#endif /* CONFIG_DUALPRED */
// Experimental debug code.
// Record of rd values recorded for this MB. -1 indicates not measured
x->e_mbd.mode_info_context->mbmi.mode = this_mode;
x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
x->e_mbd.mode_info_context->mbmi.ref_frame = vp8_ref_frame_order[mode_index];
-#if CONFIG_DUALPRED
x->e_mbd.mode_info_context->mbmi.second_ref_frame = vp8_second_ref_frame_order[mode_index];
-#endif /* CONFIG_DUALPRED */
// If the segment reference frame feature is enabled....
// then do nothing if the current ref frame is not allowed..
vp8_update_zbin_extra(cpi, x);
}
-#if CONFIG_DUALPRED
if (!x->e_mbd.mode_info_context->mbmi.second_ref_frame)
-#endif /* CONFIG_DUALPRED */
switch (this_mode)
{
case B_PRED:
&cpi->fn_ptr[BLOCK_16X16],
x->mvcost, &dis, &sse);
}
-#if CONFIG_DUALPRED
mc_search_result[x->e_mbd.mode_info_context->mbmi.ref_frame].as_int = d->bmi.mv.as_int;
-#endif /* CONFIG_DUALPRED */
mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
vp8_set_mbmode_and_mvs(x, this_mode, &mode_mv[this_mode]);
vp8_build_inter16x16_predictors_mby(&x->e_mbd);
-#if CONFIG_DUALPRED
dualmode_cost =
vp8_cost_bit( get_pred_prob( cm, xd, PRED_DUAL ), 0 );
-#endif /* CONFIG_DUALPRED */
if (cpi->active_map_enabled && x->active_ptr[0] == 0) {
x->skip = 1;
rd_inter16x16_uv(cpi, x, &rate_uv, &distortion_uv, cpi->common.full_pixel);
rate2 += rate_uv;
distortion2 += distortion_uv;
-#if CONFIG_DUALPRED
mode_excluded = cpi->common.dual_pred_mode == DUAL_PREDICTION_ONLY;
-#endif /* CONFIG_DUALPRED */
break;
default:
break;
}
-#if CONFIG_DUALPRED
else /* x->e_mbd.mode_info_context->mbmi.second_ref_frame != 0 */
{
int ref1 = x->e_mbd.mode_info_context->mbmi.ref_frame;
dualmode_cost =
vp8_cost_bit( get_pred_prob( cm, xd, PRED_DUAL ), 1 );
}
-#endif /* CONFIG_DUALPRED */
// Where skip is allowable add in the default per mb cost for the no skip case.
// where we then decide to skip we have to delete this and replace it with the
rate2 += prob_skip_cost;
}
-#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
rate2 += dualmode_cost;
}
-#endif /* CONFIG_DUALPRED */
// Estimate the reference frame signaling cost and add it
*returnintra = distortion2 ;
}
-#if CONFIG_DUALPRED
if (!disable_skip &&
(this_mode == SPLITMV || x->e_mbd.mode_info_context->mbmi.ref_frame == INTRA_FRAME))
{
if (this_rd < best_hybrid_rd)
best_hybrid_rd = this_rd;
}
-#endif /* CONFIG_DUALPRED */
// Did this mode help.. i.i is it the new best mode
if (this_rd < best_rd || x->skip)
{
-#if CONFIG_DUALPRED
if (!mode_excluded)
{
-#endif /* CONFIG_DUALPRED */
// Note index of best mode so far
best_mode_index = mode_index;
{
best_bmodes[i] = x->e_mbd.block[i].bmi;
}
-#if CONFIG_DUALPRED
}
-#endif /* CONFIG_DUALPRED */
// Testing this mode gave rise to an improvement in best error score. Lower threshold a bit for next time
cpi->rd_thresh_mult[mode_index] = (cpi->rd_thresh_mult[mode_index] >= (MIN_THRESHMULT + 2)) ? cpi->rd_thresh_mult[mode_index] - 2 : MIN_THRESHMULT;
cpi->rd_threshes[mode_index] = (cpi->rd_baseline_thresh[mode_index] >> 7) * cpi->rd_thresh_mult[mode_index];
}
-#if CONFIG_DUALPRED
/* keep record of best dual/single-only prediction */
if (!disable_skip &&
x->e_mbd.mode_info_context->mbmi.ref_frame != INTRA_FRAME &&
if (0) printf("hybrid rd [DMC: %d]: %d\n", best_hybrid_rd, hybrid_rd);
}
}
-#endif /* CONFIG_DUALPRED */
if (x->skip)
break;
(cpi->common.mb_no_coeff_skip) ? 1 : 0;
x->e_mbd.mode_info_context->mbmi.partitioning = 0;
-#if CONFIG_DUALPRED
*best_single_rd_diff = *best_dual_rd_diff = *best_hybrid_rd_diff = 0;
-#endif /* CONFIG_DUALPRED */
return;
}
rd_update_mvcount(cpi, x, &frame_best_ref_mv[xd->mode_info_context->mbmi.ref_frame]);
-#if CONFIG_DUALPRED
*best_single_rd_diff = best_rd - best_single_rd;
*best_dual_rd_diff = best_rd - best_dual_rd;
*best_hybrid_rd_diff = best_rd - best_hybrid_rd;
-#endif /* CONFIG_DUALPRED */
}
void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate_)