summaryrefslogtreecommitdiff
path: root/python/openvino/runtime/common/format_reader/yuv_nv12.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/yuv_nv12.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/yuv_nv12.cpp')
-rw-r--r--python/openvino/runtime/common/format_reader/yuv_nv12.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/python/openvino/runtime/common/format_reader/yuv_nv12.cpp b/python/openvino/runtime/common/format_reader/yuv_nv12.cpp
new file mode 100644
index 0000000..f25c5cb
--- /dev/null
+++ b/python/openvino/runtime/common/format_reader/yuv_nv12.cpp
@@ -0,0 +1,36 @@
+// Copyright (C) 2018-2022 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+// clang-format off
+#include <fstream>
+#include <iostream>
+#include <string>
+
+#include "yuv_nv12.h"
+// clang-format on
+
+using namespace FormatReader;
+
+YUV_NV12::YUV_NV12(const std::string& filename) {
+ auto pos = filename.rfind('.');
+ if (pos == std::string::npos)
+ return;
+ if (filename.substr(pos + 1) != "yuv")
+ return;
+
+ std::ifstream file(filename, std::ios::binary);
+ if (!file.is_open()) {
+ return;
+ }
+
+ file.seekg(0, file.end);
+ _size = file.tellg();
+ file.seekg(0, file.beg);
+
+ _data.reset(new unsigned char[_size], std::default_delete<unsigned char[]>());
+
+ file.read(reinterpret_cast<char*>(_data.get()), _size);
+
+ file.close();
+}