Make example tests run on realtime only build.
Bug: aomedia:3001
Change-Id: Ibc68cc6bbc2906a2d30d1da091baa3333463ccd0
diff --git a/examples/aom_cx_set_ref.c b/examples/aom_cx_set_ref.c
index 3aea2cf..da36d9f 100644
--- a/examples/aom_cx_set_ref.c
+++ b/examples/aom_cx_set_ref.c
@@ -271,7 +271,11 @@
printf("Using %s\n", aom_codec_iface_name(encoder));
+#if CONFIG_REALTIME_ONLY
+ res = aom_codec_enc_config_default(encoder, &cfg, 1);
+#else
res = aom_codec_enc_config_default(encoder, &cfg, 0);
+#endif
if (res) die_codec(&ecodec, "Failed to get default codec config.");
cfg.g_w = info.frame_width;
@@ -334,6 +338,12 @@
die_codec(&ecodec, "Failed to set encoder reference frame");
printf(" <SET_REF>");
+#if CONFIG_REALTIME_ONLY
+ // Set cpu speed in encoder.
+ if (aom_codec_control(&ecodec, AOME_SET_CPUUSED, 7))
+ die_codec(&ecodec, "Failed to set cpu speed");
+#endif
+
// If set_reference in decoder is commented out, the enc/dec mismatch
// would be seen.
if (test_decode) {
diff --git a/examples/set_maps.c b/examples/set_maps.c
index 69b4bcc..5a84faa 100644
--- a/examples/set_maps.c
+++ b/examples/set_maps.c
@@ -129,6 +129,14 @@
const int fps = 2; // TODO(dkovalev) add command line argument
const double bits_per_pixel_per_frame = 0.067;
+#if CONFIG_REALTIME_ONLY
+ const int usage = 1;
+ const int speed = 7;
+#else
+ const int usage = 0;
+ const int speed = 2;
+#endif
+
exec_name = argv[0];
if (argc != 6) die("Invalid number of arguments");
@@ -157,7 +165,7 @@
printf("Using %s\n", aom_codec_iface_name(encoder));
- res = aom_codec_enc_config_default(encoder, &cfg, 0);
+ res = aom_codec_enc_config_default(encoder, &cfg, usage);
if (res) die_codec(&codec, "Failed to get default codec config.");
cfg.g_w = info.frame_width;
@@ -177,7 +185,7 @@
if (aom_codec_enc_init(&codec, encoder, &cfg, 0))
die("Failed to initialize encoder");
- if (aom_codec_control(&codec, AOME_SET_CPUUSED, 2))
+ if (aom_codec_control(&codec, AOME_SET_CPUUSED, speed))
die_codec(&codec, "Failed to set cpu-used");
// Encode frames.
diff --git a/examples/simple_encoder.c b/examples/simple_encoder.c
index 682fe98..c026706 100644
--- a/examples/simple_encoder.c
+++ b/examples/simple_encoder.c
@@ -163,6 +163,13 @@
const char *infile_arg = NULL;
const char *outfile_arg = NULL;
const char *keyframe_interval_arg = NULL;
+#if CONFIG_REALTIME_ONLY
+ const int usage = 1;
+ const int speed = 7;
+#else
+ const int usage = 0;
+ const int speed = 2;
+#endif
exec_name = argv[0];
@@ -204,7 +211,7 @@
printf("Using %s\n", aom_codec_iface_name(encoder));
- res = aom_codec_enc_config_default(encoder, &cfg, 0);
+ res = aom_codec_enc_config_default(encoder, &cfg, usage);
if (res) die_codec(&codec, "Failed to get default codec config.");
cfg.g_w = info.frame_width;
@@ -223,7 +230,7 @@
if (aom_codec_enc_init(&codec, encoder, &cfg, 0))
die("Failed to initialize encoder");
- if (aom_codec_control(&codec, AOME_SET_CPUUSED, 2))
+ if (aom_codec_control(&codec, AOME_SET_CPUUSED, speed))
die_codec(&codec, "Failed to set cpu-used");
// Encode frames.
diff --git a/test/aomdec.sh b/test/aomdec.sh
index eda18bb..b03c42a 100755
--- a/test/aomdec.sh
+++ b/test/aomdec.sh
@@ -147,12 +147,16 @@
}
aomdec_tests="aomdec_av1_ivf
- aomdec_av1_ivf_error_resilient
aomdec_av1_ivf_multithread
aomdec_av1_ivf_multithread_row_mt
- aomdec_aom_ivf_pipe_input
- aomdec_av1_obu_annexb
- aomdec_av1_obu_section5
- aomdec_av1_webm"
+ aomdec_aom_ivf_pipe_input"
+
+if [ ! "$(realtime_only_build)" = "yes" ]; then
+ aomdec_tests="${aomdec_tests}
+ aomdec_av1_ivf_error_resilient
+ aomdec_av1_obu_annexb
+ aomdec_av1_obu_section5
+ aomdec_av1_webm"
+fi
run_tests aomdec_verify_environment "${aomdec_tests}"
diff --git a/test/aomenc.sh b/test/aomenc.sh
index 86fe5f6..ed98313 100755
--- a/test/aomenc.sh
+++ b/test/aomenc.sh
@@ -98,6 +98,24 @@
fi
}
+aomenc_av1_ivf_rt() {
+ if [ "$(aomenc_can_encode_av1)" = "yes" ]; then
+ local output="${AV1_IVF_FILE}"
+ if [ -e "${AV1_IVF_FILE}" ]; then
+ output="${AOM_TEST_OUTPUT_DIR}/av1_test.ivf"
+ fi
+ aomenc $(yuv_raw_input) \
+ $(aomenc_encode_test_rt_params) \
+ --ivf \
+ --output="${output}" || return 1
+
+ if [ ! -e "${output}" ]; then
+ elog "Output file does not exist."
+ return 1
+ fi
+ fi
+}
+
aomenc_av1_ivf_use_16bit_internal() {
if [ "$(aomenc_can_encode_av1)" = "yes" ]; then
local output="${AV1_IVF_FILE}"
@@ -274,16 +292,21 @@
fi
}
-aomenc_tests="aomenc_av1_ivf
- aomenc_av1_obu_annexb
- aomenc_av1_obu_section5
- aomenc_av1_webm
- aomenc_av1_webm_1pass
- aomenc_av1_ivf_lossless
- aomenc_av1_ivf_minq0_maxq0
- aomenc_av1_ivf_use_16bit_internal
- aomenc_av1_webm_lag5_frames10
- aomenc_av1_webm_non_square_par
- aomenc_av1_webm_cdf_update_mode"
+if [ "$(realtime_only_build)" = "yes" ]; then
+ aomenc_tests="aomenc_av1_ivf_rt"
+else
+ aomenc_tests="aomenc_av1_ivf
+ aomenc_av1_ivf_rt
+ aomenc_av1_obu_annexb
+ aomenc_av1_obu_section5
+ aomenc_av1_webm
+ aomenc_av1_webm_1pass
+ aomenc_av1_ivf_lossless
+ aomenc_av1_ivf_minq0_maxq0
+ aomenc_av1_ivf_use_16bit_internal
+ aomenc_av1_webm_lag5_frames10
+ aomenc_av1_webm_non_square_par
+ aomenc_av1_webm_cdf_update_mode"
+fi
run_tests aomenc_verify_environment "${aomenc_tests}"
diff --git a/test/dump_obu.sh b/test/dump_obu.sh
index 7dcab94..933db64 100755
--- a/test/dump_obu.sh
+++ b/test/dump_obu.sh
@@ -45,14 +45,21 @@
encode_test_file() {
if [ "$(aomenc_available)" = "yes" ]; then
local encoder="$(aom_tool_path aomenc)"
-
- eval "${encoder}" \
- $(aomenc_encode_test_fast_params) \
- $(yuv_raw_input) \
- --ivf \
- --output=${dump_obu_test_file} \
- ${devnull} || return 1
-
+ if [ "$(realtime_only_build)" = "yes" ]; then
+ eval "${encoder}" \
+ $(aomenc_encode_test_rt_params) \
+ $(yuv_raw_input) \
+ --ivf \
+ --output=${dump_obu_test_file} \
+ ${devnull} || return 1
+ else
+ eval "${encoder}" \
+ $(aomenc_encode_test_fast_params) \
+ $(yuv_raw_input) \
+ --ivf \
+ --output=${dump_obu_test_file} \
+ ${devnull} || return 1
+ fi
if [ ! -e "${dump_obu_test_file}" ]; then
elog "dump_obu test input encode failed."
return 1
diff --git a/test/examples.sh b/test/examples.sh
index 2cdb89d..87d8c2b 100755
--- a/test/examples.sh
+++ b/test/examples.sh
@@ -17,6 +17,10 @@
# List of script names to exclude.
exclude_list="best_encode examples run_encodes tools_common"
+if [ "$(realtime_only_build)" = "yes" ]; then
+ exclude_list="${exclude_list} twopass_encoder simple_decoder lightfield_test"
+fi
+
# Filter out the scripts in $exclude_list.
for word in ${exclude_list}; do
example_tests=$(filter_strings "${example_tests}" "${word}" exclude)
diff --git a/test/tools_common.sh b/test/tools_common.sh
index d40709b..4722422 100755
--- a/test/tools_common.sh
+++ b/test/tools_common.sh
@@ -202,12 +202,43 @@
--test-decode=fatal"
}
+# Echoes realtime encode params for use with aomenc.
+aomenc_encode_test_rt_params() {
+ echo "--limit=${AV1_ENCODE_TEST_FRAME_LIMIT}
+ --test-decode=fatal
+ --enable-tpl-model=0
+ --deltaq-mode=0
+ --enable-order-hint=0
+ --profile=0
+ --static-thresh=0
+ --end-usage=cbr
+ --cpu-used=7
+ --passes=1
+ --usage=1
+ --lag-in-frames=0
+ --aq-mode=3
+ --enable-obmc=0
+ --enable-warped-motion=0
+ --enable-ref-frame-mvs=0
+ --enable-cdef=1
+ --enable-order-hint=0
+ --coeff-cost-upd-freq=3
+ --mode-cost-upd-freq=3
+ --mv-cost-upd-freq=3"
+}
+
# Echoes yes to stdout when aom_config_option_enabled() reports yes for
# CONFIG_WEBM_IO.
webm_io_available() {
[ "$(aom_config_option_enabled CONFIG_WEBM_IO)" = "yes" ] && echo yes
}
+# Echoes yes to stdout when aom_config_option_enabled() reports yes for
+# CONFIG_REALTIME_ONLY.
+realtime_only_build() {
+ [ "$(aom_config_option_enabled CONFIG_REALTIME_ONLY)" = "yes" ] && echo yes
+}
+
# Filters strings from $1 using the filter specified by $2. Filter behavior
# depends on the presence of $3. When $3 is present, strings that match the
# filter are excluded. When $3 is omitted, strings matching the filter are