Commit 4e84ad1f authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Reusing FRAME_COUNTS in the encoder.

Replacing: intra_inter_count, y_mode_count, y_uv_mode_count.

Change-Id: I5d70f73288af6effe6176e26400138067a2ae2a3
parent 829ec56b
...@@ -1243,7 +1243,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) { ...@@ -1243,7 +1243,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
for (i = 0; i < INTRA_INTER_CONTEXTS; i++) for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
vp9_cond_prob_diff_update(&header_bc, &fc->intra_inter_prob[i], vp9_cond_prob_diff_update(&header_bc, &fc->intra_inter_prob[i],
cpi->intra_inter_count[i]); cm->counts.intra_inter[i]);
if (cm->allow_comp_inter_inter) { if (cm->allow_comp_inter_inter) {
const int reference_mode = cpi->common.reference_mode; const int reference_mode = cpi->common.reference_mode;
...@@ -1276,8 +1276,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) { ...@@ -1276,8 +1276,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) for (i = 0; i < BLOCK_SIZE_GROUPS; ++i)
prob_diff_update(vp9_intra_mode_tree, cm->fc.y_mode_prob[i], prob_diff_update(vp9_intra_mode_tree, cm->fc.y_mode_prob[i],
(unsigned int *)cpi->y_mode_count[i], INTRA_MODES, cm->counts.y_mode[i], INTRA_MODES, &header_bc);
&header_bc);
for (i = 0; i < PARTITION_CONTEXTS; ++i) for (i = 0; i < PARTITION_CONTEXTS; ++i)
prob_diff_update(vp9_partition_tree, fc->partition_prob[i], prob_diff_update(vp9_partition_tree, fc->partition_prob[i],
......
...@@ -754,7 +754,7 @@ static void update_stats(VP9_COMP *cpi) { ...@@ -754,7 +754,7 @@ static void update_stats(VP9_COMP *cpi) {
SEG_LVL_REF_FRAME); SEG_LVL_REF_FRAME);
if (!seg_ref_active) if (!seg_ref_active)
cpi->intra_inter_count[vp9_get_intra_inter_context(xd)] cm->counts.intra_inter[vp9_get_intra_inter_context(xd)]
[is_inter_block(mbmi)]++; [is_inter_block(mbmi)]++;
// If the segment reference feature is enabled we have only a single // If the segment reference feature is enabled we have only a single
...@@ -2006,11 +2006,11 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) { ...@@ -2006,11 +2006,11 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) {
xd->mi_8x8[0]->mbmi.mode = DC_PRED; xd->mi_8x8[0]->mbmi.mode = DC_PRED;
xd->mi_8x8[0]->mbmi.uv_mode = DC_PRED; xd->mi_8x8[0]->mbmi.uv_mode = DC_PRED;
vp9_zero(cpi->y_mode_count); vp9_zero(cm->counts.y_mode);
vp9_zero(cpi->y_uv_mode_count); vp9_zero(cm->counts.uv_mode);
vp9_zero(cm->counts.inter_mode); vp9_zero(cm->counts.inter_mode);
vp9_zero(cm->counts.partition); vp9_zero(cm->counts.partition);
vp9_zero(cpi->intra_inter_count); vp9_zero(cm->counts.intra_inter);
vp9_zero(cm->counts.comp_inter); vp9_zero(cm->counts.comp_inter);
vp9_zero(cm->counts.single_ref); vp9_zero(cm->counts.single_ref);
vp9_zero(cm->counts.comp_ref); vp9_zero(cm->counts.comp_ref);
...@@ -2145,8 +2145,8 @@ static void encode_frame_internal(VP9_COMP *cpi) { ...@@ -2145,8 +2145,8 @@ static void encode_frame_internal(VP9_COMP *cpi) {
int j; int j;
unsigned int intra_count = 0, inter_count = 0; unsigned int intra_count = 0, inter_count = 0;
for (j = 0; j < INTRA_INTER_CONTEXTS; ++j) { for (j = 0; j < INTRA_INTER_CONTEXTS; ++j) {
intra_count += cpi->intra_inter_count[j][0]; intra_count += cm->counts.intra_inter[j][0];
inter_count += cpi->intra_inter_count[j][1]; inter_count += cm->counts.intra_inter[j][1];
} }
cpi->sf.skip_encode_frame = ((intra_count << 2) < inter_count); cpi->sf.skip_encode_frame = ((intra_count << 2) < inter_count);
cpi->sf.skip_encode_frame &= (cm->frame_type != KEY_FRAME); cpi->sf.skip_encode_frame &= (cm->frame_type != KEY_FRAME);
...@@ -2484,12 +2484,12 @@ void vp9_encode_frame(VP9_COMP *cpi) { ...@@ -2484,12 +2484,12 @@ void vp9_encode_frame(VP9_COMP *cpi) {
} }
} }
static void sum_intra_stats(VP9_COMP *cpi, const MODE_INFO *mi) { static void sum_intra_stats(VP9_COMMON *cm, const MODE_INFO *mi) {
const MB_PREDICTION_MODE y_mode = mi->mbmi.mode; const MB_PREDICTION_MODE y_mode = mi->mbmi.mode;
const MB_PREDICTION_MODE uv_mode = mi->mbmi.uv_mode; const MB_PREDICTION_MODE uv_mode = mi->mbmi.uv_mode;
const BLOCK_SIZE bsize = mi->mbmi.sb_type; const BLOCK_SIZE bsize = mi->mbmi.sb_type;
++cpi->y_uv_mode_count[y_mode][uv_mode]; ++cm->counts.uv_mode[y_mode][uv_mode];
if (bsize < BLOCK_8X8) { if (bsize < BLOCK_8X8) {
int idx, idy; int idx, idy;
...@@ -2497,9 +2497,9 @@ static void sum_intra_stats(VP9_COMP *cpi, const MODE_INFO *mi) { ...@@ -2497,9 +2497,9 @@ static void sum_intra_stats(VP9_COMP *cpi, const MODE_INFO *mi) {
const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize]; const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) for (idy = 0; idy < 2; idy += num_4x4_blocks_high)
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) for (idx = 0; idx < 2; idx += num_4x4_blocks_wide)
++cpi->y_mode_count[0][mi->bmi[idy * 2 + idx].as_mode]; ++cm->counts.y_mode[0][mi->bmi[idy * 2 + idx].as_mode];
} else { } else {
++cpi->y_mode_count[size_group_lookup[bsize]][y_mode]; ++cm->counts.y_mode[size_group_lookup[bsize]][y_mode];
} }
} }
...@@ -2586,7 +2586,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled, ...@@ -2586,7 +2586,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
vp9_encode_intra_block_y(x, MAX(bsize, BLOCK_8X8)); vp9_encode_intra_block_y(x, MAX(bsize, BLOCK_8X8));
vp9_encode_intra_block_uv(x, MAX(bsize, BLOCK_8X8)); vp9_encode_intra_block_uv(x, MAX(bsize, BLOCK_8X8));
if (output_enabled) if (output_enabled)
sum_intra_stats(cpi, mi); sum_intra_stats(cm, mi);
} else { } else {
int idx = cm->ref_frame_map[get_ref_frame_idx(cpi, mbmi->ref_frame[0])]; int idx = cm->ref_frame_map[get_ref_frame_idx(cpi, mbmi->ref_frame[0])];
YV12_BUFFER_CONFIG *ref_fb = &cm->yv12_fb[idx]; YV12_BUFFER_CONFIG *ref_fb = &cm->yv12_fb[idx];
......
...@@ -1778,7 +1778,7 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) { ...@@ -1778,7 +1778,7 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) {
cm->error.setjmp = 0; cm->error.setjmp = 0;
vp9_zero(cpi->y_uv_mode_count); vp9_zero(cpi->common.counts.uv_mode);
#ifdef MODE_TEST_HIT_STATS #ifdef MODE_TEST_HIT_STATS
vp9_zero(cpi->mode_test_hits); vp9_zero(cpi->mode_test_hits);
...@@ -3084,11 +3084,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, ...@@ -3084,11 +3084,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
} }
if (!frame_is_intra_only(&cpi->common)) { if (!frame_is_intra_only(&cpi->common)) {
FRAME_COUNTS *counts = &cpi->common.counts;
vp9_copy(counts->y_mode, cpi->y_mode_count);
vp9_copy(counts->uv_mode, cpi->y_uv_mode_count);
vp9_copy(counts->intra_inter, cpi->intra_inter_count);
if (!cpi->common.error_resilient_mode && if (!cpi->common.error_resilient_mode &&
!cpi->common.frame_parallel_decoding_mode) { !cpi->common.frame_parallel_decoding_mode) {
vp9_adapt_mode_probs(&cpi->common); vp9_adapt_mode_probs(&cpi->common);
......
...@@ -431,8 +431,6 @@ typedef struct VP9_COMP { ...@@ -431,8 +431,6 @@ typedef struct VP9_COMP {
int64_t rd_comp_pred_diff[REFERENCE_MODES]; int64_t rd_comp_pred_diff[REFERENCE_MODES];
int64_t rd_prediction_type_threshes[4][REFERENCE_MODES]; int64_t rd_prediction_type_threshes[4][REFERENCE_MODES];
unsigned int intra_inter_count[INTRA_INTER_CONTEXTS][2];
int64_t rd_tx_select_diff[TX_MODES]; int64_t rd_tx_select_diff[TX_MODES];
// FIXME(rbultje) can this overflow? // FIXME(rbultje) can this overflow?
int rd_tx_select_threshes[4][TX_MODES]; int rd_tx_select_threshes[4][TX_MODES];
...@@ -461,9 +459,6 @@ typedef struct VP9_COMP { ...@@ -461,9 +459,6 @@ typedef struct VP9_COMP {
int cq_target_quality; int cq_target_quality;
int y_mode_count[4][INTRA_MODES];
int y_uv_mode_count[INTRA_MODES][INTRA_MODES];
vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES]; vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES];
vp9_coeff_probs_model frame_coef_probs[TX_SIZES][PLANE_TYPES]; vp9_coeff_probs_model frame_coef_probs[TX_SIZES][PLANE_TYPES];
vp9_coeff_stats frame_branch_ct[TX_SIZES][PLANE_TYPES]; vp9_coeff_stats frame_branch_ct[TX_SIZES][PLANE_TYPES];
......
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