Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / inference_engine / ie_preprocess_gapi.hpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include "ie_blob.h"
8 #include "ie_input_info.hpp"
9
10 #include <tuple>
11 #include <vector>
12 #include <opencv2/gapi/gcompiled.hpp>
13 #include <opencv2/gapi/util/optional.hpp>
14 #include "ie_profiling.hpp"
15
16 // FIXME: Move this definition back to ie_preprocess_data,
17 // also free ie_preprocess_gapi of these details
18
19 namespace InferenceEngine {
20
21 class PreprocEngine {
22     using BlobDesc = std::tuple<Precision, Layout, SizeVector>;
23     using CallDesc = std::tuple<BlobDesc, BlobDesc, ResizeAlgorithm>;
24     template<typename T> using Opt = cv::util::optional<T>;
25
26     Opt<CallDesc> _lastCall;
27     std::vector<cv::GCompiled> _lastComp;
28
29     ProfilingTask _perf_graph_building {"Preproc Graph Building"};
30     ProfilingTask _perf_exec_tile  {"Preproc Calc Tile"};
31     ProfilingTask _perf_exec_graph {"Preproc Exec Graph"};
32     ProfilingTask _perf_graph_compiling {"Preproc Graph compiling"};
33
34     enum class Update { REBUILD, RESHAPE, NOTHING };
35     Update needUpdate(const CallDesc &newCall) const;
36
37 public:
38     PreprocEngine();
39     bool preprocessWithGAPI(Blob::Ptr &inBlob, Blob::Ptr &outBlob, const ResizeAlgorithm &algorithm,
40         bool omp_serial, int batch_size = -1);
41 };
42
43 }  // namespace InferenceEngine