ref: 86c36a504dd7834e934707b86aa81ceb6384154c
parent: 0ca5908ff6a403ab4a792fac4bd165fb642fc90c
author: Minghai Shang <[email protected]>
date: Tue Nov 4 06:46:48 EST 2014
[spatial svc] Make spatial svc working for one pass rate control Change-Id: Ibd9114485c3d747f9d148f64f706bf873ea473ac
--- a/examples/vp9_spatial_svc_encoder.c
+++ b/examples/vp9_spatial_svc_encoder.c
@@ -60,6 +60,11 @@
ARG_DEF(NULL, "min-bitrate", 1, "Minimum bitrate");
static const arg_def_t max_bitrate_arg =
ARG_DEF(NULL, "max-bitrate", 1, "Maximum bitrate");
+static const arg_def_t lag_in_frame_arg =
+ ARG_DEF(NULL, "lag-in-frames", 1, "Number of frame to input before "
+ "generating any outputs");
+static const arg_def_t rc_end_usage_arg =
+ ARG_DEF(NULL, "rc-end-usage", 1, "0 - 3: VBR, CBR, CQ, Q");
#if CONFIG_VP9_HIGHBITDEPTH
static const struct arg_enum_list bitdepth_enum[] = {
@@ -80,11 +85,11 @@
&timebase_arg, &bitrate_arg, &skip_frames_arg, &spatial_layers_arg,
&kf_dist_arg, &scale_factors_arg, &passes_arg, &pass_arg,
&fpf_name_arg, &min_q_arg, &max_q_arg, &min_bitrate_arg,
- &max_bitrate_arg, &temporal_layers_arg,
+ &max_bitrate_arg, &temporal_layers_arg, &lag_in_frame_arg,
#if CONFIG_VP9_HIGHBITDEPTH
&bitdepth_arg,
#endif
- NULL
+ &rc_end_usage_arg, NULL
};
static const uint32_t default_frames_to_skip = 0;
@@ -207,6 +212,10 @@
min_bitrate = arg_parse_uint(&arg);
} else if (arg_match(&arg, &max_bitrate_arg, argi)) {
max_bitrate = arg_parse_uint(&arg);
+ } else if (arg_match(&arg, &lag_in_frame_arg, argi)) {
+ enc_cfg->g_lag_in_frames = arg_parse_uint(&arg);
+ } else if (arg_match(&arg, &rc_end_usage_arg, argi)) {
+ enc_cfg->rc_end_usage = arg_parse_uint(&arg);
#if CONFIG_VP9_HIGHBITDEPTH
} else if (arg_match(&arg, &bitdepth_arg, argi)) {
enc_cfg->g_bit_depth = arg_parse_enum_or_int(&arg);
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -584,7 +584,7 @@
if ((cpi->svc.number_temporal_layers > 1 && cpi->oxcf.rc_mode == VPX_CBR) ||
((cpi->svc.number_temporal_layers > 1 ||
cpi->svc.number_spatial_layers > 1) &&
- cpi->oxcf.pass == 2)) {
+ cpi->oxcf.pass != 1)) {
vp9_init_layer_context(cpi);
}
@@ -1285,7 +1285,7 @@
cpi->oxcf.rc_mode == VPX_CBR) ||
((cpi->svc.number_temporal_layers > 1 ||
cpi->svc.number_spatial_layers > 1) &&
- cpi->oxcf.pass == 2)) {
+ cpi->oxcf.pass != 1)) {
vp9_update_layer_context_change_config(cpi,
(int)cpi->oxcf.target_bandwidth);
}
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -531,9 +531,8 @@
static INLINE int is_two_pass_svc(const struct VP9_COMP *const cpi) {
return cpi->use_svc &&
- (cpi->svc.number_temporal_layers > 1 ||
- cpi->svc.number_spatial_layers > 1) &&
- (cpi->oxcf.pass == 1 || cpi->oxcf.pass == 2);
+ ((cpi->svc.number_spatial_layers > 1) ||
+ (cpi->svc.number_temporal_layers > 1 && cpi->oxcf.pass != 0));
}
static INLINE int is_altref_enabled(const VP9_COMP *const cpi) {