ref: 6b9d1302141af9d80c840a80b419a50a71656dc2
parent: 4c0655f26b831a13afe07fbcaf065a03d2785a52
parent: 1fcd5cca3c810d37b8d81c69b6ebfe04c9f4cd4c
author: Jerome Jiang <[email protected]>
date: Fri May 12 23:20:48 EDT 2017
Merge "vp9: speed 8: Fix seg fault in partition copy when drop frames."
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4414,6 +4414,7 @@
++cm->current_video_frame;
cpi->ext_refresh_frame_flags_pending = 0;
cpi->svc.rc_drop_superframe = 1;
+ cpi->last_frame_dropped = 1;
// TODO(marpan): Advancing the svc counters on dropped frames can break
// the referencing scheme for the fixed svc patterns defined in
// vp9_one_pass_cbr_svc_start_layer(). Look into fixing this issue, but
@@ -4420,6 +4421,7 @@
// for now, don't advance the svc frame counters on dropped frame.
// if (cpi->use_svc)
// vp9_inc_frame_in_layer(cpi);
+
return;
}
}
@@ -4436,6 +4438,8 @@
} else {
encode_with_recode_loop(cpi, size, dest);
}
+
+ cpi->last_frame_dropped = 0;
// Disable segmentation if it decrease rate/distortion ratio
if (cpi->oxcf.aq_mode == LOOKAHEAD_AQ)
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -704,6 +704,8 @@
uint8_t *prev_variance_low;
uint8_t *copied_frame_cnt;
uint8_t max_copied_frame;
+ // If the last frame is dropped, we don't copy partition.
+ uint8_t last_frame_dropped;
// For each superblock: keeps track of the last time (in frame distance) the
// the superblock did not have low source sad.
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -565,8 +565,9 @@
if (speed >= 8) {
sf->adaptive_rd_thresh = 4;
// Enable partition copy
- if (!cpi->use_svc && !cpi->resize_pending && cpi->resize_state == ORIG &&
- !cpi->external_resize && cpi->oxcf.resize_mode == RESIZE_NONE) {
+ if (!cpi->last_frame_dropped && !cpi->use_svc && !cpi->resize_pending &&
+ cpi->resize_state == ORIG && !cpi->external_resize &&
+ cpi->oxcf.resize_mode == RESIZE_NONE) {
sf->copy_partition_flag = 1;
cpi->max_copied_frame = 4;
}