diff options
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 55 | ||||
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_encoder.h | 1 | ||||
-rw-r--r-- | vp9/encoder/vp9_firstpass.c | 12 | ||||
-rw-r--r-- | vp9/encoder/vp9_firstpass.h | 1 | ||||
-rw-r--r-- | vp9/encoder/vp9_ratectrl.c | 4 |
6 files changed, 38 insertions, 37 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 48423dfe7..ddb836e0e 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -2961,6 +2961,33 @@ static int get_skip_encode_frame(const VP9_COMMON *cm) { cm->show_frame; } +static void encode_tiles(VP9_COMP *cpi) { + const VP9_COMMON *const cm = &cpi->common; + const int tile_cols = 1 << cm->log2_tile_cols; + const int tile_rows = 1 << cm->log2_tile_rows; + int tile_col, tile_row; + TOKENEXTRA *tok = cpi->tok; + + for (tile_row = 0; tile_row < tile_rows; ++tile_row) { + for (tile_col = 0; tile_col < tile_cols; ++tile_col) { + TileInfo tile; + TOKENEXTRA *old_tok = tok; + int mi_row; + + vp9_tile_init(&tile, cm, tile_row, tile_col); + for (mi_row = tile.mi_row_start; mi_row < tile.mi_row_end; + mi_row += MI_BLOCK_SIZE) { + if (cpi->sf.use_nonrd_pick_mode && cm->frame_type != KEY_FRAME) + encode_nonrd_sb_row(cpi, &tile, mi_row, &tok); + else + encode_rd_sb_row(cpi, &tile, mi_row, &tok); + } + cpi->tok_count[tile_row][tile_col] = (unsigned int)(tok - old_tok); + assert(tok - cpi->tok <= get_token_alloc(cm->mb_rows, cm->mb_cols)); + } + } +} + static void encode_frame_internal(VP9_COMP *cpi) { SPEED_FEATURES *const sf = &cpi->sf; RD_OPT *const rd_opt = &cpi->rd; @@ -3046,33 +3073,7 @@ static void encode_frame_internal(VP9_COMP *cpi) { struct vpx_usec_timer emr_timer; vpx_usec_timer_start(&emr_timer); - { - // Take tiles into account and give start/end MB - int tile_col, tile_row; - TOKENEXTRA *tp = cpi->tok; - const int tile_cols = 1 << cm->log2_tile_cols; - const int tile_rows = 1 << cm->log2_tile_rows; - - for (tile_row = 0; tile_row < tile_rows; tile_row++) { - for (tile_col = 0; tile_col < tile_cols; tile_col++) { - TileInfo tile; - TOKENEXTRA *tp_old = tp; - int mi_row; - - // For each row of SBs in the frame - vp9_tile_init(&tile, cm, tile_row, tile_col); - for (mi_row = tile.mi_row_start; - mi_row < tile.mi_row_end; mi_row += MI_BLOCK_SIZE) { - if (sf->use_nonrd_pick_mode && cm->frame_type != KEY_FRAME) - encode_nonrd_sb_row(cpi, &tile, mi_row, &tp); - else - encode_rd_sb_row(cpi, &tile, mi_row, &tp); - } - cpi->tok_count[tile_row][tile_col] = (unsigned int)(tp - tp_old); - assert(tp - cpi->tok <= get_token_alloc(cm->mb_rows, cm->mb_cols)); - } - } - } + encode_tiles(cpi); vpx_usec_timer_mark(&emr_timer); cpi->time_encode_sb_row += vpx_usec_timer_elapsed(&emr_timer); diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 0ebc93638..6c0e0b58d 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -1653,7 +1653,7 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) { (cpi->rc.projected_frame_size - cpi->rc.this_frame_target), cpi->rc.vbr_bits_off_target, cpi->rc.total_target_vs_actual, - (cpi->oxcf.starting_buffer_level - cpi->rc.bits_off_target), + (cpi->rc.starting_buffer_level - cpi->rc.bits_off_target), cpi->rc.total_actual_bits, cm->base_qindex, vp9_convert_qindex_to_q(cm->base_qindex), (double)vp9_dc_quant(cm->base_qindex, 0) / 4.0, diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index 1ba763414..c69a345d0 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -256,7 +256,6 @@ typedef struct VP9EncoderConfig { // these parameters aren't to be used in final build don't use!!! int play_alternate; - int alt_freq; int encode_breakout; // early breakout : for video conf recommend 800 diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index dc3832b16..a49fe3df5 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -460,7 +460,6 @@ void vp9_first_pass(VP9_COMP *cpi) { TWO_PASS *twopass = &cpi->twopass; const MV zero_mv = {0, 0}; const YV12_BUFFER_CONFIG *first_ref_buf = lst_yv12; - FIRSTPASS_STATS fps; vp9_clear_system_state(); @@ -758,6 +757,8 @@ void vp9_first_pass(VP9_COMP *cpi) { vp9_clear_system_state(); { + FIRSTPASS_STATS fps; + fps.frame = cm->current_video_frame; fps.spatial_layer_id = cpi->svc.spatial_layer_id; fps.intra_error = (double)(intra_error >> 8); @@ -796,7 +797,8 @@ void vp9_first_pass(VP9_COMP *cpi) { fps.duration = (double)(cpi->source->ts_end - cpi->source->ts_start); // Don't want to do output stats with a stack variable! - output_stats(&fps, cpi->output_pkt_list); + twopass->this_frame_stats = fps; + output_stats(&twopass->this_frame_stats, cpi->output_pkt_list); accumulate_stats(&twopass->total_stats, &fps); } @@ -804,9 +806,9 @@ void vp9_first_pass(VP9_COMP *cpi) { // the prediction is good enough... but also don't allow it to lag too far. if ((twopass->sr_update_lag > 3) || ((cm->current_video_frame > 0) && - (fps.pcnt_inter > 0.20) && - ((fps.intra_error / - DOUBLE_DIVIDE_CHECK(fps.coded_error)) > 2.0))) { + (twopass->this_frame_stats.pcnt_inter > 0.20) && + ((twopass->this_frame_stats.intra_error / + DOUBLE_DIVIDE_CHECK(twopass->this_frame_stats.coded_error)) > 2.0))) { if (gld_yv12 != NULL) { vp8_yv12_copy_frame(lst_yv12, gld_yv12); } diff --git a/vp9/encoder/vp9_firstpass.h b/vp9/encoder/vp9_firstpass.h index c89cfaf8d..309638c1e 100644 --- a/vp9/encoder/vp9_firstpass.h +++ b/vp9/encoder/vp9_firstpass.h @@ -44,6 +44,7 @@ typedef struct { unsigned int section_intra_rating; unsigned int next_iiratio; FIRSTPASS_STATS total_stats; + FIRSTPASS_STATS this_frame_stats; const FIRSTPASS_STATS *stats_in; const FIRSTPASS_STATS *stats_in_start; const FIRSTPASS_STATS *stats_in_end; diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 0163fd1e8..e8e425661 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -428,7 +428,6 @@ static int calc_active_worst_quality_one_pass_vbr(const VP9_COMP *cpi) { : rc->last_q[INTER_FRAME] * 2; } } - return MIN(active_worst_quality, rc->worst_quality); } @@ -639,7 +638,7 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi, int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q, last_boosted_q * 0.75); active_best_quality = MAX(qindex + delta_qindex, rc->best_quality); - } else if (cm->current_video_frame > 0) { + } else { // not first frame of one pass and kf_boost is set double q_adj_factor = 1.0; double q_val; @@ -982,7 +981,6 @@ int vp9_rc_pick_q_and_bounds(const VP9_COMP *cpi, } else { q = rc_pick_q_and_bounds_two_pass(cpi, bottom_index, top_index); } - if (cpi->sf.use_nonrd_pick_mode) { if (cpi->sf.force_frame_boost == 1) q -= cpi->sf.max_delta_qindex; |