summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_encodeframe.c73
-rw-r--r--vp9/encoder/vp9_encoder.c2
-rw-r--r--vp9/encoder/vp9_encoder.h1
-rw-r--r--vp9/encoder/vp9_firstpass.c12
-rw-r--r--vp9/encoder/vp9_firstpass.h1
-rw-r--r--vp9/encoder/vp9_ratectrl.c4
-rw-r--r--vp9/encoder/vp9_speed_features.c2
-rw-r--r--vp9/encoder/vp9_speed_features.h3
8 files changed, 44 insertions, 54 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 3c734eadd..84c00497a 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -547,22 +547,6 @@ static void choose_partitioning(VP9_COMP *cpi,
}
}
-// Original activity measure from Tim T's code.
-static unsigned int tt_activity_measure(MACROBLOCK *x) {
- unsigned int sse;
- // TODO: This could also be done over smaller areas (8x8), but that would
- // require extensive changes elsewhere, as lambda is assumed to be fixed
- // over an entire MB in most of the code.
- // Another option is to compute four 8x8 variances, and pick a single
- // lambda using a non-linear combination (e.g., the smallest, or second
- // smallest, etc.).
- const unsigned int act = vp9_variance16x16(x->plane[0].src.buf,
- x->plane[0].src.stride,
- VP9_VAR_OFFS, 0, &sse) << 4;
- // If the region is flat, lower the activity some more.
- return act < (8 << 12) ? MIN(act, 5 << 12) : act;
-}
-
static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
int mi_row, int mi_col, BLOCK_SIZE bsize,
int output_enabled) {
@@ -2418,6 +2402,8 @@ static TX_MODE select_tx_mode(const VP9_COMP *cpi) {
return rd_opt->tx_select_threshes[frame_type][ALLOW_32X32] >
rd_opt->tx_select_threshes[frame_type][TX_MODE_SELECT] ?
ALLOW_32X32 : TX_MODE_SELECT;
+ } else if (cpi->sf.tx_size_search_method == USE_TX_8X8) {
+ return ALLOW_8X8;
} else {
unsigned int total = 0;
int i;
@@ -2965,6 +2951,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;
@@ -3050,33 +3063,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;
diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c
index b7f839747..729fa481b 100644
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -269,6 +269,8 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
sf->partition_search_type = SOURCE_VAR_BASED_PARTITION;
sf->search_type_check_frequency = 50;
sf->source_var_thresh = 360;
+
+ sf->tx_size_search_method = USE_TX_8X8;
}
if (speed >= 7) {
diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h
index 3e7cd27d8..09180950d 100644
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -58,7 +58,8 @@ typedef enum {
USE_FULL_RD = 0,
USE_LARGESTINTRA,
USE_LARGESTINTRA_MODELINTER,
- USE_LARGESTALL
+ USE_LARGESTALL,
+ USE_TX_8X8
} TX_SIZE_SEARCH_METHOD;
typedef enum {