summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2021-02-17 17:34:27 -0800
committerJerome Jiang <jianj@google.com>2021-02-18 09:28:45 -0800
commit02392eecccde436a76aca6c86a6fdf643e98eb38 (patch)
tree69f5946359d14274865fa173c7a2637f702fb885
parent24bd0733efad6ee63eda3c49ecb730e316eb2483 (diff)
downloadlibvpx-02392eecccde436a76aca6c86a6fdf643e98eb38.tar.gz
Remove two pass related code from svc sample encoder.
SVC sample encoder is only supposed to be used for realtime SVC. Bug: webm:1705 Change-Id: I5c0c3491732db3e148073aaf7f90ee8d662b57b5
-rw-r--r--examples/vp9_spatial_svc_encoder.c69
1 files changed, 6 insertions, 63 deletions
diff --git a/examples/vp9_spatial_svc_encoder.c b/examples/vp9_spatial_svc_encoder.c
index 630557297..c37e608d1 100644
--- a/examples/vp9_spatial_svc_encoder.c
+++ b/examples/vp9_spatial_svc_encoder.c
@@ -66,12 +66,6 @@ static const arg_def_t kf_dist_arg =
ARG_DEF("k", "kf-dist", 1, "number of frames between keyframes");
static const arg_def_t scale_factors_arg =
ARG_DEF("r", "scale-factors", 1, "scale factors (lowest to highest layer)");
-static const arg_def_t passes_arg =
- ARG_DEF("p", "passes", 1, "Number of passes (1/2)");
-static const arg_def_t pass_arg =
- ARG_DEF(NULL, "pass", 1, "Pass to execute (1/2)");
-static const arg_def_t fpf_name_arg =
- ARG_DEF(NULL, "fpf", 1, "First pass statistics file name");
static const arg_def_t min_q_arg =
ARG_DEF(NULL, "min-q", 1, "Minimum quantizer");
static const arg_def_t max_q_arg =
@@ -125,9 +119,6 @@ static const arg_def_t *svc_args[] = { &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,
@@ -173,8 +164,6 @@ typedef struct {
uint32_t frames_to_skip;
struct VpxInputContext input_ctx;
stats_io_t rc_stats;
- int passes;
- int pass;
int tune_content;
int inter_layer_pred;
} AppInput;
@@ -197,9 +186,6 @@ static void parse_command_line(int argc, const char **argv_,
char **argi = NULL;
char **argj = NULL;
vpx_codec_err_t res;
- int passes = 0;
- int pass = 0;
- const char *fpf_file_name = NULL;
unsigned int min_bitrate = 0;
unsigned int max_bitrate = 0;
char string_options[1024] = { 0 };
@@ -289,18 +275,6 @@ static void parse_command_line(int argc, const char **argv_,
sizeof(string_options) - strlen(string_options) - 1);
strncat(string_options, arg.val,
sizeof(string_options) - strlen(string_options) - 1);
- } else if (arg_match(&arg, &passes_arg, argi)) {
- passes = arg_parse_uint(&arg);
- if (passes < 1 || passes > 2) {
- die("Error: Invalid number of passes (%d)\n", passes);
- }
- } else if (arg_match(&arg, &pass_arg, argi)) {
- pass = arg_parse_uint(&arg);
- if (pass < 1 || pass > 2) {
- die("Error: Invalid pass selected (%d)\n", pass);
- }
- } else if (arg_match(&arg, &fpf_name_arg, argi)) {
- fpf_file_name = arg.val;
} else if (arg_match(&arg, &min_q_arg, argi)) {
strncat(string_options, " min-quantizers=",
sizeof(string_options) - strlen(string_options) - 1);
@@ -355,35 +329,7 @@ static void parse_command_line(int argc, const char **argv_,
if (strlen(string_options) > 0)
vpx_svc_set_options(svc_ctx, string_options + 1);
- if (passes == 0 || passes == 1) {
- if (pass) {
- fprintf(stderr, "pass is ignored since there's only one pass\n");
- }
- enc_cfg->g_pass = VPX_RC_ONE_PASS;
- } else {
- if (pass == 0) {
- die("pass must be specified when passes is 2\n");
- }
-
- if (fpf_file_name == NULL) {
- die("fpf must be specified when passes is 2\n");
- }
-
- if (pass == 1) {
- enc_cfg->g_pass = VPX_RC_FIRST_PASS;
- if (!stats_open_file(&app_input->rc_stats, fpf_file_name, 0)) {
- fatal("Failed to open statistics store");
- }
- } else {
- enc_cfg->g_pass = VPX_RC_LAST_PASS;
- if (!stats_open_file(&app_input->rc_stats, fpf_file_name, 1)) {
- fatal("Failed to open statistics store");
- }
- enc_cfg->rc_twopass_stats_in = stats_get(&app_input->rc_stats);
- }
- app_input->passes = passes;
- app_input->pass = pass;
- }
+ enc_cfg->g_pass = VPX_RC_ONE_PASS;
if (enc_cfg->rc_target_bitrate > 0) {
if (min_bitrate > 0) {
@@ -1004,13 +950,11 @@ int main(int argc, const char **argv) {
info.time_base.numerator = enc_cfg.g_timebase.num;
info.time_base.denominator = enc_cfg.g_timebase.den;
- if (!(app_input.passes == 2 && app_input.pass == 1)) {
- // We don't save the bitstream for the 1st pass on two pass rate control
- writer =
- vpx_video_writer_open(app_input.output_filename, kContainerIVF, &info);
- if (!writer)
- die("Failed to open %s for writing\n", app_input.output_filename);
- }
+ writer =
+ vpx_video_writer_open(app_input.output_filename, kContainerIVF, &info);
+ if (!writer)
+ die("Failed to open %s for writing\n", app_input.output_filename);
+
#if OUTPUT_RC_STATS
// Write out spatial layer stream.
// TODO(marpan/jianj): allow for writing each spatial and temporal stream.
@@ -1230,7 +1174,6 @@ int main(int argc, const char **argv) {
#endif
if (vpx_codec_destroy(&encoder))
die_codec(&encoder, "Failed to destroy codec");
- if (app_input.passes == 2) stats_close(&app_input.rc_stats, 1);
if (writer) {
vpx_video_writer_close(writer);
}