Commit 9a44f5fb authored by Angie Chiang's avatar Angie Chiang

Add RD_STATS into MB_MODE_INFO

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
parent 85279f66
......@@ -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
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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;
......
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