]> granicus.if.org Git - libvpx/commitdiff
Re-enable support for static_threshold (encode_breakout).
authorRonald S. Bultje <rbultje@google.com>
Mon, 7 Jan 2013 19:02:14 +0000 (11:02 -0800)
committerRonald S. Bultje <rbultje@google.com>
Mon, 7 Jan 2013 19:02:14 +0000 (11:02 -0800)
Change-Id: Ibd7380f478d3127f9db91d0a4fd2fd0dfde961ab

vp9/encoder/vp9_block.h
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_rdopt.c

index e8f6f46b0aef7c00973c3b59c2af0053033fe39f..94078970b98e74a2a88360fc0a8aeb1455855130 100644 (file)
@@ -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];
index 219295052e1042fc53ed6aa3204b4679903486cd..5a84fe99762dadcdb885014ea1f596db3813586d 100644 (file)
@@ -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 {
index 5eea50779aacd821ccf5abde173f729eb8215458..267dd0aa59a7af203eb081cd01ef10441c426aab 100644 (file)
@@ -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));