ref: 1205e3207e12bf5243dd3dac1d2c08d4a036f1f2
parent: 6b6ff9c9698518abed286b339f63415b7785ebd4
author: Marco <marpan@google.com>
date: Thu May 18 10:12:24 EDT 2017
vp9: SVC: Modify condition to allow for copy partition. When temporal layers are used, only allow for copy partition on the top temporal enhancement layer frames. Change-Id: I5472abdc0f9f6c8dafa75a7a84c615e08ae22af8
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -887,18 +887,22 @@
static int copy_partitioning(VP9_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd,
int mi_row, int mi_col, int segment_id,
int sb_offset) {
- int base_is_key = 0;
+ int svc_copy_allowed = 1;
int frames_since_key_thresh = 1;
- if (cpi->use_svc && cpi->svc.spatial_layer_id > 0) {
+ if (cpi->use_svc) {
+ // For SVC, don't allow copy if base spatial layer is key frame, or if
+ // frame is not a temporal enhancement layer frame.
int layer = LAYER_IDS_TO_IDX(0, cpi->svc.temporal_layer_id,
cpi->svc.number_temporal_layers);
const LAYER_CONTEXT *lc = &cpi->svc.layer_context[layer];
- if (lc->is_key_frame) base_is_key = 1;
+ if (lc->is_key_frame ||
+ (cpi->svc.temporal_layer_id != cpi->svc.number_temporal_layers - 1 &&
+ cpi->svc.number_temporal_layers > 1))
+ svc_copy_allowed = 0;
frames_since_key_thresh = cpi->svc.number_spatial_layers << 1;
}
- if (cpi->rc.frames_since_key > frames_since_key_thresh &&
- !cpi->resize_pending && !base_is_key &&
- segment_id == CR_SEGMENT_ID_BASE &&
+ if (cpi->rc.frames_since_key > frames_since_key_thresh && svc_copy_allowed &&
+ !cpi->resize_pending && segment_id == CR_SEGMENT_ID_BASE &&
cpi->prev_segment_id[sb_offset] == CR_SEGMENT_ID_BASE &&
cpi->copied_frame_cnt[sb_offset] < cpi->max_copied_frame) {
if (cpi->prev_partition != NULL) {