summaryrefslogtreecommitdiff
path: root/python/openvino/runtime/streaming/image_streaming_app/layout_transform/source
diff options
context:
space:
mode:
authorEric Dao <eric@erickhangdao.com>2025-03-10 17:54:31 -0400
committerEric Dao <eric@erickhangdao.com>2025-03-10 17:54:31 -0400
commitab224e2e6ba65f5a369ec392f99cd8845ad06c98 (patch)
treea1e757e9341863ed52b8ad4c5a1c45933aab9da4 /python/openvino/runtime/streaming/image_streaming_app/layout_transform/source
parent40da1752f2c8639186b72f6838aa415e854d0b1d (diff)
downloadthesis-master.tar.gz
thesis-master.tar.bz2
thesis-master.zip
completed thesisHEADmaster
Diffstat (limited to 'python/openvino/runtime/streaming/image_streaming_app/layout_transform/source')
-rw-r--r--python/openvino/runtime/streaming/image_streaming_app/layout_transform/source/LayoutTransform.cpp51
-rw-r--r--python/openvino/runtime/streaming/image_streaming_app/layout_transform/source/LayoutTransform.h38
2 files changed, 89 insertions, 0 deletions
diff --git a/python/openvino/runtime/streaming/image_streaming_app/layout_transform/source/LayoutTransform.cpp b/python/openvino/runtime/streaming/image_streaming_app/layout_transform/source/LayoutTransform.cpp
new file mode 100644
index 0000000..a045b6a
--- /dev/null
+++ b/python/openvino/runtime/streaming/image_streaming_app/layout_transform/source/LayoutTransform.cpp
@@ -0,0 +1,51 @@
+// Copyright 2023 Intel Corporation.
+//
+// This software and the related documents are Intel copyrighted materials,
+// and your use of them is governed by the express license under which they
+// were provided to you ("License"). Unless the License provides otherwise,
+// you may not use, modify, copy, publish, distribute, disclose or transmit
+// this software or the related documents without Intel's prior written
+// permission.
+//
+// This software and the related documents are provided as is, with no express
+// or implied warranties, other than those that are expressly stated in the
+// License.
+
+#include "LayoutTransform.h"
+#include <thread>
+
+std::shared_ptr<ILayoutTransform> ILayoutTransform::Create() { return std::make_shared<LayoutTransform>(); }
+
+LayoutTransform::LayoutTransform() { _spUioDevice = UIO::IDevice::Load("layout_transform"); }
+
+static uint32_t FloatToUint32(float value) {
+ union FloatAndUint32 {
+ float _floatValue;
+ uint32_t _uint32Value;
+ };
+ FloatAndUint32 convertType;
+ convertType._floatValue = value;
+ return convertType._uint32Value;
+}
+
+void LayoutTransform::SetConfiguration(Configuration& configuration) {
+ _configuration = configuration;
+
+ if (_spUioDevice) {
+ _spUioDevice->Write((uint32_t)RegisterMap::RESET, 1u);
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ _spUioDevice->Write((uint32_t)RegisterMap::RESET, 0u);
+
+ _spUioDevice->Write((uint32_t)RegisterMap::C_VECT, _configuration._cVector);
+ _spUioDevice->Write((uint32_t)RegisterMap::WIDTH, _configuration._width);
+ _spUioDevice->Write((uint32_t)RegisterMap::HEIGHT, _configuration._height);
+
+ _spUioDevice->Write((uint32_t)RegisterMap::VARIANCES + 0, FloatToUint32(_configuration._blueVariance));
+ _spUioDevice->Write((uint32_t)RegisterMap::VARIANCES + 1, FloatToUint32(_configuration._greenVariance));
+ _spUioDevice->Write((uint32_t)RegisterMap::VARIANCES + 2, FloatToUint32(_configuration._redVariance));
+
+ _spUioDevice->Write((uint32_t)RegisterMap::SHIFTS + 0, FloatToUint32(_configuration._blueShift));
+ _spUioDevice->Write((uint32_t)RegisterMap::SHIFTS + 1, FloatToUint32(_configuration._greenShift));
+ _spUioDevice->Write((uint32_t)RegisterMap::SHIFTS + 2, FloatToUint32(_configuration._redShift));
+ }
+}
diff --git a/python/openvino/runtime/streaming/image_streaming_app/layout_transform/source/LayoutTransform.h b/python/openvino/runtime/streaming/image_streaming_app/layout_transform/source/LayoutTransform.h
new file mode 100644
index 0000000..3d67a5d
--- /dev/null
+++ b/python/openvino/runtime/streaming/image_streaming_app/layout_transform/source/LayoutTransform.h
@@ -0,0 +1,38 @@
+// Copyright 2023 Intel Corporation.
+//
+// This software and the related documents are Intel copyrighted materials,
+// and your use of them is governed by the express license under which they
+// were provided to you ("License"). Unless the License provides otherwise,
+// you may not use, modify, copy, publish, distribute, disclose or transmit
+// this software or the related documents without Intel's prior written
+// permission.
+//
+// This software and the related documents are provided as is, with no express
+// or implied warranties, other than those that are expressly stated in the
+// License.
+
+#pragma once
+#include <memory>
+#include "ILayoutTransform.h"
+#include "IUioDevice.h"
+
+enum class RegisterMap : uint32_t {
+ RESET = 0,
+ C_VECT,
+ WIDTH,
+ HEIGHT,
+ VARIANCES = 0x10, // to 0x1f
+ SHIFTS = 0x20, // to 0x2f
+};
+
+class LayoutTransform : public ILayoutTransform {
+ public:
+ LayoutTransform();
+
+ // ILayoutTransform interface
+ void SetConfiguration(Configuration& configuration) override;
+
+ private:
+ ILayoutTransform::Configuration _configuration = {};
+ std::shared_ptr<UIO::IDevice> _spUioDevice;
+};