1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
12 #include "ie_input_info.hpp"
13 #include "ie_profiling.hpp"
15 namespace InferenceEngine {
20 * @brief This class stores pre-process information for exact input
22 class INFERENCE_ENGINE_API_CLASS(PreProcessData) {
26 Blob::Ptr _roiBlob = nullptr;
27 Blob::Ptr _tmp1 = nullptr;
28 Blob::Ptr _tmp2 = nullptr;
31 * @brief Pointer-to-implementation (PIMPL) hiding preprocessing implementation details.
32 * BEWARE! Will be shared among copies!
34 std::shared_ptr<PreprocEngine> _preproc;
36 InferenceEngine::ProfilingTask perf_resize {"Resize"};
37 InferenceEngine::ProfilingTask perf_reorder_before {"Reorder before"};
38 InferenceEngine::ProfilingTask perf_reorder_after {"Reorder after"};
39 InferenceEngine::ProfilingTask perf_preprocessing {"Preprocessing"};
43 * @brief Sets ROI blob to be resized and placed to the default input blob during pre-processing.
44 * @param blob ROI blob.
46 void setRoiBlob(const Blob::Ptr &blob);
49 * @brief Gets pointer to the ROI blob used for a given input.
50 * @return Blob pointer.
52 Blob::Ptr getRoiBlob() const;
55 * @brief Executes input pre-processing with a given resize algorithm.
56 * @param outBlob pre-processed output blob to be used for inference.
57 * @param algorithm resize algorithm.
58 * @param serial disable OpenMP threading if the value set to true.
59 * @param batchSize batch size for pre-processing.
61 void execute(Blob::Ptr &outBlob, const ResizeAlgorithm &algorithm, bool serial,
64 static void isApplicable(const Blob::Ptr &src, const Blob::Ptr &dst);
67 //----------------------------------------------------------------------
69 // Implementation-internal types and functions and macros
71 //----------------------------------------------------------------------
75 static inline uint8_t saturateU32toU8(uint32_t v) {
76 return static_cast<uint8_t>(v > UINT8_MAX ? UINT8_MAX : v);
79 void resize_bilinear_u8(const Blob::Ptr inBlob, Blob::Ptr outBlob, uint8_t* buffer);
81 void resize_area_u8_downscale(const Blob::Ptr inBlob, Blob::Ptr outBlob, uint8_t* buffer);
83 int getResizeAreaTabSize(int dst_go, int ssize, int dsize, float scale);
85 void computeResizeAreaTab(int src_go, int dst_go, int ssize, int dsize, float scale,
86 uint16_t* si, uint16_t* alpha, int max_count);
88 void generate_alpha_and_id_arrays(int x_max_count, int dcols, const uint16_t* xalpha, uint16_t* xsi,
89 uint16_t** alpha, uint16_t** sxid);
101 } // namespace Resize
103 //----------------------------------------------------------------------
105 } // namespace InferenceEngine