aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDichenZhang1 <140119224+DichenZhang1@users.noreply.github.com>2023-12-12 18:34:48 -0800
committerGitHub <noreply@github.com>2023-12-12 18:34:48 -0800
commitfd468466f4ff2d44ebc28b51e521929305aea096 (patch)
treea28712302410e742e548a7d80a6975b3ec30a528
parent7ce766b227cd1a831c51e2cd3f267e3527ed82c3 (diff)
parenta32d418b6efc32bb052be373aaf2c14ddc34e4bf (diff)
downloadlibultrahdr-fd468466f4ff2d44ebc28b51e521929305aea096.tar.gz
Merge pull request #50 from ittiam-systems/benchmark_update
Run benchmark tests on android device from host
-rw-r--r--README.md7
-rw-r--r--benchmark/AndroidTest.xml37
-rw-r--r--benchmark/DynamicConfig.xml20
-rw-r--r--benchmark/benchmark_test.cpp4
4 files changed, 67 insertions, 1 deletions
diff --git a/README.md b/README.md
index 1133b04..04ef31e 100644
--- a/README.md
+++ b/README.md
@@ -124,7 +124,12 @@ NOTE: To not build unit tests, skip passing -DUHDR_BUILD_TESTS=1
### Building Benchmark
- cmake {cmake_options} -DUHDR_BUILD_BENCHMARK=1
+To build benchmarks, pass -DUHDR_BUILD_BENCHMARK=1 to cmake configure command and build.
+
+This will additionally generate,
+
+**ultrahdr_bm**<br> Benchmark tests
+
### Building Fuzzers
diff --git a/benchmark/AndroidTest.xml b/benchmark/AndroidTest.xml
new file mode 100644
index 0000000..f002f65
--- /dev/null
+++ b/benchmark/AndroidTest.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for ultrahdr benchmark tests">
+ <option name="test-suite-tag" value="ultrahdr_benchmark" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="ultrahdr_benchmark->/data/local/tmp/ultrahdr_benchmark/" />
+ </target_preparer>
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+ <option name="target" value="host" />
+ <option name="config-filename" value="ultrahdr_benchmark" />
+ <option name="version" value="1.0"/>
+ </target_preparer>
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.MediaPreparer">
+ <option name="push-all" value="true" />
+ <option name="media-folder-name" value="UltrahdrBenchmarkTestRes-1.0"/>
+ <option name="dynamic-config-module" value="ultrahdr_benchmark" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.GoogleBenchmarkTest" >
+ <option name="native-benchmark-device-path" value="/data/local/tmp" />
+ <option name="benchmark-module-name" value="ultrahdr_benchmark" />
+ <option name="file-exclusion-filter-regex" value=".*/bench_[^/]*$" />
+ </test>
+</configuration>
diff --git a/benchmark/DynamicConfig.xml b/benchmark/DynamicConfig.xml
new file mode 100644
index 0000000..9953ef2
--- /dev/null
+++ b/benchmark/DynamicConfig.xml
@@ -0,0 +1,20 @@
+<!-- Copyright (C) 2023 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<dynamicConfig>
+ <entry key="media_files_url">
+ <value>https://storage.googleapis.com/android_media/external/libultrahdr/benchmark/UltrahdrBenchmarkTestRes-1.0.zip</value>
+ </entry>
+</dynamicConfig> \ No newline at end of file
diff --git a/benchmark/benchmark_test.cpp b/benchmark/benchmark_test.cpp
index 024937e..13b136b 100644
--- a/benchmark/benchmark_test.cpp
+++ b/benchmark/benchmark_test.cpp
@@ -23,7 +23,11 @@
using namespace ultrahdr;
+#ifdef __ANDROID__
+std::string kTestImagesPath = "/sdcard/test/UltrahdrBenchmarkTestRes-1.0/";
+#else
std::string kTestImagesPath = "./data/UltrahdrBenchmarkTestRes-1.0/";
+#endif
std::vector<std::string> kDecodeAPITestImages{
// 12mp test vectors