Merge "VP9 SVC: Add enum type for framedrop_mode."

This commit is contained in:
Jerome Jiang 2018-03-29 18:44:35 +00:00 committed by Gerrit Code Review
commit d467bbe11e
6 changed files with 27 additions and 13 deletions

View File

@ -1455,7 +1455,7 @@ class DatarateOnePassCbrSvc
if (constrained_framedrop_) {
vpx_svc_frame_drop_t svc_drop_frame;
svc_drop_frame.framedrop_mode = 1;
svc_drop_frame.framedrop_mode = CONSTRAINED_LAYER_DROP;
for (i = 0; i < number_spatial_layers_; i++)
svc_drop_frame.framedrop_thresh[i] = 30;
encoder->Control(VP9E_SET_SVC_FRAME_DROP_LAYER, &svc_drop_frame);

View File

@ -4624,12 +4624,14 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, size_t *size,
(!cpi->use_svc ||
!cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame)) {
int svc_prev_layer_dropped = 0;
// In the contrained framedrop mode for svc (framedrop_mode = 1), if the
// previous spatial layer was dropped, drop the current spatial layer.
// In the contrained framedrop mode for svc (framedrop_mode =
// CONSTRAINED_LAYER_DROP), if the previous spatial layer was dropped, drop
// the current spatial layer.
if (cpi->use_svc && cpi->svc.spatial_layer_id > 0 &&
cpi->svc.drop_spatial_layer[cpi->svc.spatial_layer_id - 1])
svc_prev_layer_dropped = 1;
if ((svc_prev_layer_dropped && cpi->svc.framedrop_mode) ||
if ((svc_prev_layer_dropped &&
cpi->svc.framedrop_mode == CONSTRAINED_LAYER_DROP) ||
vp9_rc_drop_frame(cpi)) {
vp9_rc_postencode_update_drop_frame(cpi);
cpi->ext_refresh_frame_flags_pending = 0;

View File

@ -395,14 +395,14 @@ void vp9_rc_init(const VP9EncoderConfig *oxcf, int pass, RATE_CONTROL *rc) {
static int check_buffer(VP9_COMP *cpi, int drop_mark) {
SVC *svc = &cpi->svc;
if (!cpi->use_svc || !cpi->svc.framedrop_mode) {
if (!cpi->use_svc || cpi->svc.framedrop_mode == LAYER_DROP) {
RATE_CONTROL *const rc = &cpi->rc;
return (rc->buffer_level <= drop_mark);
} else {
int i;
// For SVC in the constrained framedrop mode (svc->framedrop_mode = 1):
// the condition on buffer (to drop frame) is checked on current and
// upper spatial layers.
// For SVC in the constrained framedrop mode (svc->framedrop_mode =
// CONSTRAINED_LAYER_DROP): the condition on buffer (to drop frame) is
// checked on current and upper spatial layers.
for (i = svc->spatial_layer_id; i < svc->number_spatial_layers; ++i) {
const int layer = LAYER_IDS_TO_IDX(i, svc->temporal_layer_id,
svc->number_temporal_layers);

View File

@ -39,7 +39,7 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
svc->non_reference_frame = 0;
svc->skip_enhancement_layer = 0;
svc->disable_inter_layer_pred = INTER_LAYER_PRED_ON;
svc->framedrop_mode = 0;
svc->framedrop_mode = LAYER_DROP;
for (i = 0; i < REF_FRAMES; ++i) svc->ref_frame_index[i] = -1;
for (sl = 0; sl < oxcf->ss_number_layers; ++sl) {

View File

@ -115,7 +115,7 @@ typedef struct SVC {
int last_layer_dropped[VPX_MAX_LAYERS];
int drop_spatial_layer[VPX_MAX_LAYERS];
int framedrop_thresh[VPX_MAX_LAYERS];
int framedrop_mode;
SVC_LAYER_DROP_MODE framedrop_mode;
INTER_LAYER_PRED disable_inter_layer_pred;
} SVC;

View File

@ -748,7 +748,7 @@ typedef struct vpx_svc_layer_id {
int temporal_layer_id; /**< Temporal layer id number. */
} vpx_svc_layer_id_t;
/*!\brief vp9 svc frame flag parameters.
/*!\brief vp9 svc frame flag parameters.
*
* This defines the frame flags and buffer indices for each spatial layer for
* svc encoding.
@ -763,7 +763,18 @@ typedef struct vpx_svc_ref_frame_config {
int alt_fb_idx[VPX_TS_MAX_LAYERS]; /**< Altref buffer index. */
} vpx_svc_ref_frame_config_t;
/*!\brief vp9 svc frame dropping parameters.
/*!\brief VP9 svc frame dropping mode.
*
* This defines the frame drop mode for SVC.
*
*/
typedef enum {
LAYER_DROP, /**< Any spatial layer can drop. */
CONSTRAINED_LAYER_DROP
/**< Upper layers are constrained to drop if current layer drops. */
} SVC_LAYER_DROP_MODE;
/*!\brief vp9 svc frame dropping parameters.
*
* This defines the frame drop thresholds for each spatial layer, and the
* the frame dropping mode: 0 = layer based frame dropping (default),
@ -772,7 +783,8 @@ typedef struct vpx_svc_ref_frame_config {
*/
typedef struct vpx_svc_frame_drop {
int framedrop_thresh[VPX_SS_MAX_LAYERS]; /**< Frame drop thresholds */
int framedrop_mode; /**< Layer-based or constrained dropping. */
SVC_LAYER_DROP_MODE
framedrop_mode; /**< Layer-based or constrained dropping. */
} vpx_svc_frame_drop_t;
/*!\cond */