VP9 SVC: Add enum type for framedrop_mode.
Change-Id: I3d4697b00729553e0860762b9264e29b8a89b9d4
This commit is contained in:
parent
382afcab98
commit
70b86af22e
@ -1455,7 +1455,7 @@ class DatarateOnePassCbrSvc
|
|||||||
|
|
||||||
if (constrained_framedrop_) {
|
if (constrained_framedrop_) {
|
||||||
vpx_svc_frame_drop_t svc_drop_frame;
|
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++)
|
for (i = 0; i < number_spatial_layers_; i++)
|
||||||
svc_drop_frame.framedrop_thresh[i] = 30;
|
svc_drop_frame.framedrop_thresh[i] = 30;
|
||||||
encoder->Control(VP9E_SET_SVC_FRAME_DROP_LAYER, &svc_drop_frame);
|
encoder->Control(VP9E_SET_SVC_FRAME_DROP_LAYER, &svc_drop_frame);
|
||||||
|
@ -4624,12 +4624,14 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, size_t *size,
|
|||||||
(!cpi->use_svc ||
|
(!cpi->use_svc ||
|
||||||
!cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame)) {
|
!cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame)) {
|
||||||
int svc_prev_layer_dropped = 0;
|
int svc_prev_layer_dropped = 0;
|
||||||
// In the contrained framedrop mode for svc (framedrop_mode = 1), if the
|
// In the contrained framedrop mode for svc (framedrop_mode =
|
||||||
// previous spatial layer was dropped, drop the current spatial layer.
|
// 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 &&
|
if (cpi->use_svc && cpi->svc.spatial_layer_id > 0 &&
|
||||||
cpi->svc.drop_spatial_layer[cpi->svc.spatial_layer_id - 1])
|
cpi->svc.drop_spatial_layer[cpi->svc.spatial_layer_id - 1])
|
||||||
svc_prev_layer_dropped = 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_drop_frame(cpi)) {
|
||||||
vp9_rc_postencode_update_drop_frame(cpi);
|
vp9_rc_postencode_update_drop_frame(cpi);
|
||||||
cpi->ext_refresh_frame_flags_pending = 0;
|
cpi->ext_refresh_frame_flags_pending = 0;
|
||||||
|
@ -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) {
|
static int check_buffer(VP9_COMP *cpi, int drop_mark) {
|
||||||
SVC *svc = &cpi->svc;
|
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;
|
RATE_CONTROL *const rc = &cpi->rc;
|
||||||
return (rc->buffer_level <= drop_mark);
|
return (rc->buffer_level <= drop_mark);
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
// For SVC in the constrained framedrop mode (svc->framedrop_mode = 1):
|
// For SVC in the constrained framedrop mode (svc->framedrop_mode =
|
||||||
// the condition on buffer (to drop frame) is checked on current and
|
// CONSTRAINED_LAYER_DROP): the condition on buffer (to drop frame) is
|
||||||
// upper spatial layers.
|
// checked on current and upper spatial layers.
|
||||||
for (i = svc->spatial_layer_id; i < svc->number_spatial_layers; ++i) {
|
for (i = svc->spatial_layer_id; i < svc->number_spatial_layers; ++i) {
|
||||||
const int layer = LAYER_IDS_TO_IDX(i, svc->temporal_layer_id,
|
const int layer = LAYER_IDS_TO_IDX(i, svc->temporal_layer_id,
|
||||||
svc->number_temporal_layers);
|
svc->number_temporal_layers);
|
||||||
|
@ -39,7 +39,7 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
|
|||||||
svc->non_reference_frame = 0;
|
svc->non_reference_frame = 0;
|
||||||
svc->skip_enhancement_layer = 0;
|
svc->skip_enhancement_layer = 0;
|
||||||
svc->disable_inter_layer_pred = INTER_LAYER_PRED_ON;
|
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 (i = 0; i < REF_FRAMES; ++i) svc->ref_frame_index[i] = -1;
|
||||||
for (sl = 0; sl < oxcf->ss_number_layers; ++sl) {
|
for (sl = 0; sl < oxcf->ss_number_layers; ++sl) {
|
||||||
|
@ -115,7 +115,7 @@ typedef struct SVC {
|
|||||||
int last_layer_dropped[VPX_MAX_LAYERS];
|
int last_layer_dropped[VPX_MAX_LAYERS];
|
||||||
int drop_spatial_layer[VPX_MAX_LAYERS];
|
int drop_spatial_layer[VPX_MAX_LAYERS];
|
||||||
int framedrop_thresh[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;
|
INTER_LAYER_PRED disable_inter_layer_pred;
|
||||||
} SVC;
|
} SVC;
|
||||||
|
18
vpx/vp8cx.h
18
vpx/vp8cx.h
@ -748,7 +748,7 @@ typedef struct vpx_svc_layer_id {
|
|||||||
int temporal_layer_id; /**< Temporal layer id number. */
|
int temporal_layer_id; /**< Temporal layer id number. */
|
||||||
} vpx_svc_layer_id_t;
|
} 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
|
* This defines the frame flags and buffer indices for each spatial layer for
|
||||||
* svc encoding.
|
* svc encoding.
|
||||||
@ -763,7 +763,18 @@ typedef struct vpx_svc_ref_frame_config {
|
|||||||
int alt_fb_idx[VPX_TS_MAX_LAYERS]; /**< Altref buffer index. */
|
int alt_fb_idx[VPX_TS_MAX_LAYERS]; /**< Altref buffer index. */
|
||||||
} vpx_svc_ref_frame_config_t;
|
} 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
|
* This defines the frame drop thresholds for each spatial layer, and the
|
||||||
* the frame dropping mode: 0 = layer based frame dropping (default),
|
* 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 {
|
typedef struct vpx_svc_frame_drop {
|
||||||
int framedrop_thresh[VPX_SS_MAX_LAYERS]; /**< Frame drop thresholds */
|
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;
|
} vpx_svc_frame_drop_t;
|
||||||
|
|
||||||
/*!\cond */
|
/*!\cond */
|
||||||
|
Loading…
Reference in New Issue
Block a user