├── README.md ├── diffusers2pnnx.py ├── ncnn_sd_pipeline.py ├── test_ncnn.py ├── torch_sd_pipeline.py └── x86 ├── vs2019_opencv-mobile_ncnn-dll_demo.sln └── vs2019_opencv-mobile_ncnn-dll_demo ├── assets ├── AutoencoderKL-base-fp16.param ├── FrozenCLIPEmbedder-fp16.param ├── log_sigmas.bin └── vocab.txt ├── decoder_slover.cpp ├── decoder_slover.h ├── diffusion_slover.cpp ├── diffusion_slover.h ├── getmem.h ├── magic.txt ├── ncnn.dll ├── ncnn └── build │ └── install │ ├── bin │ ├── caffe2ncnn.exe │ ├── darknet2ncnn.exe │ ├── mxnet2ncnn.exe │ ├── ncnn.dll │ ├── ncnn2int8.exe │ ├── ncnn2mem.exe │ ├── ncnn2table.exe │ ├── ncnnmerge.exe │ ├── ncnnoptimize.exe │ └── onnx2ncnn.exe │ ├── include │ └── ncnn │ │ ├── allocator.h │ │ ├── benchmark.h │ │ ├── blob.h │ │ ├── c_api.h │ │ ├── command.h │ │ ├── cpu.h │ │ ├── datareader.h │ │ ├── gpu.h │ │ ├── layer.h │ │ ├── layer_shader_type.h │ │ ├── layer_shader_type_enum.h │ │ ├── layer_type.h │ │ ├── layer_type_enum.h │ │ ├── mat.h │ │ ├── modelbin.h │ │ ├── ncnn_export.h │ │ ├── net.h │ │ ├── option.h │ │ ├── paramdict.h │ │ ├── pipeline.h │ │ ├── pipelinecache.h │ │ ├── platform.h │ │ ├── simpleocv.h │ │ ├── simpleomp.h │ │ ├── simplestl.h │ │ └── vulkan_header_fix.h │ └── lib │ ├── cmake │ └── ncnn │ │ ├── ncnn-release.cmake │ │ ├── ncnn.cmake │ │ └── ncnnConfig.cmake │ ├── ncnn.lib │ └── pkgconfig │ └── ncnn.pc ├── opencv-mobile-4.5.1-windows-vs2019 └── x64 │ ├── include │ └── opencv2 │ │ ├── core.hpp │ │ ├── core │ │ ├── affine.hpp │ │ ├── async.hpp │ │ ├── base.hpp │ │ ├── bindings_utils.hpp │ │ ├── bufferpool.hpp │ │ ├── check.hpp │ │ ├── core.hpp │ │ ├── core_c.h │ │ ├── cuda.hpp │ │ ├── cuda.inl.hpp │ │ ├── cuda │ │ │ ├── block.hpp │ │ │ ├── border_interpolate.hpp │ │ │ ├── color.hpp │ │ │ ├── common.hpp │ │ │ ├── datamov_utils.hpp │ │ │ ├── detail │ │ │ │ ├── color_detail.hpp │ │ │ │ ├── reduce.hpp │ │ │ │ ├── reduce_key_val.hpp │ │ │ │ ├── transform_detail.hpp │ │ │ │ ├── type_traits_detail.hpp │ │ │ │ └── vec_distance_detail.hpp │ │ │ ├── dynamic_smem.hpp │ │ │ ├── emulation.hpp │ │ │ ├── filters.hpp │ │ │ ├── funcattrib.hpp │ │ │ ├── functional.hpp │ │ │ ├── limits.hpp │ │ │ ├── reduce.hpp │ │ │ ├── saturate_cast.hpp │ │ │ ├── scan.hpp │ │ │ ├── simd_functions.hpp │ │ │ ├── transform.hpp │ │ │ ├── type_traits.hpp │ │ │ ├── utility.hpp │ │ │ ├── vec_distance.hpp │ │ │ ├── vec_math.hpp │ │ │ ├── vec_traits.hpp │ │ │ ├── warp.hpp │ │ │ ├── warp_reduce.hpp │ │ │ └── warp_shuffle.hpp │ │ ├── cuda_stream_accessor.hpp │ │ ├── cuda_types.hpp │ │ ├── cv_cpu_dispatch.h │ │ ├── cv_cpu_helper.h │ │ ├── cvdef.h │ │ ├── cvstd.hpp │ │ ├── cvstd.inl.hpp │ │ ├── cvstd_wrapper.hpp │ │ ├── detail │ │ │ ├── async_promise.hpp │ │ │ └── exception_ptr.hpp │ │ ├── directx.hpp │ │ ├── eigen.hpp │ │ ├── fast_math.hpp │ │ ├── hal │ │ │ ├── hal.hpp │ │ │ ├── interface.h │ │ │ ├── intrin.hpp │ │ │ ├── intrin_avx.hpp │ │ │ ├── intrin_avx512.hpp │ │ │ ├── intrin_cpp.hpp │ │ │ ├── intrin_forward.hpp │ │ │ ├── intrin_msa.hpp │ │ │ ├── intrin_neon.hpp │ │ │ ├── intrin_rvv.hpp │ │ │ ├── intrin_sse.hpp │ │ │ ├── intrin_sse_em.hpp │ │ │ ├── intrin_vsx.hpp │ │ │ ├── intrin_wasm.hpp │ │ │ ├── msa_macros.h │ │ │ └── simd_utils.impl.hpp │ │ ├── mat.hpp │ │ ├── mat.inl.hpp │ │ ├── matx.hpp │ │ ├── neon_utils.hpp │ │ ├── ocl.hpp │ │ ├── ocl_genbase.hpp │ │ ├── opencl │ │ │ ├── ocl_defs.hpp │ │ │ ├── opencl_info.hpp │ │ │ ├── opencl_svm.hpp │ │ │ └── runtime │ │ │ │ ├── autogenerated │ │ │ │ ├── opencl_clamdblas.hpp │ │ │ │ ├── opencl_clamdfft.hpp │ │ │ │ ├── opencl_core.hpp │ │ │ │ ├── opencl_core_wrappers.hpp │ │ │ │ ├── opencl_gl.hpp │ │ │ │ └── opencl_gl_wrappers.hpp │ │ │ │ ├── opencl_clamdblas.hpp │ │ │ │ ├── opencl_clamdfft.hpp │ │ │ │ ├── opencl_core.hpp │ │ │ │ ├── opencl_core_wrappers.hpp │ │ │ │ ├── opencl_gl.hpp │ │ │ │ ├── opencl_gl_wrappers.hpp │ │ │ │ ├── opencl_svm_20.hpp │ │ │ │ ├── opencl_svm_definitions.hpp │ │ │ │ └── opencl_svm_hsa_extension.hpp │ │ ├── opengl.hpp │ │ ├── operations.hpp │ │ ├── optim.hpp │ │ ├── ovx.hpp │ │ ├── persistence.hpp │ │ ├── quaternion.hpp │ │ ├── quaternion.inl.hpp │ │ ├── saturate.hpp │ │ ├── simd_intrinsics.hpp │ │ ├── softfloat.hpp │ │ ├── sse_utils.hpp │ │ ├── traits.hpp │ │ ├── types.hpp │ │ ├── types_c.h │ │ ├── utility.hpp │ │ ├── utils │ │ │ ├── allocator_stats.hpp │ │ │ ├── allocator_stats.impl.hpp │ │ │ ├── filesystem.hpp │ │ │ ├── instrumentation.hpp │ │ │ ├── logger.defines.hpp │ │ │ ├── logger.hpp │ │ │ ├── logtag.hpp │ │ │ ├── tls.hpp │ │ │ └── trace.hpp │ │ ├── va_intel.hpp │ │ ├── version.hpp │ │ └── vsx_utils.hpp │ │ ├── cvconfig.h │ │ ├── features2d.hpp │ │ ├── features2d │ │ ├── features2d.hpp │ │ └── hal │ │ │ └── interface.h │ │ ├── highgui.hpp │ │ ├── highgui │ │ └── highgui.hpp │ │ ├── imgproc.hpp │ │ ├── imgproc │ │ ├── detail │ │ │ └── gcgraph.hpp │ │ ├── hal │ │ │ ├── hal.hpp │ │ │ └── interface.h │ │ ├── imgproc.hpp │ │ ├── imgproc_c.h │ │ └── types_c.h │ │ ├── opencv.hpp │ │ ├── opencv_modules.hpp │ │ ├── photo.hpp │ │ ├── photo │ │ ├── cuda.hpp │ │ ├── legacy │ │ │ └── constants_c.h │ │ └── photo.hpp │ │ ├── video.hpp │ │ └── video │ │ ├── background_segm.hpp │ │ ├── legacy │ │ └── constants_c.h │ │ ├── tracking.hpp │ │ └── video.hpp │ └── x64 │ └── vc16 │ └── staticlib │ ├── opencv_core451.lib │ ├── opencv_features2d451.lib │ ├── opencv_highgui451.lib │ ├── opencv_imgproc451.lib │ ├── opencv_photo451.lib │ └── opencv_video451.lib ├── prompt_slover.cpp ├── prompt_slover.h ├── vs2019_opencv-mobile_ncnn-dll_demo.cpp ├── vs2019_opencv-mobile_ncnn-dll_demo.vcxproj ├── vs2019_opencv-mobile_ncnn-dll_demo.vcxproj.filters └── vs2019_opencv-mobile_ncnn-dll_demo.vcxproj.user /README.md: -------------------------------------------------------------------------------- 1 | # diffusers-ncnn 2 | Port [diffusers](https://github.com/huggingface/diffusers) model to [ncnn](https://github.com/Tencent/ncnn) 3 | 4 | diffusers is the well-known repo for stable diffusion pipeline, there are countless SD model in huggingface with diffusers format. 5 | 6 | With diffusers-ncnn, you can port whatever SD model to ncnn. It doesn't rely on python or pytorch and is a lightweight inference engine. Further more, you can also put the SD model on your phone. 7 | 8 | Note: Besides diffusers, there is a famous repo: [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui), but its code is awful and I used to export novelai models based on it. If you are interested in it, please refer to: [Stable-Diffusion-NCNN](https://github.com/EdVince/Stable-Diffusion-NCNN), the c++ code of this repo is mostly copied from that. 9 | 10 | ## Prepare diffusers model 11 | 12 | ### Setup Environment 13 | ```bash 14 | git clone https://github.com/huggingface/diffusers.git 15 | cd diffusers 16 | pip install -e ".[torch]" 17 | 18 | pip install --upgrade transformers accelerate xformer 19 | pip install safetensors 20 | ``` 21 | 22 | ### (Optional) Convert ckpt/safetensor to diffusers style 23 | ```bash 24 | python diffusers/scripts/convert_original_stable_diffusion_to_diffusers.py --checkpoint_path chilloutmix/Chilloutmix-ema-fp16.safetensors --scheduler_type euler-ancestral --image_size 512 --prediction_type epsilon --device cpu --from_safetensors --to_safetensors --dump_path ./diffusers-model 25 | ``` 26 | 27 | ### (Optional) Test diffusers model 28 | ```python 29 | import torch 30 | from diffusers import StableDiffusionPipeline 31 | 32 | pipe = StableDiffusionPipeline.from_pretrained("../diffusers-model", torch_dtype=torch.float16) 33 | pipe = pipe.to("cuda") 34 | 35 | image = pipe( 36 | prompt="best quality, ultra high res, (photorealistic:1.4), 1girl, thighhighs, (big chest), (upper body), (Kpop idol), (aegyo sal:1), (platinum blonde hair:1), ((puffy eyes)), looking at viewer, facing front, smiling, ((naked))", 37 | negative_prompt="paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glan, ((cloth))", 38 | num_inference_steps=50, guidance_scale=7.5, generator=torch.Generator(device="cuda").manual_seed(1234), 39 | height=512, width=512, 40 | ).images[0] 41 | 42 | image.save('test.png') 43 | ``` 44 | 45 | ## Export to ncnn 46 | 47 | ### Modify some code in python 48 | 49 | 1. UNet 50 | ```python 51 | file: ./diffusers/src/diffusers/models/unet_2d_condition.py 52 | position: the output of the "forward" func in class "UNet2DConditionModel" 53 | 54 | # if not return_dict: 55 | # return (sample,) 56 | 57 | # return UNet2DConditionOutput(sample=sample) 58 | 59 | return sample 60 | ``` 61 | 62 | ### Export to pnnx 63 | ``` 64 | python diffusers2pnnx.py 65 | ``` 66 | 67 | ### Export to ncnn 68 | ```bash 69 | pnnx unet.pt inputshape=[1,4,64,64],[1],[1,77,768] 70 | ``` 71 | 72 | ### Modify the ncnn.param 73 | 1. unet.ncnn.param 74 | ```bash 75 | change: "Expand Tensor.expand_51 xxxxxx" 76 | to: "Noop Tensor.expand_51 xxxxxx" 77 | ``` 78 | 79 | ### Test in python 80 | ```bash 81 | python test_ncnn.py 82 | ``` 83 | 84 | ## Run with x86 85 | 1. prepare model 86 | ``` 87 | assets 88 | vocab.txt 89 | log_sigmas.bin 90 | AutoencoderKL-base-fp16.param 91 | FrozenCLIPEmbedder-fp16.param 92 | AutoencoderKL-fp16.bin (please download from https://github.com/EdVince/Stable-Diffusion-NCNN) 93 | FrozenCLIPEmbedder-fp16.bin (please download from https://github.com/EdVince/Stable-Diffusion-NCNN) 94 | unet.ncnn.bin (it should be generated by yourself) 95 | unet.ncnn.param (it should be generated by yourself) 96 | ``` 97 | 2. compile it with visual studio -------------------------------------------------------------------------------- /diffusers2pnnx.py: -------------------------------------------------------------------------------- 1 | import os 2 | import torch 3 | from diffusers import StableDiffusionPipeline 4 | 5 | # config 6 | device = "cuda" 7 | from_model = "../diffusers-model" 8 | to_model = "model" 9 | height, width = 512, 512 10 | 11 | 12 | 13 | # check 14 | assert height % 8 == 0 and width % 8 == 0 15 | height, width = height // 8, width // 8 16 | os.makedirs(to_model, exist_ok=True) 17 | 18 | # load model 19 | pipe = StableDiffusionPipeline.from_pretrained(from_model, torch_dtype=torch.float32) 20 | pipe = pipe.to(device) 21 | 22 | # jit unet 23 | unet = torch.jit.trace(pipe.unet, (torch.rand(1,4,height,width).to(device),torch.rand(1).to(device),torch.rand(1,77,768).to(device))) 24 | unet.save(os.path.join(to_model,"unet.pt")) 25 | 26 | # # test 27 | # image = pipe( 28 | # prompt="best quality, ultra high res, (photorealistic:1.4), 1girl, thighhighs, (big chest), (upper body), (Kpop idol), (aegyo sal:1), (platinum blonde hair:1), ((puffy eyes)), looking at viewer, facing front, smiling, ((naked))", 29 | # negative_prompt="paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glan, ((cloth))", 30 | # num_inference_steps=50, guidance_scale=7.5, generator=torch.Generator(device=device).manual_seed(1234), 31 | # height=512, width=512, 32 | # ).images[0] 33 | # image.save('test.png') -------------------------------------------------------------------------------- /test_ncnn.py: -------------------------------------------------------------------------------- 1 | import os 2 | import torch 3 | from ncnn_sd_pipeline import StableDiffusionPipeline 4 | 5 | # config 6 | device = "cuda" 7 | from_model = "../diffusers-model" 8 | 9 | # load model 10 | pipe = StableDiffusionPipeline.from_pretrained(from_model, torch_dtype=torch.float32) 11 | pipe = pipe.to(device) 12 | 13 | pipe.load_ncnn(["model/unet.ncnn.param","model/unet.ncnn.bin"]) 14 | 15 | image = pipe( 16 | prompt="best quality, ultra high res, (photorealistic:1.4), 1girl, thighhighs, (big chest), (upper body), (Kpop idol), (aegyo sal:1), (platinum blonde hair:1), ((puffy eyes)), looking at viewer, facing front, smiling, ((naked))", 17 | negative_prompt="paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glan, ((cloth))", 18 | num_inference_steps=50, guidance_scale=7.5, 19 | height=512, width=512, 20 | )[0] 21 | 22 | image.save('test.png') 23 | 24 | pipe.clear_ncnn() -------------------------------------------------------------------------------- /torch_sd_pipeline.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer 3 | from diffusers import AutoencoderKL, UNet2DConditionModel 4 | from diffusers import EulerAncestralDiscreteScheduler 5 | from diffusers import DiffusionPipeline 6 | 7 | class StableDiffusionPipeline(DiffusionPipeline): 8 | def __init__( 9 | self, 10 | vae: AutoencoderKL, 11 | text_encoder: CLIPTextModel, 12 | tokenizer: CLIPTokenizer, 13 | unet: UNet2DConditionModel, 14 | scheduler: EulerAncestralDiscreteScheduler, 15 | safety_checker: None, 16 | feature_extractor: CLIPFeatureExtractor, 17 | ): 18 | super().__init__() 19 | 20 | self.register_modules( 21 | vae=vae, 22 | text_encoder=text_encoder, 23 | tokenizer=tokenizer, 24 | unet=unet, 25 | scheduler=scheduler, 26 | safety_checker=safety_checker, 27 | feature_extractor=feature_extractor, 28 | ) 29 | self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) 30 | 31 | def _encode_prompt(self,prompt,negative_prompt,device): 32 | # positive prompt 33 | text_inputs = self.tokenizer( 34 | prompt, 35 | padding="max_length", 36 | max_length=self.tokenizer.model_max_length, 37 | truncation=True, 38 | return_tensors="pt", 39 | ) 40 | prompt_embeds = self.text_encoder(text_inputs.input_ids.to(device)) 41 | prompt_embeds = prompt_embeds[0] 42 | prompt_embeds = prompt_embeds.to(dtype=self.text_encoder.dtype, device=device) 43 | 44 | # negative prompt 45 | uncond_input = self.tokenizer( 46 | negative_prompt, 47 | padding="max_length", 48 | max_length=self.tokenizer.model_max_length, 49 | truncation=True, 50 | return_tensors="pt", 51 | ) 52 | negative_prompt_embeds = self.text_encoder(uncond_input.input_ids.to(device)) 53 | negative_prompt_embeds = negative_prompt_embeds[0] 54 | negative_prompt_embeds = negative_prompt_embeds.to(dtype=self.text_encoder.dtype, device=device) 55 | 56 | return negative_prompt_embeds, prompt_embeds 57 | 58 | def decode_latents(self, latents): 59 | latents = 1 / self.vae.config.scaling_factor * latents 60 | image = self.vae.decode(latents).sample 61 | image = (image / 2 + 0.5).clamp(0, 1) 62 | image = image.cpu().permute(0, 2, 3, 1).float().numpy() 63 | return image 64 | 65 | def prepare_latents(self, height, width, dtype, device): 66 | shape = (1, 4, height // self.vae_scale_factor, width // self.vae_scale_factor) 67 | latents = torch.randn(shape, generator=None, device=device, dtype=dtype, layout=torch.strided).to(device) 68 | latents = latents * self.scheduler.init_noise_sigma 69 | return latents 70 | 71 | @torch.no_grad() 72 | def __call__(self,prompt,height,width,num_inference_steps,guidance_scale,negative_prompt,): 73 | # 0. Default height and width to unet 74 | height = height or self.unet.config.sample_size * self.vae_scale_factor 75 | width = width or self.unet.config.sample_size * self.vae_scale_factor 76 | device = self.device 77 | 78 | # 1. Encode input prompt 79 | negative_prompt_embeds, prompt_embeds = self._encode_prompt(prompt,negative_prompt,device) 80 | 81 | # 2. Prepare timesteps 82 | self.scheduler.set_timesteps(num_inference_steps, device=device) 83 | timesteps = self.scheduler.timesteps 84 | 85 | # 3. Prepare latent variables 86 | latents = self.prepare_latents(height,width,prompt_embeds.dtype,device) 87 | 88 | # 4. Denoising loop 89 | num_warmup_steps = len(timesteps) - num_inference_steps * self.scheduler.order 90 | with self.progress_bar(total=num_inference_steps) as progress_bar: 91 | for i, t in enumerate(timesteps): 92 | # expand the latents if we are doing classifier free guidance 93 | latent_model_input = self.scheduler.scale_model_input(latents, t) 94 | 95 | # predict the noise residual 96 | noise_pred_uncond = self.unet(latent_model_input,t,negative_prompt_embeds) 97 | noise_pred_text = self.unet(latent_model_input,t,prompt_embeds) 98 | 99 | # perform guidance 100 | noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond) 101 | 102 | # compute the previous noisy sample x_t -> x_t-1 103 | latents = self.scheduler.step(noise_pred, t, latents).prev_sample 104 | 105 | # update progress bar 106 | if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0): 107 | progress_bar.update() 108 | 109 | # 5. Decode the latent 110 | image = self.decode_latents(latents) 111 | 112 | # 6. Convert to Image 113 | image = self.numpy_to_pil(image) 114 | 115 | return image 116 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30907.101 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vs2019_opencv-mobile_ncnn-dll_demo", "vs2019_opencv-mobile_ncnn-dll_demo\vs2019_opencv-mobile_ncnn-dll_demo.vcxproj", "{2561D004-3F31-40AF-8252-F9FE4370E417}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {2561D004-3F31-40AF-8252-F9FE4370E417}.Debug|x64.ActiveCfg = Debug|x64 17 | {2561D004-3F31-40AF-8252-F9FE4370E417}.Debug|x64.Build.0 = Debug|x64 18 | {2561D004-3F31-40AF-8252-F9FE4370E417}.Debug|x86.ActiveCfg = Debug|Win32 19 | {2561D004-3F31-40AF-8252-F9FE4370E417}.Debug|x86.Build.0 = Debug|Win32 20 | {2561D004-3F31-40AF-8252-F9FE4370E417}.Release|x64.ActiveCfg = Release|x64 21 | {2561D004-3F31-40AF-8252-F9FE4370E417}.Release|x64.Build.0 = Release|x64 22 | {2561D004-3F31-40AF-8252-F9FE4370E417}.Release|x86.ActiveCfg = Release|Win32 23 | {2561D004-3F31-40AF-8252-F9FE4370E417}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {BB6692A4-60F8-4265-BE26-0528FA74690E} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/assets/log_sigmas.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/assets/log_sigmas.bin -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/decoder_slover.cpp: -------------------------------------------------------------------------------- 1 | #include "decoder_slover.h" 2 | 3 | DecodeSlover::DecodeSlover() 4 | { 5 | net.opt.use_vulkan_compute = false; 6 | net.opt.use_winograd_convolution = false; 7 | net.opt.use_sgemm_convolution = false; 8 | net.opt.use_fp16_packed = false; 9 | net.opt.use_fp16_storage = false; 10 | net.opt.use_fp16_arithmetic = false; 11 | net.opt.use_bf16_storage = true; 12 | net.opt.use_packing_layout = true; 13 | 14 | net.load_param("assets/AutoencoderKL-base-fp16.param"); 15 | net.load_model("assets/AutoencoderKL-fp16.bin"); 16 | } 17 | 18 | ncnn::Mat DecodeSlover::decode(ncnn::Mat sample) 19 | { 20 | ncnn::Mat x_samples_ddim; 21 | { 22 | sample.substract_mean_normalize(0, factor); 23 | 24 | { 25 | ncnn::Extractor ex = net.create_extractor(); 26 | ex.set_light_mode(true); 27 | ex.input("input.1", sample); 28 | ex.extract("815", x_samples_ddim); 29 | } 30 | 31 | x_samples_ddim.substract_mean_normalize(_mean_, _norm_); 32 | } 33 | 34 | return x_samples_ddim; 35 | } -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/decoder_slover.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | using namespace std; 15 | 16 | class DecodeSlover 17 | { 18 | public: 19 | DecodeSlover(); 20 | 21 | ncnn::Mat decode(ncnn::Mat sample); 22 | 23 | private: 24 | const float factor[4] = { 5.48998f, 5.48998f, 5.48998f, 5.48998f }; 25 | const float _mean_[3] = { -1.0f, -1.0f, -1.0f }; 26 | const float _norm_[3] = { 127.5f, 127.5f, 127.5f }; 27 | 28 | ncnn::Net net; 29 | }; -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/diffusion_slover.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "benchmark.h" 15 | using namespace std; 16 | 17 | class DiffusionSlover 18 | { 19 | public: 20 | DiffusionSlover(); 21 | 22 | ncnn::Mat sampler(int seed, int step, ncnn::Mat& c, ncnn::Mat& uc); 23 | 24 | private: 25 | ncnn::Mat randn_4(int seed); 26 | ncnn::Mat CFGDenoiser_CompVisDenoiser(ncnn::Mat& input, float sigma, ncnn::Mat cond, ncnn::Mat uncond); 27 | 28 | private: 29 | float log_sigmas[1000] = { 0 }; 30 | 31 | ncnn::Net net; 32 | }; -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/getmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: David Robert Nadeau 3 | * Site: http://NadeauSoftware.com/ 4 | * License: Creative Commons Attribution 3.0 Unported License 5 | * http://creativecommons.org/licenses/by/3.0/deed.en_US 6 | */ 7 | 8 | #if defined(_WIN32) 9 | #include 10 | #include 11 | 12 | #elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) 13 | #include 14 | #include 15 | 16 | #if defined(__APPLE__) && defined(__MACH__) 17 | #include 18 | 19 | #elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__))) 20 | #include 21 | #include 22 | 23 | #elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) 24 | #include 25 | 26 | #endif 27 | 28 | #else 29 | #error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS." 30 | #endif 31 | 32 | 33 | 34 | 35 | 36 | /** 37 | * Returns the peak (maximum so far) resident set size (physical 38 | * memory use) measured in bytes, or zero if the value cannot be 39 | * determined on this OS. 40 | */ 41 | size_t getPeakRSS() 42 | { 43 | #if defined(_WIN32) 44 | /* Windows -------------------------------------------------- */ 45 | PROCESS_MEMORY_COUNTERS info; 46 | GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info)); 47 | return (size_t)info.PeakWorkingSetSize; 48 | 49 | #elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__))) 50 | /* AIX and Solaris ------------------------------------------ */ 51 | struct psinfo psinfo; 52 | int fd = -1; 53 | if ((fd = open("/proc/self/psinfo", O_RDONLY)) == -1) 54 | return (size_t)0L; /* Can't open? */ 55 | if (read(fd, &psinfo, sizeof(psinfo)) != sizeof(psinfo)) 56 | { 57 | close(fd); 58 | return (size_t)0L; /* Can't read? */ 59 | } 60 | close(fd); 61 | return (size_t)(psinfo.pr_rssize * 1024L); 62 | 63 | #elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) 64 | /* BSD, Linux, and OSX -------------------------------------- */ 65 | struct rusage rusage; 66 | getrusage(RUSAGE_SELF, &rusage); 67 | #if defined(__APPLE__) && defined(__MACH__) 68 | return (size_t)rusage.ru_maxrss; 69 | #else 70 | return (size_t)(rusage.ru_maxrss * 1024L); 71 | #endif 72 | 73 | #else 74 | /* Unknown OS ----------------------------------------------- */ 75 | return (size_t)0L; /* Unsupported. */ 76 | #endif 77 | } 78 | 79 | 80 | 81 | 82 | 83 | /** 84 | * Returns the current resident set size (physical memory use) measured 85 | * in bytes, or zero if the value cannot be determined on this OS. 86 | */ 87 | size_t getCurrentRSS() 88 | { 89 | #if defined(_WIN32) 90 | /* Windows -------------------------------------------------- */ 91 | PROCESS_MEMORY_COUNTERS info; 92 | GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info)); 93 | return (size_t)info.WorkingSetSize; 94 | 95 | #elif defined(__APPLE__) && defined(__MACH__) 96 | /* OSX ------------------------------------------------------ */ 97 | struct mach_task_basic_info info; 98 | mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT; 99 | if (task_info(mach_task_self(), MACH_TASK_BASIC_INFO, 100 | (task_info_t)&info, &infoCount) != KERN_SUCCESS) 101 | return (size_t)0L; /* Can't access? */ 102 | return (size_t)info.resident_size; 103 | 104 | #elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) 105 | /* Linux ---------------------------------------------------- */ 106 | long rss = 0L; 107 | FILE* fp = NULL; 108 | if ((fp = fopen("/proc/self/statm", "r")) == NULL) 109 | return (size_t)0L; /* Can't open? */ 110 | if (fscanf(fp, "%*s%ld", &rss) != 1) 111 | { 112 | fclose(fp); 113 | return (size_t)0L; /* Can't read? */ 114 | } 115 | fclose(fp); 116 | return (size_t)rss * (size_t)sysconf(_SC_PAGESIZE); 117 | 118 | #else 119 | /* AIX, BSD, Solaris, and Unknown OS ------------------------ */ 120 | return (size_t)0L; /* Unsupported. */ 121 | #endif 122 | } -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/magic.txt: -------------------------------------------------------------------------------- 1 | 30 2 | 20230302 3 | best quality, ultra high res, (photorealistic), 1 girl, thighhighs, (big chest), (upper body), (Kpop idol), (aegyo sal), (platinum blonde hair), ((puffy eyes)), looking at viewer, facing front, smiling, ((naked)) 4 | paintings, sketches, (worst quality), (low quality), (normal quality), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glan, ((cloth)) -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn.dll -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/caffe2ncnn.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/caffe2ncnn.exe -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/darknet2ncnn.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/darknet2ncnn.exe -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/mxnet2ncnn.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/mxnet2ncnn.exe -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnn.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnn.dll -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnn2int8.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnn2int8.exe -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnn2mem.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnn2mem.exe -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnn2table.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnn2table.exe -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnnmerge.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnnmerge.exe -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnnoptimize.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/ncnnoptimize.exe -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/onnx2ncnn.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/bin/onnx2ncnn.exe -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/benchmark.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_BENCHMARK_H 16 | #define NCNN_BENCHMARK_H 17 | 18 | #include "layer.h" 19 | #include "mat.h" 20 | #include "platform.h" 21 | 22 | namespace ncnn { 23 | 24 | // get now timestamp in ms 25 | NCNN_EXPORT double get_current_time(); 26 | 27 | #if NCNN_BENCHMARK 28 | 29 | NCNN_EXPORT void benchmark(const Layer* layer, double start, double end); 30 | NCNN_EXPORT void benchmark(const Layer* layer, const Mat& bottom_blob, Mat& top_blob, double start, double end); 31 | 32 | #endif // NCNN_BENCHMARK 33 | 34 | } // namespace ncnn 35 | 36 | #endif // NCNN_BENCHMARK_H 37 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/blob.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_BLOB_H 16 | #define NCNN_BLOB_H 17 | 18 | #include "mat.h" 19 | #include "platform.h" 20 | 21 | namespace ncnn { 22 | 23 | class NCNN_EXPORT Blob 24 | { 25 | public: 26 | // empty 27 | Blob(); 28 | 29 | public: 30 | #if NCNN_STRING 31 | // blob name 32 | std::string name; 33 | #endif // NCNN_STRING 34 | // layer index which produce this blob as output 35 | int producer; 36 | // layer index which need this blob as input 37 | int consumer; 38 | // shape hint 39 | Mat shape; 40 | }; 41 | 42 | } // namespace ncnn 43 | 44 | #endif // NCNN_BLOB_H 45 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/command.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_COMMAND_H 16 | #define NCNN_COMMAND_H 17 | 18 | #include "platform.h" 19 | 20 | #if NCNN_VULKAN 21 | 22 | #include "mat.h" 23 | 24 | #include 25 | 26 | namespace ncnn { 27 | 28 | class Pipeline; 29 | #if NCNN_PLATFORM_API 30 | #if __ANDROID_API__ >= 26 31 | class ImportAndroidHardwareBufferPipeline; 32 | #endif // __ANDROID_API__ >= 26 33 | #endif // NCNN_PLATFORM_API 34 | class VkComputePrivate; 35 | class NCNN_EXPORT VkCompute 36 | { 37 | public: 38 | explicit VkCompute(const VulkanDevice* vkdev); 39 | virtual ~VkCompute(); 40 | 41 | public: 42 | void record_upload(const Mat& src, VkMat& dst, const Option& opt); 43 | 44 | void record_upload(const Mat& src, VkImageMat& dst, const Option& opt); 45 | 46 | void record_download(const VkMat& src, Mat& dst, const Option& opt); 47 | 48 | void record_download(const VkImageMat& src, Mat& dst, const Option& opt); 49 | 50 | void record_buffer_to_image(const VkMat& src, VkImageMat& dst, const Option& opt); 51 | 52 | void record_image_to_buffer(const VkImageMat& src, VkMat& dst, const Option& opt); 53 | 54 | void record_clone(const Mat& src, VkMat& dst, const Option& opt); 55 | 56 | void record_clone(const Mat& src, VkImageMat& dst, const Option& opt); 57 | 58 | void record_clone(const VkMat& src, Mat& dst, const Option& opt); 59 | 60 | void record_clone(const VkImageMat& src, Mat& dst, const Option& opt); 61 | 62 | void record_clone(const VkMat& src, VkMat& dst, const Option& opt); 63 | 64 | void record_clone(const VkImageMat& src, VkImageMat& dst, const Option& opt); 65 | 66 | void record_clone(const VkMat& src, VkImageMat& dst, const Option& opt); 67 | 68 | void record_clone(const VkImageMat& src, VkMat& dst, const Option& opt); 69 | 70 | void record_pipeline(const Pipeline* pipeline, const std::vector& bindings, const std::vector& constants, const VkMat& dispatcher); 71 | 72 | void record_pipeline(const Pipeline* pipeline, const std::vector& bindings, const std::vector& constants, const VkImageMat& dispatcher); 73 | 74 | void record_pipeline(const Pipeline* pipeline, const std::vector& buffer_bindings, const std::vector& image_bindings, const std::vector& constants, const VkMat& dispatcher); 75 | void record_pipeline(const Pipeline* pipeline, const std::vector& buffer_bindings, const std::vector& image_bindings, const std::vector& constants, const VkImageMat& dispatcher); 76 | void record_pipeline(const Pipeline* pipeline, const std::vector& buffer_bindings, const std::vector& image_bindings, const std::vector& constants, const Mat& dispatcher); 77 | 78 | #if NCNN_BENCHMARK 79 | void record_write_timestamp(uint32_t query); 80 | #endif // NCNN_BENCHMARK 81 | 82 | #if NCNN_PLATFORM_API 83 | #if __ANDROID_API__ >= 26 84 | void record_import_android_hardware_buffer(const ImportAndroidHardwareBufferPipeline* pipeline, const VkImageMat& src, const VkMat& dst); 85 | 86 | void record_import_android_hardware_buffer(const ImportAndroidHardwareBufferPipeline* pipeline, const VkImageMat& src, const VkImageMat& dst); 87 | #endif // __ANDROID_API__ >= 26 88 | #endif // NCNN_PLATFORM_API 89 | 90 | int submit_and_wait(); 91 | 92 | int reset(); 93 | 94 | #if NCNN_BENCHMARK 95 | int create_query_pool(uint32_t query_count); 96 | 97 | int get_query_pool_results(uint32_t first_query, uint32_t query_count, std::vector& results); 98 | #endif // NCNN_BENCHMARK 99 | 100 | protected: 101 | const VulkanDevice* vkdev; 102 | 103 | void barrier_readwrite(const VkMat& binding); 104 | void barrier_readwrite(const VkImageMat& binding); 105 | void barrier_readonly(const VkImageMat& binding); 106 | 107 | private: 108 | VkComputePrivate* const d; 109 | }; 110 | 111 | class VkTransferPrivate; 112 | class NCNN_EXPORT VkTransfer 113 | { 114 | public: 115 | explicit VkTransfer(const VulkanDevice* vkdev); 116 | virtual ~VkTransfer(); 117 | 118 | public: 119 | void record_upload(const Mat& src, VkMat& dst, const Option& opt, bool flatten = true); 120 | 121 | void record_upload(const Mat& src, VkImageMat& dst, const Option& opt); 122 | 123 | int submit_and_wait(); 124 | 125 | protected: 126 | const VulkanDevice* vkdev; 127 | 128 | private: 129 | VkTransferPrivate* const d; 130 | }; 131 | 132 | } // namespace ncnn 133 | 134 | #endif // NCNN_VULKAN 135 | 136 | #endif // NCNN_COMMAND_H 137 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/datareader.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_DATAREADER_H 16 | #define NCNN_DATAREADER_H 17 | 18 | #include "platform.h" 19 | #if NCNN_STDIO 20 | #include 21 | #endif 22 | 23 | #if NCNN_PLATFORM_API 24 | #if __ANDROID_API__ >= 9 25 | #include 26 | #endif 27 | #endif // NCNN_PLATFORM_API 28 | 29 | namespace ncnn { 30 | 31 | // data read wrapper 32 | class NCNN_EXPORT DataReader 33 | { 34 | public: 35 | DataReader(); 36 | virtual ~DataReader(); 37 | 38 | #if NCNN_STRING 39 | // parse plain param text 40 | // return 1 if scan success 41 | virtual int scan(const char* format, void* p) const; 42 | #endif // NCNN_STRING 43 | 44 | // read binary param and model data 45 | // return bytes read 46 | virtual size_t read(void* buf, size_t size) const; 47 | 48 | // get model data reference 49 | // return bytes referenced 50 | virtual size_t reference(size_t size, const void** buf) const; 51 | }; 52 | 53 | #if NCNN_STDIO 54 | class DataReaderFromStdioPrivate; 55 | class NCNN_EXPORT DataReaderFromStdio : public DataReader 56 | { 57 | public: 58 | explicit DataReaderFromStdio(FILE* fp); 59 | virtual ~DataReaderFromStdio(); 60 | 61 | #if NCNN_STRING 62 | virtual int scan(const char* format, void* p) const; 63 | #endif // NCNN_STRING 64 | virtual size_t read(void* buf, size_t size) const; 65 | 66 | private: 67 | DataReaderFromStdio(const DataReaderFromStdio&); 68 | DataReaderFromStdio& operator=(const DataReaderFromStdio&); 69 | 70 | private: 71 | DataReaderFromStdioPrivate* const d; 72 | }; 73 | #endif // NCNN_STDIO 74 | 75 | class DataReaderFromMemoryPrivate; 76 | class NCNN_EXPORT DataReaderFromMemory : public DataReader 77 | { 78 | public: 79 | explicit DataReaderFromMemory(const unsigned char*& mem); 80 | virtual ~DataReaderFromMemory(); 81 | 82 | #if NCNN_STRING 83 | virtual int scan(const char* format, void* p) const; 84 | #endif // NCNN_STRING 85 | virtual size_t read(void* buf, size_t size) const; 86 | virtual size_t reference(size_t size, const void** buf) const; 87 | 88 | private: 89 | DataReaderFromMemory(const DataReaderFromMemory&); 90 | DataReaderFromMemory& operator=(const DataReaderFromMemory&); 91 | 92 | private: 93 | DataReaderFromMemoryPrivate* const d; 94 | }; 95 | 96 | #if NCNN_PLATFORM_API 97 | #if __ANDROID_API__ >= 9 98 | class DataReaderFromAndroidAssetPrivate; 99 | class NCNN_EXPORT DataReaderFromAndroidAsset : public DataReader 100 | { 101 | public: 102 | explicit DataReaderFromAndroidAsset(AAsset* asset); 103 | virtual ~DataReaderFromAndroidAsset(); 104 | 105 | #if NCNN_STRING 106 | virtual int scan(const char* format, void* p) const; 107 | #endif // NCNN_STRING 108 | virtual size_t read(void* buf, size_t size) const; 109 | 110 | private: 111 | DataReaderFromAndroidAsset(const DataReaderFromAndroidAsset&); 112 | DataReaderFromAndroidAsset& operator=(const DataReaderFromAndroidAsset&); 113 | 114 | private: 115 | DataReaderFromAndroidAssetPrivate* const d; 116 | }; 117 | #endif // __ANDROID_API__ >= 9 118 | #endif // NCNN_PLATFORM_API 119 | 120 | } // namespace ncnn 121 | 122 | #endif // NCNN_DATAREADER_H 123 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/layer_shader_type.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_LAYER_SHADER_TYPE_H 16 | #define NCNN_LAYER_SHADER_TYPE_H 17 | 18 | namespace ncnn { 19 | 20 | namespace LayerShaderType { 21 | enum LayerShaderType 22 | { 23 | #include "layer_shader_type_enum.h" 24 | }; 25 | } // namespace LayerShaderType 26 | 27 | } // namespace ncnn 28 | 29 | #endif // NCNN_LAYER_SHADER_TYPE_H 30 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/layer_shader_type_enum.h: -------------------------------------------------------------------------------- 1 | // Layer Shader Enum header 2 | // 3 | // This file is auto-generated by cmake, don't edit it. 4 | 5 | 6 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/layer_type.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_LAYER_TYPE_H 16 | #define NCNN_LAYER_TYPE_H 17 | 18 | namespace ncnn { 19 | 20 | namespace LayerType { 21 | enum LayerType 22 | { 23 | #include "layer_type_enum.h" 24 | CustomBit = (1 << 8), 25 | }; 26 | } // namespace LayerType 27 | 28 | } // namespace ncnn 29 | 30 | #endif // NCNN_LAYER_TYPE_H 31 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/layer_type_enum.h: -------------------------------------------------------------------------------- 1 | // Layer Type Enum header 2 | // 3 | // This file is auto-generated by cmake, don't edit it. 4 | 5 | AbsVal = 0, 6 | ArgMax = 1, 7 | BatchNorm = 2, 8 | Bias = 3, 9 | BNLL = 4, 10 | Concat = 5, 11 | Convolution = 6, 12 | Crop = 7, 13 | Deconvolution = 8, 14 | Dropout = 9, 15 | Eltwise = 10, 16 | ELU = 11, 17 | Embed = 12, 18 | Exp = 13, 19 | Flatten = 14, 20 | InnerProduct = 15, 21 | Input = 16, 22 | Log = 17, 23 | LRN = 18, 24 | MemoryData = 19, 25 | MVN = 20, 26 | Pooling = 21, 27 | Power = 22, 28 | PReLU = 23, 29 | Proposal = 24, 30 | Reduction = 25, 31 | ReLU = 26, 32 | Reshape = 27, 33 | ROIPooling = 28, 34 | Scale = 29, 35 | Sigmoid = 30, 36 | Slice = 31, 37 | Softmax = 32, 38 | Split = 33, 39 | SPP = 34, 40 | TanH = 35, 41 | Threshold = 36, 42 | Tile = 37, 43 | RNN = 38, 44 | LSTM = 39, 45 | BinaryOp = 40, 46 | UnaryOp = 41, 47 | ConvolutionDepthWise = 42, 48 | Padding = 43, 49 | Squeeze = 44, 50 | ExpandDims = 45, 51 | Normalize = 46, 52 | Permute = 47, 53 | PriorBox = 48, 54 | DetectionOutput = 49, 55 | Interp = 50, 56 | DeconvolutionDepthWise = 51, 57 | ShuffleChannel = 52, 58 | InstanceNorm = 53, 59 | Clip = 54, 60 | Reorg = 55, 61 | YoloDetectionOutput = 56, 62 | Quantize = 57, 63 | Dequantize = 58, 64 | Yolov3DetectionOutput = 59, 65 | PSROIPooling = 60, 66 | ROIAlign = 61, 67 | Packing = 62, 68 | Requantize = 63, 69 | Cast = 64, 70 | HardSigmoid = 65, 71 | SELU = 66, 72 | HardSwish = 67, 73 | Noop = 68, 74 | PixelShuffle = 69, 75 | DeepCopy = 70, 76 | Mish = 71, 77 | StatisticsPooling = 72, 78 | Swish = 73, 79 | Gemm = 74, 80 | GroupNorm = 75, 81 | LayerNorm = 76, 82 | Softplus = 77, 83 | GRU = 78, 84 | MultiHeadAttention = 79, 85 | GELU = 80, 86 | Convolution1D = 81, 87 | Pooling1D = 82, 88 | ConvolutionDepthWise1D = 83, 89 | Convolution3D = 84, 90 | ConvolutionDepthWise3D = 85, 91 | Pooling3D = 86, 92 | MatMul = 87, 93 | Deconvolution1D = 88, 94 | DeconvolutionDepthWise1D = 89, 95 | Deconvolution3D = 90, 96 | DeconvolutionDepthWise3D = 91, 97 | Einsum = 92, 98 | DeformableConv2D = 93, 99 | GLU = 94, 100 | Fold = 95, 101 | Unfold = 96, 102 | GridSample = 97, 103 | CumulativeSum = 98, 104 | CopyTo = 99, 105 | 106 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/modelbin.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_MODELBIN_H 16 | #define NCNN_MODELBIN_H 17 | 18 | #include "mat.h" 19 | 20 | namespace ncnn { 21 | 22 | class DataReader; 23 | class NCNN_EXPORT ModelBin 24 | { 25 | public: 26 | ModelBin(); 27 | virtual ~ModelBin(); 28 | // element type 29 | // 0 = auto 30 | // 1 = float32 31 | // 2 = float16 32 | // 3 = int8 33 | // load vec 34 | virtual Mat load(int w, int type) const = 0; 35 | // load image 36 | virtual Mat load(int w, int h, int type) const; 37 | // load dim 38 | virtual Mat load(int w, int h, int c, int type) const; 39 | // load cube 40 | virtual Mat load(int w, int h, int d, int c, int type) const; 41 | }; 42 | 43 | class ModelBinFromDataReaderPrivate; 44 | class NCNN_EXPORT ModelBinFromDataReader : public ModelBin 45 | { 46 | public: 47 | explicit ModelBinFromDataReader(const DataReader& dr); 48 | virtual ~ModelBinFromDataReader(); 49 | 50 | virtual Mat load(int w, int type) const; 51 | 52 | private: 53 | ModelBinFromDataReader(const ModelBinFromDataReader&); 54 | ModelBinFromDataReader& operator=(const ModelBinFromDataReader&); 55 | 56 | private: 57 | ModelBinFromDataReaderPrivate* const d; 58 | }; 59 | 60 | class ModelBinFromMatArrayPrivate; 61 | class NCNN_EXPORT ModelBinFromMatArray : public ModelBin 62 | { 63 | public: 64 | // construct from weight blob array 65 | explicit ModelBinFromMatArray(const Mat* weights); 66 | virtual ~ModelBinFromMatArray(); 67 | 68 | virtual Mat load(int w, int type) const; 69 | 70 | private: 71 | ModelBinFromMatArray(const ModelBinFromMatArray&); 72 | ModelBinFromMatArray& operator=(const ModelBinFromMatArray&); 73 | 74 | private: 75 | ModelBinFromMatArrayPrivate* const d; 76 | }; 77 | 78 | } // namespace ncnn 79 | 80 | #endif // NCNN_MODELBIN_H 81 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/ncnn_export.h: -------------------------------------------------------------------------------- 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 __declspec(dllexport) 13 | # else 14 | /* We are using this library */ 15 | # define NCNN_EXPORT __declspec(dllimport) 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 __declspec(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 | #if 0 /* DEFINE_NO_DEPRECATED */ 37 | # ifndef NCNN_NO_DEPRECATED 38 | # define NCNN_NO_DEPRECATED 39 | # endif 40 | #endif 41 | 42 | #endif /* NCNN_EXPORT_H */ 43 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/option.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_OPTION_H 16 | #define NCNN_OPTION_H 17 | 18 | #include "platform.h" 19 | 20 | namespace ncnn { 21 | 22 | #if NCNN_VULKAN 23 | class VkAllocator; 24 | class PipelineCache; 25 | #endif // NCNN_VULKAN 26 | 27 | class Allocator; 28 | class NCNN_EXPORT Option 29 | { 30 | public: 31 | // default option 32 | Option(); 33 | 34 | public: 35 | // light mode 36 | // intermediate blob will be recycled when enabled 37 | // enabled by default 38 | bool lightmode; 39 | 40 | // thread count 41 | // default value is the one returned by get_cpu_count() 42 | int num_threads; 43 | 44 | // blob memory allocator 45 | Allocator* blob_allocator; 46 | 47 | // workspace memory allocator 48 | Allocator* workspace_allocator; 49 | 50 | #if NCNN_VULKAN 51 | // blob memory allocator 52 | VkAllocator* blob_vkallocator; 53 | 54 | // workspace memory allocator 55 | VkAllocator* workspace_vkallocator; 56 | 57 | // staging memory allocator 58 | VkAllocator* staging_vkallocator; 59 | 60 | // pipeline cache 61 | PipelineCache* pipeline_cache; 62 | #endif // NCNN_VULKAN 63 | 64 | // the time openmp threads busy-wait for more work before going to sleep 65 | // default value is 20ms to keep the cores enabled 66 | // without too much extra power consumption afterwards 67 | int openmp_blocktime; 68 | 69 | // enable winograd convolution optimization 70 | // improve convolution 3x3 stride1 performance, may consume more memory 71 | // changes should be applied before loading network structure and weight 72 | // enabled by default 73 | bool use_winograd_convolution; 74 | 75 | // enable sgemm convolution optimization 76 | // improve convolution 1x1 stride1 performance, may consume more memory 77 | // changes should be applied before loading network structure and weight 78 | // enabled by default 79 | bool use_sgemm_convolution; 80 | 81 | // enable quantized int8 inference 82 | // use low-precision int8 path for quantized model 83 | // changes should be applied before loading network structure and weight 84 | // enabled by default 85 | bool use_int8_inference; 86 | 87 | // enable vulkan compute 88 | bool use_vulkan_compute; 89 | 90 | // enable bf16 data type for storage 91 | // improve most operator performance on all arm devices, may consume more memory 92 | bool use_bf16_storage; 93 | 94 | // enable options for gpu inference 95 | bool use_fp16_packed; 96 | bool use_fp16_storage; 97 | bool use_fp16_arithmetic; 98 | bool use_int8_packed; 99 | bool use_int8_storage; 100 | bool use_int8_arithmetic; 101 | 102 | // enable simd-friendly packed memory layout 103 | // improve all operator performance on all arm devices, will consume more memory 104 | // changes should be applied before loading network structure and weight 105 | // enabled by default 106 | bool use_packing_layout; 107 | 108 | bool use_shader_pack8; 109 | 110 | // subgroup option 111 | bool use_subgroup_basic; 112 | bool use_subgroup_vote; 113 | bool use_subgroup_ballot; 114 | bool use_subgroup_shuffle; 115 | 116 | // turn on for adreno 117 | bool use_image_storage; 118 | bool use_tensor_storage; 119 | 120 | bool use_reserved_0; 121 | 122 | // enable DAZ(Denormals-Are-Zero) and FTZ(Flush-To-Zero) 123 | // default value is 3 124 | // 0 = DAZ OFF, FTZ OFF 125 | // 1 = DAZ ON , FTZ OFF 126 | // 2 = DAZ OFF, FTZ ON 127 | // 3 = DAZ ON, FTZ ON 128 | int flush_denormals; 129 | 130 | bool use_local_pool_allocator; 131 | 132 | // enable local memory optimization for gpu inference 133 | bool use_shader_local_memory; 134 | 135 | // enable cooperative matrix optimization for gpu inference 136 | bool use_cooperative_matrix; 137 | 138 | // more fine-grained control of winograd convolution 139 | bool use_winograd23_convolution; 140 | bool use_winograd43_convolution; 141 | bool use_winograd63_convolution; 142 | 143 | bool use_reserved_6; 144 | bool use_reserved_7; 145 | bool use_reserved_8; 146 | bool use_reserved_9; 147 | bool use_reserved_10; 148 | bool use_reserved_11; 149 | }; 150 | 151 | } // namespace ncnn 152 | 153 | #endif // NCNN_OPTION_H 154 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/paramdict.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_PARAMDICT_H 16 | #define NCNN_PARAMDICT_H 17 | 18 | #include "mat.h" 19 | 20 | // at most 32 parameters 21 | #define NCNN_MAX_PARAM_COUNT 32 22 | 23 | namespace ncnn { 24 | 25 | class DataReader; 26 | class Net; 27 | class ParamDictPrivate; 28 | class NCNN_EXPORT ParamDict 29 | { 30 | public: 31 | // empty 32 | ParamDict(); 33 | 34 | virtual ~ParamDict(); 35 | 36 | // copy 37 | ParamDict(const ParamDict&); 38 | 39 | // assign 40 | ParamDict& operator=(const ParamDict&); 41 | 42 | // get type 43 | int type(int id) const; 44 | 45 | // get int 46 | int get(int id, int def) const; 47 | // get float 48 | float get(int id, float def) const; 49 | // get array 50 | Mat get(int id, const Mat& def) const; 51 | 52 | // set int 53 | void set(int id, int i); 54 | // set float 55 | void set(int id, float f); 56 | // set array 57 | void set(int id, const Mat& v); 58 | 59 | protected: 60 | friend class Net; 61 | 62 | void clear(); 63 | 64 | int load_param(const DataReader& dr); 65 | int load_param_bin(const DataReader& dr); 66 | 67 | private: 68 | ParamDictPrivate* const d; 69 | }; 70 | 71 | } // namespace ncnn 72 | 73 | #endif // NCNN_PARAMDICT_H 74 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/pipeline.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_PIPELINE_H 16 | #define NCNN_PIPELINE_H 17 | 18 | #include "mat.h" 19 | #include "platform.h" 20 | #if NCNN_VULKAN 21 | #include "gpu.h" 22 | 23 | #include 24 | #endif // NCNN_VULKAN 25 | 26 | namespace ncnn { 27 | 28 | #if NCNN_VULKAN 29 | class Option; 30 | class PipelinePrivate; 31 | class NCNN_EXPORT Pipeline 32 | { 33 | public: 34 | explicit Pipeline(const VulkanDevice* vkdev); 35 | virtual ~Pipeline(); 36 | 37 | public: 38 | void set_optimal_local_size_xyz(int w = 4, int h = 4, int c = 4); 39 | void set_optimal_local_size_xyz(const Mat& local_size_xyz); 40 | void set_local_size_xyz(int w, int h, int c); 41 | 42 | int create(const uint32_t* spv_data, size_t spv_data_size, const std::vector& specializations); 43 | 44 | int create(int shader_type_index, const Option& opt, const std::vector& specializations); 45 | 46 | public: 47 | VkShaderModule shader_module() const; 48 | VkDescriptorSetLayout descriptorset_layout() const; 49 | VkPipelineLayout pipeline_layout() const; 50 | VkPipeline pipeline() const; 51 | VkDescriptorUpdateTemplateKHR descriptor_update_template() const; 52 | 53 | const ShaderInfo& shader_info() const; 54 | 55 | uint32_t local_size_x() const; 56 | uint32_t local_size_y() const; 57 | uint32_t local_size_z() const; 58 | 59 | protected: 60 | void set_shader_module(VkShaderModule shader_module); 61 | void set_descriptorset_layout(VkDescriptorSetLayout descriptorset_layout); 62 | void set_pipeline_layout(VkPipelineLayout pipeline_layout); 63 | void set_pipeline(VkPipeline pipeline); 64 | void set_descriptor_update_template(VkDescriptorUpdateTemplateKHR descriptor_update_template); 65 | 66 | void set_shader_info(const ShaderInfo& shader_info); 67 | 68 | public: 69 | const VulkanDevice* vkdev; 70 | 71 | private: 72 | Pipeline(const Pipeline&); 73 | Pipeline& operator=(const Pipeline&); 74 | 75 | private: 76 | PipelinePrivate* const d; 77 | }; 78 | 79 | #if NCNN_PLATFORM_API 80 | #if __ANDROID_API__ >= 26 81 | class VkCompute; 82 | class NCNN_EXPORT ImportAndroidHardwareBufferPipeline : private Pipeline 83 | { 84 | public: 85 | explicit ImportAndroidHardwareBufferPipeline(const VulkanDevice* vkdev); 86 | virtual ~ImportAndroidHardwareBufferPipeline(); 87 | 88 | int create(VkAndroidHardwareBufferImageAllocator* ahb_im_allocator, int type_to, int rotate_from, const Option& opt); 89 | int create(VkAndroidHardwareBufferImageAllocator* ahb_im_allocator, int type_to, int rotate_from, int target_width, int target_height, const Option& opt); 90 | void destroy(); 91 | 92 | friend class VkCompute; 93 | 94 | protected: 95 | int create_shader_module(const Option& opt); 96 | int create_sampler(VkAndroidHardwareBufferImageAllocator* ahb_im_allocator); 97 | int create_descriptorset_layout(); 98 | 99 | public: 100 | int type_to; 101 | int rotate_from; 102 | bool need_resize; 103 | 104 | VkSampler sampler; 105 | }; 106 | #endif // __ANDROID_API__ >= 26 107 | #endif // NCNN_PLATFORM_API 108 | 109 | #endif // NCNN_VULKAN 110 | 111 | } // namespace ncnn 112 | 113 | #endif // NCNN_PIPELINE_H 114 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/pipelinecache.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_PIPELINECACHE_H 16 | #define NCNN_PIPELINECACHE_H 17 | 18 | #include "platform.h" 19 | 20 | #if NCNN_VULKAN 21 | #include 22 | #endif // NCNN_VULKAN 23 | 24 | #include "mat.h" 25 | #include "gpu.h" 26 | 27 | namespace ncnn { 28 | 29 | #if NCNN_VULKAN 30 | 31 | class VulkanDevice; 32 | class PipelineCachePrivate; 33 | class NCNN_EXPORT PipelineCache 34 | { 35 | public: 36 | explicit PipelineCache(const VulkanDevice* _vkdev); 37 | 38 | virtual ~PipelineCache(); 39 | 40 | void clear(); 41 | 42 | int get_pipeline(const uint32_t* spv_data, size_t spv_data_size, const std::vector& specializations, 43 | uint32_t local_size_x, uint32_t local_size_y, uint32_t local_size_z, 44 | VkShaderModule* shader_module, 45 | VkDescriptorSetLayout* descriptorset_layout, 46 | VkPipelineLayout* pipeline_layout, 47 | VkPipeline* pipeline, 48 | VkDescriptorUpdateTemplateKHR* descriptor_update_template, 49 | ShaderInfo& shader_info) const; 50 | 51 | int get_pipeline(int shader_type_index, const Option& opt, const std::vector& specializations, 52 | uint32_t local_size_x, uint32_t local_size_y, uint32_t local_size_z, 53 | VkShaderModule* shader_module, 54 | VkDescriptorSetLayout* descriptorset_layout, 55 | VkPipelineLayout* pipeline_layout, 56 | VkPipeline* pipeline, 57 | VkDescriptorUpdateTemplateKHR* descriptor_update_template, 58 | ShaderInfo& shader_info) const; 59 | 60 | protected: 61 | int create_shader_module(int shader_type_index, const Option& opt, uint32_t local_size_x, uint32_t local_size_y, uint32_t local_size_z, 62 | VkShaderModule* _shader_module, ShaderInfo& si) const; 63 | 64 | int new_pipeline(VkShaderModule shader_module, const ShaderInfo& shader_info, const std::vector& specializations, 65 | VkDescriptorSetLayout* descriptorset_layout, 66 | VkPipelineLayout* pipeline_layout, 67 | VkPipeline* pipeline, 68 | VkDescriptorUpdateTemplateKHR* descriptor_update_template) const; 69 | 70 | protected: 71 | const VulkanDevice* vkdev; 72 | 73 | private: 74 | PipelineCache(const PipelineCache&); 75 | PipelineCache& operator=(const PipelineCache&); 76 | 77 | private: 78 | PipelineCachePrivate* const d; 79 | }; 80 | 81 | #endif // NCNN_VULKAN 82 | 83 | } // namespace ncnn 84 | 85 | #endif // NCNN_PIPELINECACHE_H 86 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/include/ncnn/simpleomp.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making ncnn available. 2 | // 3 | // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. 4 | // 5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // https://opensource.org/licenses/BSD-3-Clause 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef NCNN_SIMPLEOMP_H 16 | #define NCNN_SIMPLEOMP_H 17 | 18 | #include "platform.h" 19 | 20 | #if NCNN_SIMPLEOMP 21 | 22 | #include 23 | 24 | // This minimal openmp runtime implementation only supports the llvm openmp abi 25 | // and only supports #pragma omp parallel for num_threads(X) 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | NCNN_EXPORT int omp_get_max_threads(); 32 | 33 | NCNN_EXPORT void omp_set_num_threads(int num_threads); 34 | 35 | NCNN_EXPORT int omp_get_dynamic(); 36 | 37 | NCNN_EXPORT void omp_set_dynamic(int dynamic); 38 | 39 | NCNN_EXPORT int omp_get_num_threads(); 40 | 41 | NCNN_EXPORT int omp_get_thread_num(); 42 | 43 | NCNN_EXPORT int kmp_get_blocktime(); 44 | 45 | NCNN_EXPORT void kmp_set_blocktime(int blocktime); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif // NCNN_SIMPLEOMP 52 | 53 | #endif // NCNN_SIMPLEOMP_H 54 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/lib/cmake/ncnn/ncnn-release.cmake: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------- 2 | # Generated CMake target import file for configuration "Release". 3 | #---------------------------------------------------------------- 4 | 5 | # Commands may need to know the format version. 6 | set(CMAKE_IMPORT_FILE_VERSION 1) 7 | 8 | # Import target "ncnn" for configuration "Release" 9 | set_property(TARGET ncnn APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 10 | set_target_properties(ncnn PROPERTIES 11 | IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/ncnn.lib" 12 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/ncnn.dll" 13 | ) 14 | 15 | list(APPEND _IMPORT_CHECK_TARGETS ncnn ) 16 | list(APPEND _IMPORT_CHECK_FILES_FOR_ncnn "${_IMPORT_PREFIX}/lib/ncnn.lib" "${_IMPORT_PREFIX}/bin/ncnn.dll" ) 17 | 18 | # Commands beyond this point should not need to know the version. 19 | set(CMAKE_IMPORT_FILE_VERSION) 20 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/lib/cmake/ncnn/ncnn.cmake: -------------------------------------------------------------------------------- 1 | # Generated by CMake 2 | 3 | if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6) 4 | message(FATAL_ERROR "CMake >= 2.6.0 required") 5 | endif() 6 | cmake_policy(PUSH) 7 | cmake_policy(VERSION 2.6...3.20) 8 | #---------------------------------------------------------------- 9 | # Generated CMake target import file. 10 | #---------------------------------------------------------------- 11 | 12 | # Commands may need to know the format version. 13 | set(CMAKE_IMPORT_FILE_VERSION 1) 14 | 15 | # Protect against multiple inclusion, which would fail when already imported targets are added once more. 16 | set(_targetsDefined) 17 | set(_targetsNotDefined) 18 | set(_expectedTargets) 19 | foreach(_expectedTarget ncnn) 20 | list(APPEND _expectedTargets ${_expectedTarget}) 21 | if(NOT TARGET ${_expectedTarget}) 22 | list(APPEND _targetsNotDefined ${_expectedTarget}) 23 | endif() 24 | if(TARGET ${_expectedTarget}) 25 | list(APPEND _targetsDefined ${_expectedTarget}) 26 | endif() 27 | endforeach() 28 | if("${_targetsDefined}" STREQUAL "${_expectedTargets}") 29 | unset(_targetsDefined) 30 | unset(_targetsNotDefined) 31 | unset(_expectedTargets) 32 | set(CMAKE_IMPORT_FILE_VERSION) 33 | cmake_policy(POP) 34 | return() 35 | endif() 36 | if(NOT "${_targetsDefined}" STREQUAL "") 37 | message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") 38 | endif() 39 | unset(_targetsDefined) 40 | unset(_targetsNotDefined) 41 | unset(_expectedTargets) 42 | 43 | 44 | # Compute the installation prefix relative to this file. 45 | get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) 46 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) 47 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) 48 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) 49 | if(_IMPORT_PREFIX STREQUAL "/") 50 | set(_IMPORT_PREFIX "") 51 | endif() 52 | 53 | # Create imported target ncnn 54 | add_library(ncnn SHARED IMPORTED) 55 | 56 | set_target_properties(ncnn PROPERTIES 57 | INTERFACE_COMPILE_DEFINITIONS "NOMINMAX" 58 | INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/ncnn" 59 | INTERFACE_LINK_LIBRARIES "OpenMP::OpenMP_CXX;Threads::Threads" 60 | ) 61 | 62 | if(CMAKE_VERSION VERSION_LESS 2.8.12) 63 | message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") 64 | endif() 65 | 66 | # Load information for each installed configuration. 67 | get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 68 | file(GLOB CONFIG_FILES "${_DIR}/ncnn-*.cmake") 69 | foreach(f ${CONFIG_FILES}) 70 | include(${f}) 71 | endforeach() 72 | 73 | # Cleanup temporary variables. 74 | set(_IMPORT_PREFIX) 75 | 76 | # Loop over all imported files and verify that they actually exist 77 | foreach(target ${_IMPORT_CHECK_TARGETS} ) 78 | foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) 79 | if(NOT EXISTS "${file}" ) 80 | message(FATAL_ERROR "The imported target \"${target}\" references the file 81 | \"${file}\" 82 | but this file does not exist. Possible reasons include: 83 | * The file was deleted, renamed, or moved to another location. 84 | * An install or uninstall procedure did not complete successfully. 85 | * The installation package was faulty and contained 86 | \"${CMAKE_CURRENT_LIST_FILE}\" 87 | but not all the files it references. 88 | ") 89 | endif() 90 | endforeach() 91 | unset(_IMPORT_CHECK_FILES_FOR_${target}) 92 | endforeach() 93 | unset(_IMPORT_CHECK_TARGETS) 94 | 95 | # This file does not depend on other imported targets which have 96 | # been exported from the same project but in a separate export set. 97 | 98 | # Commands beyond this point should not need to know the version. 99 | set(CMAKE_IMPORT_FILE_VERSION) 100 | cmake_policy(POP) 101 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/lib/cmake/ncnn/ncnnConfig.cmake: -------------------------------------------------------------------------------- 1 | set(NCNN_OPENMP ON) 2 | set(NCNN_THREADS ON) 3 | set(NCNN_VULKAN OFF) 4 | set(NCNN_SHARED_LIB ON) 5 | set(NCNN_SYSTEM_GLSLANG OFF) 6 | 7 | if(NCNN_OPENMP) 8 | find_package(OpenMP) 9 | endif() 10 | 11 | if(NCNN_THREADS) 12 | set(CMAKE_THREAD_PREFER_PTHREAD TRUE) 13 | set(THREADS_PREFER_PTHREAD_FLAG TRUE) 14 | find_package(Threads REQUIRED) 15 | endif() 16 | 17 | if(NCNN_VULKAN) 18 | find_package(Vulkan REQUIRED) 19 | 20 | if(NOT NCNN_SHARED_LIB) 21 | if(NCNN_SYSTEM_GLSLANG) 22 | find_package(glslang QUIET) 23 | if(NOT glslang_FOUND) 24 | set(GLSLANG_TARGET_DIR "") 25 | include(${GLSLANG_TARGET_DIR}/OSDependentTargets.cmake) 26 | include(${GLSLANG_TARGET_DIR}/OGLCompilerTargets.cmake) 27 | if(EXISTS "${GLSLANG_TARGET_DIR}/HLSLTargets.cmake") 28 | # hlsl support can be optional 29 | include("${GLSLANG_TARGET_DIR}/HLSLTargets.cmake") 30 | endif() 31 | include(${GLSLANG_TARGET_DIR}/glslangTargets.cmake) 32 | include(${GLSLANG_TARGET_DIR}/SPIRVTargets.cmake) 33 | endif() 34 | else() 35 | set(glslang_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../lib/cmake/glslang") 36 | find_package(glslang QUIET) 37 | endif() 38 | 39 | endif() 40 | endif() 41 | 42 | include(${CMAKE_CURRENT_LIST_DIR}/ncnn.cmake) 43 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/lib/ncnn.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/lib/ncnn.lib -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/ncnn/build/install/lib/pkgconfig/ncnn.pc: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | librarydir=${prefix}/lib 3 | includedir=${prefix}/include 4 | 5 | Name: ncnn 6 | Description: high-performance neural network inference framework optimized for the mobile platform 7 | Version: 1.0.20230302 8 | URL: https://github.com/Tencent/ncnn 9 | Libs: -L"${librarydir}" -lncnn 10 | Cflags: -I"${includedir}" 11 | 12 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/async.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_ASYNC_HPP 6 | #define OPENCV_CORE_ASYNC_HPP 7 | 8 | #include 9 | 10 | #ifdef CV_CXX11 11 | //#include 12 | #include 13 | #endif 14 | 15 | namespace cv { 16 | 17 | /** @addtogroup core_async 18 | 19 | @{ 20 | */ 21 | 22 | 23 | /** @brief Returns result of asynchronous operations 24 | 25 | Object has attached asynchronous state. 26 | Assignment operator doesn't clone asynchronous state (it is shared between all instances). 27 | 28 | Result can be fetched via get() method only once. 29 | 30 | */ 31 | class CV_EXPORTS_W AsyncArray 32 | { 33 | public: 34 | ~AsyncArray() CV_NOEXCEPT; 35 | CV_WRAP AsyncArray() CV_NOEXCEPT; 36 | AsyncArray(const AsyncArray& o) CV_NOEXCEPT; 37 | AsyncArray& operator=(const AsyncArray& o) CV_NOEXCEPT; 38 | CV_WRAP void release() CV_NOEXCEPT; 39 | 40 | /** Fetch the result. 41 | @param[out] dst destination array 42 | 43 | Waits for result until container has valid result. 44 | Throws exception if exception was stored as a result. 45 | 46 | Throws exception on invalid container state. 47 | 48 | @note Result or stored exception can be fetched only once. 49 | */ 50 | CV_WRAP void get(OutputArray dst) const; 51 | 52 | /** Retrieving the result with timeout 53 | @param[out] dst destination array 54 | @param[in] timeoutNs timeout in nanoseconds, -1 for infinite wait 55 | 56 | @returns true if result is ready, false if the timeout has expired 57 | 58 | @note Result or stored exception can be fetched only once. 59 | */ 60 | bool get(OutputArray dst, int64 timeoutNs) const; 61 | 62 | CV_WRAP inline 63 | bool get(OutputArray dst, double timeoutNs) const { return get(dst, (int64)timeoutNs); } 64 | 65 | bool wait_for(int64 timeoutNs) const; 66 | 67 | CV_WRAP inline 68 | bool wait_for(double timeoutNs) const { return wait_for((int64)timeoutNs); } 69 | 70 | CV_WRAP bool valid() const CV_NOEXCEPT; 71 | 72 | #ifdef CV_CXX11 73 | inline AsyncArray(AsyncArray&& o) { p = o.p; o.p = NULL; } 74 | inline AsyncArray& operator=(AsyncArray&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; } 75 | 76 | template 77 | inline bool get(OutputArray dst, const std::chrono::duration<_Rep, _Period>& timeout) 78 | { 79 | return get(dst, (int64)(std::chrono::nanoseconds(timeout).count())); 80 | } 81 | 82 | template 83 | inline bool wait_for(const std::chrono::duration<_Rep, _Period>& timeout) 84 | { 85 | return wait_for((int64)(std::chrono::nanoseconds(timeout).count())); 86 | } 87 | 88 | #if 0 89 | std::future getFutureMat() const; 90 | std::future getFutureUMat() const; 91 | #endif 92 | #endif 93 | 94 | 95 | // PImpl 96 | struct Impl; friend struct Impl; 97 | inline void* _getImpl() const CV_NOEXCEPT { return p; } 98 | protected: 99 | Impl* p; 100 | }; 101 | 102 | 103 | //! @} 104 | } // namespace 105 | #endif // OPENCV_CORE_ASYNC_HPP 106 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/bindings_utils.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_BINDINGS_UTILS_HPP 6 | #define OPENCV_CORE_BINDINGS_UTILS_HPP 7 | 8 | #include 9 | #include 10 | 11 | namespace cv { namespace utils { 12 | //! @addtogroup core_utils 13 | //! @{ 14 | 15 | CV_EXPORTS_W String dumpInputArray(InputArray argument); 16 | 17 | CV_EXPORTS_W String dumpInputArrayOfArrays(InputArrayOfArrays argument); 18 | 19 | CV_EXPORTS_W String dumpInputOutputArray(InputOutputArray argument); 20 | 21 | CV_EXPORTS_W String dumpInputOutputArrayOfArrays(InputOutputArrayOfArrays argument); 22 | 23 | CV_WRAP static inline 24 | String dumpBool(bool argument) 25 | { 26 | return (argument) ? String("Bool: True") : String("Bool: False"); 27 | } 28 | 29 | CV_WRAP static inline 30 | String dumpInt(int argument) 31 | { 32 | return cv::format("Int: %d", argument); 33 | } 34 | 35 | CV_WRAP static inline 36 | String dumpSizeT(size_t argument) 37 | { 38 | std::ostringstream oss("size_t: ", std::ios::ate); 39 | oss << argument; 40 | return oss.str(); 41 | } 42 | 43 | CV_WRAP static inline 44 | String dumpFloat(float argument) 45 | { 46 | return cv::format("Float: %.2f", argument); 47 | } 48 | 49 | CV_WRAP static inline 50 | String dumpDouble(double argument) 51 | { 52 | return cv::format("Double: %.2f", argument); 53 | } 54 | 55 | CV_WRAP static inline 56 | String dumpCString(const char* argument) 57 | { 58 | return cv::format("String: %s", argument); 59 | } 60 | 61 | CV_WRAP static inline 62 | String dumpString(const String& argument) 63 | { 64 | return cv::format("String: %s", argument.c_str()); 65 | } 66 | 67 | CV_WRAP static inline 68 | AsyncArray testAsyncArray(InputArray argument) 69 | { 70 | AsyncPromise p; 71 | p.setValue(argument); 72 | return p.getArrayResult(); 73 | } 74 | 75 | CV_WRAP static inline 76 | AsyncArray testAsyncException() 77 | { 78 | AsyncPromise p; 79 | try 80 | { 81 | CV_Error(Error::StsOk, "Test: Generated async error"); 82 | } 83 | catch (const cv::Exception& e) 84 | { 85 | p.setException(e); 86 | } 87 | return p.getArrayResult(); 88 | } 89 | 90 | //! @} 91 | }} // namespace 92 | 93 | #endif // OPENCV_CORE_BINDINGS_UTILS_HPP 94 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/bufferpool.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | // 5 | // Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. 6 | 7 | #ifndef OPENCV_CORE_BUFFER_POOL_HPP 8 | #define OPENCV_CORE_BUFFER_POOL_HPP 9 | 10 | #ifdef _MSC_VER 11 | #pragma warning(push) 12 | #pragma warning(disable: 4265) 13 | #endif 14 | 15 | namespace cv 16 | { 17 | 18 | //! @addtogroup core 19 | //! @{ 20 | 21 | class BufferPoolController 22 | { 23 | protected: 24 | ~BufferPoolController() { } 25 | public: 26 | virtual size_t getReservedSize() const = 0; 27 | virtual size_t getMaxReservedSize() const = 0; 28 | virtual void setMaxReservedSize(size_t size) = 0; 29 | virtual void freeAllReservedBuffers() = 0; 30 | }; 31 | 32 | //! @} 33 | 34 | } 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(pop) 38 | #endif 39 | 40 | #endif // OPENCV_CORE_BUFFER_POOL_HPP 41 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/core.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/core.hpp" 49 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/cuda/common.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_COMMON_HPP 44 | #define OPENCV_CUDA_COMMON_HPP 45 | 46 | #include 47 | #include "opencv2/core/cuda_types.hpp" 48 | #include "opencv2/core/cvdef.h" 49 | #include "opencv2/core/base.hpp" 50 | 51 | /** @file 52 | * @deprecated Use @ref cudev instead. 53 | */ 54 | 55 | //! @cond IGNORED 56 | 57 | #ifndef CV_PI_F 58 | #ifndef CV_PI 59 | #define CV_PI_F 3.14159265f 60 | #else 61 | #define CV_PI_F ((float)CV_PI) 62 | #endif 63 | #endif 64 | 65 | namespace cv { namespace cuda { 66 | static inline void checkCudaError(cudaError_t err, const char* file, const int line, const char* func) 67 | { 68 | if (cudaSuccess != err) 69 | cv::error(cv::Error::GpuApiCallError, cudaGetErrorString(err), func, file, line); 70 | } 71 | }} 72 | 73 | #ifndef cudaSafeCall 74 | #define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, __FILE__, __LINE__, CV_Func) 75 | #endif 76 | 77 | namespace cv { namespace cuda 78 | { 79 | template static inline bool isAligned(const T* ptr, size_t size) 80 | { 81 | return reinterpret_cast(ptr) % size == 0; 82 | } 83 | 84 | static inline bool isAligned(size_t step, size_t size) 85 | { 86 | return step % size == 0; 87 | } 88 | }} 89 | 90 | namespace cv { namespace cuda 91 | { 92 | namespace device 93 | { 94 | __host__ __device__ __forceinline__ int divUp(int total, int grain) 95 | { 96 | return (total + grain - 1) / grain; 97 | } 98 | 99 | template inline void bindTexture(const textureReference* tex, const PtrStepSz& img) 100 | { 101 | cudaChannelFormatDesc desc = cudaCreateChannelDesc(); 102 | cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) ); 103 | } 104 | 105 | template inline void createTextureObjectPitch2D(cudaTextureObject_t* tex, PtrStepSz& img, const cudaTextureDesc& texDesc) 106 | { 107 | cudaResourceDesc resDesc; 108 | memset(&resDesc, 0, sizeof(resDesc)); 109 | resDesc.resType = cudaResourceTypePitch2D; 110 | resDesc.res.pitch2D.devPtr = static_cast(img.ptr()); 111 | resDesc.res.pitch2D.height = img.rows; 112 | resDesc.res.pitch2D.width = img.cols; 113 | resDesc.res.pitch2D.pitchInBytes = img.step; 114 | resDesc.res.pitch2D.desc = cudaCreateChannelDesc(); 115 | 116 | cudaSafeCall( cudaCreateTextureObject(tex, &resDesc, &texDesc, NULL) ); 117 | } 118 | } 119 | }} 120 | 121 | //! @endcond 122 | 123 | #endif // OPENCV_CUDA_COMMON_HPP 124 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/cuda/datamov_utils.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_DATAMOV_UTILS_HPP 44 | #define OPENCV_CUDA_DATAMOV_UTILS_HPP 45 | 46 | #include "common.hpp" 47 | 48 | /** @file 49 | * @deprecated Use @ref cudev instead. 50 | */ 51 | 52 | //! @cond IGNORED 53 | 54 | namespace cv { namespace cuda { namespace device 55 | { 56 | #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 200 57 | 58 | // for Fermi memory space is detected automatically 59 | template struct ForceGlob 60 | { 61 | __device__ __forceinline__ static void Load(const T* ptr, int offset, T& val) { val = ptr[offset]; } 62 | }; 63 | 64 | #else // __CUDA_ARCH__ >= 200 65 | 66 | #if defined(_WIN64) || defined(__LP64__) 67 | // 64-bit register modifier for inlined asm 68 | #define OPENCV_CUDA_ASM_PTR "l" 69 | #else 70 | // 32-bit register modifier for inlined asm 71 | #define OPENCV_CUDA_ASM_PTR "r" 72 | #endif 73 | 74 | template struct ForceGlob; 75 | 76 | #define OPENCV_CUDA_DEFINE_FORCE_GLOB(base_type, ptx_type, reg_mod) \ 77 | template <> struct ForceGlob \ 78 | { \ 79 | __device__ __forceinline__ static void Load(const base_type* ptr, int offset, base_type& val) \ 80 | { \ 81 | asm("ld.global."#ptx_type" %0, [%1];" : "="#reg_mod(val) : OPENCV_CUDA_ASM_PTR(ptr + offset)); \ 82 | } \ 83 | }; 84 | 85 | #define OPENCV_CUDA_DEFINE_FORCE_GLOB_B(base_type, ptx_type) \ 86 | template <> struct ForceGlob \ 87 | { \ 88 | __device__ __forceinline__ static void Load(const base_type* ptr, int offset, base_type& val) \ 89 | { \ 90 | asm("ld.global."#ptx_type" %0, [%1];" : "=r"(*reinterpret_cast(&val)) : OPENCV_CUDA_ASM_PTR(ptr + offset)); \ 91 | } \ 92 | }; 93 | 94 | OPENCV_CUDA_DEFINE_FORCE_GLOB_B(uchar, u8) 95 | OPENCV_CUDA_DEFINE_FORCE_GLOB_B(schar, s8) 96 | OPENCV_CUDA_DEFINE_FORCE_GLOB_B(char, b8) 97 | OPENCV_CUDA_DEFINE_FORCE_GLOB (ushort, u16, h) 98 | OPENCV_CUDA_DEFINE_FORCE_GLOB (short, s16, h) 99 | OPENCV_CUDA_DEFINE_FORCE_GLOB (uint, u32, r) 100 | OPENCV_CUDA_DEFINE_FORCE_GLOB (int, s32, r) 101 | OPENCV_CUDA_DEFINE_FORCE_GLOB (float, f32, f) 102 | OPENCV_CUDA_DEFINE_FORCE_GLOB (double, f64, d) 103 | 104 | #undef OPENCV_CUDA_DEFINE_FORCE_GLOB 105 | #undef OPENCV_CUDA_DEFINE_FORCE_GLOB_B 106 | #undef OPENCV_CUDA_ASM_PTR 107 | 108 | #endif // __CUDA_ARCH__ >= 200 109 | }}} // namespace cv { namespace cuda { namespace cudev 110 | 111 | //! @endcond 112 | 113 | #endif // OPENCV_CUDA_DATAMOV_UTILS_HPP 114 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/cuda/dynamic_smem.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_DYNAMIC_SMEM_HPP 44 | #define OPENCV_CUDA_DYNAMIC_SMEM_HPP 45 | 46 | /** @file 47 | * @deprecated Use @ref cudev instead. 48 | */ 49 | 50 | //! @cond IGNORED 51 | 52 | namespace cv { namespace cuda { namespace device 53 | { 54 | template struct DynamicSharedMem 55 | { 56 | __device__ __forceinline__ operator T*() 57 | { 58 | extern __shared__ int __smem[]; 59 | return (T*)__smem; 60 | } 61 | 62 | __device__ __forceinline__ operator const T*() const 63 | { 64 | extern __shared__ int __smem[]; 65 | return (T*)__smem; 66 | } 67 | }; 68 | 69 | // specialize for double to avoid unaligned memory access compile errors 70 | template<> struct DynamicSharedMem 71 | { 72 | __device__ __forceinline__ operator double*() 73 | { 74 | extern __shared__ double __smem_d[]; 75 | return (double*)__smem_d; 76 | } 77 | 78 | __device__ __forceinline__ operator const double*() const 79 | { 80 | extern __shared__ double __smem_d[]; 81 | return (double*)__smem_d; 82 | } 83 | }; 84 | }}} 85 | 86 | //! @endcond 87 | 88 | #endif // OPENCV_CUDA_DYNAMIC_SMEM_HPP 89 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/cuda/funcattrib.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP 44 | #define OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP 45 | 46 | #include 47 | 48 | /** @file 49 | * @deprecated Use @ref cudev instead. 50 | */ 51 | 52 | //! @cond IGNORED 53 | 54 | namespace cv { namespace cuda { namespace device 55 | { 56 | template 57 | void printFuncAttrib(Func& func) 58 | { 59 | 60 | cudaFuncAttributes attrs; 61 | cudaFuncGetAttributes(&attrs, func); 62 | 63 | printf("=== Function stats ===\n"); 64 | printf("Name: \n"); 65 | printf("sharedSizeBytes = %d\n", attrs.sharedSizeBytes); 66 | printf("constSizeBytes = %d\n", attrs.constSizeBytes); 67 | printf("localSizeBytes = %d\n", attrs.localSizeBytes); 68 | printf("maxThreadsPerBlock = %d\n", attrs.maxThreadsPerBlock); 69 | printf("numRegs = %d\n", attrs.numRegs); 70 | printf("ptxVersion = %d\n", attrs.ptxVersion); 71 | printf("binaryVersion = %d\n", attrs.binaryVersion); 72 | printf("\n"); 73 | fflush(stdout); 74 | } 75 | }}} // namespace cv { namespace cuda { namespace cudev 76 | 77 | //! @endcond 78 | 79 | #endif /* OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP */ 80 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/cuda/limits.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_LIMITS_HPP 44 | #define OPENCV_CUDA_LIMITS_HPP 45 | 46 | #include 47 | #include 48 | #include "common.hpp" 49 | 50 | /** @file 51 | * @deprecated Use @ref cudev instead. 52 | */ 53 | 54 | //! @cond IGNORED 55 | 56 | namespace cv { namespace cuda { namespace device 57 | { 58 | template struct numeric_limits; 59 | 60 | template <> struct numeric_limits 61 | { 62 | __device__ __forceinline__ static bool min() { return false; } 63 | __device__ __forceinline__ static bool max() { return true; } 64 | static const bool is_signed = false; 65 | }; 66 | 67 | template <> struct numeric_limits 68 | { 69 | __device__ __forceinline__ static signed char min() { return SCHAR_MIN; } 70 | __device__ __forceinline__ static signed char max() { return SCHAR_MAX; } 71 | static const bool is_signed = true; 72 | }; 73 | 74 | template <> struct numeric_limits 75 | { 76 | __device__ __forceinline__ static unsigned char min() { return 0; } 77 | __device__ __forceinline__ static unsigned char max() { return UCHAR_MAX; } 78 | static const bool is_signed = false; 79 | }; 80 | 81 | template <> struct numeric_limits 82 | { 83 | __device__ __forceinline__ static short min() { return SHRT_MIN; } 84 | __device__ __forceinline__ static short max() { return SHRT_MAX; } 85 | static const bool is_signed = true; 86 | }; 87 | 88 | template <> struct numeric_limits 89 | { 90 | __device__ __forceinline__ static unsigned short min() { return 0; } 91 | __device__ __forceinline__ static unsigned short max() { return USHRT_MAX; } 92 | static const bool is_signed = false; 93 | }; 94 | 95 | template <> struct numeric_limits 96 | { 97 | __device__ __forceinline__ static int min() { return INT_MIN; } 98 | __device__ __forceinline__ static int max() { return INT_MAX; } 99 | static const bool is_signed = true; 100 | }; 101 | 102 | template <> struct numeric_limits 103 | { 104 | __device__ __forceinline__ static unsigned int min() { return 0; } 105 | __device__ __forceinline__ static unsigned int max() { return UINT_MAX; } 106 | static const bool is_signed = false; 107 | }; 108 | 109 | template <> struct numeric_limits 110 | { 111 | __device__ __forceinline__ static float min() { return FLT_MIN; } 112 | __device__ __forceinline__ static float max() { return FLT_MAX; } 113 | __device__ __forceinline__ static float epsilon() { return FLT_EPSILON; } 114 | static const bool is_signed = true; 115 | }; 116 | 117 | template <> struct numeric_limits 118 | { 119 | __device__ __forceinline__ static double min() { return DBL_MIN; } 120 | __device__ __forceinline__ static double max() { return DBL_MAX; } 121 | __device__ __forceinline__ static double epsilon() { return DBL_EPSILON; } 122 | static const bool is_signed = true; 123 | }; 124 | }}} // namespace cv { namespace cuda { namespace cudev { 125 | 126 | //! @endcond 127 | 128 | #endif // OPENCV_CUDA_LIMITS_HPP 129 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/cuda/transform.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_TRANSFORM_HPP 44 | #define OPENCV_CUDA_TRANSFORM_HPP 45 | 46 | #include "common.hpp" 47 | #include "utility.hpp" 48 | #include "detail/transform_detail.hpp" 49 | 50 | /** @file 51 | * @deprecated Use @ref cudev instead. 52 | */ 53 | 54 | //! @cond IGNORED 55 | 56 | namespace cv { namespace cuda { namespace device 57 | { 58 | template 59 | static inline void transform(PtrStepSz src, PtrStepSz dst, UnOp op, const Mask& mask, cudaStream_t stream) 60 | { 61 | typedef TransformFunctorTraits ft; 62 | transform_detail::TransformDispatcher::cn == 1 && VecTraits::cn == 1 && ft::smart_shift != 1>::call(src, dst, op, mask, stream); 63 | } 64 | 65 | template 66 | static inline void transform(PtrStepSz src1, PtrStepSz src2, PtrStepSz dst, BinOp op, const Mask& mask, cudaStream_t stream) 67 | { 68 | typedef TransformFunctorTraits ft; 69 | transform_detail::TransformDispatcher::cn == 1 && VecTraits::cn == 1 && VecTraits::cn == 1 && ft::smart_shift != 1>::call(src1, src2, dst, op, mask, stream); 70 | } 71 | }}} 72 | 73 | //! @endcond 74 | 75 | #endif // OPENCV_CUDA_TRANSFORM_HPP 76 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/cuda/type_traits.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_TYPE_TRAITS_HPP 44 | #define OPENCV_CUDA_TYPE_TRAITS_HPP 45 | 46 | #include "detail/type_traits_detail.hpp" 47 | 48 | /** @file 49 | * @deprecated Use @ref cudev instead. 50 | */ 51 | 52 | //! @cond IGNORED 53 | 54 | namespace cv { namespace cuda { namespace device 55 | { 56 | template struct IsSimpleParameter 57 | { 58 | enum {value = type_traits_detail::IsIntegral::value || type_traits_detail::IsFloat::value || 59 | type_traits_detail::PointerTraits::type>::value}; 60 | }; 61 | 62 | template struct TypeTraits 63 | { 64 | typedef typename type_traits_detail::UnConst::type NonConstType; 65 | typedef typename type_traits_detail::UnVolatile::type NonVolatileType; 66 | typedef typename type_traits_detail::UnVolatile::type>::type UnqualifiedType; 67 | typedef typename type_traits_detail::PointerTraits::type PointeeType; 68 | typedef typename type_traits_detail::ReferenceTraits::type ReferredType; 69 | 70 | enum { isConst = type_traits_detail::UnConst::value }; 71 | enum { isVolatile = type_traits_detail::UnVolatile::value }; 72 | 73 | enum { isReference = type_traits_detail::ReferenceTraits::value }; 74 | enum { isPointer = type_traits_detail::PointerTraits::type>::value }; 75 | 76 | enum { isUnsignedInt = type_traits_detail::IsUnsignedIntegral::value }; 77 | enum { isSignedInt = type_traits_detail::IsSignedIntergral::value }; 78 | enum { isIntegral = type_traits_detail::IsIntegral::value }; 79 | enum { isFloat = type_traits_detail::IsFloat::value }; 80 | enum { isArith = isIntegral || isFloat }; 81 | enum { isVec = type_traits_detail::IsVec::value }; 82 | 83 | typedef typename type_traits_detail::Select::value, 84 | T, typename type_traits_detail::AddParameterType::type>::type ParameterType; 85 | }; 86 | }}} 87 | 88 | //! @endcond 89 | 90 | #endif // OPENCV_CUDA_TYPE_TRAITS_HPP 91 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/cuda/warp_reduce.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_WARP_REDUCE_HPP__ 44 | #define OPENCV_CUDA_WARP_REDUCE_HPP__ 45 | 46 | /** @file 47 | * @deprecated Use @ref cudev instead. 48 | */ 49 | 50 | //! @cond IGNORED 51 | 52 | namespace cv { namespace cuda { namespace device 53 | { 54 | template 55 | __device__ __forceinline__ T warp_reduce(volatile T *ptr , const unsigned int tid = threadIdx.x) 56 | { 57 | const unsigned int lane = tid & 31; // index of thread in warp (0..31) 58 | 59 | if (lane < 16) 60 | { 61 | T partial = ptr[tid]; 62 | 63 | ptr[tid] = partial = partial + ptr[tid + 16]; 64 | ptr[tid] = partial = partial + ptr[tid + 8]; 65 | ptr[tid] = partial = partial + ptr[tid + 4]; 66 | ptr[tid] = partial = partial + ptr[tid + 2]; 67 | ptr[tid] = partial = partial + ptr[tid + 1]; 68 | } 69 | 70 | return ptr[tid - lane]; 71 | } 72 | }}} // namespace cv { namespace cuda { namespace cudev { 73 | 74 | //! @endcond 75 | 76 | #endif /* OPENCV_CUDA_WARP_REDUCE_HPP__ */ 77 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/cuda_stream_accessor.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP 44 | #define OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP 45 | 46 | #ifndef __cplusplus 47 | # error cuda_stream_accessor.hpp header must be compiled as C++ 48 | #endif 49 | 50 | /** @file cuda_stream_accessor.hpp 51 | * This is only header file that depends on CUDA Runtime API. All other headers are independent. 52 | */ 53 | 54 | #include 55 | #include "opencv2/core/cuda.hpp" 56 | 57 | namespace cv 58 | { 59 | namespace cuda 60 | { 61 | 62 | //! @addtogroup cudacore_struct 63 | //! @{ 64 | 65 | /** @brief Class that enables getting cudaStream_t from cuda::Stream 66 | */ 67 | struct StreamAccessor 68 | { 69 | CV_EXPORTS static cudaStream_t getStream(const Stream& stream); 70 | CV_EXPORTS static Stream wrapStream(cudaStream_t stream); 71 | }; 72 | 73 | /** @brief Class that enables getting cudaEvent_t from cuda::Event 74 | */ 75 | struct EventAccessor 76 | { 77 | CV_EXPORTS static cudaEvent_t getEvent(const Event& event); 78 | CV_EXPORTS static Event wrapEvent(cudaEvent_t event); 79 | }; 80 | 81 | //! @} 82 | 83 | } 84 | } 85 | 86 | #endif /* OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP */ 87 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/detail/async_promise.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_ASYNC_PROMISE_HPP 6 | #define OPENCV_CORE_ASYNC_PROMISE_HPP 7 | 8 | #include "../async.hpp" 9 | 10 | #include "exception_ptr.hpp" 11 | 12 | namespace cv { 13 | 14 | /** @addtogroup core_async 15 | @{ 16 | */ 17 | 18 | 19 | /** @brief Provides result of asynchronous operations 20 | 21 | */ 22 | class CV_EXPORTS AsyncPromise 23 | { 24 | public: 25 | ~AsyncPromise() CV_NOEXCEPT; 26 | AsyncPromise() CV_NOEXCEPT; 27 | explicit AsyncPromise(const AsyncPromise& o) CV_NOEXCEPT; 28 | AsyncPromise& operator=(const AsyncPromise& o) CV_NOEXCEPT; 29 | void release() CV_NOEXCEPT; 30 | 31 | /** Returns associated AsyncArray 32 | @note Can be called once 33 | */ 34 | AsyncArray getArrayResult(); 35 | 36 | /** Stores asynchronous result. 37 | @param[in] value result 38 | */ 39 | void setValue(InputArray value); 40 | 41 | // TODO "move" setters 42 | 43 | #if CV__EXCEPTION_PTR 44 | /** Stores exception. 45 | @param[in] exception exception to be raised in AsyncArray 46 | */ 47 | void setException(std::exception_ptr exception); 48 | #endif 49 | 50 | /** Stores exception. 51 | @param[in] exception exception to be raised in AsyncArray 52 | */ 53 | void setException(const cv::Exception& exception); 54 | 55 | #ifdef CV_CXX11 56 | explicit AsyncPromise(AsyncPromise&& o) { p = o.p; o.p = NULL; } 57 | AsyncPromise& operator=(AsyncPromise&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; } 58 | #endif 59 | 60 | 61 | // PImpl 62 | typedef struct AsyncArray::Impl Impl; friend struct AsyncArray::Impl; 63 | inline void* _getImpl() const CV_NOEXCEPT { return p; } 64 | protected: 65 | Impl* p; 66 | }; 67 | 68 | 69 | //! @} 70 | } // namespace 71 | #endif // OPENCV_CORE_ASYNC_PROMISE_HPP 72 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/detail/exception_ptr.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_DETAILS_EXCEPTION_PTR_H 6 | #define OPENCV_CORE_DETAILS_EXCEPTION_PTR_H 7 | 8 | #ifndef CV__EXCEPTION_PTR 9 | # if defined(__ANDROID__) && defined(ATOMIC_INT_LOCK_FREE) && ATOMIC_INT_LOCK_FREE < 2 10 | # define CV__EXCEPTION_PTR 0 // Not supported, details: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58938 11 | # elif defined(CV_CXX11) 12 | # define CV__EXCEPTION_PTR 1 13 | # elif defined(_MSC_VER) 14 | # define CV__EXCEPTION_PTR (_MSC_VER >= 1600) 15 | # elif defined(__clang__) 16 | # define CV__EXCEPTION_PTR 0 // C++11 only (see above) 17 | # elif defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__) 18 | # define CV__EXCEPTION_PTR (__GXX_EXPERIMENTAL_CXX0X__ > 0) 19 | # endif 20 | #endif 21 | #ifndef CV__EXCEPTION_PTR 22 | # define CV__EXCEPTION_PTR 0 23 | #elif CV__EXCEPTION_PTR 24 | # include // std::exception_ptr 25 | #endif 26 | 27 | #endif // OPENCV_CORE_DETAILS_EXCEPTION_PTR_H 28 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/neon_utils.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2015, Itseez Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the Intel Corporation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_HAL_NEON_UTILS_HPP 43 | #define OPENCV_HAL_NEON_UTILS_HPP 44 | 45 | #include "opencv2/core/cvdef.h" 46 | 47 | //! @addtogroup core_utils_neon 48 | //! @{ 49 | 50 | #if CV_NEON 51 | 52 | inline int32x2_t cv_vrnd_s32_f32(float32x2_t v) 53 | { 54 | static int32x2_t v_sign = vdup_n_s32(1 << 31), 55 | v_05 = vreinterpret_s32_f32(vdup_n_f32(0.5f)); 56 | 57 | int32x2_t v_addition = vorr_s32(v_05, vand_s32(v_sign, vreinterpret_s32_f32(v))); 58 | return vcvt_s32_f32(vadd_f32(v, vreinterpret_f32_s32(v_addition))); 59 | } 60 | 61 | inline int32x4_t cv_vrndq_s32_f32(float32x4_t v) 62 | { 63 | static int32x4_t v_sign = vdupq_n_s32(1 << 31), 64 | v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f)); 65 | 66 | int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(v))); 67 | return vcvtq_s32_f32(vaddq_f32(v, vreinterpretq_f32_s32(v_addition))); 68 | } 69 | 70 | inline uint32x2_t cv_vrnd_u32_f32(float32x2_t v) 71 | { 72 | static float32x2_t v_05 = vdup_n_f32(0.5f); 73 | return vcvt_u32_f32(vadd_f32(v, v_05)); 74 | } 75 | 76 | inline uint32x4_t cv_vrndq_u32_f32(float32x4_t v) 77 | { 78 | static float32x4_t v_05 = vdupq_n_f32(0.5f); 79 | return vcvtq_u32_f32(vaddq_f32(v, v_05)); 80 | } 81 | 82 | inline float32x4_t cv_vrecpq_f32(float32x4_t val) 83 | { 84 | float32x4_t reciprocal = vrecpeq_f32(val); 85 | reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal); 86 | reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal); 87 | return reciprocal; 88 | } 89 | 90 | inline float32x2_t cv_vrecp_f32(float32x2_t val) 91 | { 92 | float32x2_t reciprocal = vrecpe_f32(val); 93 | reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal); 94 | reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal); 95 | return reciprocal; 96 | } 97 | 98 | inline float32x4_t cv_vrsqrtq_f32(float32x4_t val) 99 | { 100 | float32x4_t e = vrsqrteq_f32(val); 101 | e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e); 102 | e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e); 103 | return e; 104 | } 105 | 106 | inline float32x2_t cv_vrsqrt_f32(float32x2_t val) 107 | { 108 | float32x2_t e = vrsqrte_f32(val); 109 | e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e); 110 | e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e); 111 | return e; 112 | } 113 | 114 | inline float32x4_t cv_vsqrtq_f32(float32x4_t val) 115 | { 116 | return cv_vrecpq_f32(cv_vrsqrtq_f32(val)); 117 | } 118 | 119 | inline float32x2_t cv_vsqrt_f32(float32x2_t val) 120 | { 121 | return cv_vrecp_f32(cv_vrsqrt_f32(val)); 122 | } 123 | 124 | #endif 125 | 126 | //! @} 127 | 128 | #endif // OPENCV_HAL_NEON_UTILS_HPP 129 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/ocl_genbase.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_OPENCL_GENBASE_HPP 43 | #define OPENCV_OPENCL_GENBASE_HPP 44 | 45 | //! @cond IGNORED 46 | 47 | namespace cv { 48 | namespace ocl { 49 | 50 | class ProgramSource; 51 | 52 | namespace internal { 53 | 54 | struct CV_EXPORTS ProgramEntry 55 | { 56 | const char* module; 57 | const char* name; 58 | const char* programCode; 59 | const char* programHash; 60 | ProgramSource* pProgramSource; 61 | 62 | operator ProgramSource& () const; 63 | }; 64 | 65 | } } } // namespace 66 | 67 | //! @endcond 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/ocl_defs.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | // Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | #ifndef OPENCV_CORE_OPENCL_DEFS_HPP 9 | #define OPENCV_CORE_OPENCL_DEFS_HPP 10 | 11 | #include "opencv2/core/utility.hpp" 12 | #include "cvconfig.h" 13 | 14 | namespace cv { namespace ocl { 15 | #ifdef HAVE_OPENCL 16 | /// Call is similar to useOpenCL() but doesn't try to load OpenCL runtime or create OpenCL context 17 | CV_EXPORTS bool isOpenCLActivated(); 18 | #else 19 | static inline bool isOpenCLActivated() { return false; } 20 | #endif 21 | }} // namespace 22 | 23 | 24 | //#define CV_OPENCL_RUN_ASSERT 25 | 26 | #ifdef HAVE_OPENCL 27 | 28 | #ifdef CV_OPENCL_RUN_VERBOSE 29 | #define CV_OCL_RUN_(condition, func, ...) \ 30 | { \ 31 | if (cv::ocl::isOpenCLActivated() && (condition) && func) \ 32 | { \ 33 | printf("%s: OpenCL implementation is running\n", CV_Func); \ 34 | fflush(stdout); \ 35 | CV_IMPL_ADD(CV_IMPL_OCL); \ 36 | return __VA_ARGS__; \ 37 | } \ 38 | else \ 39 | { \ 40 | printf("%s: Plain implementation is running\n", CV_Func); \ 41 | fflush(stdout); \ 42 | } \ 43 | } 44 | #elif defined CV_OPENCL_RUN_ASSERT 45 | #define CV_OCL_RUN_(condition, func, ...) \ 46 | { \ 47 | if (cv::ocl::isOpenCLActivated() && (condition)) \ 48 | { \ 49 | if(func) \ 50 | { \ 51 | CV_IMPL_ADD(CV_IMPL_OCL); \ 52 | } \ 53 | else \ 54 | { \ 55 | CV_Error(cv::Error::StsAssert, #func); \ 56 | } \ 57 | return __VA_ARGS__; \ 58 | } \ 59 | } 60 | #else 61 | #define CV_OCL_RUN_(condition, func, ...) \ 62 | try \ 63 | { \ 64 | if (cv::ocl::isOpenCLActivated() && (condition) && func) \ 65 | { \ 66 | CV_IMPL_ADD(CV_IMPL_OCL); \ 67 | return __VA_ARGS__; \ 68 | } \ 69 | } \ 70 | catch (const cv::Exception& e) \ 71 | { \ 72 | CV_UNUSED(e); /* TODO: Add some logging here */ \ 73 | } 74 | #endif 75 | 76 | #else 77 | #define CV_OCL_RUN_(condition, func, ...) 78 | #endif 79 | 80 | #define CV_OCL_RUN(condition, func) CV_OCL_RUN_(condition, func) 81 | 82 | #endif // OPENCV_CORE_OPENCL_DEFS_HPP 83 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/opencl_svm.hpp: -------------------------------------------------------------------------------- 1 | /* See LICENSE file in the root OpenCV directory */ 2 | 3 | #ifndef OPENCV_CORE_OPENCL_SVM_HPP 4 | #define OPENCV_CORE_OPENCL_SVM_HPP 5 | 6 | // 7 | // Internal usage only (binary compatibility is not guaranteed) 8 | // 9 | #ifndef __OPENCV_BUILD 10 | #error Internal header file 11 | #endif 12 | 13 | #if defined(HAVE_OPENCL) && defined(HAVE_OPENCL_SVM) 14 | #include "runtime/opencl_core.hpp" 15 | #include "runtime/opencl_svm_20.hpp" 16 | #include "runtime/opencl_svm_hsa_extension.hpp" 17 | 18 | namespace cv { namespace ocl { namespace svm { 19 | 20 | struct SVMCapabilities 21 | { 22 | enum Value 23 | { 24 | SVM_COARSE_GRAIN_BUFFER = (1 << 0), 25 | SVM_FINE_GRAIN_BUFFER = (1 << 1), 26 | SVM_FINE_GRAIN_SYSTEM = (1 << 2), 27 | SVM_ATOMICS = (1 << 3), 28 | }; 29 | int value_; 30 | 31 | SVMCapabilities(int capabilities = 0) : value_(capabilities) { } 32 | operator int() const { return value_; } 33 | 34 | inline bool isNoSVMSupport() const { return value_ == 0; } 35 | inline bool isSupportCoarseGrainBuffer() const { return (value_ & SVM_COARSE_GRAIN_BUFFER) != 0; } 36 | inline bool isSupportFineGrainBuffer() const { return (value_ & SVM_FINE_GRAIN_BUFFER) != 0; } 37 | inline bool isSupportFineGrainSystem() const { return (value_ & SVM_FINE_GRAIN_SYSTEM) != 0; } 38 | inline bool isSupportAtomics() const { return (value_ & SVM_ATOMICS) != 0; } 39 | }; 40 | 41 | CV_EXPORTS const SVMCapabilities getSVMCapabilitites(const ocl::Context& context); 42 | 43 | struct SVMFunctions 44 | { 45 | clSVMAllocAMD_fn fn_clSVMAlloc; 46 | clSVMFreeAMD_fn fn_clSVMFree; 47 | clSetKernelArgSVMPointerAMD_fn fn_clSetKernelArgSVMPointer; 48 | //clSetKernelExecInfoAMD_fn fn_clSetKernelExecInfo; 49 | //clEnqueueSVMFreeAMD_fn fn_clEnqueueSVMFree; 50 | clEnqueueSVMMemcpyAMD_fn fn_clEnqueueSVMMemcpy; 51 | clEnqueueSVMMemFillAMD_fn fn_clEnqueueSVMMemFill; 52 | clEnqueueSVMMapAMD_fn fn_clEnqueueSVMMap; 53 | clEnqueueSVMUnmapAMD_fn fn_clEnqueueSVMUnmap; 54 | 55 | inline SVMFunctions() 56 | : fn_clSVMAlloc(NULL), fn_clSVMFree(NULL), 57 | fn_clSetKernelArgSVMPointer(NULL), /*fn_clSetKernelExecInfo(NULL),*/ 58 | /*fn_clEnqueueSVMFree(NULL),*/ fn_clEnqueueSVMMemcpy(NULL), fn_clEnqueueSVMMemFill(NULL), 59 | fn_clEnqueueSVMMap(NULL), fn_clEnqueueSVMUnmap(NULL) 60 | { 61 | // nothing 62 | } 63 | 64 | inline bool isValid() const 65 | { 66 | return fn_clSVMAlloc != NULL && fn_clSVMFree && fn_clSetKernelArgSVMPointer && 67 | /*fn_clSetKernelExecInfo && fn_clEnqueueSVMFree &&*/ fn_clEnqueueSVMMemcpy && 68 | fn_clEnqueueSVMMemFill && fn_clEnqueueSVMMap && fn_clEnqueueSVMUnmap; 69 | } 70 | }; 71 | 72 | // We should guarantee that SVMFunctions lifetime is not less than context's lifetime 73 | CV_EXPORTS const SVMFunctions* getSVMFunctions(const ocl::Context& context); 74 | 75 | CV_EXPORTS bool useSVM(UMatUsageFlags usageFlags); 76 | 77 | }}} //namespace cv::ocl::svm 78 | #endif 79 | 80 | #endif // OPENCV_CORE_OPENCL_SVM_HPP 81 | /* End of file. */ 82 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AUTOGENERATED, DO NOT EDIT 3 | // 4 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 5 | #error "Invalid usage" 6 | #endif 7 | 8 | // generated by parser_cl.py 9 | #define clCreateFromGLBuffer clCreateFromGLBuffer_ 10 | #define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_ 11 | #define clCreateFromGLTexture clCreateFromGLTexture_ 12 | #define clCreateFromGLTexture2D clCreateFromGLTexture2D_ 13 | #define clCreateFromGLTexture3D clCreateFromGLTexture3D_ 14 | #define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_ 15 | #define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_ 16 | #define clGetGLContextInfoKHR clGetGLContextInfoKHR_ 17 | #define clGetGLObjectInfo clGetGLObjectInfo_ 18 | #define clGetGLTextureInfo clGetGLTextureInfo_ 19 | 20 | #if defined __APPLE__ 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | // generated by parser_cl.py 27 | #undef clCreateFromGLBuffer 28 | #define clCreateFromGLBuffer clCreateFromGLBuffer_pfn 29 | #undef clCreateFromGLRenderbuffer 30 | #define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_pfn 31 | #undef clCreateFromGLTexture 32 | #define clCreateFromGLTexture clCreateFromGLTexture_pfn 33 | #undef clCreateFromGLTexture2D 34 | #define clCreateFromGLTexture2D clCreateFromGLTexture2D_pfn 35 | #undef clCreateFromGLTexture3D 36 | #define clCreateFromGLTexture3D clCreateFromGLTexture3D_pfn 37 | #undef clEnqueueAcquireGLObjects 38 | #define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_pfn 39 | #undef clEnqueueReleaseGLObjects 40 | #define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_pfn 41 | #undef clGetGLContextInfoKHR 42 | #define clGetGLContextInfoKHR clGetGLContextInfoKHR_pfn 43 | #undef clGetGLObjectInfo 44 | #define clGetGLObjectInfo clGetGLObjectInfo_pfn 45 | #undef clGetGLTextureInfo 46 | #define clGetGLTextureInfo clGetGLTextureInfo_pfn 47 | 48 | #ifdef cl_khr_gl_sharing 49 | 50 | // generated by parser_cl.py 51 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLBuffer)(cl_context, cl_mem_flags, cl_GLuint, int*); 52 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLRenderbuffer)(cl_context, cl_mem_flags, cl_GLuint, cl_int*); 53 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); 54 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture2D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); 55 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture3D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); 56 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueAcquireGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*); 57 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReleaseGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*); 58 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLContextInfoKHR)(const cl_context_properties*, cl_gl_context_info, size_t, void*, size_t*); 59 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLObjectInfo)(cl_mem, cl_gl_object_type*, cl_GLuint*); 60 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLTextureInfo)(cl_mem, cl_gl_texture_info, size_t, void*, size_t*); 61 | 62 | #endif // cl_khr_gl_sharing 63 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AUTOGENERATED, DO NOT EDIT 3 | // 4 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 5 | #error "Invalid usage" 6 | #endif 7 | 8 | #ifdef cl_khr_gl_sharing 9 | 10 | // generated by parser_cl.py 11 | #undef clCreateFromGLBuffer 12 | #define clCreateFromGLBuffer clCreateFromGLBuffer_fn 13 | inline cl_mem clCreateFromGLBuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, int* p3) { return clCreateFromGLBuffer_pfn(p0, p1, p2, p3); } 14 | #undef clCreateFromGLRenderbuffer 15 | #define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_fn 16 | inline cl_mem clCreateFromGLRenderbuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, cl_int* p3) { return clCreateFromGLRenderbuffer_pfn(p0, p1, p2, p3); } 17 | #undef clCreateFromGLTexture 18 | #define clCreateFromGLTexture clCreateFromGLTexture_fn 19 | inline cl_mem clCreateFromGLTexture(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture_pfn(p0, p1, p2, p3, p4, p5); } 20 | #undef clCreateFromGLTexture2D 21 | #define clCreateFromGLTexture2D clCreateFromGLTexture2D_fn 22 | inline cl_mem clCreateFromGLTexture2D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture2D_pfn(p0, p1, p2, p3, p4, p5); } 23 | #undef clCreateFromGLTexture3D 24 | #define clCreateFromGLTexture3D clCreateFromGLTexture3D_fn 25 | inline cl_mem clCreateFromGLTexture3D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture3D_pfn(p0, p1, p2, p3, p4, p5); } 26 | #undef clEnqueueAcquireGLObjects 27 | #define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_fn 28 | inline cl_int clEnqueueAcquireGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueAcquireGLObjects_pfn(p0, p1, p2, p3, p4, p5); } 29 | #undef clEnqueueReleaseGLObjects 30 | #define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_fn 31 | inline cl_int clEnqueueReleaseGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueReleaseGLObjects_pfn(p0, p1, p2, p3, p4, p5); } 32 | #undef clGetGLContextInfoKHR 33 | #define clGetGLContextInfoKHR clGetGLContextInfoKHR_fn 34 | inline cl_int clGetGLContextInfoKHR(const cl_context_properties* p0, cl_gl_context_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLContextInfoKHR_pfn(p0, p1, p2, p3, p4); } 35 | #undef clGetGLObjectInfo 36 | #define clGetGLObjectInfo clGetGLObjectInfo_fn 37 | inline cl_int clGetGLObjectInfo(cl_mem p0, cl_gl_object_type* p1, cl_GLuint* p2) { return clGetGLObjectInfo_pfn(p0, p1, p2); } 38 | #undef clGetGLTextureInfo 39 | #define clGetGLTextureInfo clGetGLTextureInfo_fn 40 | inline cl_int clGetGLTextureInfo(cl_mem p0, cl_gl_texture_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLTextureInfo_pfn(p0, p1, p2, p3, p4); } 41 | 42 | #endif // cl_khr_gl_sharing 43 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/opencl_clamdblas.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP 44 | 45 | #ifdef HAVE_CLAMDBLAS 46 | 47 | #include "opencl_core.hpp" 48 | 49 | #include "autogenerated/opencl_clamdblas.hpp" 50 | 51 | #endif // HAVE_CLAMDBLAS 52 | 53 | #endif // OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP 54 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/opencl_clamdfft.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP 44 | 45 | #ifdef HAVE_CLAMDFFT 46 | 47 | #include "opencl_core.hpp" 48 | 49 | #include "autogenerated/opencl_clamdfft.hpp" 50 | 51 | #endif // HAVE_CLAMDFFT 52 | 53 | #endif // OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP 54 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/opencl_core.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP 44 | 45 | #ifdef HAVE_OPENCL 46 | 47 | #ifndef CL_RUNTIME_EXPORT 48 | #if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE) && \ 49 | !(defined(__OPENCV_BUILD) && defined(OPENCV_MODULE_IS_PART_OF_WORLD)) 50 | #define CL_RUNTIME_EXPORT __declspec(dllimport) 51 | #else 52 | #define CL_RUNTIME_EXPORT 53 | #endif 54 | #endif 55 | 56 | #ifdef HAVE_OPENCL_SVM 57 | #define clSVMAlloc clSVMAlloc_ 58 | #define clSVMFree clSVMFree_ 59 | #define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_ 60 | #define clSetKernelExecInfo clSetKernelExecInfo_ 61 | #define clEnqueueSVMFree clEnqueueSVMFree_ 62 | #define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_ 63 | #define clEnqueueSVMMemFill clEnqueueSVMMemFill_ 64 | #define clEnqueueSVMMap clEnqueueSVMMap_ 65 | #define clEnqueueSVMUnmap clEnqueueSVMUnmap_ 66 | #endif 67 | 68 | #include "autogenerated/opencl_core.hpp" 69 | 70 | #ifndef CL_DEVICE_DOUBLE_FP_CONFIG 71 | #define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 72 | #endif 73 | 74 | #ifndef CL_DEVICE_HALF_FP_CONFIG 75 | #define CL_DEVICE_HALF_FP_CONFIG 0x1033 76 | #endif 77 | 78 | #ifndef CL_VERSION_1_2 79 | #define CV_REQUIRE_OPENCL_1_2_ERROR CV_Error(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2") 80 | #endif 81 | 82 | #endif // HAVE_OPENCL 83 | 84 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP 85 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP 44 | 45 | #include "autogenerated/opencl_core_wrappers.hpp" 46 | 47 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP 48 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/opencl_gl.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 44 | 45 | #if defined HAVE_OPENCL && defined HAVE_OPENGL 46 | 47 | #include "opencl_core.hpp" 48 | 49 | #include "autogenerated/opencl_gl.hpp" 50 | 51 | #endif // defined HAVE_OPENCL && defined HAVE_OPENGL 52 | 53 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 54 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 44 | 45 | #include "autogenerated/opencl_gl_wrappers.hpp" 46 | 47 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 48 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp: -------------------------------------------------------------------------------- 1 | /* See LICENSE file in the root OpenCV directory */ 2 | 3 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP 4 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP 5 | 6 | #if defined(HAVE_OPENCL_SVM) 7 | #include "opencl_core.hpp" 8 | 9 | #include "opencl_svm_definitions.hpp" 10 | 11 | #undef clSVMAlloc 12 | #define clSVMAlloc clSVMAlloc_pfn 13 | #undef clSVMFree 14 | #define clSVMFree clSVMFree_pfn 15 | #undef clSetKernelArgSVMPointer 16 | #define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_pfn 17 | #undef clSetKernelExecInfo 18 | //#define clSetKernelExecInfo clSetKernelExecInfo_pfn 19 | #undef clEnqueueSVMFree 20 | //#define clEnqueueSVMFree clEnqueueSVMFree_pfn 21 | #undef clEnqueueSVMMemcpy 22 | #define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_pfn 23 | #undef clEnqueueSVMMemFill 24 | #define clEnqueueSVMMemFill clEnqueueSVMMemFill_pfn 25 | #undef clEnqueueSVMMap 26 | #define clEnqueueSVMMap clEnqueueSVMMap_pfn 27 | #undef clEnqueueSVMUnmap 28 | #define clEnqueueSVMUnmap clEnqueueSVMUnmap_pfn 29 | 30 | extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSVMAlloc)(cl_context context, cl_svm_mem_flags flags, size_t size, unsigned int alignment); 31 | extern CL_RUNTIME_EXPORT void (CL_API_CALL *clSVMFree)(cl_context context, void* svm_pointer); 32 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clSetKernelArgSVMPointer)(cl_kernel kernel, cl_uint arg_index, const void* arg_value); 33 | //extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSetKernelExecInfo)(cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void* param_value); 34 | //extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMFree)(cl_command_queue command_queue, cl_uint num_svm_pointers, void* svm_pointers[], 35 | // void (CL_CALLBACK *pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data), void* user_data, 36 | // cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 37 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemcpy)(cl_command_queue command_queue, cl_bool blocking_copy, void* dst_ptr, const void* src_ptr, size_t size, 38 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 39 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemFill)(cl_command_queue command_queue, void* svm_ptr, const void* pattern, size_t pattern_size, size_t size, 40 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 41 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMap)(cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags map_flags, void* svm_ptr, size_t size, 42 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 43 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMUnmap)(cl_command_queue command_queue, void* svm_ptr, 44 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 45 | 46 | #endif // HAVE_OPENCL_SVM 47 | 48 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP 49 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp: -------------------------------------------------------------------------------- 1 | /* See LICENSE file in the root OpenCV directory */ 2 | 3 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP 4 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP 5 | 6 | #if defined(HAVE_OPENCL_SVM) 7 | #if defined(CL_VERSION_2_0) 8 | 9 | // OpenCL 2.0 contains SVM definitions 10 | 11 | #else 12 | 13 | typedef cl_bitfield cl_device_svm_capabilities; 14 | typedef cl_bitfield cl_svm_mem_flags; 15 | typedef cl_uint cl_kernel_exec_info; 16 | 17 | // 18 | // TODO Add real values after OpenCL 2.0 release 19 | // 20 | 21 | #ifndef CL_DEVICE_SVM_CAPABILITIES 22 | #define CL_DEVICE_SVM_CAPABILITIES 0x1053 23 | 24 | #define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER (1 << 0) 25 | #define CL_DEVICE_SVM_FINE_GRAIN_BUFFER (1 << 1) 26 | #define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM (1 << 2) 27 | #define CL_DEVICE_SVM_ATOMICS (1 << 3) 28 | #endif 29 | 30 | #ifndef CL_MEM_SVM_FINE_GRAIN_BUFFER 31 | #define CL_MEM_SVM_FINE_GRAIN_BUFFER (1 << 10) 32 | #endif 33 | 34 | #ifndef CL_MEM_SVM_ATOMICS 35 | #define CL_MEM_SVM_ATOMICS (1 << 11) 36 | #endif 37 | 38 | 39 | #endif // CL_VERSION_2_0 40 | #endif // HAVE_OPENCL_SVM 41 | 42 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP 43 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/ovx.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | // Copyright (C) 2016, Intel Corporation, all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | // OpenVX related definitions and declarations 9 | 10 | #pragma once 11 | #ifndef OPENCV_OVX_HPP 12 | #define OPENCV_OVX_HPP 13 | 14 | #include "cvdef.h" 15 | 16 | namespace cv 17 | { 18 | /// Check if use of OpenVX is possible 19 | CV_EXPORTS_W bool haveOpenVX(); 20 | 21 | /// Check if use of OpenVX is enabled 22 | CV_EXPORTS_W bool useOpenVX(); 23 | 24 | /// Enable/disable use of OpenVX 25 | CV_EXPORTS_W void setUseOpenVX(bool flag); 26 | } // namespace cv 27 | 28 | #endif // OPENCV_OVX_HPP 29 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/simd_intrinsics.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_SIMD_INTRINSICS_HPP 6 | #define OPENCV_CORE_SIMD_INTRINSICS_HPP 7 | 8 | /** 9 | Helper header to support SIMD intrinsics (universal intrinsics) in user code. 10 | Intrinsics documentation: https://docs.opencv.org/master/df/d91/group__core__hal__intrin.html 11 | 12 | 13 | Checks of target CPU instruction set based on compiler definitions don't work well enough. 14 | More reliable solutions require utilization of configuration systems (like CMake). 15 | 16 | So, probably you need to specify your own configuration. 17 | 18 | You can do that via CMake in this way: 19 | add_definitions(/DOPENCV_SIMD_CONFIG_HEADER=opencv_simd_config_custom.hpp) 20 | or 21 | add_definitions(/DOPENCV_SIMD_CONFIG_INCLUDE_DIR=1) 22 | 23 | Additionally you may need to add include directory to your files: 24 | include_directories("${CMAKE_CURRENT_LIST_DIR}/opencv_config_${MYTARGET}") 25 | 26 | These files can be pre-generated for target configurations of your application 27 | or generated by CMake on the fly (use CMAKE_BINARY_DIR for that). 28 | 29 | Notes: 30 | - H/W capability checks are still responsibility of your application 31 | - runtime dispatching is not covered by this helper header 32 | */ 33 | 34 | #ifdef __OPENCV_BUILD 35 | #error "Use core/hal/intrin.hpp during OpenCV build" 36 | #endif 37 | 38 | #ifdef OPENCV_HAL_INTRIN_HPP 39 | #error "core/simd_intrinsics.hpp must be included before core/hal/intrin.hpp" 40 | #endif 41 | 42 | #include "opencv2/core/cvdef.h" 43 | #include "opencv2/core/version.hpp" 44 | 45 | #ifdef OPENCV_SIMD_CONFIG_HEADER 46 | #include CVAUX_STR(OPENCV_SIMD_CONFIG_HEADER) 47 | #elif defined(OPENCV_SIMD_CONFIG_INCLUDE_DIR) 48 | #include "opencv_simd_config.hpp" // corresponding directory should be added via -I compiler parameter 49 | #else // custom config headers 50 | 51 | #if (!defined(CV_AVX_512F) || !CV_AVX_512F) && (defined(__AVX512__) || defined(__AVX512F__)) 52 | # include 53 | # undef CV_AVX_512F 54 | # define CV_AVX_512F 1 55 | # ifndef OPENCV_SIMD_DONT_ASSUME_SKX // Skylake-X with AVX-512F/CD/BW/DQ/VL 56 | # undef CV_AVX512_SKX 57 | # define CV_AVX512_SKX 1 58 | # undef CV_AVX_512CD 59 | # define CV_AVX_512CD 1 60 | # undef CV_AVX_512BW 61 | # define CV_AVX_512BW 1 62 | # undef CV_AVX_512DQ 63 | # define CV_AVX_512DQ 1 64 | # undef CV_AVX_512VL 65 | # define CV_AVX_512VL 1 66 | # endif 67 | #endif // AVX512 68 | 69 | // GCC/Clang: -mavx2 70 | // MSVC: /arch:AVX2 71 | #if defined __AVX2__ 72 | # include 73 | # undef CV_AVX2 74 | # define CV_AVX2 1 75 | # if defined __F16C__ 76 | # undef CV_FP16 77 | # define CV_FP16 1 78 | # endif 79 | #endif 80 | 81 | #endif 82 | 83 | // SSE / NEON / VSX is handled by cv_cpu_dispatch.h compatibility block 84 | #include "cv_cpu_dispatch.h" 85 | 86 | #include "hal/intrin.hpp" 87 | 88 | #endif // OPENCV_CORE_SIMD_INTRINSICS_HPP 89 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/utils/allocator_stats.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_ALLOCATOR_STATS_HPP 6 | #define OPENCV_CORE_ALLOCATOR_STATS_HPP 7 | 8 | #include "../cvdef.h" 9 | 10 | namespace cv { namespace utils { 11 | 12 | class AllocatorStatisticsInterface 13 | { 14 | protected: 15 | AllocatorStatisticsInterface() {} 16 | virtual ~AllocatorStatisticsInterface() {} 17 | public: 18 | virtual uint64_t getCurrentUsage() const = 0; 19 | virtual uint64_t getTotalUsage() const = 0; 20 | virtual uint64_t getNumberOfAllocations() const = 0; 21 | virtual uint64_t getPeakUsage() const = 0; 22 | 23 | /** set peak usage = current usage */ 24 | virtual void resetPeakUsage() = 0; 25 | }; 26 | 27 | }} // namespace 28 | 29 | #endif // OPENCV_CORE_ALLOCATOR_STATS_HPP 30 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/utils/filesystem.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_UTILS_FILESYSTEM_HPP 6 | #define OPENCV_UTILS_FILESYSTEM_HPP 7 | 8 | namespace cv { namespace utils { namespace fs { 9 | 10 | 11 | CV_EXPORTS bool exists(const cv::String& path); 12 | CV_EXPORTS bool isDirectory(const cv::String& path); 13 | 14 | CV_EXPORTS void remove_all(const cv::String& path); 15 | 16 | 17 | CV_EXPORTS cv::String getcwd(); 18 | 19 | /** @brief Converts path p to a canonical absolute path 20 | * Symlinks are processed if there is support for them on running platform. 21 | * 22 | * @param path input path. Target file/directory should exist. 23 | */ 24 | CV_EXPORTS cv::String canonical(const cv::String& path); 25 | 26 | /** Join path components */ 27 | CV_EXPORTS cv::String join(const cv::String& base, const cv::String& path); 28 | 29 | /** Get parent directory */ 30 | CV_EXPORTS cv::String getParent(const cv::String &path); 31 | CV_EXPORTS std::wstring getParent(const std::wstring& path); 32 | 33 | /** 34 | * Generate a list of all files that match the globbing pattern. 35 | * 36 | * Result entries are prefixed by base directory path. 37 | * 38 | * @param directory base directory 39 | * @param pattern filter pattern (based on '*'/'?' symbols). Use empty string to disable filtering and return all results 40 | * @param[out] result result of globing. 41 | * @param recursive scan nested directories too 42 | * @param includeDirectories include directories into results list 43 | */ 44 | CV_EXPORTS void glob(const cv::String& directory, const cv::String& pattern, 45 | CV_OUT std::vector& result, 46 | bool recursive = false, bool includeDirectories = false); 47 | 48 | /** 49 | * Generate a list of all files that match the globbing pattern. 50 | * 51 | * @param directory base directory 52 | * @param pattern filter pattern (based on '*'/'?' symbols). Use empty string to disable filtering and return all results 53 | * @param[out] result globbing result with relative paths from base directory 54 | * @param recursive scan nested directories too 55 | * @param includeDirectories include directories into results list 56 | */ 57 | CV_EXPORTS void glob_relative(const cv::String& directory, const cv::String& pattern, 58 | CV_OUT std::vector& result, 59 | bool recursive = false, bool includeDirectories = false); 60 | 61 | 62 | CV_EXPORTS bool createDirectory(const cv::String& path); 63 | CV_EXPORTS bool createDirectories(const cv::String& path); 64 | 65 | #ifdef __OPENCV_BUILD 66 | // TODO 67 | //CV_EXPORTS cv::String getTempDirectory(); 68 | 69 | /** 70 | * @brief Returns directory to store OpenCV cache files 71 | * Create sub-directory in common OpenCV cache directory if it doesn't exist. 72 | * @param sub_directory_name name of sub-directory. NULL or "" value asks to return root cache directory. 73 | * @param configuration_name optional name of configuration parameter name which overrides default behavior. 74 | * @return Path to cache directory. Returns empty string if cache directories support is not available. Returns "disabled" if cache disabled by user. 75 | */ 76 | CV_EXPORTS cv::String getCacheDirectory(const char* sub_directory_name, const char* configuration_name = NULL); 77 | 78 | #endif 79 | 80 | }}} // namespace 81 | 82 | #endif // OPENCV_UTILS_FILESYSTEM_HPP 83 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/utils/instrumentation.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_UTILS_INSTR_HPP 6 | #define OPENCV_UTILS_INSTR_HPP 7 | 8 | #include 9 | #include 10 | 11 | namespace cv { 12 | 13 | //! @addtogroup core_utils 14 | //! @{ 15 | 16 | #ifdef CV_COLLECT_IMPL_DATA 17 | CV_EXPORTS void setImpl(int flags); // set implementation flags and reset storage arrays 18 | CV_EXPORTS void addImpl(int flag, const char* func = 0); // add implementation and function name to storage arrays 19 | // Get stored implementation flags and functions names arrays 20 | // Each implementation entry correspond to function name entry, so you can find which implementation was executed in which function 21 | CV_EXPORTS int getImpl(std::vector &impl, std::vector &funName); 22 | 23 | CV_EXPORTS bool useCollection(); // return implementation collection state 24 | CV_EXPORTS void setUseCollection(bool flag); // set implementation collection state 25 | 26 | #define CV_IMPL_PLAIN 0x01 // native CPU OpenCV implementation 27 | #define CV_IMPL_OCL 0x02 // OpenCL implementation 28 | #define CV_IMPL_IPP 0x04 // IPP implementation 29 | #define CV_IMPL_MT 0x10 // multithreaded implementation 30 | 31 | #undef CV_IMPL_ADD 32 | #define CV_IMPL_ADD(impl) \ 33 | if(cv::useCollection()) \ 34 | { \ 35 | cv::addImpl(impl, CV_Func); \ 36 | } 37 | #endif 38 | 39 | // Instrumentation external interface 40 | namespace instr 41 | { 42 | 43 | #if !defined OPENCV_ABI_CHECK 44 | 45 | enum TYPE 46 | { 47 | TYPE_GENERAL = 0, // OpenCV API function, e.g. exported function 48 | TYPE_MARKER, // Information marker 49 | TYPE_WRAPPER, // Wrapper function for implementation 50 | TYPE_FUN, // Simple function call 51 | }; 52 | 53 | enum IMPL 54 | { 55 | IMPL_PLAIN = 0, 56 | IMPL_IPP, 57 | IMPL_OPENCL, 58 | }; 59 | 60 | struct NodeDataTls 61 | { 62 | NodeDataTls() 63 | { 64 | m_ticksTotal = 0; 65 | } 66 | uint64 m_ticksTotal; 67 | }; 68 | 69 | class CV_EXPORTS NodeData 70 | { 71 | public: 72 | NodeData(const char* funName = 0, const char* fileName = NULL, int lineNum = 0, void* retAddress = NULL, bool alwaysExpand = false, cv::instr::TYPE instrType = TYPE_GENERAL, cv::instr::IMPL implType = IMPL_PLAIN); 73 | NodeData(NodeData &ref); 74 | ~NodeData(); 75 | NodeData& operator=(const NodeData&); 76 | 77 | cv::String m_funName; 78 | cv::instr::TYPE m_instrType; 79 | cv::instr::IMPL m_implType; 80 | const char* m_fileName; 81 | int m_lineNum; 82 | void* m_retAddress; 83 | bool m_alwaysExpand; 84 | bool m_funError; 85 | 86 | volatile int m_counter; 87 | volatile uint64 m_ticksTotal; 88 | TLSDataAccumulator m_tls; 89 | int m_threads; 90 | 91 | // No synchronization 92 | double getTotalMs() const { return ((double)m_ticksTotal / cv::getTickFrequency()) * 1000; } 93 | double getMeanMs() const { return (((double)m_ticksTotal/m_counter) / cv::getTickFrequency()) * 1000; } 94 | }; 95 | bool operator==(const NodeData& lhs, const NodeData& rhs); 96 | 97 | typedef Node InstrNode; 98 | 99 | CV_EXPORTS InstrNode* getTrace(); 100 | 101 | #endif // !defined OPENCV_ABI_CHECK 102 | 103 | 104 | CV_EXPORTS bool useInstrumentation(); 105 | CV_EXPORTS void setUseInstrumentation(bool flag); 106 | CV_EXPORTS void resetTrace(); 107 | 108 | enum FLAGS 109 | { 110 | FLAGS_NONE = 0, 111 | FLAGS_MAPPING = 0x01, 112 | FLAGS_EXPAND_SAME_NAMES = 0x02, 113 | }; 114 | 115 | CV_EXPORTS void setFlags(FLAGS modeFlags); 116 | static inline void setFlags(int modeFlags) { setFlags((FLAGS)modeFlags); } 117 | CV_EXPORTS FLAGS getFlags(); 118 | 119 | } // namespace instr 120 | 121 | //! @} 122 | 123 | } // namespace 124 | 125 | #endif // OPENCV_UTILS_TLS_HPP 126 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/utils/logger.defines.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_LOGGER_DEFINES_HPP 6 | #define OPENCV_LOGGER_DEFINES_HPP 7 | 8 | //! @addtogroup core_logging 9 | //! @{ 10 | 11 | // Supported logging levels and their semantic 12 | #define CV_LOG_LEVEL_SILENT 0 //!< for using in setLogLevel() call 13 | #define CV_LOG_LEVEL_FATAL 1 //!< Fatal (critical) error (unrecoverable internal error) 14 | #define CV_LOG_LEVEL_ERROR 2 //!< Error message 15 | #define CV_LOG_LEVEL_WARN 3 //!< Warning message 16 | #define CV_LOG_LEVEL_INFO 4 //!< Info message 17 | #define CV_LOG_LEVEL_DEBUG 5 //!< Debug message. Disabled in the "Release" build. 18 | #define CV_LOG_LEVEL_VERBOSE 6 //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. 19 | 20 | namespace cv { 21 | namespace utils { 22 | namespace logging { 23 | 24 | //! Supported logging levels and their semantic 25 | enum LogLevel { 26 | LOG_LEVEL_SILENT = 0, //!< for using in setLogVevel() call 27 | LOG_LEVEL_FATAL = 1, //!< Fatal (critical) error (unrecoverable internal error) 28 | LOG_LEVEL_ERROR = 2, //!< Error message 29 | LOG_LEVEL_WARNING = 3, //!< Warning message 30 | LOG_LEVEL_INFO = 4, //!< Info message 31 | LOG_LEVEL_DEBUG = 5, //!< Debug message. Disabled in the "Release" build. 32 | LOG_LEVEL_VERBOSE = 6, //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. 33 | #ifndef CV_DOXYGEN 34 | ENUM_LOG_LEVEL_FORCE_INT = INT_MAX 35 | #endif 36 | }; 37 | 38 | }}} // namespace 39 | 40 | //! @} 41 | 42 | #endif // OPENCV_LOGGER_DEFINES_HPP 43 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/utils/logtag.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_LOGTAG_HPP 6 | #define OPENCV_CORE_LOGTAG_HPP 7 | 8 | #include "opencv2/core/cvstd.hpp" 9 | #include "logger.defines.hpp" 10 | 11 | namespace cv { 12 | namespace utils { 13 | namespace logging { 14 | 15 | struct LogTag 16 | { 17 | const char* name; 18 | LogLevel level; 19 | 20 | inline LogTag(const char* _name, LogLevel _level) 21 | : name(_name) 22 | , level(_level) 23 | {} 24 | }; 25 | 26 | }}} 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/va_intel.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | // Copyright (C) 2015, Itseez, Inc., all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | #ifndef OPENCV_CORE_VA_INTEL_HPP 9 | #define OPENCV_CORE_VA_INTEL_HPP 10 | 11 | #ifndef __cplusplus 12 | # error va_intel.hpp header must be compiled as C++ 13 | #endif 14 | 15 | #include "opencv2/core.hpp" 16 | #include "ocl.hpp" 17 | 18 | #if defined(HAVE_VA) 19 | # include "va/va.h" 20 | #else // HAVE_VA 21 | # if !defined(_VA_H_) 22 | typedef void* VADisplay; 23 | typedef unsigned int VASurfaceID; 24 | # endif // !_VA_H_ 25 | #endif // HAVE_VA 26 | 27 | namespace cv { namespace va_intel { 28 | 29 | /** @addtogroup core_va_intel 30 | This section describes Intel VA-API/OpenCL (CL-VA) interoperability. 31 | 32 | To enable basic VA interoperability build OpenCV with libva library integration enabled: `-DWITH_VA=ON` (corresponding dev package should be installed). 33 | 34 | To enable advanced CL-VA interoperability support on Intel HW, enable option: `-DWITH_VA_INTEL=ON` (OpenCL integration should be enabled which is the default setting). Special runtime environment should be set up in order to use this feature: correct combination of [libva](https://github.com/intel/libva), [OpenCL runtime](https://github.com/intel/compute-runtime) and [media driver](https://github.com/intel/media-driver) should be installed. 35 | 36 | Check usage example for details: samples/va_intel/va_intel_interop.cpp 37 | */ 38 | //! @{ 39 | 40 | /////////////////// CL-VA Interoperability Functions /////////////////// 41 | 42 | namespace ocl { 43 | using namespace cv::ocl; 44 | 45 | // TODO static functions in the Context class 46 | /** @brief Creates OpenCL context from VA. 47 | @param display - VADisplay for which CL interop should be established. 48 | @param tryInterop - try to set up for interoperability, if true; set up for use slow copy if false. 49 | @return Returns reference to OpenCL Context 50 | */ 51 | CV_EXPORTS Context& initializeContextFromVA(VADisplay display, bool tryInterop = true); 52 | 53 | } // namespace cv::va_intel::ocl 54 | 55 | /** @brief Converts InputArray to VASurfaceID object. 56 | @param display - VADisplay object. 57 | @param src - source InputArray. 58 | @param surface - destination VASurfaceID object. 59 | @param size - size of image represented by VASurfaceID object. 60 | */ 61 | CV_EXPORTS void convertToVASurface(VADisplay display, InputArray src, VASurfaceID surface, Size size); 62 | 63 | /** @brief Converts VASurfaceID object to OutputArray. 64 | @param display - VADisplay object. 65 | @param surface - source VASurfaceID object. 66 | @param size - size of image represented by VASurfaceID object. 67 | @param dst - destination OutputArray. 68 | */ 69 | CV_EXPORTS void convertFromVASurface(VADisplay display, VASurfaceID surface, Size size, OutputArray dst); 70 | 71 | //! @} 72 | 73 | }} // namespace cv::va_intel 74 | 75 | #endif /* OPENCV_CORE_VA_INTEL_HPP */ 76 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/core/version.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_VERSION_HPP 6 | #define OPENCV_VERSION_HPP 7 | 8 | #define CV_VERSION_MAJOR 4 9 | #define CV_VERSION_MINOR 5 10 | #define CV_VERSION_REVISION 1 11 | #define CV_VERSION_STATUS "" 12 | 13 | #define CVAUX_STR_EXP(__A) #__A 14 | #define CVAUX_STR(__A) CVAUX_STR_EXP(__A) 15 | 16 | #define CVAUX_STRW_EXP(__A) L ## #__A 17 | #define CVAUX_STRW(__A) CVAUX_STRW_EXP(__A) 18 | 19 | #define CV_VERSION CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS 20 | 21 | /* old style version constants*/ 22 | #define CV_MAJOR_VERSION CV_VERSION_MAJOR 23 | #define CV_MINOR_VERSION CV_VERSION_MINOR 24 | #define CV_SUBMINOR_VERSION CV_VERSION_REVISION 25 | 26 | #endif // OPENCV_VERSION_HPP 27 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/cvconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_CVCONFIG_H_INCLUDED 2 | #define OPENCV_CVCONFIG_H_INCLUDED 3 | 4 | /* OpenCV compiled as static or dynamic libs */ 5 | /* #undef BUILD_SHARED_LIBS */ 6 | 7 | /* OpenCV intrinsics optimized code */ 8 | #define CV_ENABLE_INTRINSICS 9 | 10 | /* OpenCV additional optimized code */ 11 | /* #undef CV_DISABLE_OPTIMIZATION */ 12 | 13 | /* Compile for 'real' NVIDIA GPU architectures */ 14 | #define CUDA_ARCH_BIN "" 15 | 16 | /* NVIDIA GPU features are used */ 17 | #define CUDA_ARCH_FEATURES "" 18 | 19 | /* Compile for 'virtual' NVIDIA PTX architectures */ 20 | #define CUDA_ARCH_PTX "" 21 | 22 | /* AMD's Basic Linear Algebra Subprograms Library*/ 23 | /* #undef HAVE_CLAMDBLAS */ 24 | 25 | /* AMD's OpenCL Fast Fourier Transform Library*/ 26 | /* #undef HAVE_CLAMDFFT */ 27 | 28 | /* Clp support */ 29 | /* #undef HAVE_CLP */ 30 | 31 | /* Cocoa API */ 32 | /* #undef HAVE_COCOA */ 33 | 34 | /* NVIDIA CUDA Runtime API*/ 35 | /* #undef HAVE_CUDA */ 36 | 37 | /* NVIDIA CUDA Basic Linear Algebra Subprograms (BLAS) API*/ 38 | /* #undef HAVE_CUBLAS */ 39 | 40 | /* NVIDIA CUDA Deep Neural Network (cuDNN) API*/ 41 | /* #undef HAVE_CUDNN */ 42 | 43 | /* NVIDIA CUDA Fast Fourier Transform (FFT) API*/ 44 | /* #undef HAVE_CUFFT */ 45 | 46 | /* DirectX */ 47 | #define HAVE_DIRECTX 48 | #define HAVE_DIRECTX_NV12 49 | #define HAVE_D3D11 50 | #define HAVE_D3D10 51 | #define HAVE_D3D9 52 | 53 | /* Eigen Matrix & Linear Algebra Library */ 54 | /* #undef HAVE_EIGEN */ 55 | 56 | /* Geospatial Data Abstraction Library */ 57 | /* #undef HAVE_GDAL */ 58 | 59 | /* GTK+ 2.0 Thread support */ 60 | /* #undef HAVE_GTHREAD */ 61 | 62 | /* GTK+ 2.x toolkit */ 63 | /* #undef HAVE_GTK */ 64 | 65 | /* Halide support */ 66 | /* #undef HAVE_HALIDE */ 67 | 68 | /* Vulkan support */ 69 | /* #undef HAVE_VULKAN */ 70 | 71 | /* Define to 1 if you have the header file. */ 72 | /* #undef HAVE_INTTYPES_H */ 73 | 74 | /* Intel Integrated Performance Primitives */ 75 | /* #undef HAVE_IPP */ 76 | /* #undef HAVE_IPP_ICV */ 77 | /* #undef HAVE_IPP_IW */ 78 | /* #undef HAVE_IPP_IW_LL */ 79 | 80 | /* JPEG-2000 codec */ 81 | /* #undef HAVE_OPENJPEG */ 82 | /* #undef HAVE_JASPER */ 83 | 84 | /* IJG JPEG codec */ 85 | /* #undef HAVE_JPEG */ 86 | 87 | /* libpng/png.h needs to be included */ 88 | /* #undef HAVE_LIBPNG_PNG_H */ 89 | 90 | /* GDCM DICOM codec */ 91 | /* #undef HAVE_GDCM */ 92 | 93 | /* NVIDIA Video Decoding API*/ 94 | /* #undef HAVE_NVCUVID */ 95 | /* #undef HAVE_NVCUVID_HEADER */ 96 | /* #undef HAVE_DYNLINK_NVCUVID_HEADER */ 97 | 98 | /* NVIDIA Video Encoding API*/ 99 | /* #undef HAVE_NVCUVENC */ 100 | 101 | /* OpenCL Support */ 102 | /* #undef HAVE_OPENCL */ 103 | /* #undef HAVE_OPENCL_STATIC */ 104 | /* #undef HAVE_OPENCL_SVM */ 105 | 106 | /* NVIDIA OpenCL D3D Extensions support */ 107 | /* #undef HAVE_OPENCL_D3D11_NV */ 108 | 109 | /* OpenEXR codec */ 110 | /* #undef HAVE_OPENEXR */ 111 | 112 | /* OpenGL support*/ 113 | /* #undef HAVE_OPENGL */ 114 | 115 | /* PNG codec */ 116 | /* #undef HAVE_PNG */ 117 | 118 | /* Posix threads (pthreads) */ 119 | /* #undef HAVE_PTHREAD */ 120 | 121 | /* parallel_for with pthreads */ 122 | /* #undef HAVE_PTHREADS_PF */ 123 | 124 | /* Qt support */ 125 | /* #undef HAVE_QT */ 126 | 127 | /* Qt OpenGL support */ 128 | /* #undef HAVE_QT_OPENGL */ 129 | 130 | /* Intel Threading Building Blocks */ 131 | /* #undef HAVE_TBB */ 132 | 133 | /* Ste||ar Group High Performance ParallelX */ 134 | /* #undef HAVE_HPX */ 135 | 136 | /* TIFF codec */ 137 | /* #undef HAVE_TIFF */ 138 | 139 | /* Win32 UI */ 140 | #define HAVE_WIN32UI 141 | 142 | /* Define if your processor stores words with the most significant byte 143 | first (like Motorola and SPARC, unlike Intel and VAX). */ 144 | /* #undef WORDS_BIGENDIAN */ 145 | 146 | /* VA library (libva) */ 147 | /* #undef HAVE_VA */ 148 | 149 | /* Intel VA-API/OpenCL */ 150 | /* #undef HAVE_VA_INTEL */ 151 | 152 | /* Lapack */ 153 | /* #undef HAVE_LAPACK */ 154 | 155 | /* Library was compiled with functions instrumentation */ 156 | /* #undef ENABLE_INSTRUMENTATION */ 157 | 158 | /* OpenVX */ 159 | /* #undef HAVE_OPENVX */ 160 | 161 | /* OpenCV trace utilities */ 162 | /* #undef OPENCV_TRACE */ 163 | 164 | /* Library QR-code decoding */ 165 | /* #undef HAVE_QUIRC */ 166 | 167 | #endif // OPENCV_CVCONFIG_H_INCLUDED 168 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/features2d/features2d.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/features2d.hpp" 49 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/features2d/hal/interface.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_FEATURE2D_HAL_INTERFACE_H 2 | #define OPENCV_FEATURE2D_HAL_INTERFACE_H 3 | 4 | #include "opencv2/core/cvdef.h" 5 | //! @addtogroup features2d_hal_interface 6 | //! @{ 7 | 8 | //! @name Fast feature detector types 9 | //! @sa cv::FastFeatureDetector 10 | //! @{ 11 | #define CV_HAL_TYPE_5_8 0 12 | #define CV_HAL_TYPE_7_12 1 13 | #define CV_HAL_TYPE_9_16 2 14 | //! @} 15 | 16 | //! @name Key point 17 | //! @sa cv::KeyPoint 18 | //! @{ 19 | struct CV_EXPORTS cvhalKeyPoint 20 | { 21 | float x; 22 | float y; 23 | float size; 24 | float angle; 25 | float response; 26 | int octave; 27 | int class_id; 28 | }; 29 | //! @} 30 | 31 | //! @} 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/highgui.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2021 nihui 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #include "opencv2/highgui/highgui.hpp" 18 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/highgui/highgui.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2021 nihui 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #ifndef OPENCV_HIGHGUI_HPP 18 | #define OPENCV_HIGHGUI_HPP 19 | 20 | #include "opencv2/core.hpp" 21 | 22 | enum 23 | { 24 | CV_LOAD_IMAGE_UNCHANGED = -1, 25 | CV_LOAD_IMAGE_GRAYSCALE = 0, 26 | CV_LOAD_IMAGE_COLOR = 1, 27 | }; 28 | 29 | enum 30 | { 31 | CV_IMWRITE_JPEG_QUALITY = 1 32 | }; 33 | 34 | namespace cv { 35 | 36 | enum ImreadModes 37 | { 38 | IMREAD_UNCHANGED = -1, 39 | IMREAD_GRAYSCALE = 0, 40 | IMREAD_COLOR = 1 41 | }; 42 | 43 | enum ImwriteFlags 44 | { 45 | IMWRITE_JPEG_QUALITY = 1 46 | }; 47 | 48 | CV_EXPORTS_W Mat imread(const String& filename, int flags = IMREAD_COLOR); 49 | 50 | CV_EXPORTS_W bool imwrite(const String& filename, InputArray img, const std::vector& params = std::vector()); 51 | 52 | CV_EXPORTS_W Mat imdecode(InputArray buf, int flags); 53 | 54 | CV_EXPORTS_W bool imencode(const String& ext, InputArray img, CV_OUT std::vector& buf, const std::vector& params = std::vector()); 55 | 56 | } // namespace cv 57 | 58 | #endif // OPENCV_HIGHGUI_HPP 59 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/imgproc/hal/interface.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_IMGPROC_HAL_INTERFACE_H 2 | #define OPENCV_IMGPROC_HAL_INTERFACE_H 3 | 4 | //! @addtogroup imgproc_hal_interface 5 | //! @{ 6 | 7 | //! @name Interpolation modes 8 | //! @sa cv::InterpolationFlags 9 | //! @{ 10 | #define CV_HAL_INTER_NEAREST 0 11 | #define CV_HAL_INTER_LINEAR 1 12 | #define CV_HAL_INTER_CUBIC 2 13 | #define CV_HAL_INTER_AREA 3 14 | #define CV_HAL_INTER_LANCZOS4 4 15 | //! @} 16 | 17 | //! @name Morphology operations 18 | //! @sa cv::MorphTypes 19 | //! @{ 20 | #define CV_HAL_MORPH_ERODE 0 21 | #define CV_HAL_MORPH_DILATE 1 22 | //! @} 23 | 24 | //! @name Threshold types 25 | //! @sa cv::ThresholdTypes 26 | //! @{ 27 | #define CV_HAL_THRESH_BINARY 0 28 | #define CV_HAL_THRESH_BINARY_INV 1 29 | #define CV_HAL_THRESH_TRUNC 2 30 | #define CV_HAL_THRESH_TOZERO 3 31 | #define CV_HAL_THRESH_TOZERO_INV 4 32 | #define CV_HAL_THRESH_MASK 7 33 | #define CV_HAL_THRESH_OTSU 8 34 | #define CV_HAL_THRESH_TRIANGLE 16 35 | //! @} 36 | 37 | //! @name Adaptive threshold algorithm 38 | //! @sa cv::AdaptiveThresholdTypes 39 | //! @{ 40 | #define CV_HAL_ADAPTIVE_THRESH_MEAN_C 0 41 | #define CV_HAL_ADAPTIVE_THRESH_GAUSSIAN_C 1 42 | //! @} 43 | 44 | //! @} 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/imgproc/imgproc.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/imgproc.hpp" 49 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/opencv.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009-2010, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_ALL_HPP 44 | #define OPENCV_ALL_HPP 45 | 46 | // File that defines what modules where included during the build of OpenCV 47 | // These are purely the defines of the correct HAVE_OPENCV_modulename values 48 | #include "opencv2/opencv_modules.hpp" 49 | 50 | // Then the list of defines is checked to include the correct headers 51 | // Core library is always included --> without no OpenCV functionality available 52 | #include "opencv2/core.hpp" 53 | 54 | // Then the optional modules are checked 55 | #ifdef HAVE_OPENCV_CALIB3D 56 | #include "opencv2/calib3d.hpp" 57 | #endif 58 | #ifdef HAVE_OPENCV_FEATURES2D 59 | #include "opencv2/features2d.hpp" 60 | #endif 61 | #ifdef HAVE_OPENCV_DNN 62 | #include "opencv2/dnn.hpp" 63 | #endif 64 | #ifdef HAVE_OPENCV_FLANN 65 | #include "opencv2/flann.hpp" 66 | #endif 67 | #ifdef HAVE_OPENCV_HIGHGUI 68 | #include "opencv2/highgui.hpp" 69 | #endif 70 | #ifdef HAVE_OPENCV_IMGCODECS 71 | #include "opencv2/imgcodecs.hpp" 72 | #endif 73 | #ifdef HAVE_OPENCV_IMGPROC 74 | #include "opencv2/imgproc.hpp" 75 | #endif 76 | #ifdef HAVE_OPENCV_ML 77 | #include "opencv2/ml.hpp" 78 | #endif 79 | #ifdef HAVE_OPENCV_OBJDETECT 80 | #include "opencv2/objdetect.hpp" 81 | #endif 82 | #ifdef HAVE_OPENCV_PHOTO 83 | #include "opencv2/photo.hpp" 84 | #endif 85 | #ifdef HAVE_OPENCV_STITCHING 86 | #include "opencv2/stitching.hpp" 87 | #endif 88 | #ifdef HAVE_OPENCV_VIDEO 89 | #include "opencv2/video.hpp" 90 | #endif 91 | #ifdef HAVE_OPENCV_VIDEOIO 92 | #include "opencv2/videoio.hpp" 93 | #endif 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/opencv_modules.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ** File generated automatically, do not modify ** 3 | * 4 | * This file defines the list of modules available in current build configuration 5 | * 6 | * 7 | */ 8 | 9 | // This definition means that OpenCV is built with enabled non-free code. 10 | // For example, patented algorithms for non-profit/non-commercial use only. 11 | /* #undef OPENCV_ENABLE_NONFREE */ 12 | 13 | #define HAVE_OPENCV_CORE 14 | #define HAVE_OPENCV_FEATURES2D 15 | #define HAVE_OPENCV_HIGHGUI 16 | #define HAVE_OPENCV_IMGPROC 17 | #define HAVE_OPENCV_PHOTO 18 | #define HAVE_OPENCV_VIDEO 19 | 20 | 21 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/photo/legacy/constants_c.h: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_PHOTO_LEGACY_CONSTANTS_H 6 | #define OPENCV_PHOTO_LEGACY_CONSTANTS_H 7 | 8 | enum InpaintingModes 9 | { 10 | CV_INPAINT_NS =0, 11 | CV_INPAINT_TELEA =1 12 | }; 13 | 14 | #endif // OPENCV_PHOTO_LEGACY_CONSTANTS_H 15 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/photo/photo.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/photo.hpp" 49 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/video.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifndef OPENCV_VIDEO_HPP 45 | #define OPENCV_VIDEO_HPP 46 | 47 | /** 48 | @defgroup video Video Analysis 49 | @{ 50 | @defgroup video_motion Motion Analysis 51 | @defgroup video_track Object Tracking 52 | @defgroup video_c C API 53 | @} 54 | */ 55 | 56 | #include "opencv2/video/tracking.hpp" 57 | #include "opencv2/video/background_segm.hpp" 58 | 59 | #endif //OPENCV_VIDEO_HPP 60 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/video/legacy/constants_c.h: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_VIDEO_LEGACY_CONSTANTS_H 6 | #define OPENCV_VIDEO_LEGACY_CONSTANTS_H 7 | 8 | enum 9 | { 10 | CV_LKFLOW_PYR_A_READY = 1, 11 | CV_LKFLOW_PYR_B_READY = 2, 12 | CV_LKFLOW_INITIAL_GUESSES = 4, 13 | CV_LKFLOW_GET_MIN_EIGENVALS = 8 14 | }; 15 | 16 | #endif // OPENCV_VIDEO_LEGACY_CONSTANTS_H 17 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/include/opencv2/video/video.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/video.hpp" 49 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_core451.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_core451.lib -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_features2d451.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_features2d451.lib -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_highgui451.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_highgui451.lib -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_imgproc451.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_imgproc451.lib -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_photo451.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_photo451.lib -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_video451.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/opencv-mobile-4.5.1-windows-vs2019/x64/x64/vc16/staticlib/opencv_video451.lib -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/prompt_slover.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EdVince/diffusers-ncnn/e8b4e338cbb6a7894aab6efba759ec18a44ddf64/x86/vs2019_opencv-mobile_ncnn-dll_demo/prompt_slover.cpp -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/prompt_slover.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | using namespace std; 12 | 13 | class PromptSlover 14 | { 15 | public: 16 | PromptSlover(); 17 | 18 | ncnn::Mat get_conditioning(string& prompt); 19 | 20 | private: 21 | std::vector split(std::string str); 22 | string whitespace_clean(string& text); 23 | vector> parse_prompt_attention(string& texts); 24 | 25 | map tokenizer_token2idx; 26 | map tokenizer_idx2token; 27 | 28 | ncnn::Net net; 29 | }; -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/vs2019_opencv-mobile_ncnn-dll_demo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "prompt_slover.h" 11 | #include "decoder_slover.h" 12 | #include "diffusion_slover.h" 13 | #include 14 | #include 15 | #include 16 | #include "getmem.h" 17 | using namespace std; 18 | 19 | int main() 20 | { 21 | int step, seed; 22 | string positive_prompt, negative_prompt; 23 | 24 | // default setting 25 | step = 30; 26 | seed = 20230302; 27 | positive_prompt = "best quality, ultra high res, (photorealistic), (1 girl), thighhighs, (big chest), (upper body), (Kpop idol), (aegyo sal), (platinum blonde hair), ((puffy eyes)), looking at viewer, facing front, smiling, ((naked))"; 28 | negative_prompt = "paintings, sketches, (worst quality), (low quality), (normal quality), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glan, ((cloth))"; 29 | 30 | // parse the magic.txt 31 | ifstream magic; 32 | magic.open("magic.txt"); 33 | if (!magic) { 34 | cout << "can not find magic.txt, using the default setting" << endl; 35 | } 36 | else { 37 | string content = ""; 38 | int i = 0; 39 | for (i = 0; i < 4; i++) { 40 | if (getline(magic, content)) { 41 | switch (i) 42 | { 43 | case 0:step = stoi(content); 44 | case 1:seed = stoi(content); 45 | case 2:positive_prompt = content; 46 | case 3:negative_prompt = content; 47 | default:break; 48 | } 49 | } 50 | else { 51 | break; 52 | } 53 | } 54 | if (i != 4) { 55 | cout << "magic.txt has wrong format, please fix it" << endl; 56 | return 0; 57 | } 58 | 59 | } 60 | if (seed == 0) { 61 | seed = (unsigned)time(NULL); 62 | } 63 | magic.close(); 64 | 65 | // stable diffusion 66 | cout << "----------------[init]--------------------"; 67 | PromptSlover prompt_slover; 68 | DiffusionSlover diffusion_slover; 69 | DecodeSlover decode_slover; 70 | printf(" %.2lfG / %.2lfG\n", getCurrentRSS() / 1024.0 / 1024.0 / 1024.0, getPeakRSS() / 1024.0 / 1024.0 / 1024.0); 71 | 72 | cout << "----------------[prompt]------------------"; 73 | ncnn::Mat cond = prompt_slover.get_conditioning(positive_prompt); 74 | ncnn::Mat uncond = prompt_slover.get_conditioning(negative_prompt); 75 | printf(" %.2lfG / %.2lfG\n", getCurrentRSS() / 1024.0 / 1024.0 / 1024.0, getPeakRSS() / 1024.0 / 1024.0 / 1024.0); 76 | 77 | cout << "----------------[diffusion]---------------" << endl; 78 | ncnn::Mat sample = diffusion_slover.sampler(seed, step, cond, uncond); 79 | cout << "----------------[diffusion]---------------"; 80 | printf(" %.2lfG / %.2lfG\n", getCurrentRSS() / 1024.0 / 1024.0 / 1024.0, getPeakRSS() / 1024.0 / 1024.0 / 1024.0); 81 | 82 | cout << "----------------[decode]------------------"; 83 | ncnn::Mat x_samples_ddim = decode_slover.decode(sample); 84 | printf(" %.2lfG / %.2lfG\n", getCurrentRSS() / 1024.0 / 1024.0 / 1024.0, getPeakRSS() / 1024.0 / 1024.0 / 1024.0); 85 | 86 | cout << "----------------[save]--------------------" << endl; 87 | cv::Mat image(512, 512, CV_8UC3); 88 | x_samples_ddim.to_pixels(image.data, ncnn::Mat::PIXEL_RGB2BGR); 89 | cv::imwrite("result_" + to_string(step) + "_" + to_string(seed) + ".png", image); 90 | 91 | cout << "----------------[close]-------------------" << endl; 92 | 93 | return 0; 94 | } 95 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/vs2019_opencv-mobile_ncnn-dll_demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | 源文件 23 | 24 | 25 | 源文件 26 | 27 | 28 | 源文件 29 | 30 | 31 | 32 | 33 | 头文件 34 | 35 | 36 | 头文件 37 | 38 | 39 | 头文件 40 | 41 | 42 | 头文件 43 | 44 | 45 | -------------------------------------------------------------------------------- /x86/vs2019_opencv-mobile_ncnn-dll_demo/vs2019_opencv-mobile_ncnn-dll_demo.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | --------------------------------------------------------------------------------