Added deprecation of nv12 legacy API (#16982)

* Added deprecation of nv12 legacy API

* Added new files

* Change macros

* Suppress warnings for preprocessing

* Suppress warnings in tests

* Suppress warnings for Windows
This commit is contained in:
Ilya Churaev
2023-04-17 14:13:43 +00:00
committed by GitHub
parent dc2fa65224
commit 25826bfe7d
11 changed files with 126 additions and 11 deletions
-3
View File
@@ -212,9 +212,6 @@ enum colorformat_e {
RGBX, ///< RGBX color format with X ignored during inference
BGRX, ///< BGRX color format with X ignored during inference
NV12, ///< NV12 color format represented as compound Y+UV blob
};
```
+12 -4
View File
@@ -25,6 +25,8 @@
#include <stdint.h>
#include <stdio.h>
#include "openvino/c/deprecated.h"
#ifdef __cplusplus
# define INFERENCE_ENGINE_C_API_EXTERN extern "C"
#else
@@ -216,8 +218,12 @@ typedef enum {
BGR, //!< BGR color format, default in OpenVINO
RGBX, //!< RGBX color format with X ignored during inference
BGRX, //!< BGRX color format with X ignored during inference
NV12, //!< NV12 color format represented as compound Y+UV blob
I420, //!< I420 color format represented as compound Y+U+V blob
NV12 OPENVINO_ENUM_DEPRECATED(
"This type is deprecated and will be removed in 2023.1 release"), //!< NV12 color format represented as
//!< compound Y+UV blob
I420 OPENVINO_ENUM_DEPRECATED(
"This type is deprecated and will be removed in 2023.1 release"), //!< I420 color format represented as
//!< compound Y+U+V blob
} colorformat_e;
/**
@@ -1071,7 +1077,8 @@ ie_blob_make_memory_with_roi(const ie_blob_t* inputBlob, const roi_t* roi, ie_bl
* @param nv12Blob A pointer to the newly created blob.
* @return Status code of the operation: OK(0) for success.
*/
INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode)
INFERENCE_ENGINE_C_API(OPENVINO_DEPRECATED("This function is deprecated and will be removed in 2023.1 release")
IE_NODISCARD IEStatusCode)
ie_blob_make_memory_nv12(const ie_blob_t* y, const ie_blob_t* uv, ie_blob_t** nv12Blob);
/**
@@ -1083,7 +1090,8 @@ ie_blob_make_memory_nv12(const ie_blob_t* y, const ie_blob_t* uv, ie_blob_t** nv
* @param i420Blob A pointer to the newly created blob.
* @return Status code of the operation: OK(0) for success.
*/
INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode)
INFERENCE_ENGINE_C_API(OPENVINO_DEPRECATED("This function is deprecated and will be removed in 2023.1 release")
IE_NODISCARD IEStatusCode)
ie_blob_make_memory_i420(const ie_blob_t* y, const ie_blob_t* u, const ie_blob_t* v, ie_blob_t** i420Blob);
/**
@@ -0,0 +1,91 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* @file openvino/c/deprecated.h
* Defines macros for API deprecation
**/
#pragma once
#ifdef OPENVINO_DEPRECATED
# undef OPENVINO_DEPRECATED
#endif
#ifdef OPENVINO_ENUM_DEPRECATED
# undef OPENVINO_ENUM_DEPRECATED
#endif
#ifdef OPENVINO_DO_PRAGMA
# undef OPENVINO_DO_PRAGMA
#endif
#ifdef OPENVINO_SUPPRESS_DEPRECATED_START
# undef OPENVINO_SUPPRESS_DEPRECATED_START
#endif
#ifdef OPENVINO_SUPPRESS_DEPRECATED_END
# undef OPENVINO_SUPPRESS_DEPRECATED_END
#endif
//
// The OPENVINO_DEPRECATED macro can be used to deprecate a function declaration. For example:
//
// OPENVINO_DEPRECATED("replace with groxify");
// void frobnicate()
//
// The macro will expand to a deprecation attribute supported by the compiler,
// so any use of `frobnicate` will produce a compiler warning.
//
#if defined(_WIN32)
# define OPENVINO_DEPRECATED(msg) __declspec(deprecated(msg))
# if __cplusplus >= 201402L
# define OPENVINO_ENUM_DEPRECATED(msg) [[deprecated(msg)]]
# else
# define OPENVINO_ENUM_DEPRECATED(msg)
# endif
#elif defined(__INTEL_COMPILER)
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated(msg)))
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
#elif defined(__GNUC__)
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ < 6 && !defined(__clang__)
# define OPENVINO_ENUM_DEPRECATED(msg)
# else
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
# endif
#else
# define OPENVINO_DEPRECATED(msg)
# define OPENVINO_ENUM_DEPRECATED(msg)
#endif
// Suppress warning "-Wdeprecated-declarations" / C4996
#if defined(_MSC_VER)
# define OPENVINO_DO_PRAGMA(x) __pragma(x)
#elif defined(__GNUC__)
# define OPENVINO_DO_PRAGMA(x) _Pragma(# x)
#else
# define OPENVINO_DO_PRAGMA(x)
#endif
#if defined(_MSC_VER) && !defined(__clang__)
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(warning(push)) \
OPENVINO_DO_PRAGMA(warning(disable : 4996))
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(warning(pop))
#elif defined(__INTEL_COMPILER)
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(warning(push)) \
OPENVINO_DO_PRAGMA(warning(disable : 1478))
OPENVINO_DO_PRAGMA(warning(disable : 1786))
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(warning(pop))
#elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(GCC diagnostic push) \
OPENVINO_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(GCC diagnostic pop)
#else
# define OPENVINO_SUPPRESS_DEPRECATED_START
# define OPENVINO_SUPPRESS_DEPRECATED_END
#endif
@@ -66,13 +66,21 @@ class ResizeAlgorithm(Enum):
class ColorFormat(Enum):
@classmethod
def _missing_(cls, value: object):
"""Add deprecation warningt to Field2"""
if str(value) == "NV12":
print("Field name `NV12` for `ColorFormat` enum is deprecated and will be removed in 2023.1 release.")
return 5
if str(value) == "I420":
print("Field name `I420` for `ColorFormat` enum is deprecated and will be removed in 2023.1 release.")
return 6
return value
RAW = 0
RGB = 1
BGR = 2
RGBX = 3
BGRX = 4
NV12 = 5
I420 = 6
cpdef enum StatusCode:
@@ -28,6 +28,8 @@
#include <opencv2/gapi/fluid/gfluidkernel.hpp> // GFluidOutputRois
IE_SUPPRESS_DEPRECATED_START
namespace InferenceEngine {
namespace {
int get_cv_depth(const TensorDesc &ie_desc);
@@ -129,6 +129,7 @@ public:
* @param nv12_surf A ID3D11Texture2D instance to create NV12 blob from
* @return NV12 remote blob
*/
OPENVINO_DEPRECATED("This function is deprecated and will be removed in 2023.1 release")
static inline Blob::Ptr make_shared_blob_nv12(size_t height,
size_t width,
RemoteContext::Ptr ctx,
@@ -230,6 +230,7 @@ public:
* @param nv12_image_plane_uv cl::Image2D object containing UV plane data.
* @return A shared remote blob instance
*/
OPENVINO_DEPRECATED("This function is deprecated and will be removed in 2023.1 release")
static inline Blob::Ptr make_shared_blob_nv12(RemoteContext::Ptr ctx,
cl::Image2D& nv12_image_plane_y,
cl::Image2D& nv12_image_plane_uv) {
@@ -100,6 +100,7 @@ public:
* @param nv12_surf NV12 `VASurfaceID` to create NV12 from
* @return A remote NV12 blob wrapping `VASurfaceID`
*/
OPENVINO_DEPRECATED("This function is deprecated and will be removed in 2023.1 release")
static inline Blob::Ptr make_shared_blob_nv12(size_t height,
size_t width,
RemoteContext::Ptr ctx,
+6 -2
View File
@@ -118,7 +118,9 @@ protected:
/**
* @brief Represents a blob that contains two planes (Y and UV) in NV12 color format
*/
class INFERENCE_ENGINE_API_CLASS(NV12Blob) : public CompoundBlob {
class INFERENCE_ENGINE_DEPRECATED("This class is deprecated and will be removed in 2023.1 release")
INFERENCE_ENGINE_API_CLASS(NV12Blob)
: public CompoundBlob {
public:
/**
* @brief A smart pointer to the NV12Blob object
@@ -176,7 +178,9 @@ public:
/**
* @brief Represents a blob that contains three planes (Y,U and V) in I420 color format
*/
class INFERENCE_ENGINE_API_CLASS(I420Blob) : public CompoundBlob {
class INFERENCE_ENGINE_DEPRECATED("This class is deprecated and will be removed in 2023.1 release")
INFERENCE_ENGINE_API_CLASS(I420Blob)
: public CompoundBlob {
public:
/**
* @brief A smart pointer to the I420Blob object
+1
View File
@@ -14,6 +14,7 @@
#include <utility>
#include <vector>
IE_SUPPRESS_DEPRECATED_START
namespace InferenceEngine {
namespace {
@@ -245,6 +245,7 @@ TEST_F(CompoundBlobTests, compoundBlobHoldsValidDataWhenUnderlyingBlobIsDestroye
EXPECT_EQ(stored_value, mb0->rmap().as<const uint8_t*>()[0]);
}
IE_SUPPRESS_DEPRECATED_START
TEST_F(NV12BlobTests, cannotCreateNV12BlobFromNullptrBlobs) {
Blob::Ptr valid = make_shared_blob<uint8_t>(TensorDesc(Precision::U8, {1, 1, 4, 4}, NHWC));
EXPECT_THROW(make_shared_blob<NV12Blob>(valid, nullptr), InferenceEngine::Exception);