]> granicus.if.org Git - libvpx/commitdiff
Add RD_STATS into MB_MODE_INFO
authorAngie Chiang <angiebird@google.com>
Sun, 6 Nov 2016 20:19:06 +0000 (12:19 -0800)
committerAngie Chiang <angiebird@google.com>
Sun, 6 Nov 2016 20:21:34 +0000 (12:21 -0800)
With RD_STATS in MB_MODE_INFO, we will be able to compare the results
from rate-distortion loop and the results from bitstream packing.

Change-Id: If1dba7d87126577a6f369ac087d4517f7cebb0c5

av1/common/blockd.h
av1/encoder/bitstream.c
av1/encoder/rdopt.c
av1/encoder/rdopt.h

index 1d08cfab439edd7ff376cf969e3fb20ced2f8ff3..f4bca8e207b0f8cc86460c38eb67fe7724fa1dae 100644 (file)
@@ -179,6 +179,23 @@ typedef struct {
 } FILTER_INTRA_MODE_INFO;
 #endif  // CONFIG_FILTER_INTRA
 
+#if CONFIG_VAR_TX
+#define TXB_COEFF_COST_MAP_SIZE (2 * MAX_MIB_SIZE)
+
+// TODO(angiebird): Merge RD_COST and RD_STATS
+typedef struct RD_STATS {
+  int rate;
+  int64_t dist;
+  int64_t sse;
+  int skip;
+#if CONFIG_RD_DEBUG
+  int txb_coeff_cost[MAX_MB_PLANE];
+  int txb_coeff_cost_map[MAX_MB_PLANE][TXB_COEFF_COST_MAP_SIZE]
+                        [TXB_COEFF_COST_MAP_SIZE];
+#endif
+} RD_STATS;
+#endif  // CONFIG_VAR_TX
+
 // This structure now relates to 8x8 block regions.
 typedef struct {
   // Common for both INTER and INTRA blocks
@@ -251,7 +268,7 @@ typedef struct {
   int current_q_index;
 #endif
 #if CONFIG_RD_DEBUG
-  int64_t txb_coeff_cost[MAX_MB_PLANE];
+  RD_STATS rd_stats;
   int mi_row;
   int mi_col;
 #endif
index fa6b905dd004f7f69f1318f20d3da1097c3f6263..1c21b60e1f8b445cd3466cf82742d0fade3f9794 100644 (file)
@@ -1913,7 +1913,7 @@ static void write_modes_b(AV1_COMP *cpi, const TileInfo *const tile,
   }
 #if CONFIG_RD_DEBUG
   for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
-    if (m->mbmi.txb_coeff_cost[plane] != txb_coeff_cost[plane]) {
+    if (m->mbmi.rd_stats.txb_coeff_cost[plane] != txb_coeff_cost[plane]) {
       dump_mode_info(m);
       assert(0);
     }
index efd42c36beb3cfeb7c223fd7f99a812adddd106b..898469ca9657848dc6a0b3184dcf57b6b79ffdc6 100644 (file)
@@ -3431,7 +3431,7 @@ static void select_tx_type_yrd(const AV1_COMP *cpi, MACROBLOCK *x,
   mbmi->tx_size = best_tx;
 #if CONFIG_RD_DEBUG
   // record plane y's transform block coefficient cost
-  mbmi->txb_coeff_cost[0] = rd_stats->txb_coeff_cost[0];
+  mbmi->rd_stats = *rd_stats;
 #endif
   memcpy(x->blk_skip[0], best_blk_skip, sizeof(best_blk_skip[0]) * n4);
 }
@@ -7539,8 +7539,7 @@ static int64_t handle_inter_mode(
           inter_block_uvrd(cpi, x, &rd_stats_uv, bsize, ref_best_rd - rdcosty);
 #if CONFIG_RD_DEBUG
       // record uv planes' transform block coefficient cost
-      mbmi->txb_coeff_cost[1] = rd_stats_uv.txb_coeff_cost[1];
-      mbmi->txb_coeff_cost[2] = rd_stats_uv.txb_coeff_cost[2];
+      av1_merge_rd_stats(&mbmi->rd_stats, &rd_stats_uv);
 #endif
       *rate_uv = rd_stats_uv.rate;
       distortion_uv = rd_stats_uv.dist;
index 18445e88e70485cfb1b3dc4c101c4b06a20e45f9..678c0db6bb8962742fa7931b486d721b6c3fdb13 100644 (file)
@@ -27,21 +27,6 @@ struct macroblock;
 struct RD_COST;
 
 #if CONFIG_VAR_TX
-#define TXB_COEFF_COST_MAP_SIZE (2 * MAX_MIB_SIZE)
-
-// TODO(angiebird): Merge RD_COST and RD_STATS
-typedef struct RD_STATS {
-  int rate;
-  int64_t dist;
-  int64_t sse;
-  int skip;
-#if CONFIG_RD_DEBUG
-  int txb_coeff_cost[MAX_MB_PLANE];
-  int txb_coeff_cost_map[MAX_MB_PLANE][TXB_COEFF_COST_MAP_SIZE]
-                        [TXB_COEFF_COST_MAP_SIZE];
-#endif
-} RD_STATS;
-
 static INLINE void av1_init_rd_stats(RD_STATS *rd_stats) {
 #if CONFIG_RD_DEBUG
   int plane;