Commit 4d1424fa authored by Marco's avatar Marco
Browse files

For 1 pass: always use the normative filter in vp9_scale_if_required()

The normative (convolve8) filter is optimized/faster than
the nonnormative one. Pass usage of scaler (normative/nonomorative)
to vp9_scale_if_required(), and always use normative one for 1 pass.

Change-Id: I2b71d9ff18b3c7499b058d1325a9554de993dd52
parent fe776ce6
...@@ -3200,7 +3200,8 @@ static void encode_without_recode_loop(VP9_COMP *cpi, ...@@ -3200,7 +3200,8 @@ static void encode_without_recode_loop(VP9_COMP *cpi,
cpi->Source = vp9_scale_if_required(cm, cpi->Source = vp9_scale_if_required(cm,
cpi->un_scaled_source, cpi->un_scaled_source,
&cpi->scaled_source); &cpi->scaled_source,
(cpi->oxcf.pass == 0));
// Avoid scaling last_source unless its needed. // Avoid scaling last_source unless its needed.
// Last source is currently only used for screen-content mode, // Last source is currently only used for screen-content mode,
...@@ -3210,7 +3211,8 @@ static void encode_without_recode_loop(VP9_COMP *cpi, ...@@ -3210,7 +3211,8 @@ static void encode_without_recode_loop(VP9_COMP *cpi,
cpi->sf.partition_search_type == SOURCE_VAR_BASED_PARTITION)) cpi->sf.partition_search_type == SOURCE_VAR_BASED_PARTITION))
cpi->Last_Source = vp9_scale_if_required(cm, cpi->Last_Source = vp9_scale_if_required(cm,
cpi->unscaled_last_source, cpi->unscaled_last_source,
&cpi->scaled_last_source); &cpi->scaled_last_source,
(cpi->oxcf.pass == 0));
if (cpi->oxcf.pass == 0 && if (cpi->oxcf.pass == 0 &&
cpi->oxcf.rc_mode == VPX_CBR && cpi->oxcf.rc_mode == VPX_CBR &&
...@@ -3342,11 +3344,13 @@ static void encode_with_recode_loop(VP9_COMP *cpi, ...@@ -3342,11 +3344,13 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
} }
cpi->Source = vp9_scale_if_required(cm, cpi->un_scaled_source, cpi->Source = vp9_scale_if_required(cm, cpi->un_scaled_source,
&cpi->scaled_source); &cpi->scaled_source,
(cpi->oxcf.pass == 0));
if (cpi->unscaled_last_source != NULL) if (cpi->unscaled_last_source != NULL)
cpi->Last_Source = vp9_scale_if_required(cm, cpi->unscaled_last_source, cpi->Last_Source = vp9_scale_if_required(cm, cpi->unscaled_last_source,
&cpi->scaled_last_source); &cpi->scaled_last_source,
(cpi->oxcf.pass == 0));
if (frame_is_intra_only(cm) == 0) { if (frame_is_intra_only(cm) == 0) {
if (loop_count > 0) { if (loop_count > 0) {
...@@ -3597,20 +3601,17 @@ static void set_ext_overrides(VP9_COMP *cpi) { ...@@ -3597,20 +3601,17 @@ static void set_ext_overrides(VP9_COMP *cpi) {
YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm, YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm,
YV12_BUFFER_CONFIG *unscaled, YV12_BUFFER_CONFIG *unscaled,
YV12_BUFFER_CONFIG *scaled) { YV12_BUFFER_CONFIG *scaled,
int use_normative_scaler) {
if (cm->mi_cols * MI_SIZE != unscaled->y_width || if (cm->mi_cols * MI_SIZE != unscaled->y_width ||
cm->mi_rows * MI_SIZE != unscaled->y_height) { cm->mi_rows * MI_SIZE != unscaled->y_height) {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (unscaled->y_width == (scaled->y_width << 1) && if (use_normative_scaler)
unscaled->y_height == (scaled->y_height << 1))
scale_and_extend_frame(unscaled, scaled, (int)cm->bit_depth); scale_and_extend_frame(unscaled, scaled, (int)cm->bit_depth);
else else
scale_and_extend_frame_nonnormative(unscaled, scaled, (int)cm->bit_depth); scale_and_extend_frame_nonnormative(unscaled, scaled, (int)cm->bit_depth);
#else #else
// Use the faster normative (convolve8) scaling filter: for now only for if (use_normative_scaler)
// scaling factor of 2.
if (unscaled->y_width == (scaled->y_width << 1) &&
unscaled->y_height == (scaled->y_height << 1))
scale_and_extend_frame(unscaled, scaled); scale_and_extend_frame(unscaled, scaled);
else else
scale_and_extend_frame_nonnormative(unscaled, scaled); scale_and_extend_frame_nonnormative(unscaled, scaled);
......
...@@ -613,7 +613,8 @@ void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv); ...@@ -613,7 +613,8 @@ void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv);
YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm, YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm,
YV12_BUFFER_CONFIG *unscaled, YV12_BUFFER_CONFIG *unscaled,
YV12_BUFFER_CONFIG *scaled); YV12_BUFFER_CONFIG *scaled,
int use_normative_scaler);
void vp9_apply_encoding_flags(VP9_COMP *cpi, vpx_enc_frame_flags_t flags); void vp9_apply_encoding_flags(VP9_COMP *cpi, vpx_enc_frame_flags_t flags);
......
...@@ -597,7 +597,7 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) { ...@@ -597,7 +597,7 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
(cpi->ref_frame_flags & VP9_GOLD_FLAG) ? GOLDEN_FRAME : NONE); (cpi->ref_frame_flags & VP9_GOLD_FLAG) ? GOLDEN_FRAME : NONE);
cpi->Source = vp9_scale_if_required(cm, cpi->un_scaled_source, cpi->Source = vp9_scale_if_required(cm, cpi->un_scaled_source,
&cpi->scaled_source); &cpi->scaled_source, 0);
} }
vp9_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y); vp9_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
......
...@@ -721,7 +721,7 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) { ...@@ -721,7 +721,7 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
"Failed to reallocate alt_ref_buffer"); "Failed to reallocate alt_ref_buffer");
} }
frames[frame] = vp9_scale_if_required( frames[frame] = vp9_scale_if_required(
cm, frames[frame], &cpi->svc.scaled_frames[frame_used]); cm, frames[frame], &cpi->svc.scaled_frames[frame_used], 0);
++frame_used; ++frame_used;
} }
} }
......
Supports Markdown
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