Merge "Fix the memory alignment issue due to patch: https://gerrit.chromium.org/gerrit/#/c/70162/"
diff --git a/vp9/decoder/vp9_decoder.c b/vp9/decoder/vp9_decoder.c
index e1292c2..8902f17 100644
--- a/vp9/decoder/vp9_decoder.c
+++ b/vp9/decoder/vp9_decoder.c
@@ -220,8 +220,7 @@
}
int vp9_receive_compressed_data(VP9Decoder *pbi,
- size_t size, const uint8_t **psource,
- int64_t time_stamp) {
+ size_t size, const uint8_t **psource) {
VP9_COMMON *const cm = &pbi->common;
const uint8_t *source = *psource;
int retcode = 0;
@@ -295,14 +294,12 @@
}
pbi->ready_for_new_data = 0;
- pbi->last_time_stamp = time_stamp;
cm->error.setjmp = 0;
return retcode;
}
int vp9_get_raw_frame(VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd,
- int64_t *time_stamp, int64_t *time_end_stamp,
vp9_ppflags_t *flags) {
int ret = -1;
#if !CONFIG_VP9_POSTPROC
@@ -317,8 +314,6 @@
return ret;
pbi->ready_for_new_data = 1;
- *time_stamp = pbi->last_time_stamp;
- *time_end_stamp = 0;
#if CONFIG_VP9_POSTPROC
ret = vp9_post_proc_frame(&pbi->common, sd, flags);
diff --git a/vp9/decoder/vp9_decoder.h b/vp9/decoder/vp9_decoder.h
index 36fb7ea..1a5576e 100644
--- a/vp9/decoder/vp9_decoder.h
+++ b/vp9/decoder/vp9_decoder.h
@@ -39,7 +39,6 @@
DECLARE_ALIGNED(16, VP9_COMMON, common);
- int64_t last_time_stamp;
int ready_for_new_data;
int refresh_frame_flags;
@@ -63,12 +62,9 @@
} VP9Decoder;
int vp9_receive_compressed_data(struct VP9Decoder *pbi,
- size_t size, const uint8_t **dest,
- int64_t time_stamp);
+ size_t size, const uint8_t **dest);
-int vp9_get_raw_frame(struct VP9Decoder *pbi,
- YV12_BUFFER_CONFIG *sd,
- int64_t *time_stamp, int64_t *time_end_stamp,
+int vp9_get_raw_frame(struct VP9Decoder *pbi, YV12_BUFFER_CONFIG *sd,
vp9_ppflags_t *flags);
vpx_codec_err_t vp9_copy_reference_dec(struct VP9Decoder *pbi,
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index a7c527a..9929ae1 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1403,30 +1403,22 @@
#endif
// Calculate a section intra ratio used in setting max loop filter.
-static void calculate_section_intra_ratio(TWO_PASS *twopass,
- const FIRSTPASS_STATS *start_pos,
- int section_length) {
- FIRSTPASS_STATS next_frame;
- FIRSTPASS_STATS sectionstats;
- int i;
+static int calculate_section_intra_ratio(const FIRSTPASS_STATS *begin,
+ const FIRSTPASS_STATS *end,
+ int section_length) {
+ const FIRSTPASS_STATS *s = begin;
+ double intra_error = 0.0;
+ double coded_error = 0.0;
+ int i = 0;
- vp9_zero(next_frame);
- vp9_zero(sectionstats);
-
- reset_fpf_position(twopass, start_pos);
-
- for (i = 0; i < section_length; ++i) {
- input_stats(twopass, &next_frame);
- accumulate_stats(§ionstats, &next_frame);
+ while (s < end && i < section_length) {
+ intra_error += s->intra_error;
+ coded_error += s->coded_error;
+ ++s;
+ ++i;
}
- avg_stats(§ionstats);
-
- twopass->section_intra_rating =
- (int)(sectionstats.intra_error /
- DOUBLE_DIVIDE_CHECK(sectionstats.coded_error));
-
- reset_fpf_position(twopass, start_pos);
+ return (int)(intra_error / DOUBLE_DIVIDE_CHECK(coded_error));
}
// Calculate the total bits to allocate in this GF/ARF group.
@@ -1486,7 +1478,7 @@
const VP9EncoderConfig *const oxcf = &cpi->oxcf;
TWO_PASS *const twopass = &cpi->twopass;
FIRSTPASS_STATS next_frame;
- const FIRSTPASS_STATS *start_pos;
+ const FIRSTPASS_STATS *const start_pos = twopass->stats_in;
int i;
double boost_score = 0.0;
double old_boost_score = 0.0;
@@ -1516,7 +1508,6 @@
vp9_zero(next_frame);
twopass->gf_group_bits = 0;
- start_pos = twopass->stats_in;
// Load stats for the current frame.
mod_frame_err = calculate_modified_err(cpi, this_frame);
@@ -1768,7 +1759,9 @@
// Calculate a section intra ratio used in setting max loop filter.
if (cpi->common.frame_type != KEY_FRAME) {
- calculate_section_intra_ratio(twopass, start_pos, rc->baseline_gf_interval);
+ twopass->section_intra_rating =
+ calculate_section_intra_ratio(start_pos, twopass->stats_in_end,
+ rc->baseline_gf_interval);
}
}
@@ -1885,7 +1878,7 @@
RATE_CONTROL *const rc = &cpi->rc;
TWO_PASS *const twopass = &cpi->twopass;
const FIRSTPASS_STATS first_frame = *this_frame;
- const FIRSTPASS_STATS *start_position = twopass->stats_in;
+ const FIRSTPASS_STATS *const start_position = twopass->stats_in;
FIRSTPASS_STATS next_frame;
FIRSTPASS_STATS last_frame;
double decay_accumulator = 1.0;
@@ -2068,7 +2061,9 @@
twopass->kf_zeromotion_pct = (int)(zero_motion_accumulator * 100.0);
// Calculate a section intra ratio used in setting max loop filter.
- calculate_section_intra_ratio(twopass, start_position, rc->frames_to_key);
+ twopass->section_intra_rating =
+ calculate_section_intra_ratio(start_position, twopass->stats_in_end,
+ rc->frames_to_key);
// Work out how many bits to allocate for the key frame itself.
rc->kf_boost = (int)boost_score;
diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c
index 2802fba..328b98f 100644
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -244,10 +244,11 @@
const uint8_t **data, unsigned int data_sz,
void *user_priv, int64_t deadline) {
YV12_BUFFER_CONFIG sd = { 0 };
- int64_t time_stamp = 0, time_end_stamp = 0;
vp9_ppflags_t flags = {0};
VP9_COMMON *cm = NULL;
+ (void)deadline;
+
ctx->img_avail = 0;
// Determine the stream parameters. Note that we rely on peek_si to
@@ -275,13 +276,13 @@
cm = &ctx->pbi->common;
- if (vp9_receive_compressed_data(ctx->pbi, data_sz, data, deadline))
+ if (vp9_receive_compressed_data(ctx->pbi, data_sz, data))
return update_error_state(ctx, &cm->error);
if (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC)
set_ppflags(ctx, &flags);
- if (vp9_get_raw_frame(ctx->pbi, &sd, &time_stamp, &time_end_stamp, &flags))
+ if (vp9_get_raw_frame(ctx->pbi, &sd, &flags))
return update_error_state(ctx, &cm->error);
yuvconfig2image(&ctx->img, &sd, user_priv);