]> granicus.if.org Git - libvpx/commitdiff
As you go mbmi->skip_coeff
authorJim Bankoski <jimbankoski@google.com>
Wed, 15 Jan 2014 01:58:25 +0000 (17:58 -0800)
committerJim Bankoski <jimbankoski@google.com>
Wed, 15 Jan 2014 01:58:25 +0000 (17:58 -0800)
Calculate the skip_coeff as part of the encode process, rather than
checking the eobs after the fact with another pass.

Change-Id: Ib41b139e96a97dee30e4b993b4cc53d86337128d

vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_encodemb.c
vp9/encoder/vp9_encodemb.h
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_tokenize.c

index 4c66c2075f7f3273d3753b0eb011a0773dbe213b..b0fae659330479bdd4786dd3b8ae41c99ac58118 100644 (file)
@@ -2543,6 +2543,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
   }
 
   if (!is_inter_block(mbmi)) {
+    mbmi->skip_coeff = 1;
     vp9_encode_intra_block_y(x, MAX(bsize, BLOCK_8X8));
     vp9_encode_intra_block_uv(x, MAX(bsize, BLOCK_8X8));
     if (output_enabled)
@@ -2561,6 +2562,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
   if (!is_inter_block(mbmi)) {
     vp9_tokenize_sb(cpi, t, !output_enabled, MAX(bsize, BLOCK_8X8));
   } else if (!x->skip) {
+    mbmi->skip_coeff = 1;
     vp9_encode_sb(x, MAX(bsize, BLOCK_8X8));
     vp9_tokenize_sb(cpi, t, !output_enabled, MAX(bsize, BLOCK_8X8));
   } else {
index 21bc5886dda5303abf3682736c3fa50a389d51a1..4bef675016d5b39a46a041f01b09ca3237c2b9d7 100644 (file)
@@ -451,6 +451,9 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
     ctx->tl[plane][j] = p->eobs[block] > 0;
   }
 
+  if (p->eobs[block])
+    *(args->skip_coeff) = 0;
+
   if (x->skip_encode || p->eobs[block] == 0)
     return;
 
@@ -474,7 +477,6 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
       assert(0 && "Invalid transform size");
   }
 }
-
 static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize,
                                TX_SIZE tx_size, void *arg) {
   struct encode_b_args *const args = arg;
@@ -499,7 +501,8 @@ static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize,
 void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize) {
   MACROBLOCKD *const xd = &x->e_mbd;
   struct optimize_ctx ctx;
-  struct encode_b_args arg = {x, &ctx};
+  MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
+  struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
 
   vp9_subtract_sby(x, bsize);
   if (x->optimize)
@@ -511,7 +514,8 @@ void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize) {
 void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
   MACROBLOCKD *const xd = &x->e_mbd;
   struct optimize_ctx ctx;
-  struct encode_b_args arg = {x, &ctx};
+  MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
+  struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
 
   if (!x->skip_recode)
     vp9_subtract_sb(x, bsize);
@@ -655,12 +659,15 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
     default:
       assert(0);
   }
+  if (*eob)
+    *(args->skip_coeff) = 0;
 }
 
 void vp9_encode_intra_block_y(MACROBLOCK *x, BLOCK_SIZE bsize) {
   MACROBLOCKD* const xd = &x->e_mbd;
   struct optimize_ctx ctx;
-  struct encode_b_args arg = {x, &ctx};
+  MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
+  struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
 
   foreach_transformed_block_in_plane(xd, bsize, 0, vp9_encode_block_intra,
                                      &arg);
@@ -668,7 +675,8 @@ void vp9_encode_intra_block_y(MACROBLOCK *x, BLOCK_SIZE bsize) {
 void vp9_encode_intra_block_uv(MACROBLOCK *x, BLOCK_SIZE bsize) {
   MACROBLOCKD* const xd = &x->e_mbd;
   struct optimize_ctx ctx;
-  struct encode_b_args arg = {x, &ctx};
+  MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
+  struct encode_b_args arg = {x, &ctx, &mbmi->skip_coeff};
   foreach_transformed_block_uv(xd, bsize, vp9_encode_block_intra, &arg);
 }
 
index cb872a7d644517e6831c526a8eaa0c3331b75361..207d573a5f9c0bc9854aab79f1dbba349cf8eead 100644 (file)
@@ -24,6 +24,7 @@ struct optimize_ctx {
 struct encode_b_args {
   MACROBLOCK *x;
   struct optimize_ctx *ctx;
+  unsigned char *skip_coeff;
 };
 
 void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
index b46e808914a04245a581ef68f9a59a57449f61c2..6671d153fb3051f6bb09da578cb77edacd60ed9f 100644 (file)
@@ -640,7 +640,9 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
   struct rdcost_block_args *args = arg;
   MACROBLOCK *const x = args->x;
   MACROBLOCKD *const xd = &x->e_mbd;
-  struct encode_b_args encode_args = {x, NULL};
+  MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
+  struct encode_b_args encode_args = {x, NULL, &mbmi->skip_coeff};
+
   int64_t rd1, rd2, rd;
 
   if (args->skip)
index 4ccead8342b73e45dc548364abe55301871c9c13..b04e3fe309fce3c5bc4f7748ef1d9e4f13697b65 100644 (file)
@@ -299,8 +299,6 @@ void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
   const int skip_inc = !vp9_segfeature_active(&cm->seg, mbmi->segment_id,
                                               SEG_LVL_SKIP);
   struct tokenize_b_args arg = {cpi, xd, t, mbmi->tx_size, cpi->mb.token_cache};
-
-  mbmi->skip_coeff = sb_is_skippable(&cpi->mb, bsize);
   if (mbmi->skip_coeff) {
     if (!dry_run)
       cm->counts.mbskip[ctx][1] += skip_inc;