Commit c13d9fef authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

Re-enable support for static_threshold (encode_breakout).

Change-Id: Ibd7380f478d3127f9db91d0a4fd2fd0dfde961ab
parent e6216d16
......@@ -76,6 +76,7 @@ typedef struct {
typedef struct {
MODE_INFO mic;
PARTITION_INFO partition_info;
int skip;
int_mv best_ref_mv;
int_mv second_best_ref_mv;
int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
......
......@@ -493,6 +493,7 @@ static void update_state(VP9_COMP *cpi, MACROBLOCK *x,
mbmi->mv[1].as_int = x->partition_info->bmi[15].second_mv.as_int;
}
x->skip = ctx->skip;
if (!output_enabled)
return;
......@@ -2125,7 +2126,6 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
int seg_ref_active;
unsigned char ref_pred_flag;
x->skip = 0;
#if CONFIG_SUPERBLOCKS
assert(!xd->mode_info_context->mbmi.sb_type);
#endif
......@@ -2178,7 +2178,6 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
vp9_set_pred_flag(xd, PRED_REF, ref_pred_flag);
}
assert(mbmi->txfm_size <= TX_16X16);
if (mbmi->ref_frame == INTRA_FRAME) {
#ifdef ENC_DEBUG
if (enc_debug) {
......@@ -2356,6 +2355,7 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
!((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))) {
assert(mbmi->txfm_size <= TX_16X16);
if (mbmi->mode != B_PRED && mbmi->mode != I8X8_PRED &&
mbmi->mode != SPLITMV) {
cpi->txfm_count_16x16p[mbmi->txfm_size]++;
......@@ -2403,8 +2403,6 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
ENTROPY_CONTEXT_PLANES ta[4], tl[4];
const int mis = cm->mode_info_stride;
x->skip = 0;
if (cm->frame_type == KEY_FRAME) {
if (cpi->oxcf.tuning == VP8_TUNE_SSIM) {
adjust_act_zbin(cpi, x);
......@@ -2494,22 +2492,22 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
#if CONFIG_TX32X32
if (xd->mode_info_context->mbmi.txfm_size == TX_32X32) {
vp9_subtract_sby_s_c(x->sb_coeff_data.src_diff, src, src_y_stride,
dst, dst_y_stride);
vp9_subtract_sbuv_s_c(x->sb_coeff_data.src_diff,
usrc, vsrc, src_uv_stride,
udst, vdst, dst_uv_stride);
vp9_transform_sby_32x32(x);
vp9_transform_sbuv_16x16(x);
vp9_quantize_sby_32x32(x);
vp9_quantize_sbuv_16x16(x);
// TODO(rbultje): trellis optimize
vp9_inverse_transform_sbuv_16x16(&x->e_mbd.sb_coeff_data);
vp9_inverse_transform_sby_32x32(&x->e_mbd.sb_coeff_data);
vp9_recon_sby_s_c(&x->e_mbd, dst);
vp9_recon_sbuv_s_c(&x->e_mbd, udst, vdst);
if (!x->skip) {
vp9_subtract_sby_s_c(x->sb_coeff_data.src_diff, src, src_y_stride,
dst, dst_y_stride);
vp9_subtract_sbuv_s_c(x->sb_coeff_data.src_diff,
usrc, vsrc, src_uv_stride,
udst, vdst, dst_uv_stride);
vp9_transform_sby_32x32(x);
vp9_transform_sbuv_16x16(x);
vp9_quantize_sby_32x32(x);
vp9_quantize_sbuv_16x16(x);
// TODO(rbultje): trellis optimize
vp9_inverse_transform_sbuv_16x16(&x->e_mbd.sb_coeff_data);
vp9_inverse_transform_sby_32x32(&x->e_mbd.sb_coeff_data);
vp9_recon_sby_s_c(&x->e_mbd, dst);
vp9_recon_sbuv_s_c(&x->e_mbd, udst, vdst);
vp9_tokenize_sb(cpi, &x->e_mbd, t, !output_enabled);
} else {
int mb_skip_context =
......@@ -2551,26 +2549,26 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
tp[n] = *t;
xd->mode_info_context = mi + x_idx + y_idx * mis;
vp9_subtract_mby_s_c(x->src_diff,
src + x_idx * 16 + y_idx * 16 * src_y_stride,
src_y_stride,
dst + x_idx * 16 + y_idx * 16 * dst_y_stride,
dst_y_stride);
vp9_subtract_mbuv_s_c(x->src_diff,
usrc + x_idx * 8 + y_idx * 8 * src_uv_stride,
vsrc + x_idx * 8 + y_idx * 8 * src_uv_stride,
src_uv_stride,
udst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
vdst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
dst_uv_stride);
vp9_fidct_mb(x);
vp9_recon_mby_s_c(&x->e_mbd,
dst + x_idx * 16 + y_idx * 16 * dst_y_stride);
vp9_recon_mbuv_s_c(&x->e_mbd,
udst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
vdst + x_idx * 8 + y_idx * 8 * dst_uv_stride);
if (!x->skip) {
vp9_subtract_mby_s_c(x->src_diff,
src + x_idx * 16 + y_idx * 16 * src_y_stride,
src_y_stride,
dst + x_idx * 16 + y_idx * 16 * dst_y_stride,
dst_y_stride);
vp9_subtract_mbuv_s_c(x->src_diff,
usrc + x_idx * 8 + y_idx * 8 * src_uv_stride,
vsrc + x_idx * 8 + y_idx * 8 * src_uv_stride,
src_uv_stride,
udst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
vdst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
dst_uv_stride);
vp9_fidct_mb(x);
vp9_recon_mby_s_c(&x->e_mbd,
dst + x_idx * 16 + y_idx * 16 * dst_y_stride);
vp9_recon_mbuv_s_c(&x->e_mbd,
udst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
vdst + x_idx * 8 + y_idx * 8 * dst_uv_stride);
vp9_tokenize_mb(cpi, &x->e_mbd, t, !output_enabled);
skip[n] = xd->mode_info_context->mbmi.mb_skip_coeff;
} else {
......@@ -2650,8 +2648,6 @@ static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t,
ENTROPY_CONTEXT_PLANES ta[16], tl[16];
const int mis = cm->mode_info_stride;
x->skip = 0;
if (cm->frame_type == KEY_FRAME) {
if (cpi->oxcf.tuning == VP8_TUNE_SSIM) {
adjust_act_zbin(cpi, x);
......@@ -2756,33 +2752,33 @@ static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t,
memcpy(&tl[n * 2], xd->left_context, sizeof(*tl) * 2);
tp[n] = *t;
xd->mode_info_context = mi + x_idx * 2 + y_idx * mis * 2;
vp9_subtract_sby_s_c(x->sb_coeff_data.src_diff,
src + x_idx * 32 + y_idx * 32 * src_y_stride,
src_y_stride,
dst + x_idx * 32 + y_idx * 32 * dst_y_stride,
dst_y_stride);
vp9_subtract_sbuv_s_c(x->sb_coeff_data.src_diff,
usrc + x_idx * 16 + y_idx * 16 * src_uv_stride,
vsrc + x_idx * 16 + y_idx * 16 * src_uv_stride,
src_uv_stride,
udst + x_idx * 16 + y_idx * 16 * dst_uv_stride,
vdst + x_idx * 16 + y_idx * 16 * dst_uv_stride,
dst_uv_stride);
vp9_transform_sby_32x32(x);
vp9_transform_sbuv_16x16(x);
vp9_quantize_sby_32x32(x);
vp9_quantize_sbuv_16x16(x);
// TODO(rbultje): trellis optimize
vp9_inverse_transform_sbuv_16x16(&x->e_mbd.sb_coeff_data);
vp9_inverse_transform_sby_32x32(&x->e_mbd.sb_coeff_data);
vp9_recon_sby_s_c(&x->e_mbd,
dst + 32 * x_idx + 32 * y_idx * dst_y_stride,
dst_y_stride);
vp9_recon_sbuv_s_c(&x->e_mbd,
udst + x_idx * 16 + y_idx * 16 * dst_uv_stride,
vdst + x_idx * 16 + y_idx * 16 * dst_uv_stride);
if (!x->skip) {
vp9_subtract_sby_s_c(x->sb_coeff_data.src_diff,
src + x_idx * 32 + y_idx * 32 * src_y_stride,
src_y_stride,
dst + x_idx * 32 + y_idx * 32 * dst_y_stride,
dst_y_stride);
vp9_subtract_sbuv_s_c(x->sb_coeff_data.src_diff,
usrc + x_idx * 16 + y_idx * 16 * src_uv_stride,
vsrc + x_idx * 16 + y_idx * 16 * src_uv_stride,
src_uv_stride,
udst + x_idx * 16 + y_idx * 16 * dst_uv_stride,
vdst + x_idx * 16 + y_idx * 16 * dst_uv_stride,
dst_uv_stride);
vp9_transform_sby_32x32(x);
vp9_transform_sbuv_16x16(x);
vp9_quantize_sby_32x32(x);
vp9_quantize_sbuv_16x16(x);
// TODO(rbultje): trellis optimize
vp9_inverse_transform_sbuv_16x16(&x->e_mbd.sb_coeff_data);
vp9_inverse_transform_sby_32x32(&x->e_mbd.sb_coeff_data);
vp9_recon_sby_s_c(&x->e_mbd,
dst + 32 * x_idx + 32 * y_idx * dst_y_stride,
dst_y_stride);
vp9_recon_sbuv_s_c(&x->e_mbd,
udst + x_idx * 16 + y_idx * 16 * dst_uv_stride,
vdst + x_idx * 16 + y_idx * 16 * dst_uv_stride);
vp9_tokenize_sb(cpi, &x->e_mbd, t, !output_enabled);
} else {
int mb_skip_context = cpi->common.mb_no_coeff_skip ?
......@@ -2827,26 +2823,26 @@ static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t,
tp[n] = *t;
xd->mode_info_context = mi + x_idx + y_idx * mis;
vp9_subtract_mby_s_c(x->src_diff,
src + x_idx * 16 + y_idx * 16 * src_y_stride,
src_y_stride,
dst + x_idx * 16 + y_idx * 16 * dst_y_stride,
dst_y_stride);
vp9_subtract_mbuv_s_c(x->src_diff,
usrc + x_idx * 8 + y_idx * 8 * src_uv_stride,
vsrc + x_idx * 8 + y_idx * 8 * src_uv_stride,
src_uv_stride,
udst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
vdst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
dst_uv_stride);
vp9_fidct_mb(x);
vp9_recon_mby_s_c(&x->e_mbd,
dst + x_idx * 16 + y_idx * 16 * dst_y_stride);
vp9_recon_mbuv_s_c(&x->e_mbd,
udst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
vdst + x_idx * 8 + y_idx * 8 * dst_uv_stride);
if (!x->skip) {
vp9_subtract_mby_s_c(x->src_diff,
src + x_idx * 16 + y_idx * 16 * src_y_stride,
src_y_stride,
dst + x_idx * 16 + y_idx * 16 * dst_y_stride,
dst_y_stride);
vp9_subtract_mbuv_s_c(x->src_diff,
usrc + x_idx * 8 + y_idx * 8 * src_uv_stride,
vsrc + x_idx * 8 + y_idx * 8 * src_uv_stride,
src_uv_stride,
udst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
vdst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
dst_uv_stride);
vp9_fidct_mb(x);
vp9_recon_mby_s_c(&x->e_mbd,
dst + x_idx * 16 + y_idx * 16 * dst_y_stride);
vp9_recon_mbuv_s_c(&x->e_mbd,
udst + x_idx * 8 + y_idx * 8 * dst_uv_stride,
vdst + x_idx * 8 + y_idx * 8 * dst_uv_stride);
vp9_tokenize_mb(cpi, &x->e_mbd, t, !output_enabled);
skip[n] = xd->mode_info_context->mbmi.mb_skip_coeff;
} else {
......
......@@ -3403,6 +3403,7 @@ static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
// Take a snapshot of the coding context so it can be
// restored if we decide to encode this way
ctx->skip = x->skip;
ctx->best_mode_index = mode_index;
vpx_memcpy(&ctx->mic, xd->mode_info_context,
sizeof(MODE_INFO));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment