ref: d748cfdad2378fc488fb5df4411adf5f2d5b99c9
parent: b1b007405125d1c8fead491ed681c75394ee27e8
author: Marco Paniconi <marpan@google.com>
date: Fri Aug 31 11:42:19 EDT 2018
vp9-svc: Add first_spatial_layer_to_encode per superframe VP9E_SET_SVC_LAYER_ID sets the first spatial layer to encoder per superframe, so add this parameter to svc encoder. This is needed, for example, to properly set is_key_frame for spatial layers when base spatial layer is skipped encoded. Change-Id: Ifd4ac77f539197ec021e62f4c624a6cc79d64f43
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -2003,6 +2003,8 @@
int target = rc->avg_frame_bandwidth;
int layer = LAYER_IDS_TO_IDX(svc->spatial_layer_id, svc->temporal_layer_id,
svc->number_temporal_layers);
+ if (svc->first_spatial_layer_to_encode)
+ svc->layer_context[svc->temporal_layer_id].is_key_frame = 0;
// Periodic key frames is based on the super-frame counter
// (svc.current_superframe), also only base spatial layer is key frame.
// Key frame is set for any of the following: very first frame, frame flags
--- a/vp9/encoder/vp9_svc_layercontext.h
+++ b/vp9/encoder/vp9_svc_layercontext.h
@@ -175,6 +175,8 @@
int use_set_ref_frame_config;
int temporal_layer_id_per_spatial[VPX_SS_MAX_LAYERS];
+
+ int first_spatial_layer_to_encode;
} SVC;
struct VP9_COMP;
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -1449,6 +1449,7 @@
int sl;
svc->spatial_layer_to_encode = data->spatial_layer_id;
+ svc->first_spatial_layer_to_encode = data->spatial_layer_id;
// TODO(jianj): Deprecated to be removed.
svc->temporal_layer_id = data->temporal_layer_id;
// Allow for setting temporal layer per spatial layer for superframe.