From c13d9fef42c91fc7bf579b8a2cf8891d5f07f17f Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 7 Jan 2013 11:02:14 -0800 Subject: Re-enable support for static_threshold (encode_breakout). Change-Id: Ibd7380f478d3127f9db91d0a4fd2fd0dfde961ab --- vp9/encoder/vp9_block.h | 1 + vp9/encoder/vp9_encodeframe.c | 166 +++++++++++++++++++++--------------------- vp9/encoder/vp9_rdopt.c | 1 + 3 files changed, 83 insertions(+), 85 deletions(-) diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h index e8f6f46b0..94078970b 100644 --- a/vp9/encoder/vp9_block.h +++ b/vp9/encoder/vp9_block.h @@ -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]; diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 219295052..5a84fe997 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -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 { diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 5eea50779..267dd0aa5 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -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)); -- cgit v1.2.3