History

Merge "Moving count_mb_ref_frame_usage to macroblock struct"

Scott LaVarnway committed 13 years ago

Commit 7891fb52 parents 836f8e9 69d07486 files · +39 −27Browse files

Unified · Split

6 files
  1. vp8/encoder/bitstream.c +2 −2
  2. vp8/encoder/block.h +1 −0
  3. vp8/encoder/encodeframe.c +18 −14
  4. vp8/encoder/ethreading.c +2 −0
  5. vp8/encoder/onyx_if.c +16 −10
  6. vp8/encoder/onyx_int.h +0 −1
vp8/encoder/bitstream.c+2−2
@@ -493,7 +493,7 @@ static void write_mb_features(vp8_writer *w, const MB_MODE_INFO *mi, const MACRO · 492 unmodified lines
493493 }
494494 void vp8_convert_rfct_to_prob(VP8_COMP *const cpi)
495495 {
496− const int *const rfct = cpi->count_mb_ref_frame_usage;
496+ const int *const rfct = cpi->mb.count_mb_ref_frame_usage;
497497 const int rf_intra = rfct[INTRA_FRAME];
498498 const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
499499
@@ -996,7 +996,7 @@ int vp8_estimate_entropy_savings(VP8_COMP *cpi) · 496 unmodified lines
996996 {
997997 int savings = 0;
998998
999− const int *const rfct = cpi->count_mb_ref_frame_usage;
999+ const int *const rfct = cpi->mb.count_mb_ref_frame_usage;
10001000 const int rf_intra = rfct[INTRA_FRAME];
10011001 const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
10021002 int new_intra, new_last, new_garf, oldtotal, newtotal;
vp8/encoder/block.h+1−0
@@ -134,6 +134,7 @@ typedef struct macroblock · 133 unmodified lines
134134 int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */
135135 int64_t prediction_error;
136136 int64_t intra_error;
137+ int count_mb_ref_frame_usage[MAX_REF_FRAMES];
137138
138139
139140 void (*short_fdct4x4)(short *input, short *output, int pitch);
vp8/encoder/encodeframe.c+18−14
@@ -642,8 +642,6 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi) · 641 unmodified lines
642642
643643 xd->left_context = &cm->left_context;
644644
645− vp8_zero(cpi->count_mb_ref_frame_usage)
646−
647645 x->mvc = cm->fc.mvc;
648646
649647 vpx_memset(cm->above_context, 0,
@@ -678,6 +676,7 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi) · 28 unmodified lines
678676 vp8_zero(x->uv_mode_count)
679677 x->prediction_error = 0;
680678 x->intra_error = 0;
679+ vp8_zero(x->count_mb_ref_frame_usage);
681680 }
682681
683682 static void sum_coef_counts(MACROBLOCK *x, MACROBLOCK *x_thread)
@@ -868,7 +867,7 @@ void vp8_encode_frame(VP8_COMP *cpi) · 184 unmodified lines
868867 for (i = 0; i < cpi->encoding_thread_count; i++)
869868 {
870869 int mode_count;
871− int mv_vals;
870+ int c_idx;
872871 totalrate += cpi->mb_row_ei[i].totalrate;
873872
874873 cpi->mb.skip_true_count += cpi->mb_row_ei[i].mb.skip_true_count;
@@ -881,18 +880,22 @@ void vp8_encode_frame(VP8_COMP *cpi) · 6 unmodified lines
881880 cpi->mb.uv_mode_count[mode_count] +=
882881 cpi->mb_row_ei[i].mb.uv_mode_count[mode_count];
883882
884− for(mv_vals = 0; mv_vals < MVvals; mv_vals++)
883+ for(c_idx = 0; c_idx < MVvals; c_idx++)
885884 {
886− cpi->mb.MVcount[0][mv_vals] +=
887− cpi->mb_row_ei[i].mb.MVcount[0][mv_vals];
888− cpi->mb.MVcount[1][mv_vals] +=
889− cpi->mb_row_ei[i].mb.MVcount[1][mv_vals];
885+ cpi->mb.MVcount[0][c_idx] +=
886+ cpi->mb_row_ei[i].mb.MVcount[0][c_idx];
887+ cpi->mb.MVcount[1][c_idx] +=
888+ cpi->mb_row_ei[i].mb.MVcount[1][c_idx];
890889 }
891890
892891 cpi->mb.prediction_error +=
893892 cpi->mb_row_ei[i].mb.prediction_error;
894893 cpi->mb.intra_error += cpi->mb_row_ei[i].mb.intra_error;
895894
895+ for(c_idx = 0; c_idx < MAX_REF_FRAMES; c_idx++)
896+ cpi->mb.count_mb_ref_frame_usage[c_idx] +=
897+ x->count_mb_ref_frame_usage[c_idx];
898+
896899 /* add up counts for each thread */
897900 sum_coef_counts(x, &cpi->mb_row_ei[i].mb);
898901 }
@@ -987,13 +990,14 @@ void vp8_encode_frame(VP8_COMP *cpi) · 88 unmodified lines
987990 {
988991 int tot_modes;
989992
990− tot_modes = cpi->count_mb_ref_frame_usage[INTRA_FRAME]
991− + cpi->count_mb_ref_frame_usage[LAST_FRAME]
992− + cpi->count_mb_ref_frame_usage[GOLDEN_FRAME]
993− + cpi->count_mb_ref_frame_usage[ALTREF_FRAME];
993+ tot_modes = cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME]
994+ + cpi->mb.count_mb_ref_frame_usage[LAST_FRAME]
995+ + cpi->mb.count_mb_ref_frame_usage[GOLDEN_FRAME]
996+ + cpi->mb.count_mb_ref_frame_usage[ALTREF_FRAME];
994997
995998 if (tot_modes)
996− cpi->this_frame_percent_intra = cpi->count_mb_ref_frame_usage[INTRA_FRAME] * 100 / tot_modes;
999+ cpi->this_frame_percent_intra =
1000+ cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME] * 100 / tot_modes;
9971001
9981002 }
9991003
@@ -1318,7 +1322,7 @@ int vp8cx_encode_inter_macroblock · 318 unmodified lines
13181322 vp8_update_zbin_extra(cpi, x);
13191323 }
13201324
1321− cpi->count_mb_ref_frame_usage[xd->mode_info_context->mbmi.ref_frame] ++;
1325+ x->count_mb_ref_frame_usage[xd->mode_info_context->mbmi.ref_frame] ++;
13221326
13231327 if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
13241328 {
vp8/encoder/ethreading.c+2−0
@@ -478,6 +478,8 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi, · 477 unmodified lines
478478 vp8_zero(mb->MVcount);
479479 mb->prediction_error = 0;
480480 mb->intra_error = 0;
481+ vp8_zero(mb->count_mb_ref_frame_usage);
482+
481483 }
482484 }
483485
vp8/encoder/onyx_if.c+16−10
@@ -246,8 +246,8 @@ static void save_layer_context(VP8_COMP *cpi) · 245 unmodified lines
246246 lc->last_frame_percent_intra = cpi->last_frame_percent_intra;
247247
248248 memcpy (lc->count_mb_ref_frame_usage,
249− cpi->count_mb_ref_frame_usage,
250− sizeof(cpi->count_mb_ref_frame_usage));
249+ cpi->mb.count_mb_ref_frame_usage,
250+ sizeof(cpi->mb.count_mb_ref_frame_usage));
251251 }
252252
253253 static void restore_layer_context(VP8_COMP *cpi, const int layer)
@@ -283,9 +283,9 @@ static void restore_layer_context(VP8_COMP *cpi, const int layer) · 29 unmodified lines
283283
284284 cpi->last_frame_percent_intra = lc->last_frame_percent_intra;
285285
286− memcpy (cpi->count_mb_ref_frame_usage,
286+ memcpy (cpi->mb.count_mb_ref_frame_usage,
287287 lc->count_mb_ref_frame_usage,
288− sizeof(cpi->count_mb_ref_frame_usage));
288+ sizeof(cpi->mb.count_mb_ref_frame_usage));
289289 }
290290
291291 static void setup_features(VP8_COMP *cpi)
@@ -2775,10 +2775,14 @@ static void update_golden_frame_stats(VP8_COMP *cpi) · 2483 unmodified lines
27752775
27762776 if (cpi->common.frames_since_golden > 1)
27772777 {
2778− cpi->recent_ref_frame_usage[INTRA_FRAME] += cpi->count_mb_ref_frame_usage[INTRA_FRAME];
2779− cpi->recent_ref_frame_usage[LAST_FRAME] += cpi->count_mb_ref_frame_usage[LAST_FRAME];
2780− cpi->recent_ref_frame_usage[GOLDEN_FRAME] += cpi->count_mb_ref_frame_usage[GOLDEN_FRAME];
2781− cpi->recent_ref_frame_usage[ALTREF_FRAME] += cpi->count_mb_ref_frame_usage[ALTREF_FRAME];
2778+ cpi->recent_ref_frame_usage[INTRA_FRAME] +=
2779+ cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME];
2780+ cpi->recent_ref_frame_usage[LAST_FRAME] +=
2781+ cpi->mb.count_mb_ref_frame_usage[LAST_FRAME];
2782+ cpi->recent_ref_frame_usage[GOLDEN_FRAME] +=
2783+ cpi->mb.count_mb_ref_frame_usage[GOLDEN_FRAME];
2784+ cpi->recent_ref_frame_usage[ALTREF_FRAME] +=
2785+ cpi->mb.count_mb_ref_frame_usage[ALTREF_FRAME];
27822786 }
27832787 }
27842788 }
@@ -2790,7 +2794,7 @@ static void update_rd_ref_frame_probs(VP8_COMP *cpi) · 5 unmodified lines
27902794 {
27912795 VP8_COMMON *cm = &cpi->common;
27922796
2793− const int *const rfct = cpi->count_mb_ref_frame_usage;
2797+ const int *const rfct = cpi->mb.count_mb_ref_frame_usage;
27942798 const int rf_intra = rfct[INTRA_FRAME];
27952799 const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
27962800
@@ -4709,7 +4713,9 @@ static void check_gf_quality(VP8_COMP *cpi) · 1912 unmodified lines
47094713 {
47104714 VP8_COMMON *cm = &cpi->common;
47114715 int gf_active_pct = (100 * cpi->gf_active_count) / (cm->mb_rows * cm->mb_cols);
4712− int gf_ref_usage_pct = (cpi->count_mb_ref_frame_usage[GOLDEN_FRAME] * 100) / (cm->mb_rows * cm->mb_cols);
4716+ int gf_ref_usage_pct =
4717+ (cpi->mb.count_mb_ref_frame_usage[GOLDEN_FRAME] * 100) /
4718+ (cm->mb_rows * cm->mb_cols);
47134719 int last_ref_zz_useage = (cpi->inter_zz_count * 100) / (cm->mb_rows * cm->mb_cols);
47144720
47154721 /* Gf refresh is not currently being signalled */
vp8/encoder/onyx_int.h+0−1
@@ -493,7 +493,6 @@ typedef struct VP8_COMP · 492 unmodified lines
493493 int last_skip_probs_q[3];
494494 int recent_ref_frame_usage[MAX_REF_FRAMES];
495495
496− int count_mb_ref_frame_usage[MAX_REF_FRAMES];
497496 int this_frame_percent_intra;
498497 int last_frame_percent_intra;
499498

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t