diff options
Diffstat (limited to 'test/ipa')
-rw-r--r-- | test/ipa/ipa_interface_test.cpp | 12 | ||||
-rw-r--r-- | test/ipa/libipa/interpolator.cpp | 54 | ||||
-rw-r--r-- | test/ipa/libipa/meson.build | 15 | ||||
-rw-r--r-- | test/ipa/meson.build | 3 | ||||
-rw-r--r-- | test/ipa/rkisp1/meson.build | 2 |
5 files changed, 77 insertions, 9 deletions
diff --git a/test/ipa/ipa_interface_test.cpp b/test/ipa/ipa_interface_test.cpp index e840f6ab..b8178366 100644 --- a/test/ipa/ipa_interface_test.cpp +++ b/test/ipa/ipa_interface_test.cpp @@ -20,11 +20,11 @@ #include <libcamera/base/thread.h> #include <libcamera/base/timer.h> +#include "libcamera/internal/camera_manager.h" #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/ipa_manager.h" #include "libcamera/internal/ipa_module.h" #include "libcamera/internal/pipeline_handler.h" -#include "libcamera/internal/process.h" #include "test.h" @@ -44,20 +44,20 @@ public: { delete notifier_; ipa_.reset(); - ipaManager_.reset(); + cameraManager_.reset(); } protected: int init() override { - ipaManager_ = make_unique<IPAManager>(); + cameraManager_ = make_unique<CameraManager>(); /* Create a pipeline handler for vimc. */ const std::vector<PipelineHandlerFactoryBase *> &factories = PipelineHandlerFactoryBase::factories(); for (const PipelineHandlerFactoryBase *factory : factories) { if (factory->name() == "vimc") { - pipe_ = factory->create(nullptr); + pipe_ = factory->create(cameraManager_.get()); break; } } @@ -171,11 +171,9 @@ private: } } - ProcessManager processManager_; - std::shared_ptr<PipelineHandler> pipe_; std::unique_ptr<ipa::vimc::IPAProxyVimc> ipa_; - std::unique_ptr<IPAManager> ipaManager_; + std::unique_ptr<CameraManager> cameraManager_; enum ipa::vimc::IPAOperationCode trace_; EventNotifier *notifier_; int fd_; diff --git a/test/ipa/libipa/interpolator.cpp b/test/ipa/libipa/interpolator.cpp new file mode 100644 index 00000000..6abb7760 --- /dev/null +++ b/test/ipa/libipa/interpolator.cpp @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2024, Ideas on Board Oy + * + * Interpolator tests + */ + +#include "../src/ipa/libipa/interpolator.h" + +#include <cmath> +#include <iostream> +#include <map> +#include <stdint.h> +#include <stdio.h> + +#include "test.h" + +using namespace std; +using namespace libcamera; +using namespace ipa; + +#define ASSERT_EQ(a, b) \ + if ((a) != (b)) { \ + printf(#a " != " #b "\n"); \ + return TestFail; \ + } + +class InterpolatorTest : public Test +{ +protected: + int run() + { + Interpolator<int> interpolator; + interpolator.setData({ { 10, 100 }, { 20, 200 }, { 30, 300 } }); + + ASSERT_EQ(interpolator.getInterpolated(0), 100); + ASSERT_EQ(interpolator.getInterpolated(10), 100); + ASSERT_EQ(interpolator.getInterpolated(20), 200); + ASSERT_EQ(interpolator.getInterpolated(25), 250); + ASSERT_EQ(interpolator.getInterpolated(30), 300); + ASSERT_EQ(interpolator.getInterpolated(40), 300); + + interpolator.setQuantization(10); + unsigned int q = 0; + ASSERT_EQ(interpolator.getInterpolated(25, &q), 300); + ASSERT_EQ(q, 30); + ASSERT_EQ(interpolator.getInterpolated(24, &q), 200); + ASSERT_EQ(q, 20); + + return TestPass; + } +}; + +TEST_REGISTER(InterpolatorTest) diff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build new file mode 100644 index 00000000..4d2427db --- /dev/null +++ b/test/ipa/libipa/meson.build @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: CC0-1.0 + +libipa_test = [ + {'name': 'interpolator', 'sources': ['interpolator.cpp']}, +] + +foreach test : libipa_test + exe = executable(test['name'], test['sources'], + dependencies : [libcamera_private, libipa_dep], + link_with : [test_libraries], + include_directories : [test_includes_internal, + '../../../src/ipa/libipa/']) + + test(test['name'], exe, suite : 'ipa') +endforeach diff --git a/test/ipa/meson.build b/test/ipa/meson.build index fe21ca58..63820de5 100644 --- a/test/ipa/meson.build +++ b/test/ipa/meson.build @@ -1,5 +1,6 @@ # SPDX-License-Identifier: CC0-1.0 +subdir('libipa') subdir('rkisp1') ipa_test = [ @@ -8,7 +9,7 @@ ipa_test = [ ] foreach test : ipa_test - exe = executable(test['name'], test['sources'], libcamera_generated_ipa_headers, + exe = executable(test['name'], test['sources'], dependencies : [libcamera_private, libipa_dep], link_with : [test_libraries], include_directories : [test_includes_internal]) diff --git a/test/ipa/rkisp1/meson.build b/test/ipa/rkisp1/meson.build index 5b08e293..894523da 100644 --- a/test/ipa/rkisp1/meson.build +++ b/test/ipa/rkisp1/meson.build @@ -5,7 +5,7 @@ rkisp1_ipa_test = [ ] foreach test : rkisp1_ipa_test - exe = executable(test['name'], test['sources'], libcamera_generated_ipa_headers, + exe = executable(test['name'], test['sources'], dependencies : [libcamera_private, libipa_dep], link_with : [test_libraries], include_directories : [test_includes_internal, |