From 2865de86ec98345be11eba285d4172c1600871e6 Mon Sep 17 00:00:00 2001 From: Jerome Jiang Date: Tue, 14 Feb 2017 19:09:15 -0800 Subject: [PATCH] vpx_temporal_svc_encoder: Expose error resilient control to cmd line. Change-Id: Ic74a8690b136ffbc370080f70b2d5a6b1572bf63 --- examples/vpx_temporal_svc_encoder.c | 27 +++++++++++++++++---------- test/vpx_temporal_svc_encoder.sh | 3 ++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/examples/vpx_temporal_svc_encoder.c b/examples/vpx_temporal_svc_encoder.c index b90698083..d5bf04caa 100644 --- a/examples/vpx_temporal_svc_encoder.c +++ b/examples/vpx_temporal_svc_encoder.c @@ -495,6 +495,7 @@ int main(int argc, char **argv) { vpx_codec_err_t res; unsigned int width; unsigned int height; + uint32_t error_resilient = 0; int speed; int frame_avail; int got_data; @@ -514,7 +515,7 @@ int main(int argc, char **argv) { FILE *infile = NULL; struct RateControlMetrics rc; int64_t cx_time = 0; - const int min_args_base = 12; + const int min_args_base = 13; #if CONFIG_VP9_HIGHBITDEPTH vpx_bit_depth_t bit_depth = VPX_BITS_8; int input_bit_depth = 8; @@ -531,12 +532,14 @@ int main(int argc, char **argv) { if (argc < min_args) { #if CONFIG_VP9_HIGHBITDEPTH die("Usage: %s " - " " + " " + " " " ... \n", argv[0]); #else die("Usage: %s " - " " + " " + " " " ... \n", argv[0]); #endif // CONFIG_VP9_HIGHBITDEPTH @@ -553,9 +556,9 @@ int main(int argc, char **argv) { die("Invalid resolution: %d x %d", width, height); } - layering_mode = (int)strtol(argv[11], NULL, 0); + layering_mode = (int)strtol(argv[12], NULL, 0); if (layering_mode < 0 || layering_mode > 13) { - die("Invalid layering mode (0..12) %s", argv[11]); + die("Invalid layering mode (0..12) %s", argv[12]); } if (argc != min_args + mode_to_num_layers[layering_mode]) { @@ -619,11 +622,11 @@ int main(int argc, char **argv) { for (i = min_args_base; (int)i < min_args_base + mode_to_num_layers[layering_mode]; ++i) { - rc.layer_target_bitrate[i - 12] = (int)strtol(argv[i], NULL, 0); + rc.layer_target_bitrate[i - 13] = (int)strtol(argv[i], NULL, 0); if (strncmp(encoder->name, "vp8", 3) == 0) - cfg.ts_target_bitrate[i - 12] = rc.layer_target_bitrate[i - 12]; + cfg.ts_target_bitrate[i - 13] = rc.layer_target_bitrate[i - 13]; else if (strncmp(encoder->name, "vp9", 3) == 0) - cfg.layer_target_bitrate[i - 12] = rc.layer_target_bitrate[i - 12]; + cfg.layer_target_bitrate[i - 13] = rc.layer_target_bitrate[i - 13]; } // Real time parameters. @@ -642,10 +645,14 @@ int main(int argc, char **argv) { cfg.rc_resize_allowed = 0; // Use 1 thread as default. - cfg.g_threads = (unsigned int)strtoul(argv[10], NULL, 0); + cfg.g_threads = (unsigned int)strtoul(argv[11], NULL, 0); + error_resilient = (uint32_t)strtoul(argv[10], NULL, 0); + if (error_resilient != 0 && error_resilient != 1) { + die("Invalid value for error resilient (0, 1): %d.", error_resilient); + } // Enable error resilient mode. - cfg.g_error_resilient = 1; + cfg.g_error_resilient = error_resilient; cfg.g_lag_in_frames = 0; cfg.kf_mode = VPX_KF_AUTO; diff --git a/test/vpx_temporal_svc_encoder.sh b/test/vpx_temporal_svc_encoder.sh index 6b6d15e7f..49492a1a8 100755 --- a/test/vpx_temporal_svc_encoder.sh +++ b/test/vpx_temporal_svc_encoder.sh @@ -41,6 +41,7 @@ vpx_tsvc_encoder() { local speed="6" local frame_drop_thresh="30" local max_threads="4" + local error_resilient="1" shift 2 @@ -54,7 +55,7 @@ vpx_tsvc_encoder() { eval "${VPX_TEST_PREFIX}" "${encoder}" "${YUV_RAW_INPUT}" "${output_file}" \ "${codec}" "${YUV_RAW_INPUT_WIDTH}" "${YUV_RAW_INPUT_HEIGHT}" \ "${timebase_num}" "${timebase_den}" "${speed}" "${frame_drop_thresh}" \ - "${threads}" "$@" \ + "${error_resilient}" "${threads}" "$@" \ ${devnull} done }