react-native-vision-camera-spoof-detector 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -46
- package/VisionCameraSpoofDetector.podspec +12 -2
- package/android/build.gradle +0 -13
- package/android/src/main/java/com/faceantispoof/FaceAntiSpoofPackage.kt +1 -3
- package/android/src/main/java/com/faceantispoof/FaceAntiSpoofingAdvanced.kt +78 -925
- package/android/src/main/java/com/lengdev/livenessdetector/LivenessDetector.kt +228 -0
- package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorOutput.kt +17 -31
- package/android/src/main/jniLibs/arm64-v8a/libliveness_detector.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libliveness_detector.so +0 -0
- package/index.d.ts +2 -9
- package/index.js +6 -6
- package/ios/FaceAntiSpoofModule.m +3 -2
- package/ios/HybridSpoofDetectorOutput.swift +73 -158
- package/ios/NcnnLivenessDetector.h +24 -0
- package/ios/NcnnLivenessDetector.mm +248 -0
- package/ios/ncnn.xcframework/Info.plist +27 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/allocator.h +433 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/benchmark.h +28 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/blob.h +33 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/c_api.h +401 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/command.h +111 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/cpu.h +177 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/datareader.h +111 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/expression.h +17 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/gpu.h +566 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/layer.h +212 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/layer_shader_type.h +18 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/layer_shader_type_enum.h +5 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/layer_type.h +19 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/layer_type_enum.h +115 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/mat.h +1868 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/modelbin.h +69 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/ncnn_export.h +43 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/net.h +252 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/option.h +151 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/paramdict.h +66 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/pipeline.h +101 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/pipelinecache.h +71 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/platform.h +372 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/simplemath.h +98 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/simpleocv.h +492 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/simpleomp.h +42 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/simplestl.h +598 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/simplevk.h +2196 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Headers/ncnn/vulkan_header_fix.h +1674 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Resources/Info.plist +18 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/allocator.h +433 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/benchmark.h +28 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/blob.h +33 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/c_api.h +401 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/command.h +111 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/cpu.h +177 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/datareader.h +111 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/expression.h +17 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/gpu.h +566 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/layer.h +212 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/layer_shader_type.h +18 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/layer_shader_type_enum.h +5 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/layer_type.h +19 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/layer_type_enum.h +115 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/mat.h +1868 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/modelbin.h +69 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/ncnn_export.h +43 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/net.h +252 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/option.h +151 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/paramdict.h +66 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/pipeline.h +101 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/pipelinecache.h +71 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/platform.h +372 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/simplemath.h +98 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/simpleocv.h +492 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/simpleomp.h +42 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/simplestl.h +598 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/simplevk.h +2196 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Headers/ncnn/vulkan_header_fix.h +1674 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/Resources/Info.plist +18 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/A/ncnn +0 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/allocator.h +433 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/benchmark.h +28 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/blob.h +33 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/c_api.h +401 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/command.h +111 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/cpu.h +177 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/datareader.h +111 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/expression.h +17 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/gpu.h +566 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/layer.h +212 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/layer_shader_type.h +18 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/layer_shader_type_enum.h +5 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/layer_type.h +19 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/layer_type_enum.h +115 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/mat.h +1868 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/modelbin.h +69 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/ncnn_export.h +43 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/net.h +252 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/option.h +151 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/paramdict.h +66 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/pipeline.h +101 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/pipelinecache.h +71 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/platform.h +372 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/simplemath.h +98 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/simpleocv.h +492 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/simpleomp.h +42 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/simplestl.h +598 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/simplevk.h +2196 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/vulkan_header_fix.h +1674 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Resources/Info.plist +18 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/ncnn +0 -0
- package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/ncnn +0 -0
- package/ios/openmp.xcframework/Info.plist +27 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Headers/omp.h +521 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Headers/ompx.h +165 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Resources/Info.plist +18 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Versions/A/Headers/omp.h +521 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Versions/A/Headers/ompx.h +165 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Versions/A/Resources/Info.plist +18 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Versions/A/openmp +0 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Versions/Current/Headers/omp.h +521 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Versions/Current/Headers/ompx.h +165 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Versions/Current/Resources/Info.plist +18 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/Versions/Current/openmp +0 -0
- package/ios/openmp.xcframework/ios-arm64/openmp.framework/openmp +0 -0
- package/lib/assets/live/config.json +1 -0
- package/lib/assets/live/model_1.bin +0 -0
- package/lib/assets/live/model_1.param +214 -0
- package/lib/assets/live/model_2.bin +0 -0
- package/lib/assets/live/model_2.param +238 -0
- package/nitrogen/generated/android/c++/JSpoofDetectorOutputOptions.hpp +1 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/SpoofDetectorOutputOptions.kt +4 -14
- package/nitrogen/generated/ios/swift/SpoofDetectorOutputOptions.swift +1 -37
- package/nitrogen/generated/shared/c++/SpoofDetectorOutputOptions.hpp +1 -9
- package/package.json +1 -2
- package/src/specs/SpoofDetectorFactory.nitro.ts +0 -2
- package/android/fix-prefab.gradle +0 -4
- package/android/src/main/java/com/faceantispoof/AcceleratorConfig.kt +0 -97
- package/android/src/main/java/com/faceantispoof/FaceAntiSpoofModule.kt +0 -242
- package/android/src/main/res/values/strings.xml +0 -3
- package/lib/assets/FaceAntiSpoofing.tflite +0 -0
- package/lib/assets/model_spec.json +0 -16
package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/modelbin.h
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright 2017 Tencent
|
|
2
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
3
|
+
|
|
4
|
+
#ifndef NCNN_MODELBIN_H
|
|
5
|
+
#define NCNN_MODELBIN_H
|
|
6
|
+
|
|
7
|
+
#include "mat.h"
|
|
8
|
+
|
|
9
|
+
namespace ncnn {
|
|
10
|
+
|
|
11
|
+
class DataReader;
|
|
12
|
+
class NCNN_EXPORT ModelBin
|
|
13
|
+
{
|
|
14
|
+
public:
|
|
15
|
+
ModelBin();
|
|
16
|
+
virtual ~ModelBin();
|
|
17
|
+
// element type
|
|
18
|
+
// 0 = auto
|
|
19
|
+
// 1 = float32
|
|
20
|
+
// 2 = float16
|
|
21
|
+
// 3 = int8
|
|
22
|
+
// load vec
|
|
23
|
+
virtual Mat load(int w, int type) const;
|
|
24
|
+
// load image
|
|
25
|
+
virtual Mat load(int w, int h, int type) const;
|
|
26
|
+
// load dim
|
|
27
|
+
virtual Mat load(int w, int h, int c, int type) const;
|
|
28
|
+
// load cube
|
|
29
|
+
virtual Mat load(int w, int h, int d, int c, int type) const;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
class ModelBinFromDataReaderPrivate;
|
|
33
|
+
class NCNN_EXPORT ModelBinFromDataReader : public ModelBin
|
|
34
|
+
{
|
|
35
|
+
public:
|
|
36
|
+
explicit ModelBinFromDataReader(const DataReader& dr);
|
|
37
|
+
virtual ~ModelBinFromDataReader();
|
|
38
|
+
|
|
39
|
+
virtual Mat load(int w, int type) const;
|
|
40
|
+
|
|
41
|
+
private:
|
|
42
|
+
ModelBinFromDataReader(const ModelBinFromDataReader&);
|
|
43
|
+
ModelBinFromDataReader& operator=(const ModelBinFromDataReader&);
|
|
44
|
+
|
|
45
|
+
private:
|
|
46
|
+
ModelBinFromDataReaderPrivate* const d;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
class ModelBinFromMatArrayPrivate;
|
|
50
|
+
class NCNN_EXPORT ModelBinFromMatArray : public ModelBin
|
|
51
|
+
{
|
|
52
|
+
public:
|
|
53
|
+
// construct from weight blob array
|
|
54
|
+
explicit ModelBinFromMatArray(const Mat* weights);
|
|
55
|
+
virtual ~ModelBinFromMatArray();
|
|
56
|
+
|
|
57
|
+
virtual Mat load(int w, int type) const;
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
ModelBinFromMatArray(const ModelBinFromMatArray&);
|
|
61
|
+
ModelBinFromMatArray& operator=(const ModelBinFromMatArray&);
|
|
62
|
+
|
|
63
|
+
private:
|
|
64
|
+
ModelBinFromMatArrayPrivate* const d;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace ncnn
|
|
68
|
+
|
|
69
|
+
#endif // NCNN_MODELBIN_H
|
package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/ncnn_export.h
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
#ifndef NCNN_EXPORT_H
|
|
3
|
+
#define NCNN_EXPORT_H
|
|
4
|
+
|
|
5
|
+
#ifdef NCNN_STATIC_DEFINE
|
|
6
|
+
# define NCNN_EXPORT
|
|
7
|
+
# define NCNN_NO_EXPORT
|
|
8
|
+
#else
|
|
9
|
+
# ifndef NCNN_EXPORT
|
|
10
|
+
# ifdef ncnn_EXPORTS
|
|
11
|
+
/* We are building this library */
|
|
12
|
+
# define NCNN_EXPORT
|
|
13
|
+
# else
|
|
14
|
+
/* We are using this library */
|
|
15
|
+
# define NCNN_EXPORT
|
|
16
|
+
# endif
|
|
17
|
+
# endif
|
|
18
|
+
|
|
19
|
+
# ifndef NCNN_NO_EXPORT
|
|
20
|
+
# define NCNN_NO_EXPORT
|
|
21
|
+
# endif
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
#ifndef NCNN_DEPRECATED
|
|
25
|
+
# define NCNN_DEPRECATED __attribute__ ((__deprecated__))
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#ifndef NCNN_DEPRECATED_EXPORT
|
|
29
|
+
# define NCNN_DEPRECATED_EXPORT NCNN_EXPORT NCNN_DEPRECATED
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#ifndef NCNN_DEPRECATED_NO_EXPORT
|
|
33
|
+
# define NCNN_DEPRECATED_NO_EXPORT NCNN_NO_EXPORT NCNN_DEPRECATED
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
|
|
37
|
+
#if 0 /* DEFINE_NO_DEPRECATED */
|
|
38
|
+
# ifndef NCNN_NO_DEPRECATED
|
|
39
|
+
# define NCNN_NO_DEPRECATED
|
|
40
|
+
# endif
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#endif /* NCNN_EXPORT_H */
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// Copyright 2017 Tencent
|
|
2
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
3
|
+
|
|
4
|
+
#ifndef NCNN_NET_H
|
|
5
|
+
#define NCNN_NET_H
|
|
6
|
+
|
|
7
|
+
#include "blob.h"
|
|
8
|
+
#include "layer.h"
|
|
9
|
+
#include "mat.h"
|
|
10
|
+
#include "option.h"
|
|
11
|
+
#include "platform.h"
|
|
12
|
+
|
|
13
|
+
#if NCNN_PLATFORM_API
|
|
14
|
+
#if __ANDROID_API__ >= 9
|
|
15
|
+
#include <android/asset_manager.h>
|
|
16
|
+
#endif // __ANDROID_API__ >= 9
|
|
17
|
+
#endif // NCNN_PLATFORM_API
|
|
18
|
+
|
|
19
|
+
namespace ncnn {
|
|
20
|
+
|
|
21
|
+
#if NCNN_VULKAN
|
|
22
|
+
class VkCompute;
|
|
23
|
+
#endif // NCNN_VULKAN
|
|
24
|
+
class DataReader;
|
|
25
|
+
class Extractor;
|
|
26
|
+
class NetPrivate;
|
|
27
|
+
class NCNN_EXPORT Net
|
|
28
|
+
{
|
|
29
|
+
public:
|
|
30
|
+
// empty init
|
|
31
|
+
Net();
|
|
32
|
+
// clear and destroy
|
|
33
|
+
virtual ~Net();
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
// option can be changed before loading
|
|
37
|
+
Option opt;
|
|
38
|
+
|
|
39
|
+
#if NCNN_VULKAN
|
|
40
|
+
// set gpu device by index
|
|
41
|
+
void set_vulkan_device(int device_index);
|
|
42
|
+
|
|
43
|
+
// set gpu device by device handle, no owner transfer
|
|
44
|
+
void set_vulkan_device(const VulkanDevice* vkdev);
|
|
45
|
+
|
|
46
|
+
const VulkanDevice* vulkan_device() const;
|
|
47
|
+
#endif // NCNN_VULKAN
|
|
48
|
+
|
|
49
|
+
#if NCNN_STRING
|
|
50
|
+
// register custom layer or overwrite built-in layer by layer type name
|
|
51
|
+
// return 0 if success
|
|
52
|
+
int register_custom_layer(const char* type, layer_creator_func creator, layer_destroyer_func destroyer = 0, void* userdata = 0);
|
|
53
|
+
virtual int custom_layer_to_index(const char* type);
|
|
54
|
+
#endif // NCNN_STRING
|
|
55
|
+
// register custom layer or overwrite built-in layer by layer type
|
|
56
|
+
// return 0 if success
|
|
57
|
+
int register_custom_layer(int index, layer_creator_func creator, layer_destroyer_func destroyer = 0, void* userdata = 0);
|
|
58
|
+
|
|
59
|
+
#if NCNN_STRING
|
|
60
|
+
int load_param(const DataReader& dr);
|
|
61
|
+
#endif // NCNN_STRING
|
|
62
|
+
|
|
63
|
+
int load_param_bin(const DataReader& dr);
|
|
64
|
+
|
|
65
|
+
int load_model(const DataReader& dr);
|
|
66
|
+
|
|
67
|
+
#if NCNN_STDIO
|
|
68
|
+
#if NCNN_STRING
|
|
69
|
+
// load network structure from plain param file
|
|
70
|
+
// return 0 if success
|
|
71
|
+
int load_param(FILE* fp);
|
|
72
|
+
int load_param(const char* protopath);
|
|
73
|
+
#if _WIN32
|
|
74
|
+
int load_param(const wchar_t* protopath);
|
|
75
|
+
#endif
|
|
76
|
+
|
|
77
|
+
// load network structure from in-memory plain param string, must be NULL-terminated
|
|
78
|
+
// return 0 if success
|
|
79
|
+
int load_param_mem(const char* mem);
|
|
80
|
+
#endif // NCNN_STRING
|
|
81
|
+
// load network structure from binary param file
|
|
82
|
+
// return 0 if success
|
|
83
|
+
int load_param_bin(FILE* fp);
|
|
84
|
+
int load_param_bin(const char* protopath);
|
|
85
|
+
#if _WIN32
|
|
86
|
+
int load_param_bin(const wchar_t* protopath);
|
|
87
|
+
#endif
|
|
88
|
+
|
|
89
|
+
// load network weight data from model file
|
|
90
|
+
// return 0 if success
|
|
91
|
+
int load_model(FILE* fp);
|
|
92
|
+
int load_model(const char* modelpath);
|
|
93
|
+
#if _WIN32
|
|
94
|
+
int load_model(const wchar_t* modelpath);
|
|
95
|
+
#endif
|
|
96
|
+
#endif // NCNN_STDIO
|
|
97
|
+
|
|
98
|
+
// load network structure from external memory
|
|
99
|
+
// memory pointer must be 32-bit aligned
|
|
100
|
+
// return bytes consumed
|
|
101
|
+
int load_param(const unsigned char* mem);
|
|
102
|
+
|
|
103
|
+
// reference network weight data from external memory
|
|
104
|
+
// weight data is not copied but referenced
|
|
105
|
+
// so external memory should be retained when used
|
|
106
|
+
// memory pointer must be 32-bit aligned
|
|
107
|
+
// return bytes consumed
|
|
108
|
+
int load_model(const unsigned char* mem);
|
|
109
|
+
|
|
110
|
+
#if NCNN_PLATFORM_API
|
|
111
|
+
#if __ANDROID_API__ >= 9
|
|
112
|
+
#if NCNN_STRING
|
|
113
|
+
// convenient load network structure from android asset plain param file
|
|
114
|
+
int load_param(AAsset* asset);
|
|
115
|
+
int load_param(AAssetManager* mgr, const char* assetpath);
|
|
116
|
+
#endif // NCNN_STRING
|
|
117
|
+
// convenient load network structure from android asset binary param file
|
|
118
|
+
int load_param_bin(AAsset* asset);
|
|
119
|
+
int load_param_bin(AAssetManager* mgr, const char* assetpath);
|
|
120
|
+
|
|
121
|
+
// convenient load network weight data from android asset model file
|
|
122
|
+
int load_model(AAsset* asset);
|
|
123
|
+
int load_model(AAssetManager* mgr, const char* assetpath);
|
|
124
|
+
#endif // __ANDROID_API__ >= 9
|
|
125
|
+
#endif // NCNN_PLATFORM_API
|
|
126
|
+
|
|
127
|
+
// unload network structure and weight data
|
|
128
|
+
void clear();
|
|
129
|
+
|
|
130
|
+
// construct an Extractor from network
|
|
131
|
+
Extractor create_extractor() const;
|
|
132
|
+
|
|
133
|
+
// get input/output indexes/names
|
|
134
|
+
const std::vector<int>& input_indexes() const;
|
|
135
|
+
const std::vector<int>& output_indexes() const;
|
|
136
|
+
#if NCNN_STRING
|
|
137
|
+
const std::vector<const char*>& input_names() const;
|
|
138
|
+
const std::vector<const char*>& output_names() const;
|
|
139
|
+
#endif
|
|
140
|
+
|
|
141
|
+
const std::vector<Blob>& blobs() const;
|
|
142
|
+
const std::vector<Layer*>& layers() const;
|
|
143
|
+
|
|
144
|
+
std::vector<Blob>& mutable_blobs();
|
|
145
|
+
std::vector<Layer*>& mutable_layers();
|
|
146
|
+
|
|
147
|
+
protected:
|
|
148
|
+
friend class Extractor;
|
|
149
|
+
#if NCNN_STRING
|
|
150
|
+
int find_blob_index_by_name(const char* name) const;
|
|
151
|
+
int find_layer_index_by_name(const char* name) const;
|
|
152
|
+
virtual Layer* create_custom_layer(const char* type);
|
|
153
|
+
virtual Layer* create_overwrite_builtin_layer(const char* type);
|
|
154
|
+
#endif // NCNN_STRING
|
|
155
|
+
virtual Layer* create_custom_layer(int index);
|
|
156
|
+
virtual Layer* create_overwrite_builtin_layer(int typeindex);
|
|
157
|
+
|
|
158
|
+
private:
|
|
159
|
+
Net(const Net&);
|
|
160
|
+
Net& operator=(const Net&);
|
|
161
|
+
|
|
162
|
+
private:
|
|
163
|
+
NetPrivate* const d;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
class ExtractorPrivate;
|
|
167
|
+
class NCNN_EXPORT Extractor
|
|
168
|
+
{
|
|
169
|
+
public:
|
|
170
|
+
virtual ~Extractor();
|
|
171
|
+
|
|
172
|
+
// copy
|
|
173
|
+
Extractor(const Extractor&);
|
|
174
|
+
|
|
175
|
+
// assign
|
|
176
|
+
Extractor& operator=(const Extractor&);
|
|
177
|
+
|
|
178
|
+
// clear blob mats and alloctors
|
|
179
|
+
void clear();
|
|
180
|
+
|
|
181
|
+
// enable light mode
|
|
182
|
+
// intermediate blob will be recycled when enabled
|
|
183
|
+
// enabled by default
|
|
184
|
+
void set_light_mode(bool enable);
|
|
185
|
+
|
|
186
|
+
// set blob memory allocator
|
|
187
|
+
void set_blob_allocator(Allocator* allocator);
|
|
188
|
+
|
|
189
|
+
// set workspace memory allocator
|
|
190
|
+
void set_workspace_allocator(Allocator* allocator);
|
|
191
|
+
|
|
192
|
+
#if NCNN_VULKAN
|
|
193
|
+
void set_blob_vkallocator(VkAllocator* allocator);
|
|
194
|
+
|
|
195
|
+
void set_workspace_vkallocator(VkAllocator* allocator);
|
|
196
|
+
|
|
197
|
+
void set_staging_vkallocator(VkAllocator* allocator);
|
|
198
|
+
#endif // NCNN_VULKAN
|
|
199
|
+
|
|
200
|
+
#if NCNN_STRING
|
|
201
|
+
// set input by blob name
|
|
202
|
+
// return 0 if success
|
|
203
|
+
int input(const char* blob_name, const Mat& in);
|
|
204
|
+
|
|
205
|
+
// get result by blob name
|
|
206
|
+
// return 0 if success
|
|
207
|
+
// type = 0, default
|
|
208
|
+
// type = 1, do not convert fp16/bf16 or / and packing
|
|
209
|
+
int extract(const char* blob_name, Mat& feat, int type = 0);
|
|
210
|
+
#endif // NCNN_STRING
|
|
211
|
+
|
|
212
|
+
// set input by blob index
|
|
213
|
+
// return 0 if success
|
|
214
|
+
int input(int blob_index, const Mat& in);
|
|
215
|
+
|
|
216
|
+
// get result by blob index
|
|
217
|
+
// return 0 if success
|
|
218
|
+
// type = 0, default
|
|
219
|
+
// type = 1, do not convert fp16/bf16 or / and packing
|
|
220
|
+
int extract(int blob_index, Mat& feat, int type = 0);
|
|
221
|
+
|
|
222
|
+
#if NCNN_VULKAN
|
|
223
|
+
#if NCNN_STRING
|
|
224
|
+
// set input by blob name
|
|
225
|
+
// return 0 if success
|
|
226
|
+
int input(const char* blob_name, const VkMat& in);
|
|
227
|
+
|
|
228
|
+
// get result by blob name
|
|
229
|
+
// return 0 if success
|
|
230
|
+
int extract(const char* blob_name, VkMat& feat, VkCompute& cmd);
|
|
231
|
+
#endif // NCNN_STRING
|
|
232
|
+
|
|
233
|
+
// set input by blob index
|
|
234
|
+
// return 0 if success
|
|
235
|
+
int input(int blob_index, const VkMat& in);
|
|
236
|
+
|
|
237
|
+
// get result by blob index
|
|
238
|
+
// return 0 if success
|
|
239
|
+
int extract(int blob_index, VkMat& feat, VkCompute& cmd);
|
|
240
|
+
#endif // NCNN_VULKAN
|
|
241
|
+
|
|
242
|
+
protected:
|
|
243
|
+
friend Extractor Net::create_extractor() const;
|
|
244
|
+
Extractor(const Net* net, size_t blob_count);
|
|
245
|
+
|
|
246
|
+
private:
|
|
247
|
+
ExtractorPrivate* const d;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
} // namespace ncnn
|
|
251
|
+
|
|
252
|
+
#endif // NCNN_NET_H
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Copyright 2019 Tencent
|
|
2
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
3
|
+
|
|
4
|
+
#ifndef NCNN_OPTION_H
|
|
5
|
+
#define NCNN_OPTION_H
|
|
6
|
+
|
|
7
|
+
#include "platform.h"
|
|
8
|
+
|
|
9
|
+
namespace ncnn {
|
|
10
|
+
|
|
11
|
+
#if NCNN_VULKAN
|
|
12
|
+
class VkAllocator;
|
|
13
|
+
class PipelineCache;
|
|
14
|
+
#endif // NCNN_VULKAN
|
|
15
|
+
|
|
16
|
+
class Allocator;
|
|
17
|
+
class NCNN_EXPORT Option
|
|
18
|
+
{
|
|
19
|
+
public:
|
|
20
|
+
// default option
|
|
21
|
+
Option();
|
|
22
|
+
|
|
23
|
+
public:
|
|
24
|
+
// light mode
|
|
25
|
+
// intermediate blob will be recycled when enabled
|
|
26
|
+
// enabled by default
|
|
27
|
+
bool lightmode;
|
|
28
|
+
|
|
29
|
+
bool use_reserved_m0;
|
|
30
|
+
|
|
31
|
+
// enable subgroup in shader
|
|
32
|
+
bool use_subgroup_ops;
|
|
33
|
+
|
|
34
|
+
bool use_reserved_0;
|
|
35
|
+
|
|
36
|
+
// thread count
|
|
37
|
+
// default value is the one returned by get_cpu_count()
|
|
38
|
+
int num_threads;
|
|
39
|
+
|
|
40
|
+
// blob memory allocator
|
|
41
|
+
Allocator* blob_allocator;
|
|
42
|
+
|
|
43
|
+
// workspace memory allocator
|
|
44
|
+
Allocator* workspace_allocator;
|
|
45
|
+
|
|
46
|
+
#if NCNN_VULKAN
|
|
47
|
+
// blob memory allocator
|
|
48
|
+
VkAllocator* blob_vkallocator;
|
|
49
|
+
|
|
50
|
+
// workspace memory allocator
|
|
51
|
+
VkAllocator* workspace_vkallocator;
|
|
52
|
+
|
|
53
|
+
// staging memory allocator
|
|
54
|
+
VkAllocator* staging_vkallocator;
|
|
55
|
+
|
|
56
|
+
// pipeline cache
|
|
57
|
+
PipelineCache* pipeline_cache;
|
|
58
|
+
#endif // NCNN_VULKAN
|
|
59
|
+
|
|
60
|
+
// the time openmp threads busy-wait for more work before going to sleep
|
|
61
|
+
// default value is 20ms to keep the cores enabled
|
|
62
|
+
// without too much extra power consumption afterwards
|
|
63
|
+
int openmp_blocktime;
|
|
64
|
+
|
|
65
|
+
// enable winograd convolution optimization
|
|
66
|
+
// improve convolution 3x3 stride1 performance, may consume more memory
|
|
67
|
+
// changes should be applied before loading network structure and weight
|
|
68
|
+
// enabled by default
|
|
69
|
+
bool use_winograd_convolution;
|
|
70
|
+
|
|
71
|
+
// enable sgemm convolution optimization
|
|
72
|
+
// improve convolution 1x1 stride1 performance, may consume more memory
|
|
73
|
+
// changes should be applied before loading network structure and weight
|
|
74
|
+
// enabled by default
|
|
75
|
+
bool use_sgemm_convolution;
|
|
76
|
+
|
|
77
|
+
// enable quantized int8 inference
|
|
78
|
+
// use low-precision int8 path for quantized model
|
|
79
|
+
// changes should be applied before loading network structure and weight
|
|
80
|
+
// enabled by default
|
|
81
|
+
bool use_int8_inference;
|
|
82
|
+
|
|
83
|
+
// enable vulkan compute
|
|
84
|
+
bool use_vulkan_compute;
|
|
85
|
+
|
|
86
|
+
// enable bf16 data type for storage
|
|
87
|
+
// improve most operator performance on all arm devices, may consume more memory
|
|
88
|
+
bool use_bf16_storage;
|
|
89
|
+
|
|
90
|
+
// enable options for gpu inference
|
|
91
|
+
bool use_fp16_packed;
|
|
92
|
+
bool use_fp16_storage;
|
|
93
|
+
bool use_fp16_arithmetic;
|
|
94
|
+
bool use_int8_packed;
|
|
95
|
+
bool use_int8_storage;
|
|
96
|
+
bool use_int8_arithmetic;
|
|
97
|
+
|
|
98
|
+
// enable simd-friendly packed memory layout
|
|
99
|
+
// improve all operator performance on all arm devices, will consume more memory
|
|
100
|
+
// changes should be applied before loading network structure and weight
|
|
101
|
+
// enabled by default
|
|
102
|
+
bool use_packing_layout;
|
|
103
|
+
|
|
104
|
+
// the vulkan device
|
|
105
|
+
int vulkan_device_index;
|
|
106
|
+
|
|
107
|
+
// enable options for gpu inference
|
|
108
|
+
bool use_bf16_packed;
|
|
109
|
+
|
|
110
|
+
bool use_tensor_storage;
|
|
111
|
+
|
|
112
|
+
bool use_reserved_1p;
|
|
113
|
+
bool use_reserved_2;
|
|
114
|
+
|
|
115
|
+
// enable DAZ(Denormals-Are-Zero) and FTZ(Flush-To-Zero)
|
|
116
|
+
// default value is 3
|
|
117
|
+
// 0 = DAZ OFF, FTZ OFF
|
|
118
|
+
// 1 = DAZ ON , FTZ OFF
|
|
119
|
+
// 2 = DAZ OFF, FTZ ON
|
|
120
|
+
// 3 = DAZ ON, FTZ ON
|
|
121
|
+
int flush_denormals;
|
|
122
|
+
|
|
123
|
+
bool use_local_pool_allocator;
|
|
124
|
+
|
|
125
|
+
// enable local memory optimization for gpu inference
|
|
126
|
+
bool use_shader_local_memory;
|
|
127
|
+
|
|
128
|
+
// enable cooperative matrix optimization for gpu inference
|
|
129
|
+
bool use_cooperative_matrix;
|
|
130
|
+
|
|
131
|
+
// more fine-grained control of winograd convolution
|
|
132
|
+
bool use_winograd23_convolution;
|
|
133
|
+
bool use_winograd43_convolution;
|
|
134
|
+
bool use_winograd63_convolution;
|
|
135
|
+
|
|
136
|
+
// this option is turned on for A53/A55 automatically
|
|
137
|
+
// but you can force this on/off if you wish
|
|
138
|
+
bool use_a53_a55_optimized_kernel;
|
|
139
|
+
|
|
140
|
+
// enable options for shared variables in gpu shader
|
|
141
|
+
bool use_fp16_uniform;
|
|
142
|
+
bool use_int8_uniform;
|
|
143
|
+
|
|
144
|
+
bool use_reserved_9;
|
|
145
|
+
bool use_reserved_10;
|
|
146
|
+
bool use_reserved_11;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
} // namespace ncnn
|
|
150
|
+
|
|
151
|
+
#endif // NCNN_OPTION_H
|
package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/paramdict.h
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright 2017 Tencent
|
|
2
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
3
|
+
|
|
4
|
+
#ifndef NCNN_PARAMDICT_H
|
|
5
|
+
#define NCNN_PARAMDICT_H
|
|
6
|
+
|
|
7
|
+
#include "mat.h"
|
|
8
|
+
|
|
9
|
+
// at most 32 parameters
|
|
10
|
+
#define NCNN_MAX_PARAM_COUNT 32
|
|
11
|
+
|
|
12
|
+
namespace ncnn {
|
|
13
|
+
|
|
14
|
+
class DataReader;
|
|
15
|
+
class Net;
|
|
16
|
+
class ParamDictPrivate;
|
|
17
|
+
class NCNN_EXPORT ParamDict
|
|
18
|
+
{
|
|
19
|
+
public:
|
|
20
|
+
// empty
|
|
21
|
+
ParamDict();
|
|
22
|
+
|
|
23
|
+
virtual ~ParamDict();
|
|
24
|
+
|
|
25
|
+
// copy
|
|
26
|
+
ParamDict(const ParamDict&);
|
|
27
|
+
|
|
28
|
+
// assign
|
|
29
|
+
ParamDict& operator=(const ParamDict&);
|
|
30
|
+
|
|
31
|
+
// get type
|
|
32
|
+
int type(int id) const;
|
|
33
|
+
|
|
34
|
+
// get int
|
|
35
|
+
int get(int id, int def) const;
|
|
36
|
+
// get float
|
|
37
|
+
float get(int id, float def) const;
|
|
38
|
+
// get array
|
|
39
|
+
Mat get(int id, const Mat& def) const;
|
|
40
|
+
// get string
|
|
41
|
+
std::string get(int id, const std::string& def) const;
|
|
42
|
+
|
|
43
|
+
// set int
|
|
44
|
+
void set(int id, int i);
|
|
45
|
+
// set float
|
|
46
|
+
void set(int id, float f);
|
|
47
|
+
// set array
|
|
48
|
+
void set(int id, const Mat& v);
|
|
49
|
+
// set string
|
|
50
|
+
void set(int id, const std::string& s);
|
|
51
|
+
|
|
52
|
+
protected:
|
|
53
|
+
friend class Net;
|
|
54
|
+
|
|
55
|
+
void clear();
|
|
56
|
+
|
|
57
|
+
int load_param(const DataReader& dr);
|
|
58
|
+
int load_param_bin(const DataReader& dr);
|
|
59
|
+
|
|
60
|
+
private:
|
|
61
|
+
ParamDictPrivate* const d;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace ncnn
|
|
65
|
+
|
|
66
|
+
#endif // NCNN_PARAMDICT_H
|
package/ios/ncnn.xcframework/ios-arm64/ncnn.framework/Versions/Current/Headers/ncnn/pipeline.h
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Copyright 2019 Tencent
|
|
2
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
3
|
+
|
|
4
|
+
#ifndef NCNN_PIPELINE_H
|
|
5
|
+
#define NCNN_PIPELINE_H
|
|
6
|
+
|
|
7
|
+
#include "mat.h"
|
|
8
|
+
#include "platform.h"
|
|
9
|
+
#if NCNN_VULKAN
|
|
10
|
+
#include "gpu.h"
|
|
11
|
+
#endif // NCNN_VULKAN
|
|
12
|
+
|
|
13
|
+
namespace ncnn {
|
|
14
|
+
|
|
15
|
+
#if NCNN_VULKAN
|
|
16
|
+
class Option;
|
|
17
|
+
class PipelinePrivate;
|
|
18
|
+
class NCNN_EXPORT Pipeline
|
|
19
|
+
{
|
|
20
|
+
public:
|
|
21
|
+
explicit Pipeline(const VulkanDevice* vkdev);
|
|
22
|
+
virtual ~Pipeline();
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
void set_optimal_local_size_xyz(int w = 4, int h = 4, int c = 4);
|
|
26
|
+
void set_optimal_local_size_xyz(const Mat& local_size_xyz);
|
|
27
|
+
void set_local_size_xyz(int w, int h, int c);
|
|
28
|
+
void set_subgroup_size(uint32_t subgroup_size);
|
|
29
|
+
|
|
30
|
+
int create(const uint32_t* spv_data, size_t spv_data_size, const std::vector<vk_specialization_type>& specializations);
|
|
31
|
+
|
|
32
|
+
int create(int shader_type_index, const Option& opt, const std::vector<vk_specialization_type>& specializations);
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
VkShaderModule shader_module() const;
|
|
36
|
+
VkDescriptorSetLayout descriptorset_layout() const;
|
|
37
|
+
VkPipelineLayout pipeline_layout() const;
|
|
38
|
+
VkPipeline pipeline() const;
|
|
39
|
+
VkDescriptorUpdateTemplateKHR descriptor_update_template() const;
|
|
40
|
+
|
|
41
|
+
const ShaderInfo& shader_info() const;
|
|
42
|
+
|
|
43
|
+
uint32_t local_size_x() const;
|
|
44
|
+
uint32_t local_size_y() const;
|
|
45
|
+
uint32_t local_size_z() const;
|
|
46
|
+
|
|
47
|
+
protected:
|
|
48
|
+
void set_shader_module(VkShaderModule shader_module);
|
|
49
|
+
void set_descriptorset_layout(VkDescriptorSetLayout descriptorset_layout);
|
|
50
|
+
void set_pipeline_layout(VkPipelineLayout pipeline_layout);
|
|
51
|
+
void set_pipeline(VkPipeline pipeline);
|
|
52
|
+
void set_descriptor_update_template(VkDescriptorUpdateTemplateKHR descriptor_update_template);
|
|
53
|
+
|
|
54
|
+
void set_shader_info(const ShaderInfo& shader_info);
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
const VulkanDevice* vkdev;
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
Pipeline(const Pipeline&);
|
|
61
|
+
Pipeline& operator=(const Pipeline&);
|
|
62
|
+
|
|
63
|
+
private:
|
|
64
|
+
PipelinePrivate* const d;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
#if NCNN_PLATFORM_API
|
|
68
|
+
#if __ANDROID_API__ >= 26
|
|
69
|
+
class VkCompute;
|
|
70
|
+
class NCNN_EXPORT ImportAndroidHardwareBufferPipeline : private Pipeline
|
|
71
|
+
{
|
|
72
|
+
public:
|
|
73
|
+
explicit ImportAndroidHardwareBufferPipeline(const VulkanDevice* vkdev);
|
|
74
|
+
virtual ~ImportAndroidHardwareBufferPipeline();
|
|
75
|
+
|
|
76
|
+
int create(VkAndroidHardwareBufferImageAllocator* ahb_im_allocator, int type_to, int rotate_from, const Option& opt);
|
|
77
|
+
int create(VkAndroidHardwareBufferImageAllocator* ahb_im_allocator, int type_to, int rotate_from, int target_width, int target_height, const Option& opt);
|
|
78
|
+
void destroy();
|
|
79
|
+
|
|
80
|
+
friend class VkCompute;
|
|
81
|
+
|
|
82
|
+
protected:
|
|
83
|
+
int create_shader_module(const Option& opt);
|
|
84
|
+
int create_sampler(VkAndroidHardwareBufferImageAllocator* ahb_im_allocator);
|
|
85
|
+
int create_descriptorset_layout();
|
|
86
|
+
|
|
87
|
+
public:
|
|
88
|
+
int type_to;
|
|
89
|
+
int rotate_from;
|
|
90
|
+
bool need_resize;
|
|
91
|
+
|
|
92
|
+
VkSampler sampler;
|
|
93
|
+
};
|
|
94
|
+
#endif // __ANDROID_API__ >= 26
|
|
95
|
+
#endif // NCNN_PLATFORM_API
|
|
96
|
+
|
|
97
|
+
#endif // NCNN_VULKAN
|
|
98
|
+
|
|
99
|
+
} // namespace ncnn
|
|
100
|
+
|
|
101
|
+
#endif // NCNN_PIPELINE_H
|