summaryrefslogtreecommitdiff
path: root/python/openvino/runtime/common/format_reader/format_reader.cpp
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/common/format_reader/format_reader.cpp
parent40da1752f2c8639186b72f6838aa415e854d0b1d (diff)
downloadthesis-master.tar.gz
thesis-master.tar.bz2
thesis-master.zip
completed thesisHEADmaster
Diffstat (limited to 'python/openvino/runtime/common/format_reader/format_reader.cpp')
-rw-r--r--python/openvino/runtime/common/format_reader/format_reader.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/python/openvino/runtime/common/format_reader/format_reader.cpp b/python/openvino/runtime/common/format_reader/format_reader.cpp
new file mode 100644
index 0000000..94a8441
--- /dev/null
+++ b/python/openvino/runtime/common/format_reader/format_reader.cpp
@@ -0,0 +1,44 @@
+// Copyright (C) 2018-2022 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <iostream>
+
+// clang-format off
+#include "bmp.h"
+#include "MnistUbyte.h"
+#include "yuv_nv12.h"
+#include "opencv_wrapper.h"
+#include "format_reader.h"
+// clang-format on
+
+using namespace FormatReader;
+
+std::vector<Registry::CreatorFunction> Registry::_data;
+
+Register<MnistUbyte> MnistUbyte::reg;
+Register<YUV_NV12> YUV_NV12::reg;
+#ifdef USE_OPENCV
+Register<OCVReader> OCVReader::reg;
+#else
+Register<BitMap> BitMap::reg;
+#endif
+
+Reader* Registry::CreateReader(const char* filename) {
+ for (const auto &maker : _data) {
+ Reader* ol = maker(filename);
+ if (ol != nullptr && ol->size() != 0)
+ return ol;
+ if (ol != nullptr)
+ delete ol;
+ }
+ return nullptr;
+}
+
+void Registry::RegisterReader(CreatorFunction f) {
+ _data.push_back(f);
+}
+
+FORMAT_READER_API(Reader*) CreateFormatReader(const char* filename) {
+ return Registry::CreateReader(filename);
+}