Commit 4d55d76e authored by Angie Chiang's avatar Angie Chiang

Add TXCOEFF_COST_TIMER

Measure the time spending on av1_cost_coeffs by turning on this
flag

Change-Id: Ide4171182d87bd52f00fe01abefc77cb2d730834
parent a7a6f4e1
......@@ -87,6 +87,7 @@ extern "C" {
// TODO(jingning): Turning this on to set up transform coefficient
// processing timer.
#define TXCOEFF_TIMER 0
#define TXCOEFF_COST_TIMER 0
typedef enum {
SINGLE_REFERENCE = 0,
......@@ -582,6 +583,12 @@ typedef struct AV1Common {
int64_t txcoeff_timer;
int txb_count;
#endif
#if TXCOEFF_COST_TIMER
int64_t cum_txcoeff_cost_timer;
int64_t txcoeff_cost_timer;
int64_t txcoeff_cost_count;
#endif
} AV1_COMMON;
// TODO(hkuang): Don't need to lock the whole pool after implementing atomic
......
......@@ -5875,9 +5875,23 @@ static void Pass2Encode(AV1_COMP *cpi, size_t *size, uint8_t *dest,
unsigned int *frame_flags) {
#if CONFIG_MISMATCH_DEBUG
mismatch_move_frame_idx_w();
#endif
#if TXCOEFF_COST_TIMER
AV1_COMMON *cm = &cpi->common;
cm->txcoeff_cost_timer = 0;
cm->txcoeff_cost_count = 0;
#endif
encode_frame_to_data_rate(cpi, size, dest, 0, frame_flags);
#if TXCOEFF_COST_TIMER
cm->cum_txcoeff_cost_timer += cm->txcoeff_cost_timer;
fprintf(stderr,
"\ntxb coeff cost block number: %ld, frame time: %ld, cum time %ld "
"in us\n",
cm->txcoeff_cost_count, cm->txcoeff_cost_timer,
cm->cum_txcoeff_cost_timer);
#endif
// Do not do post-encoding update for those frames that do not have a spot in
// a gf group, but note that an OVERLAY frame always has a spot in a gf group,
// even when show_existing_frame is used.
......
......@@ -18,6 +18,7 @@
#include "aom_dsp/aom_dsp_common.h"
#include "aom_dsp/blend.h"
#include "aom_mem/aom_mem.h"
#include "aom_ports/aom_timer.h"
#include "aom_ports/mem.h"
#include "aom_ports/system_state.h"
......@@ -1717,12 +1718,16 @@ int av1_cost_coeffs(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
int blk_row, int blk_col, int block, TX_SIZE tx_size,
const SCAN_ORDER *scan_order, const ENTROPY_CONTEXT *a,
const ENTROPY_CONTEXT *l, int use_fast_coef_costing) {
#if TXCOEFF_COST_TIMER
struct aom_usec_timer timer;
aom_usec_timer_start(&timer);
#endif
const AV1_COMMON *const cm = &cpi->common;
#if !CONFIG_LV_MAP
(void)blk_row;
(void)blk_col;
return cost_coeffs(cm, x, plane, block, tx_size, scan_order, a, l,
use_fast_coef_costing);
int cost = cost_coeffs(cm, x, plane, block, tx_size, scan_order, a, l,
use_fast_coef_costing);
#else // !CONFIG_LV_MAP
(void)scan_order;
(void)use_fast_coef_costing;
......@@ -1734,9 +1739,17 @@ int av1_cost_coeffs(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
TXB_CTX txb_ctx;
get_txb_ctx(plane_bsize, tx_size, plane, a, l, &txb_ctx);
return av1_cost_coeffs_txb(cm, x, plane, blk_row, blk_col, block, tx_size,
&txb_ctx);
int cost = av1_cost_coeffs_txb(cm, x, plane, blk_row, blk_col, block, tx_size,
&txb_ctx);
#endif // !CONFIG_LV_MAP
#if TXCOEFF_COST_TIMER
AV1_COMMON *tmp_cm = (AV1_COMMON *)&cpi->common;
aom_usec_timer_mark(&timer);
const int64_t elapsed_time = aom_usec_timer_elapsed(&timer);
tmp_cm->txcoeff_cost_timer += elapsed_time;
++tmp_cm->txcoeff_cost_count;
#endif
return cost;
}
// Get transform block visible dimensions cropped to the MI units.
......
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