History

Merge "cosmetics: Beautify whitespaces and line wrapping"

James Zern committed 10 years ago

Commit b34705f2 parents efad6fe 67611118 files · +102 −93Browse files

Unified · Split

8 files
  1. vp9/encoder/vp9_encodeframe.c +21 −17
  2. vp9/encoder/vp9_encoder.c +8 −3
  3. vp9/encoder/vp9_encoder.h +2 −3
  4. vp9/encoder/vp9_firstpass.c +65 −65
  5. vp9/encoder/vp9_lookahead.c +1 −1
  6. vp9/encoder/vp9_rd.c +1 −0
  7. vp9/encoder/vp9_rdopt.c +2 −1
  8. vp9/encoder/vp9_temporal_filter.c +2 −3
vp9/encoder/vp9_encodeframe.c+21−17
@@ -1327,8 +1327,7 @@ static int set_segment_rdmult(VP9_COMP *const cpi, · 1326 unmodified lines
13271327 VP9_COMMON *const cm = &cpi->common;
13281328 vp9_init_plane_quantizers(cpi, x);
13291329 vpx_clear_system_state();
1330− segment_qindex = vp9_get_qindex(&cm->seg, segment_id,
1331− cm->base_qindex);
1330+ segment_qindex = vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex);
13321331 return vp9_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q);
13331332 }
13341333
@@ -2727,6 +2726,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, · 1392 unmodified lines
27272726 break;
27282727 }
27292728 }
2729+
27302730 if (skip) {
27312731 if (src_diff_var == UINT_MAX) {
27322732 set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize);
@@ -2761,12 +2761,13 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, · 28 unmodified lines
27612761 ctx->mic.interp_filter;
27622762 rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize,
27632763 pc_tree->leaf_split[0], best_rdc.rdcost);
2764+
27642765 if (sum_rdc.rate == INT_MAX)
27652766 sum_rdc.rdcost = INT64_MAX;
27662767 } else {
27672768 for (i = 0; i < 4 && sum_rdc.rdcost < best_rdc.rdcost; ++i) {
2768− const int x_idx = (i & 1) * mi_step;
2769− const int y_idx = (i >> 1) * mi_step;
2769+ const int x_idx = (i & 1) * mi_step;
2770+ const int y_idx = (i >> 1) * mi_step;
27702771
27712772 if (mi_row + y_idx >= cm->mi_rows || mi_col + x_idx >= cm->mi_cols)
27722773 continue;
@@ -2870,6 +2871,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, · 97 unmodified lines
28702871 }
28712872 restore_context(x, mi_row, mi_col, a, l, sa, sl, bsize);
28722873 }
2874+
28732875 // PARTITION_VERT
28742876 if (partition_vert_allowed &&
28752877 (do_rect || vp9_active_v_edge(cpi, mi_col, mi_step))) {
@@ -2952,6 +2954,8 @@ static void encode_rd_sb_row(VP9_COMP *cpi, · 76 unmodified lines
29522954 MACROBLOCK *const x = &td->mb;
29532955 MACROBLOCKD *const xd = &x->e_mbd;
29542956 SPEED_FEATURES *const sf = &cpi->sf;
2957+ const int mi_col_start = tile_info->mi_col_start;
2958+ const int mi_col_end = tile_info->mi_col_end;
29552959 int mi_col;
29562960
29572961 // Initialize the left context for the new SB row
@@ -2959,8 +2963,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, · 1 unmodified line
29592963 memset(xd->left_seg_context, 0, sizeof(xd->left_seg_context));
29602964
29612965 // Code each SB in the row
2962− for (mi_col = tile_info->mi_col_start; mi_col < tile_info->mi_col_end;
2963− mi_col += MI_BLOCK_SIZE) {
2966+ for (mi_col = mi_col_start; mi_col < mi_col_end; mi_col += MI_BLOCK_SIZE) {
29642967 const struct segmentation *const seg = &cm->seg;
29652968 int dummy_rate;
29662969 int64_t dummy_dist;
@@ -3760,6 +3763,8 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, · 793 unmodified lines
37603763 TileInfo *const tile_info = &tile_data->tile_info;
37613764 MACROBLOCK *const x = &td->mb;
37623765 MACROBLOCKD *const xd = &x->e_mbd;
3766+ const int mi_col_start = tile_info->mi_col_start;
3767+ const int mi_col_end = tile_info->mi_col_end;
37633768 int mi_col;
37643769
37653770 // Initialize the left context for the new SB row
@@ -3767,8 +3772,7 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, · 1 unmodified line
37673772 memset(xd->left_seg_context, 0, sizeof(xd->left_seg_context));
37683773
37693774 // Code each SB in the row
3770− for (mi_col = tile_info->mi_col_start; mi_col < tile_info->mi_col_end;
3771− mi_col += MI_BLOCK_SIZE) {
3775+ for (mi_col = mi_col_start; mi_col < mi_col_end; mi_col += MI_BLOCK_SIZE) {
37723776 const struct segmentation *const seg = &cm->seg;
37733777 RD_COST dummy_rdc;
37743778 const int idx_str = cm->mi_stride * mi_row + mi_col;
@@ -3979,8 +3983,7 @@ static int get_skip_encode_frame(const VP9_COMMON *cm, ThreadData *const td) { · 204 unmodified lines
39793983 }
39803984
39813985 return (intra_count << 2) < inter_count &&
3982− cm->frame_type != KEY_FRAME &&
3983− cm->show_frame;
3986+ cm->frame_type != KEY_FRAME && cm->show_frame;
39843987 }
39853988
39863989 void vp9_init_tile_data(VP9_COMP *cpi) {
@@ -4033,14 +4036,15 @@ void vp9_encode_tile(VP9_COMP *cpi, ThreadData *td, · 46 unmodified lines
40334036 &cpi->tile_data[tile_row * tile_cols + tile_col];
40344037 const TileInfo * const tile_info = &this_tile->tile_info;
40354038 TOKENEXTRA *tok = cpi->tile_tok[tile_row][tile_col];
4039+ const int mi_row_start = tile_info->mi_row_start;
4040+ const int mi_row_end = tile_info->mi_row_end;
40364041 int mi_row;
40374042
40384043 // Set up pointers to per thread motion search counters.
40394044 td->mb.m_search_count_ptr = &td->rd_counts.m_search_count;
40404045 td->mb.ex_search_count_ptr = &td->rd_counts.ex_search_count;
40414046
4042− for (mi_row = tile_info->mi_row_start; mi_row < tile_info->mi_row_end;
4043− mi_row += MI_BLOCK_SIZE) {
4047+ for (mi_row = mi_row_start; mi_row < mi_row_end; mi_row += MI_BLOCK_SIZE) {
40444048 if (cpi->sf.use_nonrd_pick_mode)
40454049 encode_nonrd_sb_row(cpi, td, this_tile, mi_row, &tok);
40464050 else
@@ -4167,10 +4171,10 @@ static void encode_frame_internal(VP9_COMP *cpi) { · 120 unmodified lines
41674171 vpx_usec_timer_start(&emr_timer);
41684172
41694173 #if CONFIG_FP_MB_STATS
4170− if (cpi->use_fp_mb_stats) {
4171− input_fpmb_stats(&cpi->twopass.firstpass_mb_stats, cm,
4172− &cpi->twopass.this_frame_mb_stats);
4173− }
4174+ if (cpi->use_fp_mb_stats) {
4175+ input_fpmb_stats(&cpi->twopass.firstpass_mb_stats, cm,
4176+ &cpi->twopass.this_frame_mb_stats);
4177+ }
41744178 #endif
41754179
41764180 // If allowed, encoding tiles in parallel with one thread handling one tile.
@@ -4488,8 +4492,8 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td, · 311 unmodified lines
44884492 } else {
44894493 mi->tx_size = (bsize >= BLOCK_8X8) ? mi->tx_size : TX_4X4;
44904494 }
4491−
44924495 }
4496+
44934497 ++td->counts->tx.tx_totals[mi->tx_size];
44944498 ++td->counts->tx.tx_totals[get_uv_tx_size(mi, &xd->plane[1])];
44954499 if (cm->seg.enabled && cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ)
vp9/encoder/vp9_encoder.c+8−3
@@ -135,11 +135,16 @@ static INLINE void Scale2Ratio(VPX_SCALING mode, int *hr, int *hs) { · 134 unmodified lines
135135 // so memset cannot be used, instead only inactive blocks should be reset.
136136 static void suppress_active_map(VP9_COMP *cpi) {
137137 unsigned char *const seg_map = cpi->segmentation_map;
138− int i;
139− if (cpi->active_map.enabled || cpi->active_map.update)
140− for (i = 0; i < cpi->common.mi_rows * cpi->common.mi_cols; ++i)
138+
139+ if (cpi->active_map.enabled || cpi->active_map.update) {
140+ const int rows = cpi->common.mi_rows;
141+ const int cols = cpi->common.mi_cols;
142+ int i;
143+
144+ for (i = 0; i < rows * cols; ++i)
141145 if (seg_map[i] == AM_SEGMENT_ID_INACTIVE)
142146 seg_map[i] = AM_SEGMENT_ID_ACTIVE;
147+ }
143148 }
144149
145150 static void apply_active_map(VP9_COMP *cpi) {
vp9/encoder/vp9_encoder.h+2−3
@@ -455,7 +455,7 @@ typedef struct VP9_COMP { · 454 unmodified lines
455455 uint8_t *segmentation_map;
456456
457457 // segment threashold for encode breakout
458− int segment_encode_breakout[MAX_SEGMENTS];
458+ int segment_encode_breakout[MAX_SEGMENTS];
459459
460460 CYCLIC_REFRESH *cyclic_refresh;
461461 ActiveMap active_map;
@@ -477,11 +477,10 @@ typedef struct VP9_COMP { · 15 unmodified lines
477477
478478 YV12_BUFFER_CONFIG alt_ref_buffer;
479479
480−
481480 #if CONFIG_INTERNAL_STATS
482481 unsigned int mode_chosen_counts[MAX_MODES];
483482
484− int count;
483+ int count;
485484 uint64_t total_sq_error;
486485 uint64_t total_samples;
487486 ImageStat psnr;
vp9/encoder/vp9_firstpass.c+65−65
@@ -153,85 +153,85 @@ static void output_fpmb_stats(uint8_t *this_frame_mb_stats, VP9_COMMON *cm, · 152 unmodified lines
153153 #endif
154154
155155 static void zero_stats(FIRSTPASS_STATS *section) {
156− section->frame = 0.0;
157− section->weight = 0.0;
158− section->intra_error = 0.0;
159− section->coded_error = 0.0;
160− section->sr_coded_error = 0.0;
161− section->pcnt_inter = 0.0;
162− section->pcnt_motion = 0.0;
163− section->pcnt_second_ref = 0.0;
164− section->pcnt_neutral = 0.0;
165− section->intra_skip_pct = 0.0;
166− section->intra_smooth_pct = 0.0;
156+ section->frame = 0.0;
157+ section->weight = 0.0;
158+ section->intra_error = 0.0;
159+ section->coded_error = 0.0;
160+ section->sr_coded_error = 0.0;
161+ section->pcnt_inter = 0.0;
162+ section->pcnt_motion = 0.0;
163+ section->pcnt_second_ref = 0.0;
164+ section->pcnt_neutral = 0.0;
165+ section->intra_skip_pct = 0.0;
166+ section->intra_smooth_pct = 0.0;
167167 section->inactive_zone_rows = 0.0;
168168 section->inactive_zone_cols = 0.0;
169− section->MVr = 0.0;
170− section->mvr_abs = 0.0;
171− section->MVc = 0.0;
172− section->mvc_abs = 0.0;
173− section->MVrv = 0.0;
174− section->MVcv = 0.0;
175− section->mv_in_out_count = 0.0;
176− section->new_mv_count = 0.0;
177− section->count = 0.0;
178− section->duration = 1.0;
179− section->spatial_layer_id = 0;
169+ section->MVr = 0.0;
170+ section->mvr_abs = 0.0;
171+ section->MVc = 0.0;
172+ section->mvc_abs = 0.0;
173+ section->MVrv = 0.0;
174+ section->MVcv = 0.0;
175+ section->mv_in_out_count = 0.0;
176+ section->new_mv_count = 0.0;
177+ section->count = 0.0;
178+ section->duration = 1.0;
179+ section->spatial_layer_id = 0;
180180 }
181181
182182 static void accumulate_stats(FIRSTPASS_STATS *section,
183183 const FIRSTPASS_STATS *frame) {
184− section->frame += frame->frame;
185− section->weight += frame->weight;
186− section->spatial_layer_id = frame->spatial_layer_id;
187− section->intra_error += frame->intra_error;
188− section->coded_error += frame->coded_error;
189− section->sr_coded_error += frame->sr_coded_error;
190− section->pcnt_inter += frame->pcnt_inter;
191− section->pcnt_motion += frame->pcnt_motion;
192− section->pcnt_second_ref += frame->pcnt_second_ref;
193− section->pcnt_neutral += frame->pcnt_neutral;
194− section->intra_skip_pct += frame->intra_skip_pct;
195− section->intra_smooth_pct += frame->intra_smooth_pct;
184+ section->frame += frame->frame;
185+ section->weight += frame->weight;
186+ section->spatial_layer_id = frame->spatial_layer_id;
187+ section->intra_error += frame->intra_error;
188+ section->coded_error += frame->coded_error;
189+ section->sr_coded_error += frame->sr_coded_error;
190+ section->pcnt_inter += frame->pcnt_inter;
191+ section->pcnt_motion += frame->pcnt_motion;
192+ section->pcnt_second_ref += frame->pcnt_second_ref;
193+ section->pcnt_neutral += frame->pcnt_neutral;
194+ section->intra_skip_pct += frame->intra_skip_pct;
195+ section->intra_smooth_pct += frame->intra_smooth_pct;
196196 section->inactive_zone_rows += frame->inactive_zone_rows;
197197 section->inactive_zone_cols += frame->inactive_zone_cols;
198− section->MVr += frame->MVr;
199− section->mvr_abs += frame->mvr_abs;
200− section->MVc += frame->MVc;
201− section->mvc_abs += frame->mvc_abs;
202− section->MVrv += frame->MVrv;
203− section->MVcv += frame->MVcv;
204− section->mv_in_out_count += frame->mv_in_out_count;
205− section->new_mv_count += frame->new_mv_count;
206− section->count += frame->count;
207− section->duration += frame->duration;
198+ section->MVr += frame->MVr;
199+ section->mvr_abs += frame->mvr_abs;
200+ section->MVc += frame->MVc;
201+ section->mvc_abs += frame->mvc_abs;
202+ section->MVrv += frame->MVrv;
203+ section->MVcv += frame->MVcv;
204+ section->mv_in_out_count += frame->mv_in_out_count;
205+ section->new_mv_count += frame->new_mv_count;
206+ section->count += frame->count;
207+ section->duration += frame->duration;
208208 }
209209
210210 static void subtract_stats(FIRSTPASS_STATS *section,
211211 const FIRSTPASS_STATS *frame) {
212− section->frame -= frame->frame;
213− section->weight -= frame->weight;
214− section->intra_error -= frame->intra_error;
215− section->coded_error -= frame->coded_error;
216− section->sr_coded_error -= frame->sr_coded_error;
217− section->pcnt_inter -= frame->pcnt_inter;
218− section->pcnt_motion -= frame->pcnt_motion;
219− section->pcnt_second_ref -= frame->pcnt_second_ref;
220− section->pcnt_neutral -= frame->pcnt_neutral;
221− section->intra_skip_pct -= frame->intra_skip_pct;
222− section->intra_smooth_pct -= frame->intra_smooth_pct;
212+ section->frame -= frame->frame;
213+ section->weight -= frame->weight;
214+ section->intra_error -= frame->intra_error;
215+ section->coded_error -= frame->coded_error;
216+ section->sr_coded_error -= frame->sr_coded_error;
217+ section->pcnt_inter -= frame->pcnt_inter;
218+ section->pcnt_motion -= frame->pcnt_motion;
219+ section->pcnt_second_ref -= frame->pcnt_second_ref;
220+ section->pcnt_neutral -= frame->pcnt_neutral;
221+ section->intra_skip_pct -= frame->intra_skip_pct;
222+ section->intra_smooth_pct -= frame->intra_smooth_pct;
223223 section->inactive_zone_rows -= frame->inactive_zone_rows;
224224 section->inactive_zone_cols -= frame->inactive_zone_cols;
225− section->MVr -= frame->MVr;
226− section->mvr_abs -= frame->mvr_abs;
227− section->MVc -= frame->MVc;
228− section->mvc_abs -= frame->mvc_abs;
229− section->MVrv -= frame->MVrv;
230− section->MVcv -= frame->MVcv;
231− section->mv_in_out_count -= frame->mv_in_out_count;
232− section->new_mv_count -= frame->new_mv_count;
233− section->count -= frame->count;
234− section->duration -= frame->duration;
225+ section->MVr -= frame->MVr;
226+ section->mvr_abs -= frame->mvr_abs;
227+ section->MVc -= frame->MVc;
228+ section->mvc_abs -= frame->mvc_abs;
229+ section->MVrv -= frame->MVrv;
230+ section->MVcv -= frame->MVcv;
231+ section->mv_in_out_count -= frame->mv_in_out_count;
232+ section->new_mv_count -= frame->new_mv_count;
233+ section->count -= frame->count;
234+ section->duration -= frame->duration;
235235 }
236236
237237 // Calculate an active area of the image that discounts formatting
vp9/encoder/vp9_lookahead.c+1−1
@@ -89,7 +89,7 @@ struct lookahead_ctx *vp9_lookahead_init(unsigned int width, · 88 unmodified lines
8989
9090 #define USE_PARTIAL_COPY 0
9191
92−int vp9_lookahead_push(struct lookahead_ctx *ctx, YV12_BUFFER_CONFIG *src,
92+int vp9_lookahead_push(struct lookahead_ctx *ctx, YV12_BUFFER_CONFIG *src,
9393 int64_t ts_start, int64_t ts_end,
9494 #if CONFIG_VP9_HIGHBITDEPTH
9595 int use_highbitdepth,
vp9/encoder/vp9_rd.c+1−0
@@ -349,6 +349,7 @@ static void model_rd_norm(int xsq_q10, int *r_q10, int *d_q10) { · 348 unmodified lines
349349 38, 28, 21, 16, 12, 10, 8, 6,
350350 5, 3, 2, 1, 1, 1, 0, 0,
351351 };
352+
352353 // Normalized distortion:
353354 // This table models the normalized distortion for a Laplacian source
354355 // with given variance when quantized with a uniform quantizer
vp9/encoder/vp9_rdopt.c+2−1
@@ -3400,9 +3400,10 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, · 3399 unmodified lines
34003400 rate2 += skip_cost0;
34013401 } else {
34023402 // FIXME(rbultje) make this work for splitmv also
3403+ assert(total_sse >= 0);
3404+
34033405 rate2 += skip_cost1;
34043406 distortion2 = total_sse;
3405− assert(total_sse >= 0);
34063407 rate2 -= (rate_y + rate_uv);
34073408 this_skip2 = 1;
34083409 }
vp9/encoder/vp9_temporal_filter.c+2−3
@@ -433,9 +433,8 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi, · 432 unmodified lines
433433 vp9_highbd_temporal_filter_apply_c(f->u_buffer + mb_uv_offset,
434434 f->uv_stride, predictor + 256,
435435 mb_uv_width, mb_uv_height,
436− adj_strength,
437− filter_weight, accumulator + 256,
438− count + 256);
436+ adj_strength, filter_weight,
437+ accumulator + 256, count + 256);
439438 vp9_highbd_temporal_filter_apply_c(f->v_buffer + mb_uv_offset,
440439 f->uv_stride, predictor + 512,
441440 mb_uv_width, mb_uv_height,

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