summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_bitstream.c1
-rw-r--r--vp9/encoder/vp9_encodeframe.c41
-rw-r--r--vp9/encoder/vp9_encoder.c3
-rw-r--r--vp9/encoder/vp9_firstpass.c288
-rw-r--r--vp9/encoder/vp9_firstpass.h15
-rw-r--r--vp9/encoder/vp9_mbgraph.c11
-rw-r--r--vp9/encoder/vp9_mcomp.c64
-rw-r--r--vp9/encoder/vp9_pickmode.c5
-rw-r--r--vp9/encoder/vp9_ratectrl.c19
-rw-r--r--vp9/encoder/vp9_rdopt.c12
-rw-r--r--vp9/encoder/vp9_rdopt.h7
-rw-r--r--vp9/encoder/vp9_sad.c12
-rw-r--r--vp9/encoder/vp9_speed_features.c27
-rw-r--r--vp9/encoder/vp9_speed_features.h9
-rw-r--r--vp9/encoder/vp9_svc_layercontext.c11
-rw-r--r--vp9/encoder/vp9_variance.c13
-rw-r--r--vp9/encoder/vp9_variance.h6
-rw-r--r--vp9/encoder/x86/vp9_dct_ssse3_x86_64.asm (renamed from vp9/encoder/x86/vp9_dct_ssse3.asm)0
-rw-r--r--vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm (renamed from vp9/encoder/x86/vp9_quantize_ssse3.asm)0
-rw-r--r--vp9/encoder/x86/vp9_ssim_opt_x86_64.asm (renamed from vp9/encoder/x86/vp9_ssim_opt.asm)0
-rw-r--r--vp9/encoder/x86/vp9_variance_avx2.c1
-rw-r--r--vp9/encoder/x86/vp9_variance_mmx.c1
-rw-r--r--vp9/encoder/x86/vp9_variance_sse2.c1
23 files changed, 288 insertions, 259 deletions
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 8ef2b2eed..76f5e7bbe 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -20,7 +20,6 @@
#include "vp9/common/vp9_entropymode.h"
#include "vp9/common/vp9_entropymv.h"
#include "vp9/common/vp9_mvref_common.h"
-#include "vp9/common/vp9_pragmas.h"
#include "vp9/common/vp9_pred_common.h"
#include "vp9/common/vp9_seg_common.h"
#include "vp9/common/vp9_systemdependent.h"
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index ef33fcaf1..6cbc38d79 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -76,18 +76,6 @@ typedef struct {
unsigned int var;
} diff;
-static void get_sse_sum_8x8(const uint8_t *src, int src_stride,
- const uint8_t *ref, int ref_stride,
- unsigned int *sse, int *sum) {
- variance(src, src_stride, ref, ref_stride, 8, 8, sse, sum);
-}
-
-static void get_sse_sum_16x16(const uint8_t *src, int src_stride,
- const uint8_t *ref, int ref_stride,
- unsigned int *sse, int *sum) {
- variance(src, src_stride, ref, ref_stride, 16, 16, sse, sum);
-}
-
static unsigned int get_sby_perpixel_variance(VP9_COMP *cpi,
const struct buf_2d *ref,
BLOCK_SIZE bs) {
@@ -490,8 +478,8 @@ static void choose_partitioning(VP9_COMP *cpi,
unsigned int sse = 0;
int sum = 0;
if (x_idx < pixels_wide && y_idx < pixels_high)
- get_sse_sum_8x8(s + y_idx * sp + x_idx, sp,
- d + y_idx * dp + x_idx, dp, &sse, &sum);
+ vp9_get_sse_sum_8x8(s + y_idx * sp + x_idx, sp,
+ d + y_idx * dp + x_idx, dp, &sse, &sum);
fill_variance(sse, sum, 64, &vst->split[k].part_variances.none);
}
}
@@ -1226,9 +1214,9 @@ static void set_source_var_based_partition(VP9_COMP *cpi,
int b_offset = b_mi_row * MI_SIZE * src_stride +
b_mi_col * MI_SIZE;
- get_sse_sum_16x16(src + b_offset, src_stride,
- pre_src + b_offset, pre_stride,
- &d16[j].sse, &d16[j].sum);
+ vp9_get_sse_sum_16x16(src + b_offset, src_stride,
+ pre_src + b_offset, pre_stride,
+ &d16[j].sse, &d16[j].sum);
d16[j].var = d16[j].sse -
(((uint32_t)d16[j].sum * d16[j].sum) >> 8);
@@ -1303,14 +1291,14 @@ static int is_background(VP9_COMP *cpi, const TileInfo *const tile,
if (row8x8_remaining >= MI_BLOCK_SIZE &&
col8x8_remaining >= MI_BLOCK_SIZE) {
this_sad = cpi->fn_ptr[BLOCK_64X64].sdf(src, src_stride,
- pre, pre_stride, 0x7fffffff);
+ pre, pre_stride);
threshold = (1 << 12);
} else {
int r, c;
for (r = 0; r < row8x8_remaining; r += 2)
for (c = 0; c < col8x8_remaining; c += 2)
- this_sad += cpi->fn_ptr[BLOCK_16X16].sdf(src, src_stride, pre,
- pre_stride, 0x7fffffff);
+ this_sad += cpi->fn_ptr[BLOCK_16X16].sdf(src, src_stride,
+ pre, pre_stride);
threshold = (row8x8_remaining * col8x8_remaining) << 6;
}
@@ -1318,7 +1306,8 @@ static int is_background(VP9_COMP *cpi, const TileInfo *const tile,
return x->in_static_area;
}
-static int sb_has_motion(const VP9_COMMON *cm, MODE_INFO **prev_mi_8x8) {
+static int sb_has_motion(const VP9_COMMON *cm, MODE_INFO **prev_mi_8x8,
+ const int motion_thresh) {
const int mis = cm->mi_stride;
int block_row, block_col;
@@ -1327,8 +1316,8 @@ static int sb_has_motion(const VP9_COMMON *cm, MODE_INFO **prev_mi_8x8) {
for (block_col = 0; block_col < 8; ++block_col) {
const MODE_INFO *prev_mi = prev_mi_8x8[block_row * mis + block_col];
if (prev_mi) {
- if (abs(prev_mi->mbmi.mv[0].as_mv.row) >= 8 ||
- abs(prev_mi->mbmi.mv[0].as_mv.col) >= 8)
+ if (abs(prev_mi->mbmi.mv[0].as_mv.row) > motion_thresh ||
+ abs(prev_mi->mbmi.mv[0].as_mv.col) > motion_thresh)
return 1;
}
}
@@ -2324,7 +2313,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
|| cpi->rc.is_src_frame_alt_ref
|| ((sf->use_lastframe_partitioning ==
LAST_FRAME_PARTITION_LOW_MOTION) &&
- sb_has_motion(cm, prev_mi))) {
+ sb_has_motion(cm, prev_mi, sf->lf_motion_threshold))) {
// If required set upper and lower partition size limits
if (sf->auto_min_max_partition_size) {
set_offsets(cpi, tile, mi_row, mi_col, BLOCK_64X64);
@@ -2337,7 +2326,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
cpi->pc_root);
} else {
if (sf->constrain_copy_partition &&
- sb_has_motion(cm, prev_mi))
+ sb_has_motion(cm, prev_mi, sf->lf_motion_threshold))
constrain_copy_partitioning(cpi, tile, mi, prev_mi,
mi_row, mi_col, BLOCK_16X16);
else
@@ -2869,7 +2858,7 @@ static void nonrd_use_partition(VP9_COMP *cpi,
if (mi_row + hbs < cm->mi_rows) {
nonrd_pick_sb_modes(cpi, tile, mi_row + hbs, mi_col,
&rate, &dist, subsize);
- pc_tree->horizontal[1].mic.mbmi = mi[0]->mbmi;
+ pc_tree->horizontal[1].mic.mbmi = xd->mi[0]->mbmi;
if (rate != INT_MAX && dist != INT64_MAX &&
*totrate != INT_MAX && *totdist != INT64_MAX) {
*totrate += rate;
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 1f68f03c4..03bf4b0b6 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -632,9 +632,6 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
cpi->oxcf.maximum_buffer_size = 240000;
}
- // Convert target bandwidth from Kbit/s to Bit/s
- cpi->oxcf.target_bandwidth *= 1000;
-
cpi->oxcf.starting_buffer_level =
vp9_rescale(cpi->oxcf.starting_buffer_level,
cpi->oxcf.target_bandwidth, 1000);
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 9929ae101..0b9a5ac7a 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -64,8 +64,7 @@
#define MIN_GF_INTERVAL 4
#endif
-
-// #define LONG_TERM_VBR_CORRECTION
+#define LONG_TERM_VBR_CORRECTION
static void swap_yv12(YV12_BUFFER_CONFIG *a, YV12_BUFFER_CONFIG *b) {
YV12_BUFFER_CONFIG temp = *a;
@@ -259,25 +258,14 @@ static void avg_stats(FIRSTPASS_STATS *section) {
// Calculate a modified Error used in distributing bits between easier and
// harder frames.
-static double calculate_modified_err(const VP9_COMP *cpi,
+static double calculate_modified_err(const TWO_PASS *twopass,
+ const VP9EncoderConfig *oxcf,
const FIRSTPASS_STATS *this_frame) {
- const TWO_PASS *twopass = &cpi->twopass;
- const SVC *const svc = &cpi->svc;
- const FIRSTPASS_STATS *stats;
- double av_err;
- double modified_error;
-
- if (svc->number_spatial_layers > 1 &&
- svc->number_temporal_layers == 1) {
- twopass = &svc->layer_context[svc->spatial_layer_id].twopass;
- }
-
- stats = &twopass->total_stats;
- av_err = stats->ssim_weighted_pred_err / stats->count;
- modified_error = av_err * pow(this_frame->ssim_weighted_pred_err /
- DOUBLE_DIVIDE_CHECK(av_err),
- cpi->oxcf.two_pass_vbrbias / 100.0);
-
+ const FIRSTPASS_STATS *const stats = &twopass->total_stats;
+ const double av_err = stats->ssim_weighted_pred_err / stats->count;
+ const double modified_error = av_err *
+ pow(this_frame->ssim_weighted_pred_err / DOUBLE_DIVIDE_CHECK(av_err),
+ oxcf->two_pass_vbrbias / 100.0);
return fclamp(modified_error,
twopass->modified_error_min, twopass->modified_error_max);
}
@@ -1014,25 +1002,19 @@ void vp9_init_second_pass(VP9_COMP *cpi) {
// Scan the first pass file and calculate a modified total error based upon
// the bias/power function used to allocate bits.
{
- const FIRSTPASS_STATS *const start_pos = twopass->stats_in;
- FIRSTPASS_STATS this_frame;
- const double av_error = stats->ssim_weighted_pred_err /
- DOUBLE_DIVIDE_CHECK(stats->count);
-
-
- twopass->modified_error_total = 0.0;
- twopass->modified_error_min =
- (av_error * oxcf->two_pass_vbrmin_section) / 100;
- twopass->modified_error_max =
- (av_error * oxcf->two_pass_vbrmax_section) / 100;
-
- while (input_stats(twopass, &this_frame) != EOF) {
- twopass->modified_error_total +=
- calculate_modified_err(cpi, &this_frame);
+ const double avg_error = stats->ssim_weighted_pred_err /
+ DOUBLE_DIVIDE_CHECK(stats->count);
+ const FIRSTPASS_STATS *s = twopass->stats_in;
+ double modified_error_total = 0.0;
+ twopass->modified_error_min = (avg_error *
+ oxcf->two_pass_vbrmin_section) / 100;
+ twopass->modified_error_max = (avg_error *
+ oxcf->two_pass_vbrmax_section) / 100;
+ while (s < twopass->stats_in_end) {
+ modified_error_total += calculate_modified_err(twopass, oxcf, s);
+ ++s;
}
- twopass->modified_error_left = twopass->modified_error_total;
-
- reset_fpf_position(twopass, start_pos);
+ twopass->modified_error_left = modified_error_total;
}
// Reset the vbr bits off target counter
@@ -1153,16 +1135,17 @@ static void accumulate_frame_motion_stats(
}
// Calculate a baseline boost number for the current frame.
-static double calc_frame_boost(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame,
+static double calc_frame_boost(const TWO_PASS *twopass,
+ const FIRSTPASS_STATS *this_frame,
double this_frame_mv_in_out) {
double frame_boost;
// Underlying boost factor is based on inter intra error ratio.
- if (this_frame->intra_error > cpi->twopass.gf_intra_err_min)
+ if (this_frame->intra_error > twopass->gf_intra_err_min)
frame_boost = (IIFACTOR * this_frame->intra_error /
DOUBLE_DIVIDE_CHECK(this_frame->coded_error));
else
- frame_boost = (IIFACTOR * cpi->twopass.gf_intra_err_min /
+ frame_boost = (IIFACTOR * twopass->gf_intra_err_min /
DOUBLE_DIVIDE_CHECK(this_frame->coded_error));
// Increase boost for frames where new data coming into frame (e.g. zoom out).
@@ -1215,8 +1198,8 @@ static int calc_arf_boost(VP9_COMP *cpi, int offset,
? MIN_DECAY_FACTOR : decay_accumulator;
}
- boost_score += (decay_accumulator *
- calc_frame_boost(cpi, &this_frame, this_frame_mv_in_out));
+ boost_score += decay_accumulator * calc_frame_boost(twopass, &this_frame,
+ this_frame_mv_in_out);
}
*f_boost = (int)boost_score;
@@ -1252,8 +1235,8 @@ static int calc_arf_boost(VP9_COMP *cpi, int offset,
? MIN_DECAY_FACTOR : decay_accumulator;
}
- boost_score += (decay_accumulator *
- calc_frame_boost(cpi, &this_frame, this_frame_mv_in_out));
+ boost_score += decay_accumulator * calc_frame_boost(twopass, &this_frame,
+ this_frame_mv_in_out);
}
*b_boost = (int)boost_score;
@@ -1471,6 +1454,66 @@ static int calculate_boost_bits(int frame_count,
return MAX((int)(((int64_t)boost * total_group_bits) / allocation_chunks), 0);
}
+static void allocate_gf_group_bits(VP9_COMP *cpi, int64_t gf_group_bits,
+ double group_error, int gf_arf_bits) {
+ RATE_CONTROL *const rc = &cpi->rc;
+ const VP9EncoderConfig *const oxcf = &cpi->oxcf;
+ TWO_PASS *twopass = &cpi->twopass;
+ FIRSTPASS_STATS frame_stats;
+ int i;
+ int group_frame_index = 1;
+ int target_frame_size;
+ int key_frame;
+ const int max_bits = frame_max_bits(&cpi->rc, &cpi->oxcf);
+ int64_t total_group_bits = gf_group_bits;
+ double modified_err = 0.0;
+ double err_fraction;
+
+ key_frame = cpi->common.frame_type == KEY_FRAME ||
+ vp9_is_upper_layer_key_frame(cpi);
+
+ // For key frames the frame target rate is already set and it
+ // is also the golden frame.
+ // NOTE: We dont bother to check for the special case of ARF overlay
+ // frames here, as there is clamping code for this in the function
+ // vp9_rc_clamp_pframe_target_size(), which applies to one and two pass
+ // encodes.
+ if (!key_frame) {
+ twopass->gf_group_bit_allocation[0] = gf_arf_bits;
+
+ // Step over the golden frame / overlay frame
+ if (EOF == input_stats(twopass, &frame_stats))
+ return;
+ }
+
+ // Store the bits to spend on the ARF if there is one.
+ if (rc->source_alt_ref_pending) {
+ twopass->gf_group_bit_allocation[group_frame_index++] = gf_arf_bits;
+ }
+
+ // Deduct the boost bits for arf or gf if it is not a key frame.
+ if (rc->source_alt_ref_pending || !key_frame)
+ total_group_bits -= gf_arf_bits;
+
+ // Allocate bits to the other frames in the group.
+ for (i = 0; i < rc->baseline_gf_interval - 1; ++i) {
+ if (EOF == input_stats(twopass, &frame_stats))
+ break;
+
+ modified_err = calculate_modified_err(twopass, oxcf, &frame_stats);
+
+ if (group_error > 0)
+ err_fraction = modified_err / DOUBLE_DIVIDE_CHECK(group_error);
+ else
+ err_fraction = 0.0;
+
+ target_frame_size = (int)((double)total_group_bits * err_fraction);
+ target_frame_size = clamp(target_frame_size, 0,
+ MIN(max_bits, (int)total_group_bits));
+
+ twopass->gf_group_bit_allocation[group_frame_index++] = target_frame_size;
+ }
+}
// Analyse and define a gf/arf group.
static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
@@ -1503,14 +1546,24 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
int b_boost = 0;
int flash_detected;
int active_max_gf_interval;
+ int64_t gf_group_bits;
+ double gf_group_error_left;
+ int gf_arf_bits;
+
+ // Reset the GF group data structures unless this is a key
+ // frame in which case it will already have been done.
+ if (cpi->common.frame_type != KEY_FRAME) {
+ twopass->gf_group_index = 0;
+ vp9_zero(twopass->gf_group_bit_allocation);
+ }
vp9_clear_system_state();
vp9_zero(next_frame);
- twopass->gf_group_bits = 0;
+ gf_group_bits = 0;
// Load stats for the current frame.
- mod_frame_err = calculate_modified_err(cpi, this_frame);
+ mod_frame_err = calculate_modified_err(twopass, oxcf, this_frame);
// Note the error of the frame at the start of the group. This will be
// the GF frame error if we code a normal gf.
@@ -1542,7 +1595,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
++i;
// Accumulate error score of frames in this gf group.
- mod_frame_err = calculate_modified_err(cpi, this_frame);
+ mod_frame_err = calculate_modified_err(twopass, oxcf, this_frame);
gf_group_err += mod_frame_err;
if (EOF == input_stats(twopass, &next_frame))
@@ -1581,8 +1634,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
}
// Calculate a boost number for this frame.
- boost_score += (decay_accumulator *
- calc_frame_boost(cpi, &next_frame, this_frame_mv_in_out));
+ boost_score += decay_accumulator * calc_frame_boost(twopass, &next_frame,
+ this_frame_mv_in_out);
// Break out conditions.
if (
@@ -1617,7 +1670,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
break;
if (i < rc->frames_to_key) {
- mod_frame_err = calculate_modified_err(cpi, this_frame);
+ mod_frame_err = calculate_modified_err(twopass, oxcf, this_frame);
gf_group_err += mod_frame_err;
}
}
@@ -1713,7 +1766,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
reset_fpf_position(twopass, start_pos);
// Calculate the bits to be allocated to the gf/arf group as a whole
- twopass->gf_group_bits = calculate_total_gf_group_bits(cpi, gf_group_err);
+ gf_group_bits = calculate_total_gf_group_bits(cpi, gf_group_err);
// Calculate the extra bits to be used for boosted frame(s)
{
@@ -1724,19 +1777,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
boost = clamp(boost, 125, (rc->baseline_gf_interval + 1) * 200);
// Calculate the extra bits to be used for boosted frame(s)
- twopass->gf_bits = calculate_boost_bits(rc->baseline_gf_interval,
- boost, twopass->gf_group_bits);
-
-
- // For key frames the frame target rate is set already.
- // NOTE: We dont bother to check for the special case of ARF overlay
- // frames here, as there is clamping code for this in the function
- // vp9_rc_clamp_pframe_target_size(), which applies to one and two pass
- // encodes.
- if (cpi->common.frame_type != KEY_FRAME &&
- !vp9_is_upper_layer_key_frame(cpi)) {
- vp9_rc_set_frame_target(cpi, twopass->gf_bits);
- }
+ gf_arf_bits = calculate_boost_bits(rc->baseline_gf_interval,
+ boost, gf_group_bits);
}
// Adjust KF group bits and error remaining.
@@ -1749,14 +1791,19 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// For normal GFs remove the score for the GF itself unless this is
// also a key frame in which case it has already been accounted for.
if (rc->source_alt_ref_pending) {
- twopass->gf_group_error_left = (int64_t)(gf_group_err - mod_frame_err);
+ gf_group_error_left = gf_group_err - mod_frame_err;
} else if (cpi->common.frame_type != KEY_FRAME) {
- twopass->gf_group_error_left = (int64_t)(gf_group_err
- - gf_first_frame_err);
+ gf_group_error_left = gf_group_err - gf_first_frame_err;
} else {
- twopass->gf_group_error_left = (int64_t)gf_group_err;
+ gf_group_error_left = gf_group_err;
}
+ // Allocate bits to each of the frames in the GF group.
+ allocate_gf_group_bits(cpi, gf_group_bits, gf_group_error_left, gf_arf_bits);
+
+ // Reset the file position.
+ reset_fpf_position(twopass, start_pos);
+
// Calculate a section intra ratio used in setting max loop filter.
if (cpi->common.frame_type != KEY_FRAME) {
twopass->section_intra_rating =
@@ -1765,37 +1812,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
}
}
-// Allocate bits to a normal frame that is neither a gf an arf or a key frame.
-static void assign_std_frame_bits(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
- TWO_PASS *twopass = &cpi->twopass;
- // For a single frame.
- const int max_bits = frame_max_bits(&cpi->rc, &cpi->oxcf);
- // Calculate modified prediction error used in bit allocation.
- const double modified_err = calculate_modified_err(cpi, this_frame);
- int target_frame_size;
- double err_fraction;
-
- if (twopass->gf_group_error_left > 0)
- // What portion of the remaining GF group error is used by this frame.
- err_fraction = modified_err / twopass->gf_group_error_left;
- else
- err_fraction = 0.0;
-
- // How many of those bits available for allocation should we give it?
- target_frame_size = (int)((double)twopass->gf_group_bits * err_fraction);
-
- // Clip target size to 0 - max_bits (or cpi->twopass.gf_group_bits) at
- // the top end.
- target_frame_size = clamp(target_frame_size, 0,
- MIN(max_bits, (int)twopass->gf_group_bits));
-
- // Adjust error and bits remaining.
- twopass->gf_group_error_left -= (int64_t)modified_err;
-
- // Per frame bit target for this frame.
- vp9_rc_set_frame_target(cpi, target_frame_size);
-}
-
static int test_candidate_kf(TWO_PASS *twopass,
const FIRSTPASS_STATS *last_frame,
const FIRSTPASS_STATS *this_frame,
@@ -1877,10 +1893,12 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
int i, j;
RATE_CONTROL *const rc = &cpi->rc;
TWO_PASS *const twopass = &cpi->twopass;
+ const VP9EncoderConfig *const oxcf = &cpi->oxcf;
const FIRSTPASS_STATS first_frame = *this_frame;
const FIRSTPASS_STATS *const start_position = twopass->stats_in;
FIRSTPASS_STATS next_frame;
FIRSTPASS_STATS last_frame;
+ int kf_bits = 0;
double decay_accumulator = 1.0;
double zero_motion_accumulator = 1.0;
double boost_score = 0.0;
@@ -1892,6 +1910,10 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
cpi->common.frame_type = KEY_FRAME;
+ // Reset the GF group data structures.
+ twopass->gf_group_index = 0;
+ vp9_zero(twopass->gf_group_bit_allocation);
+
// Is this a forced key frame by interval.
rc->this_key_frame_forced = rc->next_key_frame_forced;
@@ -1906,14 +1928,14 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
twopass->kf_group_bits = 0; // Total bits available to kf group
twopass->kf_group_error_left = 0; // Group modified error score.
- kf_mod_err = calculate_modified_err(cpi, this_frame);
+ kf_mod_err = calculate_modified_err(twopass, oxcf, this_frame);
// Find the next keyframe.
i = 0;
while (twopass->stats_in < twopass->stats_in_end &&
rc->frames_to_key < cpi->oxcf.key_freq) {
// Accumulate kf group error.
- kf_group_err += calculate_modified_err(cpi, this_frame);
+ kf_group_err += calculate_modified_err(twopass, oxcf, this_frame);
// Load the next frame's stats.
last_frame = *this_frame;
@@ -1975,7 +1997,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// Rescan to get the correct error data for the forced kf group.
for (i = 0; i < rc->frames_to_key; ++i) {
- kf_group_err += calculate_modified_err(cpi, &tmp_frame);
+ kf_group_err += calculate_modified_err(twopass, oxcf, &tmp_frame);
input_stats(twopass, &tmp_frame);
}
rc->next_key_frame_forced = 1;
@@ -1989,7 +2011,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// Special case for the last key frame of the file.
if (twopass->stats_in >= twopass->stats_in_end) {
// Accumulate kf group error.
- kf_group_err += calculate_modified_err(cpi, this_frame);
+ kf_group_err += calculate_modified_err(twopass, oxcf, this_frame);
}
// Calculate the number of bits that should be assigned to the kf group.
@@ -2057,6 +2079,8 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
}
}
+ reset_fpf_position(twopass, start_position);
+
// Store the zero motion percentage
twopass->kf_zeromotion_pct = (int)(zero_motion_accumulator * 100.0);
@@ -2073,13 +2097,13 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
if (rc->kf_boost < MIN_KF_BOOST)
rc->kf_boost = MIN_KF_BOOST;
- twopass->kf_bits = calculate_boost_bits((rc->frames_to_key - 1),
- rc->kf_boost, twopass->kf_group_bits);
+ kf_bits = calculate_boost_bits((rc->frames_to_key - 1),
+ rc->kf_boost, twopass->kf_group_bits);
- twopass->kf_group_bits -= twopass->kf_bits;
+ twopass->kf_group_bits -= kf_bits;
- // Per frame bit target for this frame.
- vp9_rc_set_frame_target(cpi, twopass->kf_bits);
+ // Save the bits to spend on the key frame.
+ twopass->gf_group_bit_allocation[0] = kf_bits;
// Note the total error score of the kf group minus the key frame itself.
twopass->kf_group_error_left = (int)(kf_group_err - kf_mod_err);
@@ -2128,7 +2152,7 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
FIRSTPASS_STATS this_frame;
FIRSTPASS_STATS this_frame_copy;
- int target;
+ int target_rate;
LAYER_CONTEXT *lc = NULL;
const int is_spatial_svc = (cpi->use_svc &&
cpi->svc.number_temporal_layers == 1);
@@ -2144,16 +2168,23 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
if (!twopass->stats_in)
return;
+ // Increment the gf group index.
+ ++twopass->gf_group_index;
+
+ // If this is an arf frame then we dont want to read the stats file or
+ // advance the input pointer as we already have what we need.
if (cpi->refresh_alt_ref_frame) {
- int modified_target = twopass->gf_bits;
- rc->base_frame_target = twopass->gf_bits;
- cm->frame_type = INTER_FRAME;
+ int target_rate;
+ target_rate = twopass->gf_group_bit_allocation[twopass->gf_group_index];
+ target_rate = vp9_rc_clamp_pframe_target_size(cpi, target_rate);
+ rc->base_frame_target = target_rate;
#ifdef LONG_TERM_VBR_CORRECTION
// Correction to rate target based on prior over or under shoot.
if (cpi->oxcf.rc_mode == RC_MODE_VBR)
- vbr_rate_correction(&modified_target, rc->vbr_bits_off_target);
+ vbr_rate_correction(&target_rate, rc->vbr_bits_off_target);
#endif
- vp9_rc_set_frame_target(cpi, modified_target);
+ vp9_rc_set_frame_target(cpi, target_rate);
+ cm->frame_type = INTER_FRAME;
return;
}
@@ -2181,11 +2212,13 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
if (EOF == input_stats(twopass, &this_frame))
return;
+ // Local copy of the current frame's first pass stats.
+ this_frame_copy = this_frame;
+
// Keyframe and section processing.
if (rc->frames_to_key == 0 ||
(cpi->frame_flags & FRAMEFLAGS_KEY)) {
// Define next KF group and assign bits to it.
- this_frame_copy = this_frame;
find_next_key_frame(cpi, &this_frame_copy);
} else {
cm->frame_type = INTER_FRAME;
@@ -2204,11 +2237,8 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
}
}
- // Is this frame a GF / ARF? (Note: a key frame is always also a GF).
+ // Define a new GF/ARF group. (Should always enter here for key frames).
if (rc->frames_till_gf_update_due == 0) {
- // Define next gf group and assign bits to it.
- this_frame_copy = this_frame;
-
#if CONFIG_MULTIPLE_ARF
if (cpi->multi_arf_enabled) {
define_fixed_arf_period(cpi);
@@ -2231,11 +2261,6 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
cpi->refresh_golden_frame = 1;
- } else {
- // Otherwise this is an ordinary frame.
- // Assign bits from those allocated to the GF group.
- this_frame_copy = this_frame;
- assign_std_frame_bits(cpi, &this_frame_copy);
}
{
@@ -2246,18 +2271,19 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
}
}
+ target_rate = twopass->gf_group_bit_allocation[twopass->gf_group_index];
if (cpi->common.frame_type == KEY_FRAME)
- target = vp9_rc_clamp_iframe_target_size(cpi, rc->this_frame_target);
+ target_rate = vp9_rc_clamp_iframe_target_size(cpi, target_rate);
else
- target = vp9_rc_clamp_pframe_target_size(cpi, rc->this_frame_target);
+ target_rate = vp9_rc_clamp_pframe_target_size(cpi, target_rate);
- rc->base_frame_target = target;
+ rc->base_frame_target = target_rate;
#ifdef LONG_TERM_VBR_CORRECTION
// Correction to rate target based on prior over or under shoot.
if (cpi->oxcf.rc_mode == RC_MODE_VBR)
- vbr_rate_correction(&target, rc->vbr_bits_off_target);
+ vbr_rate_correction(&target_rate, rc->vbr_bits_off_target);
#endif
- vp9_rc_set_frame_target(cpi, target);
+ vp9_rc_set_frame_target(cpi, target_rate);
// Update the total stats remaining structure.
subtract_stats(&twopass->total_left_stats, &this_frame);
@@ -2306,8 +2332,6 @@ void vp9_twopass_postencode_update(VP9_COMP *cpi) {
} else {
#endif
twopass->kf_group_bits -= bits_used;
- twopass->gf_group_bits -= bits_used;
- twopass->gf_group_bits = MAX(twopass->gf_group_bits, 0);
}
twopass->kf_group_bits = MAX(twopass->kf_group_bits, 0);
}
diff --git a/vp9/encoder/vp9_firstpass.h b/vp9/encoder/vp9_firstpass.h
index d84793e28..309638c1e 100644
--- a/vp9/encoder/vp9_firstpass.h
+++ b/vp9/encoder/vp9_firstpass.h
@@ -11,6 +11,8 @@
#ifndef VP9_ENCODER_VP9_FIRSTPASS_H_
#define VP9_ENCODER_VP9_FIRSTPASS_H_
+#include "vp9/encoder/vp9_lookahead.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -51,31 +53,24 @@ typedef struct {
int64_t bits_left;
double modified_error_min;
double modified_error_max;
- double modified_error_total;
double modified_error_left;
double kf_intra_err_min;
double gf_intra_err_min;
- int kf_bits;
- // Remaining error from uncoded frames in a gf group. Two pass use only
- int64_t gf_group_error_left;
// Projected total bits available for a key frame group of frames
int64_t kf_group_bits;
// Error score of frames still to be coded in kf group
int64_t kf_group_error_left;
-
- // Projected Bits available for a group of frames including 1 GF or ARF
- int64_t gf_group_bits;
- // Bits for the golden frame or ARF - 2 pass only
- int gf_bits;
-
int sr_update_lag;
int kf_zeromotion_pct;
int gf_zeromotion_pct;
int active_worst_quality;
+
+ int gf_group_index;
+ int gf_group_bit_allocation[MAX_LAG_BUFFERS * 2];
} TWO_PASS;
struct VP9_COMP;
diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c
index 041e583fd..842bc5b9d 100644
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -72,8 +72,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
x->mv_row_max = tmp_row_max;
return vp9_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].dst.buf, xd->plane[0].dst.stride,
- INT_MAX);
+ xd->plane[0].dst.buf, xd->plane[0].dst.stride);
}
static int do_16x16_motion_search(VP9_COMP *cpi, const MV *ref_mv,
@@ -86,8 +85,7 @@ static int do_16x16_motion_search(VP9_COMP *cpi, const MV *ref_mv,
// Try zero MV first
// FIXME should really use something like near/nearest MV and/or MV prediction
err = vp9_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride,
- INT_MAX);
+ xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride);
dst_mv->as_int = 0;
// Test last reference frame using the previous best mv as the
@@ -123,8 +121,7 @@ static int do_16x16_zerozero_search(VP9_COMP *cpi, int_mv *dst_mv) {
// Try zero MV first
// FIXME should really use something like near/nearest MV and/or MV prediction
err = vp9_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride,
- INT_MAX);
+ xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride);
dst_mv->as_int = 0;
@@ -147,7 +144,7 @@ static int find_best_16x16_intra(VP9_COMP *cpi, PREDICTION_MODE *pbest_mode) {
xd->plane[0].dst.buf, xd->plane[0].dst.stride,
0, 0, 0);
err = vp9_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].dst.buf, xd->plane[0].dst.stride, best_err);
+ xd->plane[0].dst.buf, xd->plane[0].dst.stride);
// find best
if (err < best_err) {
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index 4f7d6f17c..9d2b2a497 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -524,9 +524,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
// Work out the start point for the search
bestsad = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv), in_what->stride,
- 0x7fffffff) + mvsad_err_cost(x, ref_mv, &fcenter_mv,
- sad_per_bit);
+ get_buf_from_mv(in_what, ref_mv), in_what->stride);
// Search all possible scales upto the search param around the center point
// pick the scale of the point that is best as the starting scale of
@@ -542,7 +540,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
bc + candidates[t][i].col};
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
+ in_what->stride);
CHECK_BETTER
}
} else {
@@ -553,7 +551,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
continue;
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
+ in_what->stride);
CHECK_BETTER
}
}
@@ -585,7 +583,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
bc + candidates[s][i].col};
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
+ in_what->stride);
CHECK_BETTER
}
} else {
@@ -596,7 +594,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
continue;
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
+ in_what->stride);
CHECK_BETTER
}
}
@@ -623,7 +621,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
bc + candidates[s][next_chkpts_indices[i]].col};
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
+ in_what->stride);
CHECK_BETTER
}
} else {
@@ -634,7 +632,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
continue;
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
+ in_what->stride);
CHECK_BETTER
}
}
@@ -661,7 +659,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
bc + neighbors[i].col};
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
+ in_what->stride);
CHECK_BETTER
}
} else {
@@ -672,7 +670,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
continue;
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
- in_what->stride, bestsad);
+ in_what->stride);
CHECK_BETTER
}
}
@@ -894,8 +892,7 @@ int vp9_full_range_search_c(const MACROBLOCK *x,
*best_mv = *ref_mv;
*num00 = 11;
best_sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv), in_what->stride,
- 0x7fffffff) +
+ get_buf_from_mv(in_what, ref_mv), in_what->stride) +
mvsad_err_cost(x, ref_mv, &fcenter_mv, sad_per_bit);
start_row = MAX(-range, x->mv_row_min - ref_mv->row);
start_col = MAX(-range, x->mv_col_min - ref_mv->col);
@@ -929,7 +926,7 @@ int vp9_full_range_search_c(const MACROBLOCK *x,
for (i = 0; i < end_col - c; ++i) {
const MV mv = {ref_mv->row + r, ref_mv->col + c + i};
unsigned int sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &mv), in_what->stride, best_sad);
+ get_buf_from_mv(in_what, &mv), in_what->stride);
if (sad < best_sad) {
sad += mvsad_err_cost(x, &mv, &fcenter_mv, sad_per_bit);
if (sad < best_sad) {
@@ -975,7 +972,7 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x,
// Check the starting position
best_sad = fn_ptr->sdf(what->buf, what->stride,
- best_address, in_what->stride, 0x7fffffff) +
+ best_address, in_what->stride) +
mvsad_err_cost(x, best_mv, &fcenter_mv, sad_per_bit);
i = 1;
@@ -986,8 +983,7 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x,
best_mv->col + ss[i].mv.col};
if (is_mv_in(x, &mv)) {
int sad = fn_ptr->sdf(what->buf, what->stride,
- best_address + ss[i].offset, in_what->stride,
- best_sad);
+ best_address + ss[i].offset, in_what->stride);
if (sad < best_sad) {
sad += mvsad_err_cost(x, &mv, &fcenter_mv, sad_per_bit);
if (sad < best_sad) {
@@ -1012,7 +1008,7 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x,
if (is_mv_in(x, &this_mv)) {
int sad = fn_ptr->sdf(what->buf, what->stride,
best_address + ss[best_site].offset,
- in_what->stride, best_sad);
+ in_what->stride);
if (sad < best_sad) {
sad += mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit);
if (sad < best_sad) {
@@ -1077,7 +1073,7 @@ int vp9_diamond_search_sadx4(const MACROBLOCK *x,
best_address = in_what;
// Check the starting position
- bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
+ bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride)
+ mvsad_err_cost(x, best_mv, &fcenter_mv, sad_per_bit);
i = 1;
@@ -1129,7 +1125,7 @@ int vp9_diamond_search_sadx4(const MACROBLOCK *x,
if (is_mv_in(x, &this_mv)) {
const uint8_t *const check_here = ss[i].offset + best_address;
unsigned int thissad = fn_ptr->sdf(what, what_stride, check_here,
- in_what_stride, bestsad);
+ in_what_stride);
if (thissad < bestsad) {
thissad += mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit);
@@ -1154,7 +1150,7 @@ int vp9_diamond_search_sadx4(const MACROBLOCK *x,
if (is_mv_in(x, &this_mv)) {
const uint8_t *const check_here = ss[best_site].offset + best_address;
unsigned int thissad = fn_ptr->sdf(what, what_stride, check_here,
- in_what_stride, bestsad);
+ in_what_stride);
if (thissad < bestsad) {
thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
@@ -1253,7 +1249,7 @@ int vp9_full_search_sad_c(const MACROBLOCK *x, const MV *ref_mv,
const int col_max = MIN(ref_mv->col + distance, x->mv_col_max);
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
int best_sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv), in_what->stride, 0x7fffffff) +
+ get_buf_from_mv(in_what, ref_mv), in_what->stride) +
mvsad_err_cost(x, ref_mv, &fcenter_mv, sad_per_bit);
*best_mv = *ref_mv;
@@ -1261,7 +1257,7 @@ int vp9_full_search_sad_c(const MACROBLOCK *x, const MV *ref_mv,
for (c = col_min; c < col_max; ++c) {
const MV mv = {r, c};
const int sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &mv), in_what->stride, best_sad) +
+ get_buf_from_mv(in_what, &mv), in_what->stride) +
mvsad_err_cost(x, &mv, &fcenter_mv, sad_per_bit);
if (sad < best_sad) {
best_sad = sad;
@@ -1286,7 +1282,7 @@ int vp9_full_search_sadx3(const MACROBLOCK *x, const MV *ref_mv,
const int col_max = MIN(ref_mv->col + distance, x->mv_col_max);
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
unsigned int best_sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv), in_what->stride, 0x7fffffff) +
+ get_buf_from_mv(in_what, ref_mv), in_what->stride) +
mvsad_err_cost(x, ref_mv, &fcenter_mv, sad_per_bit);
*best_mv = *ref_mv;
@@ -1320,7 +1316,7 @@ int vp9_full_search_sadx3(const MACROBLOCK *x, const MV *ref_mv,
while (c < col_max) {
unsigned int sad = fn_ptr->sdf(what->buf, what->stride,
- check_here, in_what->stride, best_sad);
+ check_here, in_what->stride);
if (sad < best_sad) {
const MV mv = {r, c};
sad += mvsad_err_cost(x, &mv, &fcenter_mv, sad_per_bit);
@@ -1351,7 +1347,7 @@ int vp9_full_search_sadx8(const MACROBLOCK *x, const MV *ref_mv,
const int col_max = MIN(ref_mv->col + distance, x->mv_col_max);
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
unsigned int best_sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv), in_what->stride, 0x7fffffff) +
+ get_buf_from_mv(in_what, ref_mv), in_what->stride) +
mvsad_err_cost(x, ref_mv, &fcenter_mv, sad_per_bit);
*best_mv = *ref_mv;
@@ -1409,7 +1405,7 @@ int vp9_full_search_sadx8(const MACROBLOCK *x, const MV *ref_mv,
while (c < col_max) {
unsigned int sad = fn_ptr->sdf(what->buf, what->stride,
- check_here, in_what->stride, best_sad);
+ check_here, in_what->stride);
if (sad < best_sad) {
const MV mv = {r, c};
sad += mvsad_err_cost(x, &mv, &fcenter_mv, sad_per_bit);
@@ -1438,7 +1434,7 @@ int vp9_refining_search_sad_c(const MACROBLOCK *x,
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
unsigned int best_sad = fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, ref_mv),
- in_what->stride, 0x7fffffff) +
+ in_what->stride) +
mvsad_err_cost(x, ref_mv, &fcenter_mv, error_per_bit);
int i, j;
@@ -1450,7 +1446,7 @@ int vp9_refining_search_sad_c(const MACROBLOCK *x,
ref_mv->col + neighbors[j].col};
if (is_mv_in(x, &mv)) {
unsigned int sad = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &mv), in_what->stride, best_sad);
+ get_buf_from_mv(in_what, &mv), in_what->stride);
if (sad < best_sad) {
sad += mvsad_err_cost(x, &mv, &fcenter_mv, error_per_bit);
if (sad < best_sad) {
@@ -1483,7 +1479,7 @@ int vp9_refining_search_sadx4(const MACROBLOCK *x,
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
const uint8_t *best_address = get_buf_from_mv(in_what, ref_mv);
unsigned int best_sad = fn_ptr->sdf(what->buf, what->stride, best_address,
- in_what->stride, 0x7fffffff) +
+ in_what->stride) +
mvsad_err_cost(x, ref_mv, &fcenter_mv, error_per_bit);
int i, j;
@@ -1524,7 +1520,7 @@ int vp9_refining_search_sadx4(const MACROBLOCK *x,
if (is_mv_in(x, &mv)) {
unsigned int sad = fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &mv),
- in_what->stride, best_sad);
+ in_what->stride);
if (sad < best_sad) {
sad += mvsad_err_cost(x, &mv, &fcenter_mv, error_per_bit);
if (sad < best_sad) {
@@ -1563,8 +1559,7 @@ int vp9_refining_search_8p_c(const MACROBLOCK *x,
const struct buf_2d *const in_what = &xd->plane[0].pre[0];
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
unsigned int best_sad = fn_ptr->sdaf(what->buf, what->stride,
- get_buf_from_mv(in_what, ref_mv), in_what->stride,
- second_pred, 0x7fffffff) +
+ get_buf_from_mv(in_what, ref_mv), in_what->stride, second_pred) +
mvsad_err_cost(x, ref_mv, &fcenter_mv, error_per_bit);
int i, j;
@@ -1577,8 +1572,7 @@ int vp9_refining_search_8p_c(const MACROBLOCK *x,
if (is_mv_in(x, &mv)) {
unsigned int sad = fn_ptr->sdaf(what->buf, what->stride,
- get_buf_from_mv(in_what, &mv), in_what->stride,
- second_pred, best_sad);
+ get_buf_from_mv(in_what, &mv), in_what->stride, second_pred);
if (sad < best_sad) {
sad += mvsad_err_cost(x, &mv, &fcenter_mv, error_per_bit);
if (sad < best_sad) {
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c
index 437b68078..11633a73d 100644
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -284,9 +284,8 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
(1 << INTER_OFFSET(this_mode)))
continue;
- if (best_rd < ((int64_t)rd_threshes[mode_idx[this_mode]] *
- rd_thresh_freq_fact[this_mode] >> 5) ||
- rd_threshes[mode_idx[this_mode]] == INT_MAX)
+ if (rd_less_than_thresh(best_rd, rd_threshes[mode_idx[this_mode]],
+ rd_thresh_freq_fact[this_mode]))
continue;
if (this_mode == NEWMV) {
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index a04622c8c..9ad851754 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -213,6 +213,7 @@ void vp9_rc_init(const VP9EncoderConfig *oxcf, int pass, RATE_CONTROL *rc) {
rc->long_rolling_actual_bits = rc->avg_frame_bandwidth;
rc->total_actual_bits = 0;
+ rc->total_target_bits = 0;
rc->total_target_vs_actual = 0;
rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
@@ -607,13 +608,27 @@ static int rc_pick_q_and_bounds_one_pass_cbr(const VP9_COMP *cpi,
return q;
}
+static int get_active_cq_level(const RATE_CONTROL *rc,
+ const VP9EncoderConfig *const oxcf) {
+ static const double cq_adjust_threshold = 0.5;
+ int active_cq_level = oxcf->cq_level;
+ if (oxcf->rc_mode == RC_MODE_CONSTRAINED_QUALITY &&
+ rc->total_target_bits > 0) {
+ const double x = (double)rc->total_actual_bits / rc->total_target_bits;
+ if (x < cq_adjust_threshold) {
+ active_cq_level = (int)(active_cq_level * x / cq_adjust_threshold);
+ }
+ }
+ return active_cq_level;
+}
+
static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi,
int *bottom_index,
int *top_index) {
const VP9_COMMON *const cm = &cpi->common;
const RATE_CONTROL *const rc = &cpi->rc;
const VP9EncoderConfig *const oxcf = &cpi->oxcf;
- const int cq_level = oxcf->cq_level;
+ const int cq_level = get_active_cq_level(rc, oxcf);
int active_best_quality;
int active_worst_quality = calc_active_worst_quality_one_pass_vbr(cpi);
int q;
@@ -791,7 +806,7 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
const VP9_COMMON *const cm = &cpi->common;
const RATE_CONTROL *const rc = &cpi->rc;
const VP9EncoderConfig *const oxcf = &cpi->oxcf;
- const int cq_level = oxcf->cq_level;
+ const int cq_level = get_active_cq_level(rc, oxcf);
int active_best_quality;
int active_worst_quality = cpi->twopass.active_worst_quality;
int q;
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 601e64d39..832372479 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -9,7 +9,6 @@
*/
#include <assert.h>
-#include <limits.h>
#include <math.h>
#include <stdio.h>
@@ -22,7 +21,6 @@
#include "vp9/common/vp9_entropymode.h"
#include "vp9/common/vp9_idct.h"
#include "vp9/common/vp9_mvref_common.h"
-#include "vp9/common/vp9_pragmas.h"
#include "vp9/common/vp9_pred_common.h"
#include "vp9/common/vp9_quant_common.h"
#include "vp9/common/vp9_reconinter.h"
@@ -2131,8 +2129,7 @@ static void mv_pred(VP9_COMP *cpi, MACROBLOCK *x,
// Find sad for current vector.
this_sad = cpi->fn_ptr[block_size].sdf(src_y_ptr, x->plane[0].src.stride,
- ref_y_ptr, ref_y_stride,
- 0x7fffffff);
+ ref_y_ptr, ref_y_stride);
// Note if it is the best so far.
if (this_sad < best_sad) {
@@ -2991,11 +2988,6 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
ctx->mic = *xd->mi[0];
}
-static INLINE int rd_less_than_thresh(int64_t best_rd, int thresh,
- int thresh_fact) {
- return best_rd < ((int64_t)thresh * thresh_fact >> 5) || thresh == INT_MAX;
-}
-
// Updating rd_thresh_freq_fact[] here means that the different
// partition/block sizes are handled independently based on the best
// choice for the current partition. It may well be better to keep a scaled
@@ -3228,7 +3220,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
// Test best rd so far against threshold for trying this mode.
if (rd_less_than_thresh(best_rd, rd_threshes[mode_index],
- rd_thresh_freq_fact[mode_index]))
+ rd_thresh_freq_fact[mode_index]))
continue;
this_mode = vp9_mode_order[mode_index].mode;
diff --git a/vp9/encoder/vp9_rdopt.h b/vp9/encoder/vp9_rdopt.h
index b6b51e553..5ea09a8a7 100644
--- a/vp9/encoder/vp9_rdopt.h
+++ b/vp9/encoder/vp9_rdopt.h
@@ -11,6 +11,8 @@
#ifndef VP9_ENCODER_VP9_RDOPT_H_
#define VP9_ENCODER_VP9_RDOPT_H_
+#include <limits.h>
+
#include "vp9/encoder/vp9_encoder.h"
#ifdef __cplusplus
@@ -87,6 +89,11 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi);
void vp9_set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi);
+static INLINE int rd_less_than_thresh(int64_t best_rd, int thresh,
+ int thresh_fact) {
+ return best_rd < ((int64_t)thresh * thresh_fact >> 5) || thresh == INT_MAX;
+}
+
static INLINE int full_pixel_search(VP9_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, MV *mvp_full,
int step_param, int error_per_bit,
diff --git a/vp9/encoder/vp9_sad.c b/vp9/encoder/vp9_sad.c
index 892e90551..d06263676 100644
--- a/vp9/encoder/vp9_sad.c
+++ b/vp9/encoder/vp9_sad.c
@@ -35,14 +35,12 @@ static INLINE unsigned int sad(const uint8_t *a, int a_stride,
#define sadMxN(m, n) \
unsigned int vp9_sad##m##x##n##_c(const uint8_t *src, int src_stride, \
- const uint8_t *ref, int ref_stride, \
- unsigned int max_sad) { \
+ const uint8_t *ref, int ref_stride) { \
return sad(src, src_stride, ref, ref_stride, m, n); \
} \
unsigned int vp9_sad##m##x##n##_avg_c(const uint8_t *src, int src_stride, \
const uint8_t *ref, int ref_stride, \
- const uint8_t *second_pred, \
- unsigned int max_sad) { \
+ const uint8_t *second_pred) { \
uint8_t comp_pred[m * n]; \
vp9_comp_avg_pred(comp_pred, second_pred, m, n, ref, ref_stride); \
return sad(src, src_stride, comp_pred, m, m, n); \
@@ -54,8 +52,7 @@ void vp9_sad##m##x##n##x##k##_c(const uint8_t *src, int src_stride, \
unsigned int *sads) { \
int i; \
for (i = 0; i < k; ++i) \
- sads[i] = vp9_sad##m##x##n##_c(src, src_stride, &ref[i], ref_stride, \
- 0x7fffffff); \
+ sads[i] = vp9_sad##m##x##n##_c(src, src_stride, &ref[i], ref_stride); \
}
#define sadMxNx4D(m, n) \
@@ -64,8 +61,7 @@ void vp9_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \
unsigned int *sads) { \
int i; \
for (i = 0; i < 4; ++i) \
- sads[i] = vp9_sad##m##x##n##_c(src, src_stride, refs[i], ref_stride, \
- 0x7fffffff); \
+ sads[i] = vp9_sad##m##x##n##_c(src, src_stride, refs[i], ref_stride); \
}
// 64x64
diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c
index 7b2d1e2f0..7c3abd5d7 100644
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -80,12 +80,16 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
}
if (speed >= 2) {
- if (MIN(cm->width, cm->height) >= 720)
+ if (MIN(cm->width, cm->height) >= 720) {
+ sf->lf_motion_threshold = LOW_MOITION_THRESHOLD;
+ sf->last_partitioning_redo_frequency = 3;
sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
: DISABLE_ALL_INTER_SPLIT;
- else
+ } else {
sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
-
+ sf->last_partitioning_redo_frequency = 2;
+ sf->lf_motion_threshold = NO_MOITION_THRESHOLD;
+ }
sf->adaptive_pred_interp_filter = 2;
sf->reference_masking = 1;
sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
@@ -97,7 +101,6 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION;
sf->adjust_partitioning_from_last_frame = 1;
- sf->last_partitioning_redo_frequency = 3;
}
if (speed >= 3) {
@@ -108,6 +111,8 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
else
sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT;
+ sf->lf_motion_threshold = LOW_MOITION_THRESHOLD;
+ sf->last_partitioning_redo_frequency = 3;
sf->recode_loop = ALLOW_RECODE_KFMAXBW;
sf->adaptive_rd_thresh = 3;
sf->mode_skip_start = 6;
@@ -142,8 +147,11 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
}
}
-static void set_rt_speed_feature(VP9_COMMON *cm, SPEED_FEATURES *sf,
+static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
int speed) {
+ VP9_COMMON *const cm = &cpi->common;
+ const int frames_since_key =
+ cm->frame_type == KEY_FRAME ? 0 : cpi->rc.frames_since_key;
sf->static_segmentation = 0;
sf->adaptive_rd_thresh = 1;
sf->use_fast_coef_costing = 1;
@@ -196,6 +204,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm, SPEED_FEATURES *sf,
sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION;
+ sf->lf_motion_threshold = LOW_MOITION_THRESHOLD;
sf->adjust_partitioning_from_last_frame = 1;
sf->last_partitioning_redo_frequency = 3;
@@ -233,7 +242,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm, SPEED_FEATURES *sf,
sf->auto_min_max_partition_size = STRICT_NEIGHBORING_MIN_MAX;
sf->adjust_partitioning_from_last_frame =
cm->last_frame_type != cm->frame_type || (0 ==
- (cm->current_video_frame + 1) % sf->last_partitioning_redo_frequency);
+ (frames_since_key + 1) % sf->last_partitioning_redo_frequency);
sf->subpel_force_stop = 1;
for (i = 0; i < TX_SIZES; i++) {
sf->intra_y_mode_mask[i] = INTRA_DC_H_V;
@@ -254,9 +263,9 @@ static void set_rt_speed_feature(VP9_COMMON *cm, SPEED_FEATURES *sf,
sf->max_partition_size = BLOCK_32X32;
sf->min_partition_size = BLOCK_8X8;
sf->partition_check =
- (cm->current_video_frame % sf->last_partitioning_redo_frequency == 1);
+ (frames_since_key % sf->last_partitioning_redo_frequency == 1);
sf->force_frame_boost = cm->frame_type == KEY_FRAME ||
- (cm->current_video_frame %
+ (frames_since_key %
(sf->last_partitioning_redo_frequency << 1) == 1);
sf->max_delta_qindex = (cm->frame_type == KEY_FRAME) ? 20 : 15;
sf->partition_search_type = REFERENCE_PARTITION;
@@ -356,7 +365,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
set_good_speed_feature(cpi, cm, sf, oxcf->speed);
break;
case REALTIME:
- set_rt_speed_feature(cm, sf, oxcf->speed);
+ set_rt_speed_feature(cpi, sf, oxcf->speed);
break;
}
diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h
index d8c1a8be2..a54599e6a 100644
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -44,6 +44,11 @@ typedef enum {
} SUBPEL_SEARCH_METHODS;
typedef enum {
+ NO_MOITION_THRESHOLD = 0,
+ LOW_MOITION_THRESHOLD = 7
+} MOTION_THRESHOLD;
+
+typedef enum {
LAST_FRAME_PARTITION_OFF = 0,
LAST_FRAME_PARTITION_LOW_MOTION = 1,
LAST_FRAME_PARTITION_ALL = 2
@@ -200,6 +205,10 @@ typedef struct SPEED_FEATURES {
// partitioning.
LAST_FRAME_PARTITION_METHOD use_lastframe_partitioning;
+ // The threshold is to determine how slow the motino is, it is used when
+ // use_lastframe_partitioning is set to LAST_FRAME_PARTITION_LOW_MOTION
+ MOTION_THRESHOLD lf_motion_threshold;
+
// Determine which method we use to determine transform size. We can choose
// between options like full rd, largest for prediction size, largest
// for intra and model coefs for the rest.
diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c
index dd28496be..48aa64c13 100644
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -46,10 +46,10 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
lrc->key_frame_rate_correction_factor = 1.0;
if (svc->number_temporal_layers > 1) {
- lc->target_bandwidth = oxcf->ts_target_bitrate[layer] * 1000;
+ lc->target_bandwidth = oxcf->ts_target_bitrate[layer];
lrc->last_q[INTER_FRAME] = oxcf->worst_allowed_q;
} else {
- lc->target_bandwidth = oxcf->ss_target_bitrate[layer] * 1000;
+ lc->target_bandwidth = oxcf->ss_target_bitrate[layer];
lrc->last_q[0] = oxcf->best_allowed_q;
lrc->last_q[1] = oxcf->best_allowed_q;
lrc->last_q[2] = oxcf->best_allowed_q;
@@ -82,9 +82,9 @@ void vp9_update_layer_context_change_config(VP9_COMP *const cpi,
RATE_CONTROL *const lrc = &lc->rc;
if (svc->number_temporal_layers > 1) {
- lc->target_bandwidth = oxcf->ts_target_bitrate[layer] * 1000;
+ lc->target_bandwidth = oxcf->ts_target_bitrate[layer];
} else {
- lc->target_bandwidth = oxcf->ss_target_bitrate[layer] * 1000;
+ lc->target_bandwidth = oxcf->ss_target_bitrate[layer];
}
bitrate_alloc = (float)lc->target_bandwidth / target_bandwidth;
// Update buffer-related quantities.
@@ -132,8 +132,7 @@ void vp9_update_temporal_layer_framerate(VP9_COMP *const cpi) {
} else {
const double prev_layer_framerate =
oxcf->framerate / oxcf->ts_rate_decimator[layer - 1];
- const int prev_layer_target_bandwidth =
- oxcf->ts_target_bitrate[layer - 1] * 1000;
+ const int prev_layer_target_bandwidth = oxcf->ts_target_bitrate[layer - 1];
lc->avg_frame_size =
(int)((lc->target_bandwidth - prev_layer_target_bandwidth) /
(lc->framerate - prev_layer_framerate));
diff --git a/vp9/encoder/vp9_variance.c b/vp9/encoder/vp9_variance.c
index 91d8ea4dc..02bed8988 100644
--- a/vp9/encoder/vp9_variance.c
+++ b/vp9/encoder/vp9_variance.c
@@ -156,6 +156,19 @@ unsigned int vp9_sub_pixel_avg_variance##W##x##H##_c( \
return vp9_variance##W##x##H##_c(temp3, W, dst, dst_stride, sse); \
}
+
+void vp9_get_sse_sum_16x16_c(const uint8_t *src_ptr, int source_stride,
+ const uint8_t *ref_ptr, int ref_stride,
+ unsigned int *sse, int *sum) {
+ variance(src_ptr, source_stride, ref_ptr, ref_stride, 16, 16, sse, sum);
+}
+
+void vp9_get_sse_sum_8x8_c(const uint8_t *src_ptr, int source_stride,
+ const uint8_t *ref_ptr, int ref_stride,
+ unsigned int *sse, int *sum) {
+ variance(src_ptr, source_stride, ref_ptr, ref_stride, 8, 8, sse, sum);
+}
+
unsigned int vp9_mse16x16_c(const uint8_t *src, int src_stride,
const uint8_t *ref, int ref_stride,
unsigned int *sse) {
diff --git a/vp9/encoder/vp9_variance.h b/vp9/encoder/vp9_variance.h
index c47fe1335..4a194b72c 100644
--- a/vp9/encoder/vp9_variance.h
+++ b/vp9/encoder/vp9_variance.h
@@ -25,15 +25,13 @@ void variance(const uint8_t *a, int a_stride,
typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr,
int source_stride,
const uint8_t *ref_ptr,
- int ref_stride,
- unsigned int max_sad);
+ int ref_stride);
typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr,
int source_stride,
const uint8_t *ref_ptr,
int ref_stride,
- const uint8_t *second_pred,
- unsigned int max_sad);
+ const uint8_t *second_pred);
typedef void (*vp9_sad_multi_fn_t)(const uint8_t *src_ptr,
int source_stride,
diff --git a/vp9/encoder/x86/vp9_dct_ssse3.asm b/vp9/encoder/x86/vp9_dct_ssse3_x86_64.asm
index 8723a7114..8723a7114 100644
--- a/vp9/encoder/x86/vp9_dct_ssse3.asm
+++ b/vp9/encoder/x86/vp9_dct_ssse3_x86_64.asm
diff --git a/vp9/encoder/x86/vp9_quantize_ssse3.asm b/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm
index 48ccef8cc..48ccef8cc 100644
--- a/vp9/encoder/x86/vp9_quantize_ssse3.asm
+++ b/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm
diff --git a/vp9/encoder/x86/vp9_ssim_opt.asm b/vp9/encoder/x86/vp9_ssim_opt_x86_64.asm
index 455d10d2c..455d10d2c 100644
--- a/vp9/encoder/x86/vp9_ssim_opt.asm
+++ b/vp9/encoder/x86/vp9_ssim_opt_x86_64.asm
diff --git a/vp9/encoder/x86/vp9_variance_avx2.c b/vp9/encoder/x86/vp9_variance_avx2.c
index 835c51957..7f81f46b8 100644
--- a/vp9/encoder/x86/vp9_variance_avx2.c
+++ b/vp9/encoder/x86/vp9_variance_avx2.c
@@ -10,7 +10,6 @@
#include "./vpx_config.h"
#include "vp9/encoder/vp9_variance.h"
-#include "vp9/common/vp9_pragmas.h"
#include "vpx_ports/mem.h"
typedef void (*get_var_avx2) (
diff --git a/vp9/encoder/x86/vp9_variance_mmx.c b/vp9/encoder/x86/vp9_variance_mmx.c
index c4d17fc0f..ae2f976af 100644
--- a/vp9/encoder/x86/vp9_variance_mmx.c
+++ b/vp9/encoder/x86/vp9_variance_mmx.c
@@ -10,7 +10,6 @@
#include "./vpx_config.h"
#include "vp9/encoder/vp9_variance.h"
-#include "vp9/common/vp9_pragmas.h"
#include "vpx_ports/mem.h"
extern unsigned int vp9_get8x8var_mmx
diff --git a/vp9/encoder/x86/vp9_variance_sse2.c b/vp9/encoder/x86/vp9_variance_sse2.c
index 41f225922..6a82038ab 100644
--- a/vp9/encoder/x86/vp9_variance_sse2.c
+++ b/vp9/encoder/x86/vp9_variance_sse2.c
@@ -11,7 +11,6 @@
#include "./vpx_config.h"
#include "vp9/encoder/vp9_variance.h"
-#include "vp9/common/vp9_pragmas.h"
#include "vpx_ports/mem.h"
extern unsigned int vp9_get4x4var_mmx