├── .clang-format ├── .github └── workflows │ └── coverity.yml ├── .gitignore ├── CMakeLists.txt ├── README.md ├── build.sh ├── cmake ├── hisi3516dv300 │ └── hisi3516dv300_toolchain.cmake ├── hisi3519av100 │ └── hisi3519av100_toolchain.cmake ├── hisi3559av100 │ └── hisi3559av100_toolchain.cmake ├── host │ └── host_toolchain.cmake ├── host_mnn │ └── host_mnn_toolchain.cmake ├── host_mnn_windows │ └── host_mnn_windows.cmake └── rv1126 │ └── rv1126_toolchain.cmake ├── demo ├── CMakeLists.txt ├── data │ ├── config │ │ ├── 3ddfa.yaml │ │ ├── arcface.yaml │ │ ├── centernet_head.yaml │ │ ├── config.yaml │ │ ├── config_ttf.yaml │ │ ├── retinanet_body.yaml │ │ ├── vfnet_body.yaml │ │ ├── yolox_body.yaml │ │ └── yolox_head.yaml │ ├── image │ │ └── head_detect │ │ │ ├── 70.jpg │ │ │ ├── face.jpg │ │ │ └── test.jpg │ └── model │ │ ├── mnn │ │ ├── 3DDFA_sim.mnn │ │ ├── centernet_lite.mnn │ │ └── retinaface.mnn │ │ └── rv_1126 │ │ ├── ttf_725_pre_br.rknn │ │ └── ttf_725_pre_br_asu8.rknn ├── nce_alg_c_test.c ├── nce_alg_cpp_test.cpp ├── nce_alg_test_facerec.cpp └── nce_alg_test_landmarks.cpp ├── nce_alg ├── CMakeLists.txt ├── StanfordCPPLib │ └── linkedhashmap.h ├── alg │ ├── alg_manager │ │ ├── 3ddfa │ │ │ ├── tddfa.cpp │ │ │ └── tddfa.hpp │ │ ├── IAlg.hpp │ │ ├── arcface │ │ │ ├── arcface.cpp │ │ │ └── arcface.hpp │ │ ├── centernet │ │ │ ├── centernet.cpp │ │ │ └── centernet.hpp │ │ ├── face_fake │ │ │ ├── fc_fk_alg.cpp │ │ │ └── fc_fk_alg.hpp │ │ ├── retinaface │ │ │ ├── retinaface.cpp │ │ │ └── retinaface.hpp │ │ ├── ttf │ │ │ ├── hd_alg.cpp │ │ │ └── hd_alg.hpp │ │ ├── util │ │ │ ├── util.cpp │ │ │ └── util.hpp │ │ └── vfnet │ │ │ ├── vfnet.cpp │ │ │ └── vfnet.hpp │ ├── core │ │ ├── factory.hpp │ │ └── nce_tensor.hpp │ ├── engine_manager │ │ ├── IEngine.hpp │ │ ├── MNN │ │ │ ├── MNN_backend.cpp │ │ │ └── MNN_backend.hpp │ │ ├── hisi_3516dv300 │ │ │ ├── engine_hisi_3516dv300.cpp │ │ │ └── engine_hisi_3516dv300.hpp │ │ ├── hisi_3559av100 │ │ │ ├── engine_hisi_3559av100.cpp │ │ │ └── engine_hisi_3559av100.hpp │ │ ├── host │ │ │ └── host_engine.hpp │ │ ├── openvino_backend │ │ │ ├── openvino_backend.cpp │ │ │ └── openvino_backend.hpp │ │ └── rv1126 │ │ │ ├── rv1126_engine.cpp │ │ │ ├── rv1126_engine.hpp │ │ │ ├── rv1126_tool.cpp │ │ │ └── rv1126_tool.hpp │ ├── hook_manager │ │ ├── hook.hpp │ │ ├── keep_upper_bbox │ │ │ ├── keep_upper_bbox.cpp │ │ │ └── keep_upper_bbox.hpp │ │ ├── nms_hook │ │ │ ├── body_nms_hook.cpp │ │ │ └── body_nms_hook.hpp │ │ ├── reflection_filter_hook │ │ │ ├── reflection_filter_hook.cpp │ │ │ └── reflection_filter_hook.hpp │ │ └── softmax_hook │ │ │ ├── softmax_hook.cpp │ │ │ └── softmax_hook.hpp │ ├── nce_alg.cpp │ └── nce_alg_c.cpp ├── common │ ├── common.cpp │ ├── common.h │ ├── stb_image.h │ └── stb_image_write.h ├── include │ ├── alg_type.h │ ├── nce_alg.hpp │ └── nce_alg_c.h └── platform │ ├── hisi3516dv300 │ ├── audio │ │ ├── audio_aac_adp.h │ │ ├── audio_dl_adp.h │ │ ├── audio_mp3_adp.h │ │ └── mp3dec.h │ ├── common │ │ ├── sample_comm_ive.h │ │ ├── sample_comm_nnie.c │ │ ├── sample_comm_nnie.h │ │ ├── sample_comm_svp.c │ │ └── sample_comm_svp.h │ ├── common_sys │ │ ├── loadbmp.c │ │ ├── loadbmp.h │ │ ├── mk-lcd-cmd.sh │ │ ├── rp-lcd-mipi-10inch-800x1280.h │ │ ├── rp-lcd-mipi-4inch-480x800.h │ │ ├── rp-lcd-mipi-5.5inch-720x1280.h │ │ ├── rp-lcd-mipi-5inch-480x854.h │ │ ├── rp-lcd-mipi-5inch-720x1280.h │ │ ├── rp-lcd-mipi-7inch-1024x600-client-mipi-5inch-cfg.h │ │ ├── rp-lcd-mipi-7inch-1024x600.h │ │ ├── rp-lcd-mipi-8inch-800x1280.h │ │ ├── rp-lcd.h │ │ ├── sample_comm.h │ │ ├── sample_comm_audio.c │ │ ├── sample_comm_isp.c │ │ ├── sample_comm_region.c │ │ ├── sample_comm_sys.c │ │ ├── sample_comm_vdec.c │ │ ├── sample_comm_venc.c │ │ ├── sample_comm_vi.c │ │ ├── sample_comm_vo.c │ │ └── sample_comm_vpss.c │ ├── hisi3516dv300.cmake │ ├── include │ │ ├── aacdec.h │ │ ├── aacenc.h │ │ ├── acodec.h │ │ ├── autoconf.h │ │ ├── fisheye_calibrate.h │ │ ├── hi_ae_comm.h │ │ ├── hi_af_comm.h │ │ ├── hi_awb_comm.h │ │ ├── hi_buffer.h │ │ ├── hi_comm_3a.h │ │ ├── hi_comm_adec.h │ │ ├── hi_comm_aenc.h │ │ ├── hi_comm_ai.h │ │ ├── hi_comm_aio.h │ │ ├── hi_comm_ao.h │ │ ├── hi_comm_dis.h │ │ ├── hi_comm_gdc.h │ │ ├── hi_comm_hdmi.h │ │ ├── hi_comm_isp.h │ │ ├── hi_comm_ive.h │ │ ├── hi_comm_rc.h │ │ ├── hi_comm_region.h │ │ ├── hi_comm_snap.h │ │ ├── hi_comm_sns.h │ │ ├── hi_comm_svp.h │ │ ├── hi_comm_sys.h │ │ ├── hi_comm_vb.h │ │ ├── hi_comm_vdec.h │ │ ├── hi_comm_venc.h │ │ ├── hi_comm_vgs.h │ │ ├── hi_comm_vi.h │ │ ├── hi_comm_video.h │ │ ├── hi_comm_vo.h │ │ ├── hi_comm_vpss.h │ │ ├── hi_common.h │ │ ├── hi_common_cipher.h │ │ ├── hi_debug.h │ │ ├── hi_defines.h │ │ ├── hi_errno.h │ │ ├── hi_i2c.h │ │ ├── hi_isp_bin.h │ │ ├── hi_isp_debug.h │ │ ├── hi_isp_defines.h │ │ ├── hi_ive.h │ │ ├── hi_math.h │ │ ├── hi_md.h │ │ ├── hi_mipi.h │ │ ├── hi_mipi_tx.h │ │ ├── hi_nnie.h │ │ ├── hi_plugin.h │ │ ├── hi_resampler_api.h │ │ ├── hi_runtime_api.h │ │ ├── hi_runtime_comm.h │ │ ├── hi_securec.h │ │ ├── hi_sns_ctrl.h │ │ ├── hi_spi.h │ │ ├── hi_ssp.h │ │ ├── hi_tde_api.h │ │ ├── hi_tde_errcode.h │ │ ├── hi_tde_type.h │ │ ├── hi_type.h │ │ ├── hi_types.h │ │ ├── hi_unf_cipher.h │ │ ├── hifb.h │ │ ├── hiir.h │ │ ├── ivs_md.h │ │ ├── list.h │ │ ├── mpi_ae.h │ │ ├── mpi_audio.h │ │ ├── mpi_awb.h │ │ ├── mpi_gdc.h │ │ ├── mpi_hdmi.h │ │ ├── mpi_isp.h │ │ ├── mpi_ive.h │ │ ├── mpi_nnie.h │ │ ├── mpi_region.h │ │ ├── mpi_snap.h │ │ ├── mpi_sys.h │ │ ├── mpi_vb.h │ │ ├── mpi_vdec.h │ │ ├── mpi_venc.h │ │ ├── mpi_vgs.h │ │ ├── mpi_vi.h │ │ ├── mpi_vo.h │ │ ├── mpi_vpss.h │ │ ├── sample_comm_svp.h │ │ ├── securec.h │ │ ├── securectype.h │ │ ├── vdec_exp.h │ │ ├── vou_exp.h │ │ └── watchdog.h │ ├── rtsp-v2 │ │ ├── aacdec.h │ │ ├── aacenc.h │ │ ├── acodec.h │ │ ├── audio_aac_adp.h │ │ ├── audio_dl_adp.h │ │ ├── autoconf.h │ │ ├── dictionary.h │ │ ├── fisheye_calibrate.h │ │ ├── hi_ae_comm.h │ │ ├── hi_af_comm.h │ │ ├── hi_awb_comm.h │ │ ├── hi_buffer.h │ │ ├── hi_comm_3a.h │ │ ├── hi_comm_adec.h │ │ ├── hi_comm_aenc.h │ │ ├── hi_comm_ai.h │ │ ├── hi_comm_aio.h │ │ ├── hi_comm_ao.h │ │ ├── hi_comm_dis.h │ │ ├── hi_comm_fisheye.h │ │ ├── hi_comm_gdc.h │ │ ├── hi_comm_hdmi.h │ │ ├── hi_comm_isp.h │ │ ├── hi_comm_ive.h │ │ ├── hi_comm_pciv.h │ │ ├── hi_comm_rc.h │ │ ├── hi_comm_region.h │ │ ├── hi_comm_snap.h │ │ ├── hi_comm_sns.h │ │ ├── hi_comm_svp.h │ │ ├── hi_comm_sys.h │ │ ├── hi_comm_vb.h │ │ ├── hi_comm_vda.h │ │ ├── hi_comm_vdec.h │ │ ├── hi_comm_venc.h │ │ ├── hi_comm_vgs.h │ │ ├── hi_comm_vi.h │ │ ├── hi_comm_video.h │ │ ├── hi_comm_vo.h │ │ ├── hi_comm_vpss.h │ │ ├── hi_common.h │ │ ├── hi_common_cipher.h │ │ ├── hi_debug.h │ │ ├── hi_defines.h │ │ ├── hi_errno.h │ │ ├── hi_i2c.h │ │ ├── hi_io.h │ │ ├── hi_isp_bin.h │ │ ├── hi_isp_debug.h │ │ ├── hi_isp_defines.h │ │ ├── hi_ive.h │ │ ├── hi_math.h │ │ ├── hi_md.h │ │ ├── hi_mipi.h │ │ ├── hi_mipi_tx.h │ │ ├── hi_nnie.h │ │ ├── hi_plugin.h │ │ ├── hi_resampler_api.h │ │ ├── hi_rtc.h │ │ ├── hi_runtime_api.h │ │ ├── hi_runtime_comm.h │ │ ├── hi_securec.h │ │ ├── hi_sns_ctrl.h │ │ ├── hi_spi.h │ │ ├── hi_ssp.h │ │ ├── hi_tde_api.h │ │ ├── hi_tde_errcode.h │ │ ├── hi_tde_type.h │ │ ├── hi_type.h │ │ ├── hi_types.h │ │ ├── hi_unf_cipher.h │ │ ├── hi_vreg.h │ │ ├── hifb.h │ │ ├── hiir.h │ │ ├── himedia.h │ │ ├── iniparser.h │ │ ├── isp_dehaze.h │ │ ├── ivs_md.h │ │ ├── list.h │ │ ├── mod_ext.h │ │ ├── mpi_adec.h │ │ ├── mpi_ae.h │ │ ├── mpi_aenc.h │ │ ├── mpi_af.h │ │ ├── mpi_ai.h │ │ ├── mpi_ao.h │ │ ├── mpi_audio.h │ │ ├── mpi_awb.h │ │ ├── mpi_fisheye.h │ │ ├── mpi_gdc.h │ │ ├── mpi_hdmi.h │ │ ├── mpi_isp.h │ │ ├── mpi_ive.h │ │ ├── mpi_nnie.h │ │ ├── mpi_pciv.h │ │ ├── mpi_region.h │ │ ├── mpi_snap.h │ │ ├── mpi_sys.h │ │ ├── mpi_vb.h │ │ ├── mpi_vda.h │ │ ├── mpi_vdec.h │ │ ├── mpi_venc.h │ │ ├── mpi_vgs.h │ │ ├── mpi_vi.h │ │ ├── mpi_vo.h │ │ ├── mpi_vpss.h │ │ ├── pwm.h │ │ ├── ringfifo.h │ │ ├── rp-lcd-mipi-10inch-800x1280.h │ │ ├── rp-lcd-mipi-5inch-480x854.h │ │ ├── rp-lcd-mipi-7inch-1024x600-client-mipi-5inch-cfg.h │ │ ├── rp-lcd-mipi-7inch-1024x600.h │ │ ├── rp-lcd-mipi-8inch-800x1280.h │ │ ├── rp-lcd.h │ │ ├── rtputils.h │ │ ├── rtspservice.h │ │ ├── rtsputils.h │ │ ├── sample_comm.h │ │ ├── securec.h │ │ ├── securectype.h │ │ ├── strlib.h │ │ ├── vdec_exp.h │ │ ├── viu_ext.h │ │ ├── vou_exp.h │ │ └── watchdog.h │ ├── sample_nnie_software │ │ ├── sample_svp_nnie_software.c │ │ └── sample_svp_nnie_software.h │ └── tools │ │ └── caffe_merge_bn_tool.py │ ├── hisi3519av100 │ ├── MNN │ │ └── include │ │ │ └── MNN │ │ │ ├── AutoTime.hpp │ │ │ ├── ErrorCode.hpp │ │ │ ├── HalideRuntime.h │ │ │ ├── ImageProcess.hpp │ │ │ ├── Interpreter.hpp │ │ │ ├── MNNDefine.h │ │ │ ├── MNNForwardType.h │ │ │ ├── MNNSharedContext.h │ │ │ ├── Matrix.h │ │ │ ├── Rect.h │ │ │ ├── Tensor.hpp │ │ │ ├── expr │ │ │ ├── Executor.hpp │ │ │ ├── ExecutorScope.hpp │ │ │ ├── Expr.hpp │ │ │ ├── ExprCreator.hpp │ │ │ ├── MathOp.hpp │ │ │ ├── Module.hpp │ │ │ ├── NeuralNetWorkOp.hpp │ │ │ ├── Optimizer.hpp │ │ │ └── Scope.hpp │ │ │ └── plugin │ │ │ ├── PluginContext.hpp │ │ │ ├── PluginKernel.hpp │ │ │ └── PluginShapeInference.hpp │ └── hisi3519av100.cmake │ ├── hisi3559av100 │ ├── drv │ │ └── hisi_sdk_src │ │ │ ├── common │ │ │ ├── sample_comm_nnie.c │ │ │ └── sample_comm_svp.c │ │ │ └── nnie │ │ │ ├── sample │ │ │ └── sample_nnie.c │ │ │ └── sample_nnie_software │ │ │ └── sample_svp_nnie_software.c │ ├── hisi3559av100.cmake │ └── include │ │ ├── aacdec.h │ │ ├── aacenc.h │ │ ├── acodec.h │ │ ├── autoconf.h │ │ ├── fisheye_calibrate.h │ │ ├── hi_ae_comm.h │ │ ├── hi_af_comm.h │ │ ├── hi_avs_lut_generate.h │ │ ├── hi_avs_position_query.h │ │ ├── hi_awb_comm.h │ │ ├── hi_buffer.h │ │ ├── hi_comm_3a.h │ │ ├── hi_comm_adec.h │ │ ├── hi_comm_aenc.h │ │ ├── hi_comm_ai.h │ │ ├── hi_comm_aio.h │ │ ├── hi_comm_ao.h │ │ ├── hi_comm_avs.h │ │ ├── hi_comm_dis.h │ │ ├── hi_comm_dpu_match.h │ │ ├── hi_comm_dpu_rect.h │ │ ├── hi_comm_gdc.h │ │ ├── hi_comm_hdmi.h │ │ ├── hi_comm_hdr.h │ │ ├── hi_comm_isp.h │ │ ├── hi_comm_ive.h │ │ ├── hi_comm_pciv.h │ │ ├── hi_comm_photo.h │ │ ├── hi_comm_rc.h │ │ ├── hi_comm_region.h │ │ ├── hi_comm_snap.h │ │ ├── hi_comm_sns.h │ │ ├── hi_comm_svp.h │ │ ├── hi_comm_sys.h │ │ ├── hi_comm_vb.h │ │ ├── hi_comm_vdec.h │ │ ├── hi_comm_venc.h │ │ ├── hi_comm_vgs.h │ │ ├── hi_comm_vi.h │ │ ├── hi_comm_video.h │ │ ├── hi_comm_vo.h │ │ ├── hi_comm_vpss.h │ │ ├── hi_common.h │ │ ├── hi_common_cipher.h │ │ ├── hi_debug.h │ │ ├── hi_defines.h │ │ ├── hi_dsp.h │ │ ├── hi_errno.h │ │ ├── hi_i2c.h │ │ ├── hi_isp_bin.h │ │ ├── hi_isp_debug.h │ │ ├── hi_isp_defines.h │ │ ├── hi_ive.h │ │ ├── hi_math.h │ │ ├── hi_mcc_usrdev.h │ │ ├── hi_md.h │ │ ├── hi_mipi.h │ │ ├── hi_mipi_tx.h │ │ ├── hi_nnie.h │ │ ├── hi_plugin.h │ │ ├── hi_resampler_api.h │ │ ├── hi_runtime_api.h │ │ ├── hi_runtime_comm.h │ │ ├── hi_securec.h │ │ ├── hi_sns_ctrl.h │ │ ├── hi_spi.h │ │ ├── hi_ssp.h │ │ ├── hi_tde_api.h │ │ ├── hi_tde_errcode.h │ │ ├── hi_tde_type.h │ │ ├── hi_type.h │ │ ├── hi_types.h │ │ ├── hi_unf_cipher.h │ │ ├── hifb.h │ │ ├── hiir.h │ │ ├── isp_dehaze.h │ │ ├── ivs_md.h │ │ ├── list.h │ │ ├── mpi_ae.h │ │ ├── mpi_audio.h │ │ ├── mpi_avs.h │ │ ├── mpi_awb.h │ │ ├── mpi_dpu_match.h │ │ ├── mpi_dpu_rect.h │ │ ├── mpi_dsp.h │ │ ├── mpi_gdc.h │ │ ├── mpi_hdmi.h │ │ ├── mpi_hdr.h │ │ ├── mpi_isp.h │ │ ├── mpi_ive.h │ │ ├── mpi_nnie.h │ │ ├── mpi_pciv.h │ │ ├── mpi_photo.h │ │ ├── mpi_region.h │ │ ├── mpi_snap.h │ │ ├── mpi_sys.h │ │ ├── mpi_vb.h │ │ ├── mpi_vdec.h │ │ ├── mpi_venc.h │ │ ├── mpi_vgs.h │ │ ├── mpi_vi.h │ │ ├── mpi_vo.h │ │ ├── mpi_vpss.h │ │ ├── sample_comm.h │ │ ├── sample_comm_ive.h │ │ ├── sample_comm_nnie.h │ │ ├── sample_comm_svp.h │ │ ├── sample_nnie_main.h │ │ ├── sample_svp_nnie_software.h │ │ ├── securec.h │ │ ├── securectype.h │ │ ├── vdec_exp.h │ │ ├── vou_exp.h │ │ └── watchdog.h │ ├── host │ └── host.cmake │ ├── host_mnn │ ├── MNN │ │ └── include │ │ │ └── MNN │ │ │ ├── AutoTime.hpp │ │ │ ├── ErrorCode.hpp │ │ │ ├── HalideRuntime.h │ │ │ ├── ImageProcess.hpp │ │ │ ├── Interpreter.hpp │ │ │ ├── MNNDefine.h │ │ │ ├── MNNForwardType.h │ │ │ ├── MNNSharedContext.h │ │ │ ├── Matrix.h │ │ │ ├── Rect.h │ │ │ ├── Tensor.hpp │ │ │ ├── expr │ │ │ ├── Executor.hpp │ │ │ ├── ExecutorScope.hpp │ │ │ ├── Expr.hpp │ │ │ ├── ExprCreator.hpp │ │ │ ├── MathOp.hpp │ │ │ ├── Module.hpp │ │ │ ├── NeuralNetWorkOp.hpp │ │ │ ├── Optimizer.hpp │ │ │ └── Scope.hpp │ │ │ └── plugin │ │ │ ├── PluginContext.hpp │ │ │ ├── PluginKernel.hpp │ │ │ └── PluginShapeInference.hpp │ └── host_mnn.cmake │ ├── host_mnn_windows │ ├── host_mnn_windows.cmake │ ├── include │ │ └── MNN │ │ │ ├── AutoTime.hpp │ │ │ ├── ErrorCode.hpp │ │ │ ├── HalideRuntime.h │ │ │ ├── ImageProcess.hpp │ │ │ ├── Interpreter.hpp │ │ │ ├── MNNDefine.h │ │ │ ├── MNNForwardType.h │ │ │ ├── MNNSharedContext.h │ │ │ ├── Matrix.h │ │ │ ├── Rect.h │ │ │ ├── Tensor.hpp │ │ │ ├── expr │ │ │ ├── Executor.hpp │ │ │ ├── ExecutorScope.hpp │ │ │ ├── Expr.hpp │ │ │ ├── ExprCreator.hpp │ │ │ ├── MathOp.hpp │ │ │ ├── Module.hpp │ │ │ ├── NeuralNetWorkOp.hpp │ │ │ ├── Optimizer.hpp │ │ │ └── Scope.hpp │ │ │ └── plugin │ │ │ ├── PluginContext.hpp │ │ │ ├── PluginKernel.hpp │ │ │ └── PluginShapeInference.hpp │ └── lib │ │ ├── MNN.dll │ │ └── MNN.lib │ ├── openvino │ ├── builders │ │ ├── ie_argmax_layer.hpp │ │ ├── ie_batch_normalization_layer.hpp │ │ ├── ie_clamp_layer.hpp │ │ ├── ie_concat_layer.hpp │ │ ├── ie_const_layer.hpp │ │ ├── ie_convolution_layer.hpp │ │ ├── ie_crop_layer.hpp │ │ ├── ie_ctc_greedy_decoder_layer.hpp │ │ ├── ie_deconvolution_layer.hpp │ │ ├── ie_deformable_convolution_layer.hpp │ │ ├── ie_detection_output_layer.hpp │ │ ├── ie_eltwise_layer.hpp │ │ ├── ie_elu_layer.hpp │ │ ├── ie_fully_connected_layer.hpp │ │ ├── ie_grn_layer.hpp │ │ ├── ie_gru_sequence_layer.hpp │ │ ├── ie_input_layer.hpp │ │ ├── ie_layer_builder.hpp │ │ ├── ie_layer_decorator.hpp │ │ ├── ie_lrn_layer.hpp │ │ ├── ie_lstm_sequence_layer.hpp │ │ ├── ie_memory_layer.hpp │ │ ├── ie_mvn_layer.hpp │ │ ├── ie_network_builder.hpp │ │ ├── ie_norm_layer.hpp │ │ ├── ie_normalize_layer.hpp │ │ ├── ie_output_layer.hpp │ │ ├── ie_permute_layer.hpp │ │ ├── ie_pooling_layer.hpp │ │ ├── ie_power_layer.hpp │ │ ├── ie_prelu_layer.hpp │ │ ├── ie_prior_box_clustered_layer.hpp │ │ ├── ie_prior_box_layer.hpp │ │ ├── ie_proposal_layer.hpp │ │ ├── ie_psroi_pooling_layer.hpp │ │ ├── ie_region_yolo_layer.hpp │ │ ├── ie_relu6_layer.hpp │ │ ├── ie_relu_layer.hpp │ │ ├── ie_reorg_yolo_layer.hpp │ │ ├── ie_resample_layer.hpp │ │ ├── ie_reshape_layer.hpp │ │ ├── ie_rnn_sequence_layer.hpp │ │ ├── ie_roi_pooling_layer.hpp │ │ ├── ie_scale_shift_layer.hpp │ │ ├── ie_sigmoid_layer.hpp │ │ ├── ie_simpler_nms_layer.hpp │ │ ├── ie_softmax_layer.hpp │ │ ├── ie_split_layer.hpp │ │ ├── ie_tanh_layer.hpp │ │ └── ie_tile_layer.hpp │ ├── c_api │ │ └── ie_c_api.h │ ├── cldnn │ │ └── cldnn_config.hpp │ ├── cpp │ │ ├── ie_cnn_net_reader.h │ │ ├── ie_cnn_network.h │ │ ├── ie_executable_network.hpp │ │ ├── ie_infer_request.hpp │ │ ├── ie_memory_state.hpp │ │ └── ie_plugin_cpp.hpp │ ├── details │ │ ├── caseless.hpp │ │ ├── ie_blob_iterator.hpp │ │ ├── ie_cnn_network_iterator.hpp │ │ ├── ie_cnn_network_tools.h │ │ ├── ie_exception.hpp │ │ ├── ie_exception_conversion.hpp │ │ ├── ie_inetwork_iterator.hpp │ │ ├── ie_irelease.hpp │ │ ├── ie_no_copy.hpp │ │ ├── ie_no_release.hpp │ │ ├── ie_pre_allocator.hpp │ │ ├── ie_so_loader.h │ │ ├── ie_so_pointer.hpp │ │ └── os │ │ │ ├── lin_shared_object_loader.h │ │ │ ├── os_filesystem.hpp │ │ │ └── win_shared_object_loader.h │ ├── gna │ │ └── gna_config.hpp │ ├── gpu │ │ ├── details │ │ │ └── gpu_context_helpers.hpp │ │ ├── gpu_context_api_dx.hpp │ │ ├── gpu_context_api_ocl.hpp │ │ ├── gpu_context_api_va.hpp │ │ ├── gpu_ocl_wrapper.hpp │ │ └── gpu_params.hpp │ ├── hetero │ │ └── hetero_plugin_config.hpp │ ├── ie_allocator.hpp │ ├── ie_api.h │ ├── ie_blob.h │ ├── ie_builders.hpp │ ├── ie_common.h │ ├── ie_compound_blob.h │ ├── ie_context.hpp │ ├── ie_core.hpp │ ├── ie_data.h │ ├── ie_error.hpp │ ├── ie_extension.h │ ├── ie_icnn_net_reader.h │ ├── ie_icnn_network.hpp │ ├── ie_icnn_network_stats.hpp │ ├── ie_iexecutable_network.hpp │ ├── ie_iextension.h │ ├── ie_iinfer_request.hpp │ ├── ie_imemory_state.hpp │ ├── ie_input_info.hpp │ ├── ie_layers.h │ ├── ie_layers_property.hpp │ ├── ie_layouts.h │ ├── ie_locked_memory.hpp │ ├── ie_network.hpp │ ├── ie_parallel.hpp │ ├── ie_parameter.hpp │ ├── ie_plugin.hpp │ ├── ie_plugin_config.hpp │ ├── ie_plugin_dispatcher.hpp │ ├── ie_plugin_ptr.hpp │ ├── ie_precision.hpp │ ├── ie_preprocess.hpp │ ├── ie_primitive_info.hpp │ ├── ie_remote_context.hpp │ ├── ie_tensor_info.hpp │ ├── ie_unicode.hpp │ ├── ie_version.hpp │ ├── inference_engine.hpp │ ├── multi-device │ │ └── multi_device_config.hpp │ ├── openvino.cmake │ ├── os │ │ └── windows │ │ │ └── w_dirent.h │ ├── samples │ │ ├── args_helper.hpp │ │ ├── common.hpp │ │ ├── ocv_common.hpp │ │ └── slog.hpp │ └── vpu │ │ ├── hddl_plugin_config.hpp │ │ ├── myriad_plugin_config.hpp │ │ └── vpu_plugin_config.hpp │ └── rv1126 │ ├── include │ ├── amdgpu_drm.h │ ├── drm.h │ ├── drm_fourcc.h │ ├── drm_mode.h │ ├── drm_sarea.h │ ├── i915_drm.h │ ├── mach64_drm.h │ ├── mga_drm.h │ ├── nouveau_drm.h │ ├── qxl_drm.h │ ├── r128_drm.h │ ├── radeon_drm.h │ ├── rknn_api.h │ ├── savage_drm.h │ ├── sis_drm.h │ ├── tegra_drm.h │ ├── vc4_drm.h │ ├── via_drm.h │ ├── virtgpu_drm.h │ ├── xf86drm.h │ └── xf86drmMode.h │ ├── lib │ └── librknn_api.so │ └── rv1126.cmake └── third-party ├── CMakeLists.txt ├── modules.cmake ├── modules └── module_yaml.cmake └── yaml ├── CMakeLists.txt └── yaml-cpp-master.tar.gz /.clang-format: -------------------------------------------------------------------------------- 1 | AccessModifierOffset: -4 2 | AlignAfterOpenBracket: Align 3 | AlignConsecutiveAssignments: true 4 | AlignConsecutiveDeclarations: true 5 | AlignEscapedNewlines: Left 6 | AlignOperands: true 7 | AlignTrailingComments: true 8 | AllowAllParametersOfDeclarationOnNextLine: false 9 | AllowShortBlocksOnASingleLine: true 10 | AllowShortCaseLabelsOnASingleLine: false 11 | AllowShortFunctionsOnASingleLine: None 12 | AllowShortIfStatementsOnASingleLine: false 13 | AllowShortLoopsOnASingleLine: false 14 | AlwaysBreakAfterReturnType: None 15 | AlwaysBreakBeforeMultilineStrings: false 16 | AlwaysBreakTemplateDeclarations: true 17 | BinPackArguments: false 18 | BinPackParameters: false 19 | BraceWrapping: 20 | AfterClass: true 21 | AfterControlStatement: true 22 | AfterEnum: true 23 | AfterFunction: true 24 | AfterNamespace: false 25 | AfterStruct: true 26 | AfterUnion: true 27 | BeforeElse: true 28 | IndentBraces: false 29 | SplitEmptyFunction: false 30 | BreakBeforeBinaryOperators: NonAssignment 31 | BreakBeforeBraces: Custom 32 | BreakBeforeTernaryOperators: true 33 | ColumnLimit: 120 34 | ContinuationIndentWidth: 4 35 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 36 | ConstructorInitializerIndentWidth: 4 37 | Cpp11BracedListStyle: false 38 | DerivePointerAlignment: false 39 | DisableFormat: false 40 | IndentCaseLabels: true 41 | IndentWidth: 4 42 | IndentWrappedFunctionNames: false 43 | KeepEmptyLinesAtTheStartOfBlocks: true 44 | Language: Cpp 45 | MaxEmptyLinesToKeep: 1 46 | PenaltyBreakBeforeFirstCallParameter: 19 47 | PenaltyBreakComment: 300 48 | PenaltyBreakFirstLessLess: 120 49 | PenaltyBreakString: 1000 50 | PenaltyExcessCharacter: 1000000 51 | PenaltyReturnTypeOnItsOwnLine: 60 52 | PointerAlignment: Right 53 | ReflowComments: true 54 | SortIncludes: false 55 | SpaceAfterCStyleCast: false 56 | SpaceBeforeAssignmentOperators: true 57 | SpaceBeforeParens: ControlStatements 58 | SpaceInEmptyParentheses: false 59 | SpacesBeforeTrailingComments: 1 60 | SpacesInCStyleCastParentheses: false 61 | SpacesInParentheses: false 62 | SpacesInSquareBrackets: false 63 | UseTab: Never -------------------------------------------------------------------------------- /.github/workflows/coverity.yml: -------------------------------------------------------------------------------- 1 | name: coverity-scan 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | workflow_dispatch: 7 | 8 | env: 9 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 10 | BUILD_TYPE: Debug 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | with: 19 | submodules: true 20 | 21 | - name: Create Build Environment 22 | run: cmake -E make_directory ${{github.workspace}}/build 23 | 24 | - name: Download Coverity Build Tool 25 | working-directory: ${{github.workspace}}/build 26 | shell: bash 27 | run: | 28 | wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=NceBoy%2FNceAlg" -O cov-analysis-linux64.tar.gz 29 | mkdir cov-analysis-linux64 30 | tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 31 | env: 32 | TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} 33 | 34 | - name: Configure CMake 35 | working-directory: ${{github.workspace}}/build 36 | shell: bash 37 | run: cmake $GITHUB_WORKSPACE -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/host/host_toolchain.cmake -DPLATFORM=host -DCMAKE_BUILD_TYPE=Debug 38 | 39 | 40 | - name: Build with cov-build 41 | working-directory: ${{github.workspace}}/build 42 | shell: bash 43 | run: | 44 | export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH 45 | cov-build --dir cov-int cmake --build . -v 46 | - name: Submit the result to Coverity Scan 47 | working-directory: ${{github.workspace}}/build 48 | shell: bash 49 | run: | 50 | tar czvf NceAlg.tgz cov-int 51 | curl --form token=xDnqyM9zMivLilhi4HV-_A \ 52 | --form email=451017151@qq.com \ 53 | --form file=@NceAlg.tgz \ 54 | --form version="Version" \ 55 | --form description="Description" \ 56 | https://scan.coverity.com/builds?project=NceBoy%2FNceAlg 57 | env: 58 | TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .onnx 3 | .mnn 4 | .lib 5 | .dll 6 | .txt 7 | *.[oa] 8 | build/* 9 | nce_alg/alg/alg_manager/alg_closed_source 10 | nce_alg/alg/engine_manager/engine_closed_source -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | if(CMAKE_BUILD_TYPE MATCHES "Release") 4 | SET(NCE_BUILD "Release") 5 | endif() 6 | if(CMAKE_BUILD_TYPE MATCHES "Debug") 7 | SET(NCE_BUILD "Debug") 8 | endif() 9 | 10 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/third-party/modules) 11 | message("${CMAKE_MODULE_PATH}") 12 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") 13 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/) 14 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/) 15 | else(CMAKE_SYSTEM_NAME MATCHES "Windows") 16 | if(MSVC) 17 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/out/) 18 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/out/) 19 | endif() 20 | endif() 21 | 22 | SET(NCE_BUILD_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 23 | add_definitions(-DPLATFORM=${PLATFORM}) 24 | 25 | add_subdirectory("third-party") 26 | add_subdirectory("nce_alg") 27 | add_subdirectory("demo") -------------------------------------------------------------------------------- /cmake/hisi3516dv300/hisi3516dv300_toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | set(CMAKE_CHIP_NAME hi3516d) 4 | 5 | set(CMAKE_CROSS_PREFIX "arm-himix200-linux") 6 | set(CMAKE_C_COMPILER "arm-himix200-linux-gcc") 7 | set(CMAKE_CXX_COMPILER "arm-himix200-linux-g++") 8 | set(CMAKE_AR "arm-himix200-linux-ar") 9 | set(CMAKE_LINER "arm-himix200-linux-g++") 10 | set(CMAKE_LD "arm-himix200-linux-ld") 11 | #set(CMAKE_SYSROOT /home/cjyvm2/3516rootfs/rootfs) 12 | # This crosstool doesn't define SO_REUSEPORT 13 | add_compile_options(-Wno-unused-function -fPIC) 14 | #add_compile_options(-std=c++11) 15 | # This chip provides the floating-point operation unit and NEON. 16 | # The libraries in the file system are compiled with hard floating point and neon compatible with the soft floating point call interface. 17 | #add_compile_options(-mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -fno-aggressive-loop-optimizations) 18 | 19 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 20 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 21 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 22 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 23 | -------------------------------------------------------------------------------- /cmake/hisi3519av100/hisi3519av100_toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR armv) 3 | set(CMAKE_CHIP_NAME hi3519) 4 | set(CMAKE_TOOLCHAIN_PATH "/home/video/tools/hisi/arm-hisiv600-linux/target/bin") 5 | set(CMAKE_CROSS_PREFIX "${CMAKE_TOOLCHAIN_PATH}/arm-hisiv600-linux") 6 | set(CMAKE_C_COMPILER "${CMAKE_TOOLCHAIN_PATH}/arm-hisiv600-linux-gcc") 7 | set(CMAKE_CXX_COMPILER "${CMAKE_TOOLCHAIN_PATH}/arm-hisiv600-linux-g++") 8 | set(CMAKE_AR "${CMAKE_TOOLCHAIN_PATH}/arm-hisiv600-linux-ar") 9 | set(CMAKE_LINER "${CMAKE_TOOLCHAIN_PATH}/arm-hisiv600-linux-g++") 10 | set(CMAKE_LD "${CMAKE_TOOLCHAIN_PATH}/arm-hisiv600-linux-ld") 11 | #set(CMAKE_SYSROOT /home/cjyvm2/3516rootfs/rootfs) 12 | # This crosstool doesn't define SO_REUSEPORT 13 | add_compile_options(-Wno-unused-function) 14 | #add_compile_options(-std=c++11) 15 | # This chip provides the floating-point operation unit and NEON. 16 | # The libraries in the file system are compiled with hard floating point and neon compatible with the soft floating point call interface. 17 | #add_compile_options(-mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -fno-aggressive-loop-optimizations) 18 | 19 | # set(CMAKE_CXX_FLAGS "-mfloat-abi=softfp -mfpu=neon-vfpv4 -mno-unaligned-access -fno-aggressive-loop-optimizations -ffunction-sections -fdata-sections ${CMAKE_CXX_FLAGS}") 20 | # set(CMAKE_CXX_FLAGS "-g -fPIC -O3 -std=c++11 -mcpu=cortex-a17.cortex-a7 -ldl -lrt -lpthread ${CMAKE_CXX_FLAGS}") 21 | 22 | add_compile_options(-g -fPIC -O3 -std=c++11 -mcpu=cortex-a17.cortex-a7) 23 | add_compile_options(-mfloat-abi=softfp -mfpu=neon-vfpv4 -mno-unaligned-access -fno-aggressive-loop-optimizations -ffunction-sections -fdata-sections) 24 | 25 | # set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 26 | # set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 27 | # set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 28 | # set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) -------------------------------------------------------------------------------- /cmake/hisi3559av100/hisi3559av100_toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_CROSS_PREFIX "aarch64-himix100-linux") 2 | set(CMAKE_C_COMPILER "aarch64-himix100-linux-gcc") 3 | set(CMAKE_CXX_COMPILER "aarch64-himix100-linux-g++") 4 | set(CMAKE_AR "aarch64-himix100-linux-ar") 5 | set(CMAKE_LINER "aarch64-himix100-linux-g++") 6 | set(CMAKE_LD "aarch64-himix100-linux-ld") 7 | 8 | set(CMAKE_CXX_FLAGS "-ffunction-sections -fdata-sections -mcpu=cortex-a73.cortex-a53 -fno-aggressive-loop-optimizations") 9 | set(CMAKE_CXX_FLAGS "-fPIC -O2 -mcpu=cortex-a73.cortex-a53 ${CMAKE_CXX_FLAGS}") 10 | #set(CMAKE_SYSROOT /home/cjyvm2/3516rootfs/rootfs) 11 | # This crosstool doesn't define SO_REUSEPORT 12 | 13 | #add_compile_options(-std=c++11) 14 | # This chip provides the floating-point operation unit and NEON. 15 | # The libraries in the file system are compiled with hard floating point and neon compatible with the soft floating point call interface. 16 | #add_compile_options(-mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -fno-aggressive-loop-optimizations) 17 | 18 | 19 | -------------------------------------------------------------------------------- /cmake/host/host_toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR x86_64) 3 | set(CMAKE_CHIP_NAME host) 4 | 5 | set(CMAKE_CROSS_PREFIX "") 6 | set(CMAKE_C_COMPILER "gcc") 7 | set(CMAKE_CXX_COMPILER "g++") 8 | set(CMAKE_AR "ar") 9 | set(CMAKE_LINER "g++") 10 | set(CMAKE_LD "ld") 11 | add_compile_options(-std=c++11) 12 | 13 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 14 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 15 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 17 | -------------------------------------------------------------------------------- /cmake/host_mnn/host_mnn_toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR x86_64) 3 | set(CMAKE_CHIP_NAME host) 4 | 5 | set(CMAKE_CROSS_PREFIX "") 6 | set(CMAKE_C_COMPILER "gcc") 7 | set(CMAKE_CXX_COMPILER "g++") 8 | set(CMAKE_AR "ar") 9 | set(CMAKE_LINER "g++") 10 | set(CMAKE_LD "ld") 11 | add_compile_options(-std=c++11 -fPIC) 12 | 13 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 14 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 15 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 17 | -------------------------------------------------------------------------------- /cmake/host_mnn_windows/host_mnn_windows.cmake: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/cmake/host_mnn_windows/host_mnn_windows.cmake -------------------------------------------------------------------------------- /cmake/rv1126/rv1126_toolchain.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | set(CMAKE_CHIP_NAME rv1126) 4 | 5 | set(CMAKE_CROSS_PREFIX "/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf") 6 | set(CMAKE_C_COMPILER "/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc") 7 | set(CMAKE_CXX_COMPILER "/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++") 8 | set(CMAKE_AR /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar CACHE FILEPATH "Archiver") 9 | set(CMAKE_LINER "/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++") 10 | set(CMAKE_LD "/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld") 11 | #set(CMAKE_SYSROOT /home/cjyvm2/3516rootfs/rootfs) 12 | # This crosstool doesn't define SO_REUSEPORT 13 | add_compile_options(-Wno-unused-function -fPIC -O3) 14 | #add_compile_options(-std=c++11) 15 | # This chip provides the floating-point operation unit and NEON. 16 | # The libraries in the file system are compiled with hard floating point and neon compatible with the soft floating point call interface. 17 | #add_compile_options(-mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -fno-aggressive-loop-optimizations -funsafe-math-optimizations) 18 | 19 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 20 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 21 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 22 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 23 | -------------------------------------------------------------------------------- /demo/data/config/3ddfa.yaml: -------------------------------------------------------------------------------- 1 | alg_config: 2 | mean0: [127.5,127.5,127.5] 3 | std0: [0.0078125,0.0078125,0.0078125] 4 | output_names: [vertices] 5 | face_mean: face_mean.raw 6 | face_std: face_std.raw 7 | face_exp: face_exp.raw 8 | face_shp: face_shp.raw 9 | face_base: face_base.raw 10 | engine_config: 11 | model_path: ./3DDFA_sim.mnn -------------------------------------------------------------------------------- /demo/data/config/arcface.yaml: -------------------------------------------------------------------------------- 1 | alg_config: 2 | mean0: [127.5,127.5,127.5] 3 | std0: [0.0078125,0.0078125,0.0078125] 4 | output_names: [face_id] 5 | dims: 512 6 | engine_config: 7 | model_path: arcface_r18.mnn -------------------------------------------------------------------------------- /demo/data/config/centernet_head.yaml: -------------------------------------------------------------------------------- 1 | alg_config: 2 | mean0: [127.5,127.5,127.5] 3 | std0: [0.0078125,0.0078125,0.0078125] 4 | conf_thresh: 0.3 5 | out_stride: 4 6 | output_names: [hm, pool, wh, off] 7 | engine_config: 8 | model_path: ./centernet_head.mnn 9 | custom_hook: 10 | body_nms_hook: 11 | used_func: [after_alg_get_result] 12 | nms_thresh: 0.6 13 | small_thresh: 0.92 14 | height_thresh: 0.9 -------------------------------------------------------------------------------- /demo/data/config/config.yaml: -------------------------------------------------------------------------------- 1 | alg_config: 2 | topk: 100 3 | num_anchors: 3 4 | num_cls: 1 5 | conf_thresh: 0.5 6 | stride_num: 5 7 | mean0: [127.5,127.5,127.5] 8 | std0: [0.0078125,0.0078125,0.0078125] 9 | output_names: ["P3_bbox_reg", "P4_bbox_reg", "P5_bbox_reg","P6_bbox_reg","P7_bbox_reg","P3_logits","P4_logits","P5_logits","P6_logits","P7_logits"] 10 | engine_config: 11 | model_path: ./vfnet.wk 12 | engine_type: nnie 13 | engine_core: 0 14 | hisi_mmz_init: true 15 | custom_hook: 16 | body_nms_hook: 17 | used_func: [after_alg_get_result] 18 | nms_thresh: 0.3 19 | small_thresh: 0.92 20 | height_thresh: 0.9 21 | is_body: true -------------------------------------------------------------------------------- /demo/data/config/config_ttf.yaml: -------------------------------------------------------------------------------- 1 | alg_config: 2 | topk: 100 3 | num_anchors: 3 4 | num_cls: 1 5 | mean0: [127.5,127.5,127.5] 6 | std0: [0.0078125,0.0078125,0.0078125] 7 | output_names: ["hm", "wh"] 8 | engine_config: 9 | model_path: ./ttf_725_pre_br.rknn 10 | engine_type: npu 11 | engine_core: 0 12 | custom_hook: 13 | body_nms_hook: 14 | used_func: [after_alg_get_result] 15 | nms_thresh: 0.3 16 | small_thresh: 0.92 17 | height_thresh: 0.9 18 | is_body: true -------------------------------------------------------------------------------- /demo/data/config/retinanet_body.yaml: -------------------------------------------------------------------------------- 1 | alg_config: 2 | mean0: [127.5,127.5,127.5] 3 | std0: [0.0078125,0.0078125,0.0078125] 4 | conf_thresh: 0.6 5 | num_anchors: 2 6 | num_cls: 1 7 | stride_num: 5 8 | output_names: [logits_1, logits_2, logits_3, bboxes_1, bboxes_2, bboxes_3, landmaeks_1, landmaeks_2, landmaeks_3] 9 | engine_config: 10 | model_path: D:/ccode/deeplearning/inference/NceAlg/build/out/Debug/retinaface.mnn 11 | custom_hook: 12 | body_nms_hook: 13 | used_func: [after_alg_get_result] 14 | nms_thresh: 0.3 15 | small_thresh: 0.92 16 | height_thresh: 0.9 17 | is_body: true 18 | # reflection_filter_hook: 19 | # used_func: [after_alg_get_result, before_engine_inference] 20 | # mean_thresh: 10 21 | # var_thresh: 10 22 | # conf_thresh: 0.7 -------------------------------------------------------------------------------- /demo/data/config/vfnet_body.yaml: -------------------------------------------------------------------------------- 1 | alg_config: 2 | mean0: [127.5,127.5,127.5] 3 | std0: [0.0078125,0.0078125,0.0078125] 4 | conf_thresh: 0.5 5 | num_anchors: 3 6 | num_cls: 4 7 | stride_num: 5 8 | output_names: [P3_logits, P4_logits, P5_logits, P6_logits, P7_logits, P3_bbox_reg, P4_bbox_reg, P5_bbox_reg, P6_bbox_reg, P7_bbox_reg] 9 | engine_config: 10 | model_path: F:/VSproject/nce_alg/demo/data/model/mnn/vfnet_body.mnn 11 | custom_hook: 12 | body_nms_hook: 13 | used_func: [after_alg_get_result] 14 | nms_thresh: 0.3 15 | small_thresh: 0.92 16 | height_thresh: 0.9 17 | is_body: true 18 | reflection_filter_hook: 19 | used_func: [after_alg_get_result, before_engine_inference] 20 | mean_thresh: 10 21 | var_thresh: 10 22 | conf_thresh: 0.7 -------------------------------------------------------------------------------- /demo/data/config/yolox_body.yaml: -------------------------------------------------------------------------------- 1 | alg_config: 2 | mean0: [127.5,127.5,127.5] 3 | std0: [0.0078125,0.0078125,0.0078125] 4 | conf_thresh: 0.6 5 | output_names: [bbox_cls_1, bbox_cls_2, bbox_cls_3, bbox_reg_1, bbox_reg_2, bbox_reg_3, bbox_obj_1, bbox_obj_2, bbox_obj_3] 6 | stride_num: [8, 16, 32] 7 | engine_config: 8 | model_path: F:/VSproject/nce_alg/demo/data/model/mnn/yolox_body.mnn 9 | custom_hook: 10 | reflection_filter_hook: 11 | used_func: [after_alg_get_result, before_engine_inference] 12 | mean_thresh: 10 13 | var_thresh: 10 14 | conf_thresh: 0.7 15 | body_nms_hook: 16 | used_func: [after_alg_get_result] 17 | nms_thresh: 0.3 18 | small_thresh: 0.92 19 | height_thresh: 0.9 20 | is_body: true -------------------------------------------------------------------------------- /demo/data/config/yolox_head.yaml: -------------------------------------------------------------------------------- 1 | alg_config: 2 | mean0: [127.5,127.5,127.5] 3 | std0: [0.0078125,0.0078125,0.0078125] 4 | conf_thresh: 0.45 5 | output_names: [bbox_cls_1, bbox_reg_1, bbox_obj_1] 6 | stride_num: [4] 7 | engine_config: 8 | model_path: ./yolox_head.mnn 9 | custom_hook: 10 | body_nms_hook: 11 | used_func: [after_alg_get_result] 12 | nms_thresh: 0.6 13 | small_thresh: 0.92 14 | height_thresh: 0.9 -------------------------------------------------------------------------------- /demo/data/image/head_detect/70.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/demo/data/image/head_detect/70.jpg -------------------------------------------------------------------------------- /demo/data/image/head_detect/face.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/demo/data/image/head_detect/face.jpg -------------------------------------------------------------------------------- /demo/data/image/head_detect/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/demo/data/image/head_detect/test.jpg -------------------------------------------------------------------------------- /demo/data/model/mnn/3DDFA_sim.mnn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/demo/data/model/mnn/3DDFA_sim.mnn -------------------------------------------------------------------------------- /demo/data/model/mnn/centernet_lite.mnn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/demo/data/model/mnn/centernet_lite.mnn -------------------------------------------------------------------------------- /demo/data/model/mnn/retinaface.mnn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/demo/data/model/mnn/retinaface.mnn -------------------------------------------------------------------------------- /demo/data/model/rv_1126/ttf_725_pre_br.rknn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/demo/data/model/rv_1126/ttf_725_pre_br.rknn -------------------------------------------------------------------------------- /demo/data/model/rv_1126/ttf_725_pre_br_asu8.rknn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/demo/data/model/rv_1126/ttf_725_pre_br_asu8.rknn -------------------------------------------------------------------------------- /nce_alg/alg/alg_manager/3ddfa/tddfa.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-24 20:13:03 6 | * @LastEditors: Please set LastEditors 7 | * @LastEditTime: 2021-11-16 16:13:35 8 | */ 9 | #ifndef __TDDFA_HPP__ 10 | #define __TDDFA_HPP__ 11 | 12 | #include 13 | #include "alg_type.h" 14 | #include "IAlg.hpp" 15 | #include "linkedhashmap.h" 16 | #include "IEngine.hpp" 17 | #include 18 | #include 19 | #include "nce_tensor.hpp" 20 | #include "factory.hpp" 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | 24 | extern "C" { 25 | #endif 26 | #endif /* __cplusplus */ 27 | 28 | using namespace std; 29 | namespace nce_alg { 30 | 31 | class tddfa_priv 32 | { 33 | public: 34 | vector *input_tensor_infos; 35 | landmarks landmark_result; 36 | alg_result tmp_result; 37 | 38 | NCE_F32* param_mean; 39 | NCE_F32* param_std; 40 | NCE_F32* w_exp_base; 41 | NCE_F32* w_shp_base; 42 | NCE_F32* u_base; 43 | NCE_F32 trans_matrix[9]; 44 | NCE_F32 kpt[204]; 45 | tddfa_priv(); 46 | NCE_S32 read_face_model(string file_path, NCE_F32** buffer); 47 | ~tddfa_priv(); 48 | }; 49 | 50 | class tddfa : public IAlg, public NceCreator 51 | { 52 | public: 53 | 54 | NCE_S32 alg_init(vector & st_tensor_infos, 55 | LinkedHashMap &st_result_map, 56 | YAML::Node & config); 57 | 58 | NCE_S32 alg_cfg_set(const task_config_info &st_task_config_info); 59 | 60 | NCE_S32 alg_inference(vector &pc_img); 61 | 62 | NCE_S32 alg_get_result(alg_result_info &results, LinkedHashMap &st_result_map); 63 | 64 | NCE_S32 alg_destroy(); 65 | 66 | protected: 67 | shared_ptr pPriv; 68 | }; 69 | 70 | } // namespace nce_alg 71 | 72 | #ifdef __cplusplus 73 | #if __cplusplus 74 | } 75 | #endif 76 | #endif /* __cplusplus */ 77 | 78 | #endif /* __ENGINE_HISI3516_DV300_HPP__ */ 79 | -------------------------------------------------------------------------------- /nce_alg/alg/alg_manager/IAlg.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-20 10:32:17 6 | * @LastEditors: Please set LastEditors 7 | * @LastEditTime: 2021-11-16 17:44:02 8 | */ 9 | #ifndef __IALG_HPP__ 10 | #define __IALG_HPP__ 11 | 12 | #include 13 | #include 14 | #include "nce_tensor.hpp" 15 | #include "linkedhashmap.h" 16 | #include 17 | #include "yaml-cpp/yaml.h" 18 | #ifdef __cplusplus 19 | #if __cplusplus 20 | 21 | extern "C" { 22 | #endif 23 | #endif 24 | 25 | using namespace std; 26 | namespace nce_alg { 27 | class IAlg 28 | { 29 | public: 30 | virtual NCE_S32 alg_init(vector & st_tensor_infos, 31 | LinkedHashMap &st_result_map, 32 | YAML::Node & config) 33 | { 34 | return NCE_FAILED; 35 | } 36 | 37 | virtual NCE_S32 alg_cfg_set(const task_config_info &st_task_config_info) 38 | { 39 | return NCE_FAILED; 40 | } 41 | 42 | virtual NCE_S32 alg_inference(vector &pc_imgs) //后续改成图片预处理? 43 | { 44 | return NCE_FAILED; 45 | } 46 | 47 | virtual NCE_S32 alg_get_result(alg_result_info &results, LinkedHashMap &st_result_map) 48 | { 49 | return NCE_FAILED; 50 | } 51 | 52 | virtual NCE_S32 alg_destroy() 53 | { 54 | return NCE_FAILED; 55 | } 56 | 57 | virtual ~IAlg() 58 | {} 59 | }; 60 | } // namespace nce_alg 61 | 62 | #ifdef __cplusplus 63 | #if __cplusplus 64 | } 65 | #endif 66 | #endif /* __cplusplus */ 67 | 68 | #endif /* __ENGINE_HISI3516_DV300_HPP__ */ 69 | -------------------------------------------------------------------------------- /nce_alg/alg/alg_manager/arcface/arcface.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-24 20:13:03 6 | * @LastEditors: Please set LastEditors 7 | * @LastEditTime: 2021-11-16 16:13:35 8 | */ 9 | #ifndef __arcface_HPP__ 10 | #define __arcface_HPP__ 11 | 12 | #include 13 | #include "alg_type.h" 14 | #include "IAlg.hpp" 15 | #include "linkedhashmap.h" 16 | #include "IEngine.hpp" 17 | #include 18 | #include 19 | #include "nce_tensor.hpp" 20 | #include "factory.hpp" 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | 24 | extern "C" { 25 | #endif 26 | #endif /* __cplusplus */ 27 | 28 | using namespace std; 29 | namespace nce_alg { 30 | 31 | class arcface_priv 32 | { 33 | public: 34 | FaceID face_id; 35 | alg_result tmp_result; 36 | }; 37 | class arcface : public IAlg, public NceCreator 38 | { 39 | public: 40 | 41 | NCE_S32 alg_init(vector & st_tensor_infos, 42 | LinkedHashMap &st_result_map, 43 | YAML::Node & config); 44 | 45 | NCE_S32 alg_cfg_set(const task_config_info &st_task_config_info); 46 | 47 | NCE_S32 alg_inference(vector &pc_img); 48 | 49 | NCE_S32 alg_get_result(alg_result_info &results, LinkedHashMap &st_result_map); 50 | 51 | NCE_S32 alg_destroy(); 52 | 53 | private: 54 | shared_ptr pPriv; 55 | }; 56 | 57 | } 58 | 59 | #ifdef __cplusplus 60 | #if __cplusplus 61 | } 62 | #endif 63 | #endif /* __cplusplus */ 64 | 65 | #endif /* __ENGINE_HISI3516_DV300_HPP__ */ 66 | -------------------------------------------------------------------------------- /nce_alg/alg/alg_manager/centernet/centernet.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-24 20:13:03 6 | * @LastEditors: Please set LastEditors 7 | * @LastEditTime: 2021-11-16 16:14:38 8 | */ 9 | #ifndef __CENTERNET_HPP__ 10 | #define __CENTERNET_HPP__ 11 | 12 | #include 13 | #include "alg_type.h" 14 | #include "IAlg.hpp" 15 | #include "linkedhashmap.h" 16 | #include "IEngine.hpp" 17 | #include 18 | #include 19 | #include "nce_tensor.hpp" 20 | #include "factory.hpp" 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | 24 | extern "C" { 25 | #endif 26 | #endif 27 | 28 | using namespace std; 29 | namespace nce_alg { 30 | 31 | class centernet_priv 32 | { 33 | public: 34 | task_config_info alg_cfg; 35 | vector tmp_result; 36 | vector detect_results; 37 | vector *input_tensor_infos; 38 | NCE_U32 topk; 39 | NCE_U32 output_stride; 40 | centernet_priv(); 41 | 42 | ~centernet_priv(); 43 | 44 | NCE_S32 alg_priv_engine_init(); 45 | }; 46 | 47 | class centernet : public IAlg, public NceCreator 48 | { 49 | public: 50 | 51 | NCE_S32 alg_init(vector & st_tensor_infos, 52 | LinkedHashMap &st_result_map, 53 | YAML::Node & config); 54 | NCE_S32 alg_cfg_set(const task_config_info &st_task_config_info); 55 | 56 | NCE_S32 alg_inference(vector &pc_img); 57 | 58 | NCE_S32 alg_get_result(alg_result_info &results, LinkedHashMap &st_result_map); 59 | 60 | NCE_S32 alg_destroy(); 61 | 62 | protected: 63 | shared_ptr pPriv; 64 | }; 65 | 66 | } // namespace nce_alg 67 | 68 | #ifdef __cplusplus 69 | #if __cplusplus 70 | } 71 | #endif 72 | #endif /* __cplusplus */ 73 | 74 | #endif /* __ENGINE_HISI3516_DV300_HPP__ */ 75 | -------------------------------------------------------------------------------- /nce_alg/alg/alg_manager/face_fake/fc_fk_alg.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: your name 3 | * @Date: 2021-09-26 10:14:43 4 | * @LastEditTime: 2021-11-16 16:14:22 5 | * @LastEditors: your name 6 | * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE 7 | * @FilePath: \NceAlg\nce_alg\alg\alg_manager\face_fake\fc_fk_alg.hpp 8 | */ 9 | #ifndef __FC_FK_ALG_HPP__ 10 | #define __FC_FK_ALG_HPP__ 11 | #include 12 | #include "alg_type.h" 13 | #include "IAlg.hpp" 14 | #include 15 | #include "IEngine.hpp" 16 | #include 17 | #include 18 | #include "nce_tensor.hpp" 19 | #include "factory.hpp" 20 | #ifdef __cplusplus 21 | #if __cplusplus 22 | 23 | extern "C" { 24 | #endif 25 | #endif /* __cplusplus */ 26 | 27 | 28 | using namespace std; 29 | namespace nce_alg { 30 | 31 | class fc_fk_alg_priv 32 | { 33 | public: 34 | task_config_info alg_cfg; 35 | vector tmp_result; 36 | vector head_info; 37 | img_info * input_info; 38 | NCE_F32 * score; 39 | img_info model_image_info; 40 | 41 | fc_fk_alg_priv(); 42 | 43 | ~fc_fk_alg_priv(); 44 | 45 | NCE_S32 alg_priv_engine_init(); 46 | }; 47 | 48 | class fc_fk_alg : public IAlg, public NceCreator 49 | { 50 | public: 51 | 52 | NCE_S32 alg_init(vector & st_tensor_infos, 53 | LinkedHashMap &st_result_map, 54 | YAML::Node & config); 55 | NCE_S32 alg_cfg_set(const task_config_info &st_task_config_info); 56 | 57 | NCE_S32 alg_inference(img_t &pc_img); 58 | 59 | NCE_S32 alg_get_result(alg_result_info &results, map &st_result_map); 60 | 61 | NCE_S32 alg_destroy(); 62 | 63 | protected: 64 | shared_ptr pPriv; 65 | }; 66 | 67 | } // namespace nce_alg 68 | 69 | #ifdef __cplusplus 70 | #if __cplusplus 71 | } 72 | #endif 73 | #endif /* __cplusplus */ 74 | 75 | #endif /* __ENGINE_HISI3516_DV300_HPP__ */ 76 | -------------------------------------------------------------------------------- /nce_alg/alg/alg_manager/util/util.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: your name 3 | * @Date: 2021-12-02 10:56:06 4 | * @LastEditTime: 2021-12-06 15:23:24 5 | * @LastEditors: your name 6 | * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE 7 | * @FilePath: \NceAlg\nce_alg\alg\alg_manager\util\util.hpp 8 | */ 9 | #ifndef __UTIL_HPP__ 10 | #define __UTIL_HPP__ 11 | 12 | #include 13 | #include "alg_type.h" 14 | #include 15 | #include 16 | #include 17 | 18 | using namespace std; 19 | namespace nce_alg { 20 | NCE_S32 nms(vector input, vector &output, float threshold); 21 | NCE_S32 RB_REPLACE_PACKAGE(img_t &frame); 22 | NCE_S32 RB_REPLACE_PLANNER(img_t &frame); 23 | NCE_S32 softmax(NCE_U32 dim, NCE_F32 *score); 24 | NCE_S32 refelction_judge(const img_t & frame, 25 | alg_result_info &results, 26 | NCE_F32 conf_thresh, 27 | NCE_F32 mean_thresh, 28 | NCE_F32 var_thresh); 29 | 30 | template 31 | T get_yaml_default(const YAML::Node &config, std::string key, T value ) 32 | { 33 | auto sub_node = config[key]; 34 | bool is_defined = false; 35 | try 36 | { 37 | is_defined = sub_node.IsDefined(); 38 | } 39 | catch(...) 40 | { 41 | } 42 | if (!is_defined) 43 | { 44 | printf("%s is not defined! get default value\n", key.c_str()); 45 | return value; 46 | } 47 | return sub_node.as(); 48 | } 49 | } // namespace nce_alg 50 | 51 | #endif /* __ENGINE_HISI3516_DV300_HPP__ */ 52 | -------------------------------------------------------------------------------- /nce_alg/alg/alg_manager/vfnet/vfnet.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-24 20:13:03 6 | * @LastEditors: Please set LastEditors 7 | * @LastEditTime: 2021-11-16 16:13:35 8 | */ 9 | #ifndef __VFNET_HPP__ 10 | #define __VFNET_HPP__ 11 | 12 | #include 13 | #include "alg_type.h" 14 | #include "IAlg.hpp" 15 | #include "linkedhashmap.h" 16 | #include "IEngine.hpp" 17 | #include 18 | #include 19 | #include "nce_tensor.hpp" 20 | #include "factory.hpp" 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | 24 | extern "C" { 25 | #endif 26 | #endif /* __cplusplus */ 27 | 28 | using namespace std; 29 | namespace nce_alg { 30 | 31 | class vfnet_priv 32 | { 33 | public: 34 | task_config_info alg_cfg; 35 | vector *input_tensor_infos; 36 | vector detect_results; 37 | vector tmp_result; 38 | img_info model_image_info; 39 | NCE_U32 num_cls; 40 | NCE_U32 num_anchors; 41 | 42 | 43 | vfnet_priv(); 44 | 45 | ~vfnet_priv(); 46 | 47 | NCE_S32 alg_priv_engine_init(); 48 | }; 49 | 50 | class vfnet : public IAlg, public NceCreator 51 | { 52 | public: 53 | 54 | NCE_S32 alg_init(vector & st_tensor_infos, 55 | LinkedHashMap &st_result_map, 56 | YAML::Node & config); 57 | 58 | NCE_S32 alg_cfg_set(const task_config_info &st_task_config_info); 59 | 60 | NCE_S32 alg_inference(vector &pc_img); 61 | 62 | NCE_S32 alg_get_result(alg_result_info &results, LinkedHashMap &st_result_map); 63 | 64 | NCE_S32 alg_destroy(); 65 | 66 | protected: 67 | shared_ptr pPriv; 68 | }; 69 | 70 | } // namespace nce_alg 71 | 72 | #ifdef __cplusplus 73 | #if __cplusplus 74 | } 75 | #endif 76 | #endif /* __cplusplus */ 77 | 78 | #endif /* __ENGINE_HISI3516_DV300_HPP__ */ 79 | -------------------------------------------------------------------------------- /nce_alg/alg/core/nce_tensor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __nce_tensor_H__ 2 | #define __nce_tensor_H__ 3 | #include "alg_type.h" 4 | #include 5 | 6 | namespace nce_alg { 7 | typedef enum Tagfeattype 8 | { 9 | FEAT_S32, 10 | FEAT_F32, 11 | FEAT_MAX, 12 | } feattype; 13 | 14 | typedef struct tag_input_tensor_info 15 | { 16 | NCE_S32 width; 17 | NCE_S32 height; 18 | NCE_S32 channel; 19 | image_order order; 20 | image_format format; 21 | NCE_F32 std[3]; 22 | NCE_F32 mean[3]; 23 | std::string name; 24 | } input_tensor_info; 25 | typedef struct output_tensor 26 | { 27 | NCE_S32 height_stride; 28 | NCE_S32 width_stride; 29 | NCE_S32 channel_stride; 30 | NCE_S32 u32FeatWidth; 31 | NCE_S32 u32FeatHeight; 32 | NCE_S32 u32ch; 33 | NCE_S8 fl; /* fractional length . */ 34 | NCE_S32 zp; /* zero point. */ 35 | NCE_F32 scale; /* scale */ 36 | image_format outfmt; /* the data format of tensor. */ 37 | std::string name; 38 | 39 | } output_tensor; 40 | 41 | typedef struct tmp_map_result 42 | { 43 | NCE_S32 feat_type; 44 | NCE_S32 * pu32Feat; 45 | output_tensor tensor; 46 | } tmp_map_result; 47 | } // namespace nce_alg 48 | #endif 49 | -------------------------------------------------------------------------------- /nce_alg/alg/engine_manager/IEngine.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: your name 3 | * @Date: 2021-09-26 10:15:19 4 | * @LastEditTime: 2021-11-16 17:44:12 5 | * @LastEditors: Please set LastEditors 6 | * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE 7 | * @FilePath: \NceAlg\nce_alg\alg\engine_manager\IEngine.hpp 8 | */ 9 | #ifndef __IENGINE_HPP__ 10 | #define __IENGINE_HPP__ 11 | #include "linkedhashmap.h" 12 | #include "alg_type.h" 13 | #include "nce_tensor.hpp" 14 | #include 15 | #include "yaml-cpp/yaml.h" 16 | #include "util/util.hpp" 17 | #ifdef __cplusplus 18 | #if __cplusplus 19 | extern "C" { 20 | #endif 21 | #endif /* __cplusplus */ 22 | 23 | using namespace std; 24 | namespace nce_alg { 25 | 26 | class IEngine 27 | { 28 | public: 29 | virtual NCE_S32 engine_init(const YAML::Node & config, 30 | vector & st_img_infos, 31 | LinkedHashMap &st_result_map) 32 | { 33 | return NCE_FAILED; 34 | } 35 | 36 | virtual NCE_S32 engine_inference(vector &pc_imgs) 37 | { 38 | return NCE_FAILED; 39 | } 40 | virtual NCE_S32 engine_get_result(LinkedHashMap &st_engine_result) 41 | { 42 | return NCE_FAILED; 43 | } 44 | 45 | virtual NCE_S32 engine_destroy() 46 | { 47 | return NCE_FAILED; 48 | } 49 | 50 | virtual ~IEngine() 51 | {} 52 | }; 53 | } // namespace nce_alg 54 | 55 | #ifdef __cplusplus 56 | #if __cplusplus 57 | } 58 | #endif 59 | #endif /* __cplusplus */ 60 | #endif 61 | -------------------------------------------------------------------------------- /nce_alg/alg/engine_manager/MNN/MNN_backend.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-20 11:44:46 6 | * @LastEditors: Haochen Ye 7 | * @LastEditTime: 2021-09-06 17:02:46 8 | */ 9 | #ifndef __MNN_BACKEND_HPP__ 10 | #define __MNN_BACKEND_HPP__ 11 | 12 | #include 13 | #include 14 | #include "linkedhashmap.h" 15 | #include 16 | #include "factory.hpp" 17 | #include 18 | #ifdef __cplusplus 19 | #if __cplusplus 20 | 21 | using namespace std; 22 | extern "C" { 23 | #endif 24 | #endif /* __cplusplus */ 25 | 26 | namespace nce_alg { 27 | class MNN_engine : public IEngine, public NceCreator 28 | { 29 | public: 30 | MNN_engine(); 31 | 32 | NCE_S32 engine_init(const YAML::Node & config, 33 | vector & st_tensor_infos, 34 | LinkedHashMap &st_result_map); 35 | 36 | NCE_S32 engine_inference(vector &pc_imgs); 37 | 38 | NCE_S32 engine_get_result(LinkedHashMap &st_engine_result); 39 | 40 | NCE_S32 engine_destroy(); 41 | 42 | private: 43 | class engine_priv; 44 | shared_ptr pPriv; 45 | }; 46 | } // namespace nce_alg 47 | 48 | #ifdef __cplusplus 49 | #if __cplusplus 50 | } 51 | #endif 52 | #endif /* __cplusplus */ 53 | 54 | #endif /* __ENGINE_HISI_3516DV300_HPP__ */ 55 | -------------------------------------------------------------------------------- /nce_alg/alg/engine_manager/hisi_3516dv300/engine_hisi_3516dv300.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-20 10:32:17 6 | * @LastEditors: Haochen Ye 7 | * @LastEditTime: 2021-09-06 18:35:37 8 | */ 9 | #ifndef __ENGINE_HISI_3516DV300_HPP__ 10 | #define __ENGINE_HISI_3516DV300_HPP__ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "factory.hpp" 17 | #include "linkedhashmap.h" 18 | 19 | #ifdef __cplusplus 20 | #if __cplusplus 21 | 22 | using namespace std; 23 | extern "C" { 24 | #endif 25 | #endif /* __cplusplus */ 26 | 27 | namespace nce_alg { 28 | class hisi_3516dv300_engine : public IEngine, public NceCreator 29 | { 30 | public: 31 | hisi_3516dv300_engine(); 32 | 33 | NCE_S32 engine_init(const YAML::Node & config, 34 | vector & st_tensor_infos, 35 | LinkedHashMap &st_result_map); 36 | 37 | NCE_S32 engine_inference(vector &pc_img); 38 | 39 | NCE_S32 engine_get_result(LinkedHashMap &st_engine_result); 40 | 41 | NCE_S32 engine_destroy(); 42 | 43 | private: 44 | class engine_priv; 45 | shared_ptr pPriv; 46 | }; 47 | } // namespace nce_alg 48 | 49 | #ifdef __cplusplus 50 | #if __cplusplus 51 | } 52 | #endif 53 | #endif /* __cplusplus */ 54 | 55 | #endif /* __ENGINE_HISI_3516DV300_HPP__ */ 56 | -------------------------------------------------------------------------------- /nce_alg/alg/engine_manager/hisi_3559av100/engine_hisi_3559av100.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-20 10:32:17 6 | * @LastEditors: Please set LastEditors 7 | * @LastEditTime: 2021-10-23 10:56:05 8 | */ 9 | #ifndef __ENGINE_HISI_3559AV100_HPP__ 10 | #define __ENGINE_HISI_3559AV100_HPP__ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "factory.hpp" 17 | 18 | #ifdef __cplusplus 19 | #if __cplusplus 20 | 21 | using namespace std; 22 | extern "C" { 23 | #endif 24 | #endif /* __cplusplus */ 25 | 26 | namespace nce_alg { 27 | class hisi_3559av100_engine : public IEngine, public NceCreator 28 | { 29 | public: 30 | hisi_3559av100_engine(); 31 | 32 | NCE_S32 engine_init(const YAML::Node & config, 33 | vector & st_tensor_infos, 34 | LinkedHashMap &st_result_map); 35 | 36 | NCE_S32 engine_inference(vector &pc_img); 37 | 38 | NCE_S32 engine_get_result(LinkedHashMap &st_engine_result); 39 | 40 | NCE_S32 engine_destroy(); 41 | 42 | private: 43 | class engine_priv; 44 | shared_ptr pPriv; 45 | }; 46 | } // namespace nce_alg 47 | 48 | #ifdef __cplusplus 49 | #if __cplusplus 50 | } 51 | #endif 52 | #endif /* __cplusplus */ 53 | 54 | #endif /* __ENGINE_HISI_3516DV300_HPP__ */ 55 | -------------------------------------------------------------------------------- /nce_alg/alg/engine_manager/host/host_engine.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __HOST_ENGINE_HPP__ 2 | #define __HOST_ENGINE_HPP__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #ifdef __cplusplus 10 | #if __cplusplus 11 | 12 | using namespace std; 13 | extern "C" { 14 | #endif 15 | #endif /* __cplusplus */ 16 | 17 | namespace nce_alg { 18 | class host_engine : public IEngine 19 | { 20 | public: 21 | NCE_S32 engine_init(const YAML::Node config, img_info &st_img_info, map &st_result_map) 22 | { 23 | return NCE_SUCCESS; 24 | }; 25 | 26 | NCE_S32 engine_inference(img_t &pc_img) 27 | { 28 | return NCE_SUCCESS; 29 | }; 30 | 31 | NCE_S32 engine_get_result(map &st_engine_result) 32 | { 33 | return NCE_SUCCESS; 34 | }; 35 | 36 | NCE_S32 engine_destroy() 37 | { 38 | return NCE_SUCCESS; 39 | }; 40 | }; 41 | } // namespace nce_alg 42 | 43 | #ifdef __cplusplus 44 | #if __cplusplus 45 | } 46 | #endif 47 | #endif /* __cplusplus */ 48 | 49 | #endif /* __HOST_ENGINE_HPP__ */ 50 | -------------------------------------------------------------------------------- /nce_alg/alg/engine_manager/openvino_backend/openvino_backend.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __OPENVINO_BACKEND_HPP__ 2 | #define __OPENVINO_BACKEND_HPP__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "factory.hpp" 9 | 10 | #ifdef __cplusplus 11 | #if __cplusplus 12 | 13 | using namespace std; 14 | extern "C" { 15 | #endif 16 | #endif /* __cplusplus */ 17 | 18 | namespace nce_alg { 19 | class openvino_engine : public IEngine, public NceEngineCreator 20 | { 21 | public: 22 | NCE_S32 engine_init(const YAML::Node & config, 23 | vector & st_tensor_infos, 24 | LinkedHashMap &st_result_map); 25 | 26 | NCE_S32 engine_inference(img_t &pc_img); 27 | 28 | NCE_S32 engine_get_result(map &st_engine_result); 29 | 30 | NCE_S32 engine_destroy(); 31 | 32 | private: 33 | class engine_priv; 34 | 35 | shared_ptr pPriv; 36 | }; 37 | } // namespace nce_alg 38 | 39 | #ifdef __cplusplus 40 | #if __cplusplus 41 | } 42 | #endif 43 | #endif /* __cplusplus */ 44 | 45 | #endif /* __ENGINE_HISI3516_DV300_HPP__ */ 46 | -------------------------------------------------------------------------------- /nce_alg/alg/engine_manager/rv1126/rv1126_engine.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: your name 3 | * @Date: 2021-09-26 10:15:19 4 | * @LastEditTime: 2021-11-19 17:27:16 5 | * @LastEditors: your name 6 | * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE 7 | * @FilePath: \NceAlg\nce_alg\alg\engine_manager\rv1126\rv1126_engine.hpp 8 | */ 9 | #ifndef __ENGINE_HISI_3516DV300_HPP__ 10 | #define __ENGINE_HISI_3516DV300_HPP__ 11 | 12 | #include 13 | #include 14 | #include "factory.hpp" 15 | #include "linkedhashmap.h" 16 | #include 17 | 18 | #ifdef __cplusplus 19 | #if __cplusplus 20 | 21 | using namespace std; 22 | extern "C" { 23 | #endif 24 | #endif /* __cplusplus */ 25 | 26 | namespace nce_alg { 27 | class rv1126_engine : public IEngine, public NceCreator 28 | { 29 | public: 30 | rv1126_engine(); 31 | 32 | NCE_S32 engine_init(const YAML::Node & config, 33 | vector & st_tensor_infos, 34 | LinkedHashMap &st_result_map); 35 | 36 | NCE_S32 engine_inference(vector &pc_imgs); 37 | 38 | NCE_S32 engine_get_result(LinkedHashMap &st_engine_result); 39 | 40 | NCE_S32 engine_destroy(); 41 | 42 | private: 43 | class engine_priv; 44 | shared_ptr pPriv; 45 | }; 46 | } // namespace nce_alg 47 | 48 | #ifdef __cplusplus 49 | #if __cplusplus 50 | } 51 | #endif 52 | #endif /* __cplusplus */ 53 | 54 | #endif /* __ENGINE_HISI_3516DV300_HPP__ */ 55 | -------------------------------------------------------------------------------- /nce_alg/alg/engine_manager/rv1126/rv1126_tool.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: your name 3 | * @Date: 2021-10-18 10:57:52 4 | * @LastEditTime: 2021-10-18 10:57:52 5 | * @LastEditors: Please set LastEditors 6 | * @Description: In User Settings Edit 7 | * @FilePath: \NceAlg\nce_alg\alg\engine_manager\rv1126\rv1126_tool.hpp 8 | */ 9 | #ifndef __DRM_FUNC_H__ 10 | #define __DRM_FUNC_H__ 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include // open function 16 | #include // close function 17 | #include 18 | #include 19 | 20 | 21 | #include 22 | #include "drm_fourcc.h" 23 | #include "xf86drm.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef int (* FUNC_DRM_IOCTL)(int fd, unsigned long request, void *arg); 30 | 31 | typedef struct _drm_context{ 32 | void *drm_handle; 33 | FUNC_DRM_IOCTL io_func; 34 | } drm_context; 35 | 36 | /* memory type definitions. */ 37 | enum drm_rockchip_gem_mem_type 38 | { 39 | /* Physically Continuous memory and used as default. */ 40 | ROCKCHIP_BO_CONTIG = 1 << 0, 41 | /* cachable mapping. */ 42 | ROCKCHIP_BO_CACHABLE = 1 << 1, 43 | /* write-combine mapping. */ 44 | ROCKCHIP_BO_WC = 1 << 2, 45 | ROCKCHIP_BO_SECURE = 1 << 3, 46 | ROCKCHIP_BO_MASK = ROCKCHIP_BO_CONTIG | ROCKCHIP_BO_CACHABLE | 47 | ROCKCHIP_BO_WC | ROCKCHIP_BO_SECURE 48 | }; 49 | 50 | int drm_init(drm_context *drm_ctx); 51 | 52 | void* drm_buf_alloc(drm_context *drm_ctx,int drm_fd, int TexWidth, int TexHeight,int bpp,int *fd,unsigned int *handle,size_t *actual_size); 53 | 54 | int drm_buf_destroy(drm_context *drm_ctx,int drm_fd,int buf_fd, int handle,void *drm_buf,size_t size); 55 | 56 | void drm_deinit(drm_context *drm_ctx, int drm_fd); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | #endif /*__DRM_FUNC_H__*/ -------------------------------------------------------------------------------- /nce_alg/alg/hook_manager/keep_upper_bbox/keep_upper_bbox.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-20 10:32:17 6 | * @LastEditors: Haochen Ye 7 | * @LastEditTime: 2021-09-06 18:35:37 8 | */ 9 | #ifndef __KEEP_UPPER_BBOX_HPP__ 10 | #define __KEEP_UPPER_BBOX_HPP__ 11 | 12 | #include 13 | #include "hook.hpp" 14 | #include 15 | #include 16 | #include "factory.hpp" 17 | #include "linkedhashmap.h" 18 | 19 | #ifdef __cplusplus 20 | #if __cplusplus 21 | 22 | using namespace std; 23 | extern "C" { 24 | #endif 25 | #endif /* __cplusplus */ 26 | 27 | namespace nce_alg { 28 | class keep_upper_bbox : public Hook, public NceCreator 29 | { 30 | public: 31 | keep_upper_bbox(); 32 | 33 | NCE_S32 hook_init(YAML::Node &config); 34 | 35 | NCE_S32 after_alg_get_result(alg_result_info &results, LinkedHashMap &st_result_map); 36 | 37 | NCE_S32 before_engine_inference(vector &pc_imgs); 38 | 39 | private: 40 | YAML::Node *pconfig; 41 | NCE_S32 keep_max; 42 | NCE_S32 img_width; 43 | NCE_S32 img_heigth; 44 | }; 45 | } // namespace nce_alg 46 | 47 | #ifdef __cplusplus 48 | #if __cplusplus 49 | } 50 | #endif 51 | #endif /* __cplusplus */ 52 | 53 | #endif /* __ENGINE_HISI_3516DV300_HPP__ */ 54 | -------------------------------------------------------------------------------- /nce_alg/alg/hook_manager/nms_hook/body_nms_hook.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-20 10:32:17 6 | * @LastEditors: Haochen Ye 7 | * @LastEditTime: 2021-09-06 18:35:37 8 | */ 9 | #ifndef __BODY_NMS_HOOK_HPP__ 10 | #define __BODY_NMS_HOOK_HPP__ 11 | 12 | #include 13 | #include "hook.hpp" 14 | #include 15 | #include 16 | #include "factory.hpp" 17 | #include "linkedhashmap.h" 18 | #ifdef __cplusplus 19 | #if __cplusplus 20 | 21 | using namespace std; 22 | extern "C" { 23 | #endif 24 | #endif /* __cplusplus */ 25 | 26 | namespace nce_alg { 27 | class body_nms_hook : public Hook, public NceCreator 28 | { 29 | 30 | public: 31 | body_nms_hook(); 32 | 33 | NCE_S32 hook_init(YAML::Node &config); 34 | 35 | NCE_S32 after_alg_get_result(alg_result_info &results, LinkedHashMap &st_result_map); 36 | 37 | bool _is_overlap(detect_result &bbox1, detect_result &bbox2); 38 | 39 | private: 40 | NCE_F32 nms_thresh; 41 | NCE_F32 small_thresh; 42 | NCE_F32 height_thresh; 43 | bool is_body; 44 | YAML::Node *pconfig; 45 | }; 46 | } // namespace nce_alg 47 | 48 | #ifdef __cplusplus 49 | #if __cplusplus 50 | } 51 | #endif 52 | #endif /* __cplusplus */ 53 | 54 | #endif /* __ENGINE_HISI_3516DV300_HPP__ */ 55 | -------------------------------------------------------------------------------- /nce_alg/alg/hook_manager/reflection_filter_hook/reflection_filter_hook.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Descripttion: 3 | * @version: 4 | * @Author: Haochen Ye 5 | * @Date: 2021-08-20 10:32:17 6 | * @LastEditors: Please set LastEditors 7 | * @LastEditTime: 2022-01-20 19:48:03 8 | */ 9 | #ifndef __REFLECTION_FILTER_HOOK_HPP__ 10 | #define __REFLECTION_FILTER_HOOK_HPP__ 11 | 12 | #include 13 | #include "hook.hpp" 14 | #include 15 | #include 16 | #include "factory.hpp" 17 | #include "linkedhashmap.h" 18 | #ifdef __cplusplus 19 | #if __cplusplus 20 | 21 | using namespace std; 22 | extern "C" { 23 | #endif 24 | #endif /* __cplusplus */ 25 | 26 | namespace nce_alg { 27 | class reflection_filter_hook : public Hook, public NceCreator 28 | { 29 | public: 30 | reflection_filter_hook(); 31 | 32 | NCE_S32 hook_init(YAML::Node &config); 33 | 34 | NCE_S32 before_engine_inference(vector &pc_imgs); 35 | 36 | NCE_S32 after_alg_get_result(alg_result_info &results, LinkedHashMap &st_result_map); 37 | 38 | private: 39 | NCE_F32 mean_thresh; 40 | NCE_F32 var_thresh; 41 | NCE_F32 conf_thresh; 42 | //todo async for pingpongbuffer 43 | img_t pcur_img; 44 | YAML::Node *pconfig; 45 | }; 46 | } // namespace nce_alg 47 | 48 | #ifdef __cplusplus 49 | #if __cplusplus 50 | } 51 | #endif 52 | #endif /* __cplusplus */ 53 | 54 | #endif /* __ENGINE_HISI_3516DV300_HPP__ */ 55 | -------------------------------------------------------------------------------- /nce_alg/alg/hook_manager/softmax_hook/softmax_hook.cpp: -------------------------------------------------------------------------------- 1 | #include "softmax_hook/softmax_hook.hpp" 2 | #include "util/util.hpp" 3 | 4 | namespace nce_alg { 5 | softmax_hook::softmax_hook() : pconfig(nullptr), pcur_img(nullptr) 6 | { 7 | printf("Softmax_hook \n"); 8 | } 9 | 10 | NCE_S32 softmax_hook::hook_init(YAML::Node &config) 11 | { 12 | printf("No parameters are required for softmax_hook \n"); 13 | pconfig = &config; 14 | return NCE_SUCCESS; 15 | } 16 | 17 | NCE_S32 softmax_hook::after_alg_get_result(alg_result_info & results, 18 | LinkedHashMap &st_result_map) 19 | { 20 | auto rec_result = (humanbody_reco *)(results.st_alg_results->obj); 21 | auto score = rec_result->score; 22 | auto dim = rec_result->dim; 23 | softmax(dim, score); 24 | NCE_S32 target_idx = 0; 25 | NCE_F32 max_num = 0; 26 | 27 | for (NCE_S32 i = 0; i < dim; i++) 28 | { 29 | if (score[i] > max_num) 30 | { 31 | max_num = score[i]; 32 | target_idx = i; 33 | } 34 | } 35 | 36 | rec_result->label = target_idx; 37 | return NCE_SUCCESS; 38 | } 39 | 40 | NCE_S32 softmax_hook::before_engine_inference(vector &pc_imgs) 41 | { 42 | pcur_img = &pc_imgs[0]; 43 | return NCE_SUCCESS; 44 | } 45 | } // namespace nce_alg -------------------------------------------------------------------------------- /nce_alg/alg/hook_manager/softmax_hook/softmax_hook.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * @Descripttion: 4 | * @version: 5 | * @Author: Zirui Wang 6 | * @Date: 2021-08-20 10:32:17 7 | * @LastEditors: Haochen Ye 8 | * @LastEditTime: 2021-09-06 18:35:37 9 | */ 10 | #ifndef __SOFTMAX_HOOK_HPP__ 11 | #define __SOFTMAX_HOOK_HPP__ 12 | 13 | #include 14 | #include "hook.hpp" 15 | #include 16 | #include 17 | #include "factory.hpp" 18 | #include "linkedhashmap.h" 19 | #ifdef __cplusplus 20 | #if __cplusplus 21 | 22 | using namespace std; 23 | extern "C" { 24 | #endif 25 | #endif /* __cplusplus */ 26 | 27 | namespace nce_alg { 28 | class softmax_hook : public Hook, public NceCreator 29 | { 30 | public: 31 | softmax_hook(); 32 | 33 | NCE_S32 hook_init(YAML::Node &config); 34 | 35 | NCE_S32 before_engine_inference(vector &pc_imgs); 36 | 37 | NCE_S32 after_alg_get_result(alg_result_info &results, LinkedHashMap &st_result_map); 38 | 39 | private: 40 | img_t * pcur_img; 41 | YAML::Node *pconfig; 42 | }; 43 | } // namespace nce_alg 44 | 45 | #ifdef __cplusplus 46 | #if __cplusplus 47 | } 48 | #endif 49 | #endif /* __cplusplus */ 50 | 51 | #endif /* __ENGINE_HISI_3516DV300_HPP__ */ 52 | -------------------------------------------------------------------------------- /nce_alg/include/nce_alg.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: your name 3 | * @Date: 2021-09-26 10:15:19 4 | * @LastEditTime: 2021-11-16 13:26:50 5 | * @LastEditors: Please set LastEditors 6 | * @Description: In User Settings Edit 7 | * @FilePath: \NceAlg\nce_alg\include\nce_alg.hpp 8 | */ 9 | #ifndef __NCE_ALG_HPP__ 10 | #define __NCE_ALG_HPP__ 11 | #include "alg_type.h" 12 | #include "common.h" 13 | #include 14 | #include 15 | #ifdef __cplusplus 16 | #if __cplusplus 17 | 18 | extern "C" { 19 | #endif 20 | #endif /* __cplusplus */ 21 | 22 | using namespace std; 23 | namespace nce_alg { 24 | class nce_alg_machine 25 | { 26 | public: 27 | NCE_PUBLIC nce_alg_machine(taskcls alg_type, const platform engine_type); 28 | 29 | NCE_S32 NCE_PUBLIC nce_alg_init(const char *yaml_cfg_path, vector &st_img_infos); 30 | 31 | NCE_S32 NCE_PUBLIC nce_alg_cfg_set(const task_config_info &st_task_config_info); 32 | 33 | NCE_S32 NCE_PUBLIC nce_alg_inference(vector &pc_imgs); 34 | 35 | NCE_S32 NCE_PUBLIC nce_alg_get_result(alg_result_info &results); 36 | 37 | NCE_S32 NCE_PUBLIC nce_alg_process_set(std::vector &pre_proc_cfg); 38 | 39 | NCE_S32 NCE_PUBLIC nce_alg_destroy(); 40 | 41 | private: 42 | class dynamic_factory; 43 | shared_ptr pPriv; 44 | }; 45 | } // namespace nce_alg 46 | 47 | #ifdef __cplusplus 48 | #if __cplusplus 49 | } 50 | #endif 51 | #endif /* __cplusplus */ 52 | 53 | #endif /* __ENGINE_HISI3516_DV300_HPP__ */ -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/audio/audio_dl_adp.h: -------------------------------------------------------------------------------- 1 | #ifndef __AUDIO_DL_ADP_H__ 2 | #define __AUDIO_DL_ADP_H__ 3 | 4 | #include "hi_type.h" 5 | 6 | HI_S32 Audio_Dlpath(HI_CHAR* pChLibPath); 7 | 8 | HI_S32 Audio_Dlopen(HI_VOID** pLibhandle, HI_CHAR* pChLibName); 9 | 10 | HI_S32 Audio_Dlsym(HI_VOID** pFunchandle, HI_VOID* Libhandle, HI_CHAR* pChFuncName); 11 | 12 | HI_S32 Audio_Dlclose(HI_VOID* Libhandle); 13 | 14 | #endif -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/common_sys/rp-lcd-mipi-7inch-1024x600.h: -------------------------------------------------------------------------------- 1 | #ifndef __RP_LCD_MIPI_7INCH_1024X600_H__ 2 | #define __RP_LCD_MIPI_7INCH_1024X600_H__ 3 | #include "sample_comm.h" 4 | #include "hi_mipi_tx.h" 5 | /*============================= mipi 7 inch 1024x600 lcd config ====================================*/ 6 | combo_dev_cfg_t MIPI_TX_7INCH_1024X600_60_CONFIG = 7 | { 8 | .devno = 0, 9 | .lane_id = {0, 1, 2, 3}, 10 | .output_mode = OUTPUT_MODE_DSI_VIDEO, 11 | .output_format = OUT_FORMAT_RGB_24_BIT, 12 | .video_mode = BURST_MODE, 13 | 14 | .sync_info = { 15 | .vid_pkt_size = 1024, // hact 16 | .vid_hsa_pixels = 4, // hsa //20 17 | .vid_hbp_pixels = 60, // hbp //20 18 | .vid_hline_pixels = 1224, // hact + hsa + hbp + hfp //hfb=32 //972 19 | .vid_vsa_lines = 2, // vsa 20 | .vid_vbp_lines = 16, // vbp 21 | .vid_vfp_lines = 16, // vfp 22 | .vid_active_lines = 634,// vact 23 | .edpi_cmd_size = 0, 24 | }, 25 | 26 | .phy_data_rate = 495, 27 | .pixel_clk = 46561, 28 | }; 29 | 30 | VO_SYNC_INFO_S MIPI_TX_7INCH_1024X600_60_SYNC_INFO = 31 | { 32 | .u16Hact = 1024, 33 | .u16Hbb = 64, 34 | .u16Hfb = 136, 35 | .u16Hpw = 4, 36 | .u16Vact = 600, 37 | .u16Vbb = 18, 38 | .u16Vfb = 16, 39 | .u16Vpw = 2, 40 | }; 41 | 42 | VO_USER_INTFSYNC_INFO_S MIPI_TX_7INCH_1024X600_60_USER_INTFSYNC_INFO = 43 | { 44 | .stUserIntfSyncAttr = 45 | { 46 | .stUserSyncPll = 47 | { 48 | .u32Fbdiv = 380, 49 | .u32Frac = 0x3f7271, 50 | .u32Refdiv = 4, 51 | .u32Postdiv1= 7, 52 | .u32Postdiv2= 7, 53 | }, 54 | }, 55 | 56 | .u32DevDiv = 1, 57 | .u32PreDiv = 1, 58 | }; 59 | 60 | lcd_resoluton_t MIPI_TX_7INCH_1024X600_60_LCD_RESOLUTION = 61 | { 62 | .pu32W = 1024, 63 | .pu32H = 600, 64 | .pu32Frm= 60, 65 | 66 | }; 67 | 68 | 69 | HI_VOID InitScreen_mipi_7inch_1024x600(HI_S32 s32fd) 70 | { 71 | 72 | SAMPLE_PRT("%s,%d.\n",__FUNCTION__,__LINE__); 73 | usleep(1000); 74 | 75 | } 76 | 77 | #endif /* End of #ifndef __RP_LCD_MIPI_7INCH_1024X600_H__ */ 78 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/hisi3516dv300.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Os") 4 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Os") 5 | SET(HISI_4096 4096.f) 6 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/common/) 7 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/common_sys/) 8 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/sample_nnie_software/) 9 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/include/) 10 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/rtsp-v2/) 11 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/audio/) 12 | 13 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/alg/engine_manager/hisi_3516dv300/ ENGINE_3516DV300_SRC) 14 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/sample_nnie_software/ NNIE_SRC) 15 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/common/ COMMON_SRC) 16 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/common_sys/ COMMON_SYS_SRC) 17 | 18 | #设置hisi3516dv300所需源文件 19 | set(PLATFORM_SRC 20 | ${ENGINE_3516DV300_SRC} 21 | ${NNIE_SRC} 22 | ${COMMON_SRC}) 23 | 24 | #设置hisi3516dv300所需库文件 25 | set(PLATFORM_LIB 26 | -ldnvqe 27 | -lVoiceEngine 28 | -live 29 | -lmd 30 | -lnnie 31 | -lmpi 32 | -lupvqe 33 | -lsecurec 34 | -ldl 35 | -lpthread 36 | -lm 37 | ) 38 | 39 | link_directories(${PROJECT_SOURCE_DIR}/platform/hisi3516dv300/lib) 40 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/hi_af_comm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_af_comm.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/20 10 | Description : 11 | History : 12 | 1.Date : 2012/12/20 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __HI_AF_COMM_H__ 18 | #define __HI_AF_COMM_H__ 19 | 20 | #include "hi_type.h" 21 | 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C" { 25 | #endif 26 | #endif /* End of #ifdef __cplusplus */ 27 | 28 | #define HI_AF_LIB_NAME "hisi_af_lib" 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/hi_comm_ai.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ai.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AI_H__ 19 | #define __HI_COMM_AI_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | #ifdef __cplusplus 30 | #if __cplusplus 31 | } 32 | #endif 33 | #endif /* End of #ifdef __cplusplus */ 34 | 35 | #endif /* End of #ifndef __HI_COMM_AI_H__ */ 36 | 37 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/hi_comm_ao.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ao.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AO_H__ 19 | #define __HI_COMM_AO_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif /* End of #ifndef __HI_COMM_AO_H__ */ 37 | 38 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/hi_i2c.h: -------------------------------------------------------------------------------- 1 | #ifndef _HI_I2C_H 2 | #define _HI_I2C_H 3 | 4 | 5 | 6 | /* /dev/i2c-X ioctl commands. The ioctl's parameter is always an 7 | * unsigned long, except for: 8 | * - I2C_FUNCS, takes pointer to an unsigned long 9 | * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data 10 | * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data 11 | */ 12 | #define I2C_RETRIES 0x0701 /* number of times a device address should 13 | be polled when not acknowledging */ 14 | #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ 15 | 16 | /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses 17 | * are NOT supported! (due to code brokenness) 18 | */ 19 | #define I2C_SLAVE 0x0703 /* Use this slave address */ 20 | #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it 21 | is already in use by a driver! */ 22 | #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ 23 | 24 | #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ 25 | 26 | #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ 27 | 28 | #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ 29 | #define I2C_SMBUS 0x0720 /* SMBus transfer */ 30 | #define I2C_16BIT_REG 0x0709 /* 16BIT REG WIDTH */ 31 | #define I2C_16BIT_DATA 0x070a /* 16BIT DATA WIDTH */ 32 | 33 | typedef struct hiI2C_DATA_S 34 | { 35 | unsigned char dev_addr; 36 | unsigned int reg_addr; 37 | unsigned int addr_byte_num; 38 | unsigned int data; 39 | unsigned int data_byte_num; 40 | }I2C_DATA_S; 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/hi_isp_bin.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_isp_bin.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2015/01/14 10 | Description : 11 | History : 12 | 1.Date : 2015/01/14 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __HI_ISP_BIN_H__ 19 | #define __HI_ISP_BIN_H__ 20 | 21 | #include "hi_type.h" 22 | #include "hi_comm_isp.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C" { 27 | #endif 28 | #endif /* End of #ifdef __cplusplus */ 29 | 30 | /**************************************************************************** 31 | * MACRO DEFINITION * 32 | ****************************************************************************/ 33 | #define MAX_BIN_REG_NUM 5 34 | 35 | /**************************************************************************** 36 | * GENERAL STRUCTURES * 37 | ****************************************************************************/ 38 | typedef struct hiISP_BIN_REG_ATTR_S 39 | { 40 | HI_U32 u32Addr; /* register addr */ 41 | HI_U8 u8StartBit; /* start bit of register addr */ 42 | HI_U8 u8EndBit; /* end bit of register addr */ 43 | } ISP_BIN_REG_ATTR_S; 44 | 45 | /*-------------------------------------------* 46 | The base addr of ISP logic register 47 | The base addr of ISP ext register 48 | The base addr of Hisi AE ext register 49 | The base addr of Hisi AWB ext register 50 | *-------------------------------------------*/ 51 | 52 | ISP_BIN_REG_ATTR_S g_astIspBinRegAttr[ISP_MAX_PIPE_NUM][MAX_BIN_REG_NUM] = 53 | { 54 | [0 ... (ISP_MAX_PIPE_NUM - 1)] = {0} 55 | }; 56 | 57 | 58 | #ifdef __cplusplus 59 | #if __cplusplus 60 | } 61 | #endif 62 | #endif /* End of #ifdef __cplusplus */ 63 | 64 | #endif /*__HI_ISP_BIN_H__ */ 65 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/hi_isp_debug.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_isp_debug.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2010/08/30 10 | Description : 11 | History : 12 | 1.Date : 2010/08/30 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __HI_ISP_DEBUG_H__ 19 | #define __HI_ISP_DEBUG_H__ 20 | 21 | #include "hi_debug.h" 22 | 23 | #if 0 24 | #define PRINT_DEBUG_INFO 25 | #endif 26 | 27 | #if 0 28 | #define PRINT_INFO_2FILE 29 | #endif 30 | 31 | #define ISP_TRACE(level, fmt, ...)\ 32 | do{ \ 33 | HI_TRACE(level, HI_ID_ISP,"[Func]:%s [Line]:%d [Info]:"fmt,__FUNCTION__, __LINE__,##__VA_ARGS__);\ 34 | }while(0) 35 | 36 | /* To avoid divide-0 exception in code. */ 37 | #define DIV_0_TO_1(a) ( (0 == (a)) ? 1 : (a) ) 38 | #define DIV_0_TO_1_FLOAT(a) ((((a) < 1E-10) && ((a) > -1E-10)) ? 1 : (a)) 39 | 40 | #endif /* __HI_ISP_DEBUG_H__ */ 41 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/hi_md.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2015, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_md.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software (IVE) group 9 | Created : 2014/11/10 10 | Description : 11 | History : 12 | 1.Date : 2014/11/10 13 | Author : 14 | Modification: Created file 15 | 2.Date : 2015/11/24 16 | Author : 17 | Modification: Modify MD_ATTR_S 18 | ******************************************************************************/ 19 | #ifndef _HI_MD_H_ 20 | #define _HI_MD_H_ 21 | 22 | #include "hi_ive.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C"{ 27 | #endif 28 | #endif 29 | /* 30 | * Definition md algorithm mode 31 | */ 32 | typedef enum hiMD_ALG_MODE_E 33 | { 34 | MD_ALG_MODE_BG = 0x0,/*Base on background image*/ 35 | MD_ALG_MODE_REF = 0x1,/*Base on reference image*/ 36 | 37 | MD_ALG_MODE_BUTT 38 | }MD_ALG_MODE_E; 39 | /* 40 | * Definition of md attribute 41 | */ 42 | typedef struct hiMD_ATTR_S 43 | { 44 | MD_ALG_MODE_E enAlgMode; /*Md algorithm mode*/ 45 | IVE_SAD_MODE_E enSadMode; /*Sad mode*/ 46 | IVE_SAD_OUT_CTRL_E enSadOutCtrl; /*Sad output ctrl*/ 47 | HI_U32 u32Width; /*Image width*/ 48 | HI_U32 u32Height; /*Image height*/ 49 | HI_U16 u16SadThr; /*Sad thresh*/ 50 | IVE_CCL_CTRL_S stCclCtrl; /*Ccl ctrl*/ 51 | IVE_ADD_CTRL_S stAddCtrl; /*Add ctrl*/ 52 | }MD_ATTR_S; 53 | 54 | #ifdef __cplusplus 55 | #if __cplusplus 56 | } 57 | #endif 58 | #endif 59 | 60 | #endif/*_HI_MD_H_*/ -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/hi_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef __HI_PLUGIN_TYPE_H__ 2 | #define __HI_PLUGIN_TYPE_H__ 3 | 4 | #include "hi_type.h" 5 | 6 | #if defined(_MSC_VER) 7 | #define EXPORT __declspec(dllexport) 8 | #elif defined(__GNUC__) 9 | #define EXPORT __attribute__((visibility("default"))) 10 | #else 11 | #define EXPORT 12 | #pragma warning cant export dynamic symbos 13 | #endif 14 | 15 | #ifdef __cplusplus 16 | #if __cplusplus 17 | extern "C" { 18 | #endif 19 | #endif /* __cplusplus */ 20 | 21 | #define MAX_OPERAND_NAME_LEN (64) 22 | 23 | typedef struct hiNodePlugin_Shape_S 24 | { 25 | HI_S32 s32H; 26 | HI_S32 s32W; 27 | HI_S32 s32C; 28 | } HI_NodePlugin_Shape_S; 29 | 30 | typedef enum hiNodePlugin_ElemType_E 31 | { 32 | ELEM_TYPE_U8, 33 | ELEM_TYPE_U16, 34 | ELEM_TYPE_U32 35 | } HI_NodePlugin_ElemType_E; 36 | 37 | typedef struct hiNodePlugin_Operand_S 38 | { 39 | HI_U64 u64Offset; // addr 40 | HI_CHAR mName[MAX_OPERAND_NAME_LEN + 1]; 41 | HI_NodePlugin_ElemType_E enElemType; 42 | HI_U32 u32Num; 43 | HI_U32 u32Stride; 44 | HI_NodePlugin_Shape_S stShape; 45 | } HI_NodePlugin_Operand_S; 46 | 47 | typedef struct HiNodeParam 48 | { 49 | HI_VOID* pParam; 50 | HI_U32 u32Size; 51 | } HI_NodePlugin_NodeParam_S; 52 | 53 | typedef HI_S32 (*NodePluginCompute)(const HI_NodePlugin_Operand_S*, HI_U32, HI_NodePlugin_Operand_S*, HI_U32, HI_NodePlugin_NodeParam_S*, HI_NodePlugin_NodeParam_S*); 54 | 55 | typedef HI_S32 (*NodePluginGetType)(HI_CHAR pszNodeType[], const HI_U32 u32Length); 56 | 57 | EXPORT HI_S32 HI_NodePlugin_Compute(const HI_NodePlugin_Operand_S* pstInputs, HI_U32 u32InputNum, 58 | HI_NodePlugin_Operand_S* pstOutputs, HI_U32 u32Outputs, HI_NodePlugin_NodeParam_S* pstHyperParam, HI_NodePlugin_NodeParam_S* pstTrainingParam); 59 | 60 | EXPORT HI_S32 HI_NodePlugin_getNodeType(HI_CHAR pszNodeType[], const HI_U32 u32Length); 61 | 62 | #ifdef __cplusplus 63 | #if __cplusplus 64 | } 65 | #endif 66 | #endif /* __cplusplus */ 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/hi_ssp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * extdrv/include/hi_ssp.h for Linux . 3 | * 4 | * History: 5 | * 2006-4-11 create this file 6 | */ 7 | 8 | #ifndef __HI_SSP_H__ 9 | #define __HI_SSP_H__ 10 | 11 | #define SSP_READ_ALT 0x1 12 | #define SSP_WRITE_ALT 0X3 13 | 14 | typedef struct hiSPI_DATA_S 15 | { 16 | unsigned int spi_no; 17 | unsigned char dev_addr; 18 | unsigned int dev_byte_num; 19 | unsigned int reg_addr; 20 | unsigned int addr_byte_num; 21 | unsigned int data; 22 | unsigned int data_byte_num; 23 | }SPI_DATA_S; 24 | 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/mpi_region.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | Copyright (C), 2016-2011, Hisilicon Tech. Co., Ltd. 4 | ****************************************************************************** 5 | File Name : mpi_region.h 6 | Version : Initial Draft 7 | Author : Hisilicon multimedia software group 8 | Created : 2016/11/15 9 | Last Modified : 10 | Description : MPP Programe Interface for region moudle 11 | Function List : 12 | ******************************************************************************/ 13 | 14 | 15 | #ifndef __MPI_REGION_H__ 16 | #define __MPI_REGION_H__ 17 | 18 | #include "hi_comm_region.h" 19 | 20 | #ifdef __cplusplus 21 | #if __cplusplus 22 | extern "C"{ 23 | #endif 24 | #endif /* End of #ifdef __cplusplus */ 25 | 26 | HI_S32 HI_MPI_RGN_Create(RGN_HANDLE Handle, const RGN_ATTR_S *pstRegion); 27 | HI_S32 HI_MPI_RGN_Destroy(RGN_HANDLE Handle); 28 | 29 | HI_S32 HI_MPI_RGN_GetAttr(RGN_HANDLE Handle, RGN_ATTR_S *pstRegion); 30 | HI_S32 HI_MPI_RGN_SetAttr(RGN_HANDLE Handle, const RGN_ATTR_S *pstRegion); 31 | 32 | HI_S32 HI_MPI_RGN_SetBitMap(RGN_HANDLE Handle, const BITMAP_S *pstBitmap); 33 | 34 | HI_S32 HI_MPI_RGN_AttachToChn(RGN_HANDLE Handle, const MPP_CHN_S *pstChn, const RGN_CHN_ATTR_S *pstChnAttr); 35 | HI_S32 HI_MPI_RGN_DetachFromChn(RGN_HANDLE Handle, const MPP_CHN_S *pstChn); 36 | 37 | HI_S32 HI_MPI_RGN_SetDisplayAttr(RGN_HANDLE Handle, const MPP_CHN_S *pstChn, const RGN_CHN_ATTR_S *pstChnAttr); 38 | HI_S32 HI_MPI_RGN_GetDisplayAttr(RGN_HANDLE Handle, const MPP_CHN_S *pstChn, RGN_CHN_ATTR_S *pstChnAttr); 39 | 40 | HI_S32 HI_MPI_RGN_GetCanvasInfo(RGN_HANDLE Handle, RGN_CANVAS_INFO_S *pstCanvasInfo); 41 | HI_S32 HI_MPI_RGN_UpdateCanvas(RGN_HANDLE Handle); 42 | 43 | HI_S32 HI_MPI_RGN_BatchBegin(RGN_HANDLEGROUP *pu32Group,HI_U32 u32Num,const RGN_HANDLE handle[]); 44 | HI_S32 HI_MPI_RGN_BatchEnd(RGN_HANDLEGROUP u32Group); 45 | 46 | HI_S32 HI_MPI_RGN_GetFd(HI_VOID); 47 | #ifdef __cplusplus 48 | #if __cplusplus 49 | } 50 | #endif 51 | #endif /* End of #ifdef __cplusplus */ 52 | 53 | #endif /* End of #ifndef __MPI_REGION_H__ */ 54 | 55 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/mpi_snap.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2017, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_vi.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2017/06/16 10 | Description : 11 | History : 12 | 13 | 14 | ******************************************************************************/ 15 | #ifndef __MPI_SNAP_H__ 16 | #define __MPI_SNAP_H__ 17 | 18 | #include "hi_comm_video.h" 19 | #include "hi_comm_snap.h" 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C" { 24 | #endif 25 | #endif /* __cplusplus */ 26 | 27 | HI_S32 HI_MPI_SNAP_SetPipeAttr(VI_PIPE ViPipe, const SNAP_ATTR_S *pstSnapAttr); 28 | HI_S32 HI_MPI_SNAP_GetPipeAttr(VI_PIPE ViPipe, SNAP_ATTR_S *pstSnapAttr); 29 | HI_S32 HI_MPI_SNAP_EnablePipe(VI_PIPE ViPipe); 30 | HI_S32 HI_MPI_SNAP_DisablePipe(VI_PIPE ViPipe); 31 | HI_S32 HI_MPI_SNAP_TriggerPipe(VI_PIPE ViPipe); 32 | 33 | HI_S32 HI_MPI_SNAP_MultiTrigger(VI_STITCH_GRP StitchGrp); 34 | 35 | /* HDR */ 36 | HI_S32 HI_MPI_SNAP_SetProSharpenParam(VI_PIPE ViPipe, const ISP_PRO_SHARPEN_PARAM_S *pstIspShpParam); 37 | HI_S32 HI_MPI_SNAP_GetProSharpenParam(VI_PIPE ViPipe, ISP_PRO_SHARPEN_PARAM_S *pstIspShpParam); 38 | HI_S32 HI_MPI_SNAP_SetProBNRParam(VI_PIPE ViPipe, const ISP_PRO_BNR_PARAM_S *pstNrParma); 39 | HI_S32 HI_MPI_SNAP_GetProBNRParam(VI_PIPE ViPipe, ISP_PRO_BNR_PARAM_S *pstNrParma); 40 | 41 | #ifdef __cplusplus 42 | #if __cplusplus 43 | } 44 | #endif 45 | #endif /* __cplusplus */ 46 | 47 | #endif /* __MPI_SNAP_H__ */ 48 | 49 | 50 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/vdec_exp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Copyright (C), 2017, Hisilicon Tech. Co., Ltd. 3 | ****************************************************************************** 4 | File Name : vdec_exp.h 5 | Version : Initial Draft 6 | Author : Hisilicon multimedia software group 7 | Created : 2017/07/15 8 | Last Modified : 9 | Description : 10 | Function List : 11 | ******************************************************************************/ 12 | 13 | #include "hi_common.h" 14 | 15 | #ifndef __HI_VDEC_EXP_H__ 16 | #define __HI_VDEC_EXP_H__ 17 | 18 | typedef struct hiVDEC_EXPORT_CALLBACK_S { 19 | void (*pfnVdecNotify)(int module_id, int channel, int event_type, void *args); 20 | int (*pfnVdecSetscheduler_Dec)(void); 21 | int (*pfnVdecSetscheduler_Stm)(void); 22 | int (*pfnVdecSetscheduler_Syn)(void); 23 | } VDEC_EXPORT_CALLBACK_S; 24 | 25 | typedef HI_S32 FN_VDEC_RegisterExpCallback(VDEC_EXPORT_CALLBACK_S *pstExpCallback); 26 | 27 | typedef struct hiVDEC_EXPORT_SYMBOL_S { 28 | FN_VDEC_RegisterExpCallback *pfnVdecRegisterExpCallback; 29 | } VDEC_EXPORT_SYMBOL_S; 30 | 31 | #endif /* __HI_VOU_EXP_H__ */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/include/vou_exp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : vou_ext.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2011/06/28 10 | Description : 11 | History : 12 | 1.Date : 2011/06/28 13 | Author : n00168968/z00185248/l00181524 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #include "hi_common.h" 19 | 20 | #ifndef __HI_VOU_EXP_H__ 21 | #define __HI_VOU_EXP_H__ 22 | 23 | typedef struct hiVOU_EXPORT_CALLBACK_S { 24 | void (*pfnVoNotify)(int module_id, int vodev); 25 | } VOU_EXPORT_CALLBACK_S; 26 | 27 | typedef HI_S32 FN_VO_RegisterExternCallback(VOU_EXPORT_CALLBACK_S *pstExpCallback); 28 | 29 | typedef struct hiVOU_EXPORT_SYMBOL_S { 30 | FN_VO_RegisterExternCallback *pfnVoRegisterExpCallback; 31 | } VOU_EXPORT_SYMBOL_S; 32 | 33 | #endif /* __HI_VOU_EXP_H__ */ 34 | 35 | 36 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/audio_dl_adp.h: -------------------------------------------------------------------------------- 1 | #ifndef __AUDIO_DL_ADP_H__ 2 | #define __AUDIO_DL_ADP_H__ 3 | 4 | #include "hi_type.h" 5 | 6 | HI_S32 Audio_Dlpath(HI_CHAR* pChLibPath); 7 | 8 | HI_S32 Audio_Dlopen(HI_VOID** pLibhandle, HI_CHAR* pChLibName); 9 | 10 | HI_S32 Audio_Dlsym(HI_VOID** pFunchandle, HI_VOID* Libhandle, HI_CHAR* pChFuncName); 11 | 12 | HI_S32 Audio_Dlclose(HI_VOID* Libhandle); 13 | 14 | #endif -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/hi_af_comm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_af_comm.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/20 10 | Description : 11 | History : 12 | 1.Date : 2012/12/20 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __HI_AF_COMM_H__ 18 | #define __HI_AF_COMM_H__ 19 | 20 | #include "hi_type.h" 21 | 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C" { 25 | #endif 26 | #endif /* End of #ifdef __cplusplus */ 27 | 28 | #define HI_AF_LIB_NAME "hisi_af_lib" 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/hi_comm_ai.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ai.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AI_H__ 19 | #define __HI_COMM_AI_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | #ifdef __cplusplus 30 | #if __cplusplus 31 | } 32 | #endif 33 | #endif /* End of #ifdef __cplusplus */ 34 | 35 | #endif /* End of #ifndef __HI_COMM_AI_H__ */ 36 | 37 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/hi_comm_ao.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ao.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AO_H__ 19 | #define __HI_COMM_AO_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif /* End of #ifndef __HI_COMM_AO_H__ */ 37 | 38 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/hi_i2c.h: -------------------------------------------------------------------------------- 1 | #ifndef _HI_I2C_H 2 | #define _HI_I2C_H 3 | 4 | 5 | 6 | /* /dev/i2c-X ioctl commands. The ioctl's parameter is always an 7 | * unsigned long, except for: 8 | * - I2C_FUNCS, takes pointer to an unsigned long 9 | * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data 10 | * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data 11 | */ 12 | #define I2C_RETRIES 0x0701 /* number of times a device address should 13 | be polled when not acknowledging */ 14 | #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ 15 | 16 | /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses 17 | * are NOT supported! (due to code brokenness) 18 | */ 19 | #define I2C_SLAVE 0x0703 /* Use this slave address */ 20 | #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it 21 | is already in use by a driver! */ 22 | #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ 23 | 24 | #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ 25 | 26 | #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ 27 | 28 | #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ 29 | #define I2C_SMBUS 0x0720 /* SMBus transfer */ 30 | #define I2C_16BIT_REG 0x0709 /* 16BIT REG WIDTH */ 31 | #define I2C_16BIT_DATA 0x070a /* 16BIT DATA WIDTH */ 32 | 33 | typedef struct hiI2C_DATA_S 34 | { 35 | unsigned char dev_addr; 36 | unsigned int reg_addr; 37 | unsigned int addr_byte_num; 38 | unsigned int data; 39 | unsigned int data_byte_num; 40 | }I2C_DATA_S; 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/hi_isp_debug.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_isp_debug.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2010/08/30 10 | Description : 11 | History : 12 | 1.Date : 2010/08/30 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __HI_ISP_DEBUG_H__ 19 | #define __HI_ISP_DEBUG_H__ 20 | 21 | #include "hi_debug.h" 22 | 23 | #if 0 24 | #define PRINT_DEBUG_INFO 25 | #endif 26 | 27 | #if 0 28 | #define PRINT_INFO_2FILE 29 | #endif 30 | 31 | #define ISP_TRACE(level, fmt, ...)\ 32 | do{ \ 33 | HI_TRACE(level, HI_ID_ISP,"[Func]:%s [Line]:%d [Info]:"fmt,__FUNCTION__, __LINE__,##__VA_ARGS__);\ 34 | }while(0) 35 | 36 | /* To avoid divide-0 exception in code. */ 37 | #define DIV_0_TO_1(a) ( (0 == (a)) ? 1 : (a) ) 38 | #define DIV_0_TO_1_FLOAT(a) ((((a) < 1E-10) && ((a) > -1E-10)) ? 1 : (a)) 39 | 40 | #endif /* __HI_ISP_DEBUG_H__ */ 41 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/hi_md.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2015, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_md.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software (IVE) group 9 | Created : 2014/11/10 10 | Description : 11 | History : 12 | 1.Date : 2014/11/10 13 | Author : 14 | Modification: Created file 15 | 2.Date : 2015/11/24 16 | Author : 17 | Modification: Modify MD_ATTR_S 18 | ******************************************************************************/ 19 | #ifndef _HI_MD_H_ 20 | #define _HI_MD_H_ 21 | 22 | #include "hi_ive.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C"{ 27 | #endif 28 | #endif 29 | /* 30 | * Definition md algorithm mode 31 | */ 32 | typedef enum hiMD_ALG_MODE_E 33 | { 34 | MD_ALG_MODE_BG = 0x0,/*Base on background image*/ 35 | MD_ALG_MODE_REF = 0x1,/*Base on reference image*/ 36 | 37 | MD_ALG_MODE_BUTT 38 | }MD_ALG_MODE_E; 39 | /* 40 | * Definition of md attribute 41 | */ 42 | typedef struct hiMD_ATTR_S 43 | { 44 | MD_ALG_MODE_E enAlgMode; /*Md algorithm mode*/ 45 | IVE_SAD_MODE_E enSadMode; /*Sad mode*/ 46 | IVE_SAD_OUT_CTRL_E enSadOutCtrl; /*Sad output ctrl*/ 47 | HI_U32 u32Width; /*Image width*/ 48 | HI_U32 u32Height; /*Image height*/ 49 | HI_U16 u16SadThr; /*Sad thresh*/ 50 | IVE_CCL_CTRL_S stCclCtrl; /*Ccl ctrl*/ 51 | IVE_ADD_CTRL_S stAddCtrl; /*Add ctrl*/ 52 | }MD_ATTR_S; 53 | 54 | #ifdef __cplusplus 55 | #if __cplusplus 56 | } 57 | #endif 58 | #endif 59 | 60 | #endif/*_HI_MD_H_*/ -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/hi_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef __HI_PLUGIN_TYPE_H__ 2 | #define __HI_PLUGIN_TYPE_H__ 3 | 4 | #include "hi_type.h" 5 | 6 | #if defined(_MSC_VER) 7 | #define EXPORT __declspec(dllexport) 8 | #elif defined(__GNUC__) 9 | #define EXPORT __attribute__((visibility("default"))) 10 | #else 11 | #define EXPORT 12 | #pragma warning cant export dynamic symbos 13 | #endif 14 | 15 | #ifdef __cplusplus 16 | #if __cplusplus 17 | extern "C" { 18 | #endif 19 | #endif /* __cplusplus */ 20 | 21 | #define MAX_OPERAND_NAME_LEN (64) 22 | 23 | typedef struct hiNodePlugin_Shape_S 24 | { 25 | HI_S32 s32H; 26 | HI_S32 s32W; 27 | HI_S32 s32C; 28 | } HI_NodePlugin_Shape_S; 29 | 30 | typedef enum hiNodePlugin_ElemType_E 31 | { 32 | ELEM_TYPE_U8, 33 | ELEM_TYPE_U16, 34 | ELEM_TYPE_U32 35 | } HI_NodePlugin_ElemType_E; 36 | 37 | typedef struct hiNodePlugin_Operand_S 38 | { 39 | HI_U64 u64Offset; // addr 40 | HI_CHAR mName[MAX_OPERAND_NAME_LEN + 1]; 41 | HI_NodePlugin_ElemType_E enElemType; 42 | HI_U32 u32Num; 43 | HI_U32 u32Stride; 44 | HI_NodePlugin_Shape_S stShape; 45 | } HI_NodePlugin_Operand_S; 46 | 47 | typedef struct HiNodeParam 48 | { 49 | HI_VOID* pParam; 50 | HI_U32 u32Size; 51 | } HI_NodePlugin_NodeParam_S; 52 | 53 | typedef HI_S32 (*NodePluginCompute)(const HI_NodePlugin_Operand_S*, HI_U32, HI_NodePlugin_Operand_S*, HI_U32, HI_NodePlugin_NodeParam_S*, HI_NodePlugin_NodeParam_S*); 54 | 55 | typedef HI_S32 (*NodePluginGetType)(HI_CHAR pszNodeType[], const HI_U32 u32Length); 56 | 57 | EXPORT HI_S32 HI_NodePlugin_Compute(const HI_NodePlugin_Operand_S* pstInputs, HI_U32 u32InputNum, 58 | HI_NodePlugin_Operand_S* pstOutputs, HI_U32 u32Outputs, HI_NodePlugin_NodeParam_S* pstHyperParam, HI_NodePlugin_NodeParam_S* pstTrainingParam); 59 | 60 | EXPORT HI_S32 HI_NodePlugin_getNodeType(HI_CHAR pszNodeType[], const HI_U32 u32Length); 61 | 62 | #ifdef __cplusplus 63 | #if __cplusplus 64 | } 65 | #endif 66 | #endif /* __cplusplus */ 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/hi_rtc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * include/hi_rtc.h for Linux . 3 | * 4 | * This file defines hi_rtc micro-definitions for driver developer. 5 | * 6 | * History: 7 | * 10-April-2006 create this file 8 | */ 9 | 10 | #ifndef __HI_RTC__ 11 | #define __HI_RTC__ 12 | 13 | typedef struct { 14 | unsigned int year; 15 | unsigned int month; 16 | unsigned int date; 17 | unsigned int hour; 18 | unsigned int minute; 19 | unsigned int second; 20 | unsigned int weekday; 21 | } rtc_time_t; 22 | 23 | typedef struct { 24 | unsigned char reg_index; 25 | unsigned char val; 26 | } reg_data_t; 27 | 28 | typedef struct { 29 | unsigned int freq_l; 30 | } rtc_freq_t; 31 | 32 | #define HI_RTC_AIE_ON _IO('p', 0x01) 33 | #define HI_RTC_AIE_OFF _IO('p', 0x02) 34 | 35 | #define HI_RTC_GET_FREQ _IOR('P', 0x05, rtc_freq_t) 36 | #define HI_RTC_SET_FREQ _IOW('p', 0x06, rtc_freq_t) 37 | 38 | #define HI_RTC_ALM_SET _IOW('p', 0x07, rtc_time_t) 39 | #define HI_RTC_ALM_READ _IOR('p', 0x08, rtc_time_t) 40 | #define HI_RTC_RD_TIME _IOR('p', 0x09, rtc_time_t) 41 | #define HI_RTC_SET_TIME _IOW('p', 0x0a, rtc_time_t) 42 | #define HI_RTC_RESET _IO('p', 0x0b) 43 | #define HI_RTC_REG_SET _IOW('p', 0x0c, reg_data_t) 44 | #define HI_RTC_REG_READ _IOWR('p', 0x0d, reg_data_t) 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/hi_ssp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * extdrv/include/hi_ssp.h for Linux . 3 | * 4 | * History: 5 | * 2006-4-11 create this file 6 | */ 7 | 8 | #ifndef __HI_SSP_H__ 9 | #define __HI_SSP_H__ 10 | 11 | #define SSP_READ_ALT 0x1 12 | #define SSP_WRITE_ALT 0X3 13 | 14 | typedef struct hiSPI_DATA_S 15 | { 16 | unsigned int spi_no; 17 | unsigned char dev_addr; 18 | unsigned int dev_byte_num; 19 | unsigned int reg_addr; 20 | unsigned int addr_byte_num; 21 | unsigned int data; 22 | unsigned int data_byte_num; 23 | }SPI_DATA_S; 24 | 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/iniparser.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/nce_alg/platform/hisi3516dv300/rtsp-v2/iniparser.h -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/mpi_adec.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : ai.c 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/6/15 10 | Description : 11 | History : 12 | 1.Date : 2009/6/19 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | #ifndef __MPI_ADEC_H__ 17 | #define __MPI_ADEC_H__ 18 | 19 | #include "hi_common.h" 20 | #include "hi_comm_aio.h" 21 | #include "hi_comm_adec.h" 22 | 23 | #ifdef __cplusplus 24 | #if __cplusplus 25 | extern "C" 26 | { 27 | #endif 28 | #endif /* __cplusplus */ 29 | 30 | HI_S32 HI_MPI_ADEC_CreateChn(ADEC_CHN AdChn, ADEC_CHN_ATTR_S *pstAttr); 31 | HI_S32 HI_MPI_ADEC_DestroyChn(ADEC_CHN AdChn); 32 | 33 | HI_S32 HI_MPI_ADEC_SendStream(ADEC_CHN AdChn, const AUDIO_STREAM_S *pstStream, HI_BOOL bBlock); 34 | 35 | HI_S32 HI_MPI_ADEC_ClearChnBuf(ADEC_CHN AdChn); 36 | 37 | HI_S32 HI_MPI_ADEC_RegeisterDecoder(HI_S32 *ps32Handle, ADEC_DECODER_S *pstDecoder); 38 | HI_S32 HI_MPI_ADEC_UnRegisterDecoder(HI_S32 s32Handle); 39 | 40 | HI_S32 HI_MPI_ADEC_GetFrame(ADEC_CHN AdChn, AUDIO_FRAME_INFO_S *pstFrmInfo, HI_BOOL bBlock); 41 | HI_S32 HI_MPI_ADEC_ReleaseFrame(ADEC_CHN AdChn, AUDIO_FRAME_INFO_S *pstFrmInfo); 42 | HI_S32 HI_MPI_ADEC_SendEndOfStream(ADEC_CHN AdChn, HI_BOOL bInstant); 43 | 44 | 45 | 46 | #ifdef __cplusplus 47 | #if __cplusplus 48 | } 49 | #endif 50 | #endif /* __cplusplus */ 51 | 52 | #endif /* __MPI_ADEC_H__ */ 53 | 54 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/mpi_aenc.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : ai.c 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/6/15 10 | Description : 11 | History : 12 | 1.Date : 2009/6/15 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | #ifndef __MPI_AENC_H__ 17 | #define __MPI_AENC_H__ 18 | 19 | #include "hi_common.h" 20 | #include "hi_comm_aio.h" 21 | #include "hi_comm_aenc.h" 22 | 23 | #ifdef __cplusplus 24 | #if __cplusplus 25 | extern "C" 26 | { 27 | #endif 28 | #endif /* __cplusplus */ 29 | 30 | #define AENC_ADAPT_MAGIC 0Xfcfcfcfc 31 | 32 | HI_S32 HI_MPI_AENC_CreateChn(AENC_CHN AeChn, const AENC_CHN_ATTR_S *pstAttr); 33 | HI_S32 HI_MPI_AENC_DestroyChn(AENC_CHN AeChn); 34 | 35 | HI_S32 HI_MPI_AENC_SendFrame(AENC_CHN AeChn, const AUDIO_FRAME_S *pstFrm, const AEC_FRAME_S *pstAecFrm); 36 | 37 | HI_S32 HI_MPI_AENC_GetStream(AENC_CHN AeChn, AUDIO_STREAM_S *pstStream, HI_S32 s32MilliSec); 38 | HI_S32 HI_MPI_AENC_ReleaseStream(AENC_CHN AeChn, const AUDIO_STREAM_S *pstStream); 39 | 40 | HI_S32 HI_MPI_AENC_GetFd(AENC_CHN AeChn); 41 | 42 | HI_S32 HI_MPI_AENC_RegeisterEncoder(HI_S32 *ps32Handle, AENC_ENCODER_S *pstEncoder); 43 | HI_S32 HI_MPI_AENC_UnRegisterEncoder(HI_S32 s32Handle); 44 | 45 | HI_S32 HI_MPI_AENC_SaveFile(AENC_CHN AeChn, AUDIO_SAVE_FILE_INFO_S *pstSaveFileInfo); 46 | HI_S32 HI_MPI_AENC_QueryFileStatus(AENC_CHN AeChn, AUDIO_FILE_STATUS_S* pstFileStatus); 47 | 48 | HI_S32 HI_MPI_AENC_GetStreamBufInfo(AENC_CHN AeChn, HI_U32 *pu32PhysAddr, HI_U32 *pu32Size); 49 | 50 | 51 | #ifdef __cplusplus 52 | #if __cplusplus 53 | } 54 | #endif 55 | #endif /* __cplusplus */ 56 | 57 | #endif /* __MPI_AENC_H__ */ 58 | 59 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/mpi_region.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | Copyright (C), 2016-2011, Hisilicon Tech. Co., Ltd. 4 | ****************************************************************************** 5 | File Name : mpi_region.h 6 | Version : Initial Draft 7 | Author : Hisilicon multimedia software group 8 | Created : 2016/11/15 9 | Last Modified : 10 | Description : MPP Programe Interface for region moudle 11 | Function List : 12 | ******************************************************************************/ 13 | 14 | 15 | #ifndef __MPI_REGION_H__ 16 | #define __MPI_REGION_H__ 17 | 18 | #include "hi_comm_region.h" 19 | 20 | #ifdef __cplusplus 21 | #if __cplusplus 22 | extern "C"{ 23 | #endif 24 | #endif /* End of #ifdef __cplusplus */ 25 | 26 | HI_S32 HI_MPI_RGN_Create(RGN_HANDLE Handle, const RGN_ATTR_S *pstRegion); 27 | HI_S32 HI_MPI_RGN_Destroy(RGN_HANDLE Handle); 28 | 29 | HI_S32 HI_MPI_RGN_GetAttr(RGN_HANDLE Handle, RGN_ATTR_S *pstRegion); 30 | HI_S32 HI_MPI_RGN_SetAttr(RGN_HANDLE Handle, const RGN_ATTR_S *pstRegion); 31 | 32 | HI_S32 HI_MPI_RGN_SetBitMap(RGN_HANDLE Handle, const BITMAP_S *pstBitmap); 33 | 34 | HI_S32 HI_MPI_RGN_AttachToChn(RGN_HANDLE Handle, const MPP_CHN_S *pstChn, const RGN_CHN_ATTR_S *pstChnAttr); 35 | HI_S32 HI_MPI_RGN_DetachFromChn(RGN_HANDLE Handle, const MPP_CHN_S *pstChn); 36 | 37 | HI_S32 HI_MPI_RGN_SetDisplayAttr(RGN_HANDLE Handle, const MPP_CHN_S *pstChn, const RGN_CHN_ATTR_S *pstChnAttr); 38 | HI_S32 HI_MPI_RGN_GetDisplayAttr(RGN_HANDLE Handle, const MPP_CHN_S *pstChn, RGN_CHN_ATTR_S *pstChnAttr); 39 | 40 | HI_S32 HI_MPI_RGN_GetCanvasInfo(RGN_HANDLE Handle, RGN_CANVAS_INFO_S *pstCanvasInfo); 41 | HI_S32 HI_MPI_RGN_UpdateCanvas(RGN_HANDLE Handle); 42 | 43 | HI_S32 HI_MPI_RGN_BatchBegin(RGN_HANDLEGROUP *pu32Group,HI_U32 u32Num,const RGN_HANDLE handle[]); 44 | HI_S32 HI_MPI_RGN_BatchEnd(RGN_HANDLEGROUP u32Group); 45 | 46 | HI_S32 HI_MPI_RGN_GetFd(HI_VOID); 47 | #ifdef __cplusplus 48 | #if __cplusplus 49 | } 50 | #endif 51 | #endif /* End of #ifdef __cplusplus */ 52 | 53 | #endif /* End of #ifndef __MPI_REGION_H__ */ 54 | 55 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/mpi_snap.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2017, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_vi.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2017/06/16 10 | Description : 11 | History : 12 | 13 | 14 | ******************************************************************************/ 15 | #ifndef __MPI_SNAP_H__ 16 | #define __MPI_SNAP_H__ 17 | 18 | #include "hi_comm_video.h" 19 | #include "hi_comm_snap.h" 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C" 24 | { 25 | #endif 26 | #endif /* __cplusplus */ 27 | 28 | 29 | HI_S32 HI_MPI_SNAP_SetPipeAttr(VI_PIPE ViPipe, const SNAP_ATTR_S *pstSnapAttr); 30 | HI_S32 HI_MPI_SNAP_GetPipeAttr(VI_PIPE ViPipe, SNAP_ATTR_S *pstSnapAttr); 31 | HI_S32 HI_MPI_SNAP_EnablePipe(VI_PIPE ViPipe); 32 | HI_S32 HI_MPI_SNAP_DisablePipe(VI_PIPE ViPipe); 33 | HI_S32 HI_MPI_SNAP_TriggerPipe(VI_PIPE ViPipe); 34 | 35 | HI_S32 HI_MPI_SNAP_MultiTrigger(VI_STITCH_GRP StitchGrp); 36 | 37 | /* HDR */ 38 | HI_S32 HI_MPI_SNAP_SetProSharpenParam(VI_PIPE ViPipe, const ISP_PRO_SHARPEN_PARAM_S *pstIspShpParam); 39 | HI_S32 HI_MPI_SNAP_GetProSharpenParam(VI_PIPE ViPipe, ISP_PRO_SHARPEN_PARAM_S *pstIspShpParam); 40 | HI_S32 HI_MPI_SNAP_SetProBNRParam(VI_PIPE ViPipe, const ISP_PRO_BNR_PARAM_S *pstNrParma); 41 | HI_S32 HI_MPI_SNAP_GetProBNRParam(VI_PIPE ViPipe, ISP_PRO_BNR_PARAM_S *pstNrParma); 42 | 43 | 44 | #ifdef __cplusplus 45 | #if __cplusplus 46 | } 47 | #endif 48 | #endif /* __cplusplus */ 49 | 50 | #endif /*__MPI_SNAP_H__ */ 51 | 52 | 53 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/mpi_vda.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_vda.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2013/05/09 10 | Description : 11 | History : 12 | 1.Date : 2013/05/09 13 | Author : x00100808 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __MPI_VDA_H__ 18 | #define __MPI_VDA_H__ 19 | 20 | #include "hi_comm_vda.h" 21 | 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C"{ 25 | #endif 26 | #endif /* End of #ifdef __cplusplus */ 27 | 28 | HI_S32 HI_MPI_VDA_CreateChn(VDA_CHN VdaChn, const VDA_CHN_ATTR_S *pstAttr); 29 | HI_S32 HI_MPI_VDA_DestroyChn(VDA_CHN VdaChn); 30 | 31 | HI_S32 HI_MPI_VDA_GetChnAttr(VDA_CHN VdaChn, VDA_CHN_ATTR_S *pstAttr); 32 | HI_S32 HI_MPI_VDA_SetChnAttr(VDA_CHN VdaChn, const VDA_CHN_ATTR_S *pstAttr); 33 | 34 | HI_S32 HI_MPI_VDA_StartRecvPic(VDA_CHN VdaChn); 35 | HI_S32 HI_MPI_VDA_StopRecvPic(VDA_CHN VdaChn); 36 | 37 | HI_S32 HI_MPI_VDA_GetData(VDA_CHN VdaChn, VDA_DATA_S *pstVdaData, HI_S32 s32MilliSec); 38 | HI_S32 HI_MPI_VDA_ReleaseData(VDA_CHN VdaChn, const VDA_DATA_S* pstVdaData); 39 | 40 | HI_S32 HI_MPI_VDA_ResetOdRegion(VDA_CHN VdaChn, HI_S32 s32RgnIndex); 41 | 42 | HI_S32 HI_MPI_VDA_Query(VDA_CHN VdaChn, VDA_CHN_STAT_S *pstChnStat); 43 | 44 | HI_S32 HI_MPI_VDA_GetFd(VDA_CHN VdaChn); 45 | 46 | HI_S32 HI_MPI_VDA_UpdateRef(VDA_CHN VdaChn, const VIDEO_FRAME_INFO_S *pstRefFrame); 47 | 48 | HI_S32 HI_MPI_VDA_SendPic(VDA_CHN VdaChn, const VIDEO_FRAME_INFO_S *pstUserFrame, HI_S32 s32MilliSec); 49 | 50 | 51 | #ifdef __cplusplus 52 | #if __cplusplus 53 | } 54 | #endif 55 | #endif /* End of #ifdef __cplusplus */ 56 | 57 | #endif /* End of #ifndef __MPI_VDA_H__ */ 58 | 59 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/pwm.h: -------------------------------------------------------------------------------- 1 | #ifndef __HI_PWM_H__ 2 | #define __HI_PWM_H__ 3 | 4 | #ifdef __cplusplus 5 | #if __cplusplus 6 | extern "C" { 7 | #endif 8 | #endif /* __cplusplus */ 9 | 10 | typedef struct hiPWM_DATA_S 11 | { 12 | unsigned char pwm_num; //0:PWM0,1:PWM1,2:PWM2,3:PWMII0,4:PWMII1,5:PWMII2 13 | unsigned int duty; 14 | unsigned int period; 15 | unsigned char enable; 16 | 17 | } PWM_DATA_S; 18 | 19 | #define PWM_CMD_WRITE 0x01 20 | #define PWM_CMD_READ 0x03 21 | 22 | int PWM_DRV_Write(unsigned char pwm_num, unsigned int duty, unsigned int period, unsigned char enable); 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | } 27 | #endif 28 | #endif /* __cplusplus */ 29 | 30 | #endif /* __HI_PWM_H__ */ 31 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/ringfifo.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/nce_alg/platform/hisi3516dv300/rtsp-v2/ringfifo.h -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/rp-lcd-mipi-7inch-1024x600.h: -------------------------------------------------------------------------------- 1 | #ifndef __RP_LCD_MIPI_7INCH_1024X600_H__ 2 | #define __RP_LCD_MIPI_7INCH_1024X600_H__ 3 | #include "sample_comm.h" 4 | #include "hi_mipi_tx.h" 5 | /*============================= mipi 7 inch 1024x600 lcd config ====================================*/ 6 | combo_dev_cfg_t MIPI_TX_7INCH_1024X600_60_CONFIG = 7 | { 8 | .devno = 0, 9 | .lane_id = {0, 1, 2, 3}, 10 | .output_mode = OUTPUT_MODE_DSI_VIDEO, 11 | .output_format = OUT_FORMAT_RGB_24_BIT, 12 | .video_mode = BURST_MODE, 13 | 14 | .sync_info = { 15 | .vid_pkt_size = 1024, // hact 16 | .vid_hsa_pixels = 4, // hsa //20 17 | .vid_hbp_pixels = 60, // hbp //20 18 | .vid_hline_pixels = 1224, // hact + hsa + hbp + hfp //hfb=32 //972 19 | .vid_vsa_lines = 2, // vsa 20 | .vid_vbp_lines = 16, // vbp 21 | .vid_vfp_lines = 16, // vfp 22 | .vid_active_lines = 634,// vact 23 | .edpi_cmd_size = 0, 24 | }, 25 | 26 | .phy_data_rate = 495, 27 | .pixel_clk = 46561, 28 | }; 29 | 30 | VO_SYNC_INFO_S MIPI_TX_7INCH_1024X600_60_SYNC_INFO = 31 | { 32 | .u16Hact = 1024, 33 | .u16Hbb = 64, 34 | .u16Hfb = 136, 35 | .u16Hpw = 4, 36 | .u16Vact = 600, 37 | .u16Vbb = 18, 38 | .u16Vfb = 16, 39 | .u16Vpw = 2, 40 | }; 41 | 42 | VO_USER_INTFSYNC_INFO_S MIPI_TX_7INCH_1024X600_60_USER_INTFSYNC_INFO = 43 | { 44 | .stUserIntfSyncAttr = 45 | { 46 | .stUserSyncPll = 47 | { 48 | .u32Fbdiv = 380, 49 | .u32Frac = 0x3f7271, 50 | .u32Refdiv = 4, 51 | .u32Postdiv1= 7, 52 | .u32Postdiv2= 7, 53 | }, 54 | }, 55 | 56 | .u32DevDiv = 1, 57 | .u32PreDiv = 1, 58 | }; 59 | 60 | lcd_resoluton_t MIPI_TX_7INCH_1024X600_60_LCD_RESOLUTION = 61 | { 62 | .pu32W = 1024, 63 | .pu32H = 600, 64 | .pu32Frm= 60, 65 | 66 | }; 67 | 68 | 69 | HI_VOID InitScreen_mipi_7inch_1024x600(HI_S32 s32fd) 70 | { 71 | 72 | SAMPLE_PRT("%s,%d.\n",__FUNCTION__,__LINE__); 73 | usleep(1000); 74 | 75 | } 76 | 77 | #endif /* End of #ifndef __RP_LCD_MIPI_7INCH_1024X600_H__ */ 78 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/rtputils.h: -------------------------------------------------------------------------------- 1 | #ifndef _RTPUTILS_H 2 | #define _RTPUTILS_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #define MAX_RTP_PKT_LENGTH 1400 15 | 16 | #define H264 96 17 | #define G711 97 18 | 19 | typedef enum 20 | { 21 | _h264 = 0x100, 22 | _h264nalu, 23 | _mjpeg, 24 | _g711 = 0x200, 25 | }EmRtpPayload; 26 | enum H264_FRAME_TYPE {FRAME_TYPE_I, FRAME_TYPE_P, FRAME_TYPE_B}; 27 | 28 | unsigned int RtpCreate(unsigned int u32IP, int s32Port, EmRtpPayload emPayload); 29 | void RtpDelete(unsigned int u32Rtp); 30 | unsigned int RtpSend(unsigned int u32Rtp, char *pData, int s32DataSize, unsigned int u32TimeStamp); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* _RTPUTILS_H */ 37 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/rtspservice.h: -------------------------------------------------------------------------------- 1 | #ifndef _RTSP_H 2 | #define _RTSP_H 3 | #include "rtsputils.h" 4 | 5 | #define RTSP_DEBUG 1 6 | #define RTP_DEFAULT_PORT 5004 7 | 8 | void CallBackNotifyRtspExit(char s8IsExit); 9 | void *ThreadRtsp(void *pArgs); 10 | int rtsp_server(RTSP_buffer *rtsp); 11 | void IntHandl(int i); 12 | void UpdateSps(unsigned char *data,int len); 13 | void UpdatePps(unsigned char *data,int len); 14 | 15 | 16 | #endif /* _RTSP_H */ 17 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/rtsputils.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/nce_alg/platform/hisi3516dv300/rtsp-v2/rtsputils.h -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/vdec_exp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Copyright (C), 2017, Hisilicon Tech. Co., Ltd. 3 | ****************************************************************************** 4 | File Name : vdec_exp.h 5 | Version : Initial Draft 6 | Author : Hisilicon multimedia software group 7 | Created : 2017/07/15 8 | Last Modified : 9 | Description : 10 | Function List : 11 | ******************************************************************************/ 12 | 13 | 14 | #include "hi_common.h" 15 | 16 | #ifndef __HI_VDEC_EXP_H__ 17 | #define __HI_VDEC_EXP_H__ 18 | 19 | typedef struct hiVDEC_EXPORT_CALLBACK_S 20 | { 21 | void (*pfnVdecNotify) (int module_id, int channel, int event_type, void* args); 22 | int (*pfnVdecSetscheduler_Dec) (void); 23 | int (*pfnVdecSetscheduler_Stm) (void); 24 | int (*pfnVdecSetscheduler_Syn) (void); 25 | } VDEC_EXPORT_CALLBACK_S; 26 | 27 | typedef HI_S32 FN_VDEC_RegisterExpCallback(VDEC_EXPORT_CALLBACK_S *pstExpCallback); 28 | 29 | typedef struct hiVDEC_EXPORT_SYMBOL_S 30 | { 31 | FN_VDEC_RegisterExpCallback *pfnVdecRegisterExpCallback; 32 | }VDEC_EXPORT_SYMBOL_S; 33 | 34 | 35 | #endif /* __HI_VOU_EXP_H__ */ 36 | 37 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3516dv300/rtsp-v2/vou_exp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : vou_ext.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2011/06/28 10 | Description : 11 | History : 12 | 1.Date : 2011/06/28 13 | Author : n00168968/z00185248/l00181524 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #include "hi_common.h" 19 | 20 | #ifndef __HI_VOU_EXP_H__ 21 | #define __HI_VOU_EXP_H__ 22 | 23 | typedef struct hiVOU_EXPORT_CALLBACK_S 24 | { 25 | void (*pfnVoNotify) (int module_id, int vodev); 26 | } VOU_EXPORT_CALLBACK_S; 27 | 28 | typedef HI_S32 FN_VO_RegisterExternCallback(VOU_EXPORT_CALLBACK_S *pstExpCallback); 29 | 30 | typedef struct hiVOU_EXPORT_SYMBOL_S 31 | { 32 | FN_VO_RegisterExternCallback *pfnVoRegisterExpCallback; 33 | }VOU_EXPORT_SYMBOL_S; 34 | 35 | 36 | #endif /* __HI_VOU_EXP_H__ */ 37 | 38 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3519av100/MNN/include/MNN/AutoTime.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AutoTime.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2018/07/27. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef AutoTime_hpp 10 | #define AutoTime_hpp 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace MNN { 17 | 18 | class MNN_PUBLIC Timer { 19 | public: 20 | Timer(); 21 | ~Timer(); 22 | Timer(const Timer&) = delete; 23 | Timer(const Timer&&) = delete; 24 | Timer& operator=(const Timer&) = delete; 25 | Timer& operator=(const Timer&&) = delete; 26 | 27 | // reset timer 28 | void reset(); 29 | // get duration (us) from init or latest reset. 30 | uint64_t durationInUs(); 31 | 32 | protected: 33 | uint64_t mLastResetTime; 34 | }; 35 | 36 | /** time tracing util. prints duration between init and deinit. */ 37 | class MNN_PUBLIC AutoTime : Timer { 38 | public: 39 | AutoTime(int line, const char* func); 40 | ~AutoTime(); 41 | AutoTime(const AutoTime&) = delete; 42 | AutoTime(const AutoTime&&) = delete; 43 | AutoTime& operator=(const AutoTime&) = delete; 44 | AutoTime& operator=(const AutoTime&&) = delete; 45 | 46 | private: 47 | int mLine; 48 | char* mName; 49 | }; 50 | } // namespace MNN 51 | 52 | #ifdef MNN_OPEN_TIME_TRACE 53 | #define AUTOTIME MNN::AutoTime ___t(__LINE__, __func__) 54 | #else 55 | #define AUTOTIME 56 | #endif 57 | 58 | #endif /* AutoTime_hpp */ 59 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3519av100/MNN/include/MNN/ErrorCode.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ErrorCode.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2018/09/18. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef ErrorCode_h 10 | #define ErrorCode_h 11 | 12 | namespace MNN { 13 | enum ErrorCode { 14 | #ifdef NO_ERROR 15 | #undef NO_ERROR 16 | #endif // NO_ERROR 17 | NO_ERROR = 0, 18 | OUT_OF_MEMORY = 1, 19 | NOT_SUPPORT = 2, 20 | COMPUTE_SIZE_ERROR = 3, 21 | NO_EXECUTION = 4, 22 | INVALID_VALUE = 5, 23 | 24 | // User error 25 | INPUT_DATA_ERROR = 10, 26 | CALL_BACK_STOP = 11, 27 | 28 | // Op Resize Error 29 | TENSOR_NOT_SUPPORT = 20, 30 | TENSOR_NEED_DIVIDE = 21, 31 | }; 32 | } // namespace MNN 33 | 34 | #endif /* ErrorCode_h */ 35 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3519av100/MNN/include/MNN/MNNDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // MNNDefine.h 3 | // MNN 4 | // 5 | // Created by MNN on 2018/08/09. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNNDefine_h 10 | #define MNNDefine_h 11 | 12 | #include 13 | #include 14 | 15 | #if defined(__APPLE__) 16 | #include 17 | #if TARGET_OS_IPHONE 18 | #define MNN_BUILD_FOR_IOS 19 | #endif 20 | #endif 21 | 22 | #ifdef MNN_USE_LOGCAT 23 | #include 24 | #define MNN_ERROR(format, ...) __android_log_print(ANDROID_LOG_ERROR, "MNNJNI", format, ##__VA_ARGS__) 25 | #define MNN_PRINT(format, ...) __android_log_print(ANDROID_LOG_INFO, "MNNJNI", format, ##__VA_ARGS__) 26 | #else 27 | #define MNN_PRINT(format, ...) printf(format, ##__VA_ARGS__) 28 | #define MNN_ERROR(format, ...) printf(format, ##__VA_ARGS__) 29 | #endif 30 | 31 | #ifdef DEBUG 32 | #define MNN_ASSERT(x) \ 33 | { \ 34 | int res = (x); \ 35 | if (!res) { \ 36 | MNN_ERROR("Error for %s, %d\n", __FILE__, __LINE__); \ 37 | assert(res); \ 38 | } \ 39 | } 40 | #else 41 | #define MNN_ASSERT(x) 42 | #endif 43 | 44 | #define FUNC_PRINT(x) MNN_PRINT(#x "=%d in %s, %d \n", x, __func__, __LINE__); 45 | #define FUNC_PRINT_ALL(x, type) MNN_PRINT(#x "=" #type " %" #type " in %s, %d \n", x, __func__, __LINE__); 46 | 47 | #define MNN_CHECK(success, log) \ 48 | if(!(success)){ \ 49 | MNN_ERROR("Check failed: %s ==> %s\n", #success, #log); \ 50 | } 51 | 52 | #if defined(_MSC_VER) 53 | #if defined(BUILDING_MNN_DLL) 54 | #define MNN_PUBLIC __declspec(dllexport) 55 | #elif defined(USING_MNN_DLL) 56 | #define MNN_PUBLIC __declspec(dllimport) 57 | #else 58 | #define MNN_PUBLIC 59 | #endif 60 | #else 61 | #define MNN_PUBLIC __attribute__((visibility("default"))) 62 | #endif 63 | 64 | #endif /* MNNDefine_h */ 65 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3519av100/MNN/include/MNN/MNNSharedContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // MNNSharedContext.h 3 | // MNN 4 | // 5 | // Created by MNN on 2018/10/11. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNNSharedContext_h 10 | #define MNNSharedContext_h 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include /*uint32_t*/ 16 | 17 | #ifndef VK_DEFINE_HANDLE 18 | #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; 19 | VK_DEFINE_HANDLE(VkInstance) 20 | VK_DEFINE_HANDLE(VkPhysicalDevice) 21 | VK_DEFINE_HANDLE(VkDevice) 22 | VK_DEFINE_HANDLE(VkQueue) 23 | #endif 24 | struct MNNVulkanContext { 25 | VkInstance pInstance; 26 | VkPhysicalDevice pPhysicalDevice; 27 | VkDevice pDevice; 28 | VkQueue pQueue; 29 | uint32_t iQueueFamilyIndex; 30 | }; 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* MNNSharedContext_h */ 36 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3519av100/MNN/include/MNN/expr/ExecutorScope.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExecutorScope.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2020/10/26. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNN_EXPR_EXECUTOR_SCOPE_HPP_ 10 | #define MNN_EXPR_EXECUTOR_SCOPE_HPP_ 11 | 12 | #include 13 | 14 | namespace MNN { 15 | namespace Express { 16 | 17 | struct MNN_PUBLIC ExecutorScope final { 18 | public: 19 | ExecutorScope() = delete; 20 | explicit ExecutorScope(const ExecutorScope&) = delete; 21 | explicit ExecutorScope(const std::shared_ptr& current); 22 | 23 | explicit ExecutorScope(const std::string& scope_name, 24 | const std::shared_ptr& current); 25 | 26 | virtual ~ExecutorScope(); 27 | 28 | static const std::shared_ptr Current(); 29 | }; 30 | 31 | } // namespace MNN 32 | } // namespace Express 33 | #endif // MNN_EXPR_EXECUTOR_SCOPE_HPP_ 34 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3519av100/MNN/include/MNN/expr/ExprCreator.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExprCreator.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2019/06/27. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef ExprCreator_hpp 10 | #define ExprCreator_hpp 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3519av100/MNN/include/MNN/expr/Optimizer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Optimizer.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2019/08/20. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | #ifndef Optimizer_hpp 9 | #define Optimizer_hpp 10 | #include 11 | #include 12 | 13 | namespace MNN { 14 | namespace Express { 15 | class MNN_PUBLIC Optimizer { 16 | public: 17 | enum Device { 18 | CPU = 0, 19 | GPU = 1, 20 | OTHER = 2, 21 | AUTO = 3 22 | }; 23 | struct Config { 24 | Device device = CPU; 25 | MNNForwardType forwardType = MNN_FORWARD_ALL; 26 | int numThread = 4; 27 | }; 28 | static std::shared_ptr create(Config config); 29 | struct Cost { 30 | float compute; // MFlops 31 | float memory; // MB 32 | }; 33 | class Parameters { 34 | public: 35 | Parameters(int n); 36 | virtual ~Parameters(); 37 | 38 | float* get() const { 39 | return mValue; 40 | } 41 | int size() const { 42 | return mSize; 43 | } 44 | 45 | private: 46 | float* mValue; 47 | int mSize; 48 | }; 49 | virtual std::shared_ptr onGetParameters(const std::vector& outputs) { 50 | return nullptr; 51 | } 52 | 53 | //Given paramters and measure cost, the parameters must be the same as onGetParameters 54 | virtual Cost onMeasure(const std::vector& outputs, std::shared_ptr parameters = nullptr) = 0; 55 | 56 | //Modify the output directly, the parameters must be the same as onGetParameters 57 | virtual bool onExecute(const std::vector& outputs, std::shared_ptr parameters = nullptr) = 0; 58 | 59 | Optimizer() = default; 60 | virtual ~Optimizer() = default; 61 | }; 62 | } // namespace Express 63 | } // namespace MNN 64 | #endif 65 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3519av100/MNN/include/MNN/plugin/PluginShapeInference.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ShapeInference.h 3 | // MNN 4 | // 5 | // Created by MNN on 2020/04/05. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNN_PLUGIN_PLUGIN_SHAPE_INFERENCE_HPP_ 10 | #define MNN_PLUGIN_PLUGIN_SHAPE_INFERENCE_HPP_ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace MNN { 19 | namespace plugin { 20 | 21 | class MNN_PUBLIC InferShapeKernel { 22 | public: 23 | virtual ~InferShapeKernel() = default; 24 | virtual bool compute(InferShapeContext* ctx) = 0; 25 | }; 26 | 27 | class MNN_PUBLIC InferShapeKernelRegister { 28 | public: 29 | // typedef InferShapeKernel* (*Factory)(); 30 | typedef std::function Factory; 31 | static std::unordered_map* getFactoryMap(); 32 | 33 | static bool add(const std::string& name, Factory factory); 34 | 35 | static InferShapeKernel* get(const std::string& name); 36 | }; 37 | 38 | template 39 | struct InferShapeKernelRegistrar { 40 | InferShapeKernelRegistrar(const std::string& name) { 41 | InferShapeKernelRegister::add(name, []() { // NOLINT 42 | return new PluginKernel; // NOLINT 43 | }); 44 | } 45 | }; 46 | 47 | #define REGISTER_PLUGIN_OP(name, inferShapeKernel) \ 48 | namespace { \ 49 | static auto _plugin_infer_shape_##name##_ __attribute__((unused)) = \ 50 | InferShapeKernelRegistrar(#name); \ 51 | } // namespace 52 | 53 | } // namespace plugin 54 | } // namespace MNN 55 | 56 | #endif // MNN_PLUGIN_PLUGIN_SHAPE_INFERENCE_HPP_ 57 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3519av100/hisi3519av100.cmake: -------------------------------------------------------------------------------- 1 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/alg/engine_manager/MNN/ ENGINE_3519av100_SRC) 2 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/hisi3519av100/MNN/include) 3 | #设置hisi3516dv300所需源文件 4 | set(PLATFORM_SRC 5 | ${ENGINE_3519av100_SRC} 6 | ) 7 | 8 | 9 | link_directories("${PROJECT_SOURCE_DIR}/platform/hisi3519av100/lib/") 10 | 11 | 12 | #设置hisi3516dv300所需库文件 13 | set(PLATFORM_LIB 14 | -lMNN 15 | -ldl 16 | -lpthread 17 | -lm 18 | -lrt 19 | ) 20 | 21 | # link_directories("/home/video/user/yehc/sdk/hisi/arm-himix200-linux/arm-himix200-linux/lib") 22 | # link_directories("/home/video/user/yehc/sdk/hisi/arm-himix200-linux/arm-himix200-linux/bin") 23 | # SET(CMAKE_SYSROOT "/home/video/user/yehc/sdk/hisi/arm-himix200-linux/") 24 | 25 | 26 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/drv/hisi_sdk_src/nnie/sample/sample_nnie.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/nce_alg/platform/hisi3559av100/drv/hisi_sdk_src/nnie/sample/sample_nnie.c -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/hisi3559av100.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/hisi3559av100/include/) 2 | 3 | file(GLOB PLATFORM_SRC ${PROJECT_SOURCE_DIR}/platform/hisi3559av100/drv/hisi_sdk_src/common/*.c 4 | ${PROJECT_SOURCE_DIR}/platform/hisi3559av100/drv/hisi_sdk_src/nnie/sample/*.c 5 | ${PROJECT_SOURCE_DIR}/platform/hisi3559av100/drv/hisi_sdk_src/nnie/sample_nnie_software/*.c 6 | ${PROJECT_SOURCE_DIR}/alg/engine_manager/hisi_3559av100/*.cpp 7 | ) 8 | 9 | message("${PLATFORM_SRC}") 10 | set(PLATFORM_LIB 11 | -ldnvqe 12 | -lVoiceEngine 13 | -ldsp 14 | -live 15 | -lmd 16 | -lnnie 17 | -lmpi 18 | -lupvqe 19 | -lsecurec 20 | -ldl 21 | -lpthread 22 | -lm 23 | ) 24 | link_directories(${PROJECT_SOURCE_DIR}/platform/hisi3559av100/lib) 25 | SET(HISI_4096 4096.f) 26 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/hi_af_comm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_af_comm.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/20 10 | Description : 11 | History : 12 | 1.Date : 2012/12/20 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __HI_AF_COMM_H__ 18 | #define __HI_AF_COMM_H__ 19 | 20 | #include "hi_type.h" 21 | 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C" { 25 | #endif 26 | #endif /* End of #ifdef __cplusplus */ 27 | 28 | #define HI_AF_LIB_NAME "hisi_af_lib" 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/hi_comm_ai.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ai.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AI_H__ 19 | #define __HI_COMM_AI_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | #ifdef __cplusplus 30 | #if __cplusplus 31 | } 32 | #endif 33 | #endif /* End of #ifdef __cplusplus */ 34 | 35 | #endif /* End of #ifndef __HI_COMM_AI_H__ */ 36 | 37 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/hi_comm_ao.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ao.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AO_H__ 19 | #define __HI_COMM_AO_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif /* End of #ifndef __HI_COMM_AO_H__ */ 37 | 38 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/hi_i2c.h: -------------------------------------------------------------------------------- 1 | #ifndef _HI_I2C_H 2 | #define _HI_I2C_H 3 | 4 | 5 | 6 | /* /dev/i2c-X ioctl commands. The ioctl's parameter is always an 7 | * unsigned long, except for: 8 | * - I2C_FUNCS, takes pointer to an unsigned long 9 | * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data 10 | * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data 11 | */ 12 | #define I2C_RETRIES 0x0701 /* number of times a device address should 13 | be polled when not acknowledging */ 14 | #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ 15 | 16 | /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses 17 | * are NOT supported! (due to code brokenness) 18 | */ 19 | #define I2C_SLAVE 0x0703 /* Use this slave address */ 20 | #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it 21 | is already in use by a driver! */ 22 | #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ 23 | 24 | #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ 25 | 26 | #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ 27 | 28 | #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ 29 | #define I2C_SMBUS 0x0720 /* SMBus transfer */ 30 | #define I2C_16BIT_REG 0x0709 /* 16BIT REG WIDTH */ 31 | #define I2C_16BIT_DATA 0x070a /* 16BIT DATA WIDTH */ 32 | 33 | typedef struct hiI2C_DATA_S 34 | { 35 | unsigned char dev_addr; 36 | unsigned int reg_addr; 37 | unsigned int addr_byte_num; 38 | unsigned int data; 39 | unsigned int data_byte_num; 40 | }I2C_DATA_S; 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/hi_isp_debug.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2016, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_isp_debug.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2010/08/30 10 | Description : 11 | History : 12 | 1.Date : 2010/08/30 13 | Author : 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __HI_ISP_DEBUG_H__ 19 | #define __HI_ISP_DEBUG_H__ 20 | 21 | #include "hi_debug.h" 22 | 23 | #if 0 24 | #define PRINT_DEBUG_INFO 25 | #endif 26 | 27 | #if 0 28 | #define PRINT_INFO_2FILE 29 | #endif 30 | 31 | #define ISP_TRACE(level, fmt, ...)\ 32 | do{ \ 33 | HI_TRACE(level, HI_ID_ISP,"[Func]:%s [Line]:%d [Info]:"fmt,__FUNCTION__, __LINE__,##__VA_ARGS__);\ 34 | }while(0) 35 | 36 | /* To avoid divide-0 exception in code. */ 37 | #define DIV_0_TO_1(a) ( (0 == (a)) ? 1 : (a) ) 38 | #define DIV_0_TO_1_FLOAT(a) ((((a) < 1E-10) && ((a) > -1E-10)) ? 1 : (a)) 39 | 40 | #endif /* __HI_ISP_DEBUG_H__ */ 41 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/hi_md.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2015, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_md.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software (IVE) group 9 | Created : 2014/11/10 10 | Description : 11 | History : 12 | 1.Date : 2014/11/10 13 | Author : 14 | Modification: Created file 15 | 2.Date : 2015/11/24 16 | Author : 17 | Modification: Modify MD_ATTR_S 18 | ******************************************************************************/ 19 | #ifndef _HI_MD_H_ 20 | #define _HI_MD_H_ 21 | 22 | #include "hi_ive.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C"{ 27 | #endif 28 | #endif 29 | /* 30 | * Definition md algorithm mode 31 | */ 32 | typedef enum hiMD_ALG_MODE_E 33 | { 34 | MD_ALG_MODE_BG = 0x0,/*Base on background image*/ 35 | MD_ALG_MODE_REF = 0x1,/*Base on reference image*/ 36 | 37 | MD_ALG_MODE_BUTT 38 | }MD_ALG_MODE_E; 39 | /* 40 | * Definition of md attribute 41 | */ 42 | typedef struct hiMD_ATTR_S 43 | { 44 | MD_ALG_MODE_E enAlgMode; /*Md algorithm mode*/ 45 | IVE_SAD_MODE_E enSadMode; /*Sad mode*/ 46 | IVE_SAD_OUT_CTRL_E enSadOutCtrl; /*Sad output ctrl*/ 47 | HI_U32 u32Width; /*Image width*/ 48 | HI_U32 u32Height; /*Image height*/ 49 | HI_U16 u16SadThr; /*Sad thresh*/ 50 | IVE_CCL_CTRL_S stCclCtrl; /*Ccl ctrl*/ 51 | IVE_ADD_CTRL_S stAddCtrl; /*Add ctrl*/ 52 | }MD_ATTR_S; 53 | 54 | #ifdef __cplusplus 55 | #if __cplusplus 56 | } 57 | #endif 58 | #endif 59 | 60 | #endif/*_HI_MD_H_*/ -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/hi_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef __HI_PLUGIN_TYPE_H__ 2 | #define __HI_PLUGIN_TYPE_H__ 3 | 4 | #include "hi_type.h" 5 | 6 | #if defined(_MSC_VER) 7 | #define EXPORT __declspec(dllexport) 8 | #elif defined(__GNUC__) 9 | #define EXPORT __attribute__((visibility("default"))) 10 | #else 11 | #define EXPORT 12 | #pragma warning cant export dynamic symbos 13 | #endif 14 | 15 | #ifdef __cplusplus 16 | #if __cplusplus 17 | extern "C" { 18 | #endif 19 | #endif /* __cplusplus */ 20 | 21 | #define MAX_OPERAND_NAME_LEN (64) 22 | 23 | typedef struct hiNodePlugin_Shape_S 24 | { 25 | HI_S32 s32H; 26 | HI_S32 s32W; 27 | HI_S32 s32C; 28 | } HI_NodePlugin_Shape_S; 29 | 30 | typedef enum hiNodePlugin_ElemType_E 31 | { 32 | ELEM_TYPE_U8, 33 | ELEM_TYPE_U16, 34 | ELEM_TYPE_U32 35 | } HI_NodePlugin_ElemType_E; 36 | 37 | typedef struct hiNodePlugin_Operand_S 38 | { 39 | HI_U64 u64Offset; // addr 40 | HI_CHAR mName[MAX_OPERAND_NAME_LEN + 1]; 41 | HI_NodePlugin_ElemType_E enElemType; 42 | HI_U32 u32Num; 43 | HI_U32 u32Stride; 44 | HI_NodePlugin_Shape_S stShape; 45 | } HI_NodePlugin_Operand_S; 46 | 47 | typedef struct HiNodeParam 48 | { 49 | HI_VOID* pParam; 50 | HI_U32 u32Size; 51 | } HI_NodePlugin_NodeParam_S; 52 | 53 | typedef HI_S32 (*NodePluginCompute)(const HI_NodePlugin_Operand_S*, HI_U32, HI_NodePlugin_Operand_S*, HI_U32, HI_NodePlugin_NodeParam_S*, HI_NodePlugin_NodeParam_S*); 54 | 55 | typedef HI_S32 (*NodePluginGetType)(HI_CHAR pszNodeType[], const HI_U32 u32Length); 56 | 57 | EXPORT HI_S32 HI_NodePlugin_Compute(const HI_NodePlugin_Operand_S* pstInputs, HI_U32 u32InputNum, 58 | HI_NodePlugin_Operand_S* pstOutputs, HI_U32 u32Outputs, HI_NodePlugin_NodeParam_S* pstHyperParam, HI_NodePlugin_NodeParam_S* pstTrainingParam); 59 | 60 | EXPORT HI_S32 HI_NodePlugin_getNodeType(HI_CHAR pszNodeType[], const HI_U32 u32Length); 61 | 62 | #ifdef __cplusplus 63 | #if __cplusplus 64 | } 65 | #endif 66 | #endif /* __cplusplus */ 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/hi_ssp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * extdrv/include/hi_ssp.h for Linux . 3 | * 4 | * History: 5 | * 2006-4-11 create this file 6 | */ 7 | 8 | #ifndef __HI_SSP_H__ 9 | #define __HI_SSP_H__ 10 | 11 | #define SSP_READ_ALT 0x1 12 | #define SSP_WRITE_ALT 0X3 13 | 14 | typedef struct hiSPI_DATA_S 15 | { 16 | unsigned int spi_no; 17 | unsigned char dev_addr; 18 | unsigned int dev_byte_num; 19 | unsigned int reg_addr; 20 | unsigned int addr_byte_num; 21 | unsigned int data; 22 | unsigned int data_byte_num; 23 | }SPI_DATA_S; 24 | 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/mpi_photo.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2017-2018, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_photo.h 7 | Version : Initial Draft 8 | Author : 9 | Created : 10 | Last Modified : 11 | Description : mpi photo function declarations 12 | Function List : 13 | History : 14 | 1.Date : 20171216 15 | Author : 16 | Modification: Create 17 | ******************************************************************************/ 18 | #ifndef __MPI_PHOTO_H__ 19 | #define __MPI_PHOTO_H__ 20 | 21 | #include "hi_common.h" 22 | #include "hi_comm_photo.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C"{ 27 | #endif 28 | #endif /* __cplusplus */ 29 | 30 | 31 | 32 | HI_S32 HI_MPI_PHOTO_AlgInit(PHOTO_ALG_TYPE_E enAlgType, const PHOTO_ALG_INIT_S* pstPhotoInit); 33 | HI_S32 HI_MPI_PHOTO_AlgDeinit(PHOTO_ALG_TYPE_E enAlgType); 34 | 35 | HI_S32 HI_MPI_PHOTO_AlgProcess(PHOTO_ALG_TYPE_E enAlgType, const PHOTO_ALG_ATTR_S* pstPhotoAttr); 36 | 37 | HI_S32 HI_MPI_PHOTO_SetAlgCoef(PHOTO_ALG_TYPE_E enAlgType, const PHOTO_ALG_COEF_S* pstAlgCoef); 38 | HI_S32 HI_MPI_PHOTO_GetAlgCoef(PHOTO_ALG_TYPE_E enAlgType, PHOTO_ALG_COEF_S* pstAlgCoef); 39 | 40 | 41 | 42 | #ifdef __cplusplus 43 | #if __cplusplus 44 | } 45 | #endif 46 | #endif /* __cplusplus */ 47 | 48 | #endif /* __MPI_PHOTO_H__ */ 49 | 50 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/mpi_region.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | Copyright (C), 2016-2011, Hisilicon Tech. Co., Ltd. 4 | ****************************************************************************** 5 | File Name : mpi_region.h 6 | Version : Initial Draft 7 | Author : Hisilicon multimedia software group 8 | Created : 2016/11/15 9 | Last Modified : 10 | Description : MPP Programe Interface for region moudle 11 | Function List : 12 | ******************************************************************************/ 13 | 14 | 15 | #ifndef __MPI_REGION_H__ 16 | #define __MPI_REGION_H__ 17 | 18 | #include "hi_comm_region.h" 19 | 20 | #ifdef __cplusplus 21 | #if __cplusplus 22 | extern "C"{ 23 | #endif 24 | #endif /* End of #ifdef __cplusplus */ 25 | 26 | HI_S32 HI_MPI_RGN_Create(RGN_HANDLE Handle, const RGN_ATTR_S *pstRegion); 27 | HI_S32 HI_MPI_RGN_Destroy(RGN_HANDLE Handle); 28 | 29 | HI_S32 HI_MPI_RGN_GetAttr(RGN_HANDLE Handle, RGN_ATTR_S *pstRegion); 30 | HI_S32 HI_MPI_RGN_SetAttr(RGN_HANDLE Handle, const RGN_ATTR_S *pstRegion); 31 | 32 | HI_S32 HI_MPI_RGN_SetBitMap(RGN_HANDLE Handle, const BITMAP_S *pstBitmap); 33 | 34 | HI_S32 HI_MPI_RGN_AttachToChn(RGN_HANDLE Handle, const MPP_CHN_S *pstChn, const RGN_CHN_ATTR_S *pstChnAttr); 35 | HI_S32 HI_MPI_RGN_DetachFromChn(RGN_HANDLE Handle, const MPP_CHN_S *pstChn); 36 | 37 | HI_S32 HI_MPI_RGN_SetDisplayAttr(RGN_HANDLE Handle, const MPP_CHN_S *pstChn, const RGN_CHN_ATTR_S *pstChnAttr); 38 | HI_S32 HI_MPI_RGN_GetDisplayAttr(RGN_HANDLE Handle, const MPP_CHN_S *pstChn, RGN_CHN_ATTR_S *pstChnAttr); 39 | 40 | HI_S32 HI_MPI_RGN_GetCanvasInfo(RGN_HANDLE Handle, RGN_CANVAS_INFO_S *pstCanvasInfo); 41 | HI_S32 HI_MPI_RGN_UpdateCanvas(RGN_HANDLE Handle); 42 | 43 | HI_S32 HI_MPI_RGN_BatchBegin(RGN_HANDLEGROUP *pu32Group,HI_U32 u32Num,const RGN_HANDLE handle[]); 44 | HI_S32 HI_MPI_RGN_BatchEnd(RGN_HANDLEGROUP u32Group); 45 | 46 | HI_S32 HI_MPI_RGN_GetFd(HI_VOID); 47 | #ifdef __cplusplus 48 | #if __cplusplus 49 | } 50 | #endif 51 | #endif /* End of #ifdef __cplusplus */ 52 | 53 | #endif /* End of #ifndef __MPI_REGION_H__ */ 54 | 55 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/mpi_snap.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2017, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_vi.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2017/06/16 10 | Description : 11 | History : 12 | 13 | 14 | ******************************************************************************/ 15 | #ifndef __MPI_SNAP_H__ 16 | #define __MPI_SNAP_H__ 17 | 18 | #include "hi_comm_video.h" 19 | #include "hi_comm_snap.h" 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C" 24 | { 25 | #endif 26 | #endif /* __cplusplus */ 27 | 28 | 29 | HI_S32 HI_MPI_SNAP_SetPipeAttr(VI_PIPE ViPipe, const SNAP_ATTR_S *pstSnapAttr); 30 | HI_S32 HI_MPI_SNAP_GetPipeAttr(VI_PIPE ViPipe, SNAP_ATTR_S *pstSnapAttr); 31 | HI_S32 HI_MPI_SNAP_EnablePipe(VI_PIPE ViPipe); 32 | HI_S32 HI_MPI_SNAP_DisablePipe(VI_PIPE ViPipe); 33 | HI_S32 HI_MPI_SNAP_TriggerPipe(VI_PIPE ViPipe); 34 | 35 | HI_S32 HI_MPI_SNAP_MultiTrigger(VI_STITCH_GRP StitchGrp); 36 | 37 | /* HDR */ 38 | HI_S32 HI_MPI_SNAP_SetProSharpenParam(VI_PIPE ViPipe, const ISP_PRO_SHARPEN_PARAM_S *pstIspShpParam); 39 | HI_S32 HI_MPI_SNAP_GetProSharpenParam(VI_PIPE ViPipe, ISP_PRO_SHARPEN_PARAM_S *pstIspShpParam); 40 | HI_S32 HI_MPI_SNAP_SetProBNRParam(VI_PIPE ViPipe, const ISP_PRO_BNR_PARAM_S *pstNrParma); 41 | HI_S32 HI_MPI_SNAP_GetProBNRParam(VI_PIPE ViPipe, ISP_PRO_BNR_PARAM_S *pstNrParma); 42 | 43 | 44 | #ifdef __cplusplus 45 | #if __cplusplus 46 | } 47 | #endif 48 | #endif /* __cplusplus */ 49 | 50 | #endif /*__MPI_SNAP_H__ */ 51 | 52 | 53 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/vdec_exp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Copyright (C), 2017, Hisilicon Tech. Co., Ltd. 3 | ****************************************************************************** 4 | File Name : vdec_exp.h 5 | Version : Initial Draft 6 | Author : Hisilicon multimedia software group 7 | Created : 2017/07/15 8 | Last Modified : 9 | Description : 10 | Function List : 11 | ******************************************************************************/ 12 | 13 | 14 | #include "hi_common.h" 15 | 16 | #ifndef __HI_VDEC_EXP_H__ 17 | #define __HI_VDEC_EXP_H__ 18 | 19 | typedef struct hiVDEC_EXPORT_CALLBACK_S 20 | { 21 | void (*pfnVdecNotify) (int module_id, int channel, int event_type, void* args); 22 | int (*pfnVdecSetscheduler_Dec) (void); 23 | int (*pfnVdecSetscheduler_Stm) (void); 24 | int (*pfnVdecSetscheduler_Syn) (void); 25 | } VDEC_EXPORT_CALLBACK_S; 26 | 27 | typedef HI_S32 FN_VDEC_RegisterExpCallback(VDEC_EXPORT_CALLBACK_S *pstExpCallback); 28 | 29 | typedef struct hiVDEC_EXPORT_SYMBOL_S 30 | { 31 | FN_VDEC_RegisterExpCallback *pfnVdecRegisterExpCallback; 32 | }VDEC_EXPORT_SYMBOL_S; 33 | 34 | 35 | #endif /* __HI_VOU_EXP_H__ */ 36 | 37 | -------------------------------------------------------------------------------- /nce_alg/platform/hisi3559av100/include/vou_exp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : vou_ext.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2011/06/28 10 | Description : 11 | History : 12 | 1.Date : 2011/06/28 13 | Author : n00168968/z00185248/l00181524 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #include "hi_common.h" 19 | 20 | #ifndef __HI_VOU_EXP_H__ 21 | #define __HI_VOU_EXP_H__ 22 | 23 | typedef struct hiVOU_EXPORT_CALLBACK_S 24 | { 25 | void (*pfnVoNotify) (int module_id, int vodev); 26 | } VOU_EXPORT_CALLBACK_S; 27 | 28 | typedef HI_S32 FN_VO_RegisterExternCallback(VOU_EXPORT_CALLBACK_S *pstExpCallback); 29 | 30 | typedef struct hiVOU_EXPORT_SYMBOL_S 31 | { 32 | FN_VO_RegisterExternCallback *pfnVoRegisterExpCallback; 33 | }VOU_EXPORT_SYMBOL_S; 34 | 35 | 36 | #endif /* __HI_VOU_EXP_H__ */ 37 | 38 | -------------------------------------------------------------------------------- /nce_alg/platform/host/host.cmake: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/nce_alg/platform/host/host.cmake -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn/MNN/include/MNN/AutoTime.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AutoTime.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2018/07/27. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef AutoTime_hpp 10 | #define AutoTime_hpp 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace MNN { 17 | 18 | class MNN_PUBLIC Timer { 19 | public: 20 | Timer(); 21 | ~Timer(); 22 | Timer(const Timer&) = delete; 23 | Timer(const Timer&&) = delete; 24 | Timer& operator=(const Timer&) = delete; 25 | Timer& operator=(const Timer&&) = delete; 26 | 27 | // reset timer 28 | void reset(); 29 | // get duration (us) from init or latest reset. 30 | uint64_t durationInUs(); 31 | 32 | protected: 33 | uint64_t mLastResetTime; 34 | }; 35 | 36 | /** time tracing util. prints duration between init and deinit. */ 37 | class MNN_PUBLIC AutoTime : Timer { 38 | public: 39 | AutoTime(int line, const char* func); 40 | ~AutoTime(); 41 | AutoTime(const AutoTime&) = delete; 42 | AutoTime(const AutoTime&&) = delete; 43 | AutoTime& operator=(const AutoTime&) = delete; 44 | AutoTime& operator=(const AutoTime&&) = delete; 45 | 46 | private: 47 | int mLine; 48 | char* mName; 49 | }; 50 | } // namespace MNN 51 | 52 | #ifdef MNN_OPEN_TIME_TRACE 53 | #define AUTOTIME MNN::AutoTime ___t(__LINE__, __func__) 54 | #else 55 | #define AUTOTIME 56 | #endif 57 | 58 | #endif /* AutoTime_hpp */ 59 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn/MNN/include/MNN/ErrorCode.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ErrorCode.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2018/09/18. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef ErrorCode_h 10 | #define ErrorCode_h 11 | 12 | namespace MNN { 13 | enum ErrorCode { 14 | #ifdef NO_ERROR 15 | #undef NO_ERROR 16 | #endif // NO_ERROR 17 | NO_ERROR = 0, 18 | OUT_OF_MEMORY = 1, 19 | NOT_SUPPORT = 2, 20 | COMPUTE_SIZE_ERROR = 3, 21 | NO_EXECUTION = 4, 22 | INVALID_VALUE = 5, 23 | 24 | // User error 25 | INPUT_DATA_ERROR = 10, 26 | CALL_BACK_STOP = 11, 27 | 28 | // Op Resize Error 29 | TENSOR_NOT_SUPPORT = 20, 30 | TENSOR_NEED_DIVIDE = 21, 31 | }; 32 | } // namespace MNN 33 | 34 | #endif /* ErrorCode_h */ 35 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn/MNN/include/MNN/MNNDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // MNNDefine.h 3 | // MNN 4 | // 5 | // Created by MNN on 2018/08/09. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNNDefine_h 10 | #define MNNDefine_h 11 | 12 | #include 13 | #include 14 | 15 | #if defined(__APPLE__) 16 | #include 17 | #if TARGET_OS_IPHONE 18 | #define MNN_BUILD_FOR_IOS 19 | #endif 20 | #endif 21 | 22 | #ifdef MNN_USE_LOGCAT 23 | #include 24 | #define MNN_ERROR(format, ...) __android_log_print(ANDROID_LOG_ERROR, "MNNJNI", format, ##__VA_ARGS__) 25 | #define MNN_PRINT(format, ...) __android_log_print(ANDROID_LOG_INFO, "MNNJNI", format, ##__VA_ARGS__) 26 | #else 27 | #define MNN_PRINT(format, ...) printf(format, ##__VA_ARGS__) 28 | #define MNN_ERROR(format, ...) printf(format, ##__VA_ARGS__) 29 | #endif 30 | 31 | #ifdef DEBUG 32 | #define MNN_ASSERT(x) \ 33 | { \ 34 | int res = (x); \ 35 | if (!res) { \ 36 | MNN_ERROR("Error for %s, %d\n", __FILE__, __LINE__); \ 37 | assert(res); \ 38 | } \ 39 | } 40 | #else 41 | #define MNN_ASSERT(x) 42 | #endif 43 | 44 | #define FUNC_PRINT(x) MNN_PRINT(#x "=%d in %s, %d \n", x, __func__, __LINE__); 45 | #define FUNC_PRINT_ALL(x, type) MNN_PRINT(#x "=" #type " %" #type " in %s, %d \n", x, __func__, __LINE__); 46 | 47 | #define MNN_CHECK(success, log) \ 48 | if(!(success)){ \ 49 | MNN_ERROR("Check failed: %s ==> %s\n", #success, #log); \ 50 | } 51 | 52 | #if defined(_MSC_VER) 53 | #if defined(BUILDING_MNN_DLL) 54 | #define MNN_PUBLIC __declspec(dllexport) 55 | #elif defined(USING_MNN_DLL) 56 | #define MNN_PUBLIC __declspec(dllimport) 57 | #else 58 | #define MNN_PUBLIC 59 | #endif 60 | #else 61 | #define MNN_PUBLIC __attribute__((visibility("default"))) 62 | #endif 63 | 64 | #endif /* MNNDefine_h */ 65 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn/MNN/include/MNN/MNNSharedContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // MNNSharedContext.h 3 | // MNN 4 | // 5 | // Created by MNN on 2018/10/11. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNNSharedContext_h 10 | #define MNNSharedContext_h 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include /*uint32_t*/ 16 | 17 | #ifndef VK_DEFINE_HANDLE 18 | #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; 19 | VK_DEFINE_HANDLE(VkInstance) 20 | VK_DEFINE_HANDLE(VkPhysicalDevice) 21 | VK_DEFINE_HANDLE(VkDevice) 22 | VK_DEFINE_HANDLE(VkQueue) 23 | #endif 24 | struct MNNVulkanContext { 25 | VkInstance pInstance; 26 | VkPhysicalDevice pPhysicalDevice; 27 | VkDevice pDevice; 28 | VkQueue pQueue; 29 | uint32_t iQueueFamilyIndex; 30 | }; 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* MNNSharedContext_h */ 36 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn/MNN/include/MNN/expr/ExecutorScope.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExecutorScope.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2020/10/26. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNN_EXPR_EXECUTOR_SCOPE_HPP_ 10 | #define MNN_EXPR_EXECUTOR_SCOPE_HPP_ 11 | 12 | #include 13 | 14 | namespace MNN { 15 | namespace Express { 16 | 17 | struct MNN_PUBLIC ExecutorScope final { 18 | public: 19 | ExecutorScope() = delete; 20 | explicit ExecutorScope(const ExecutorScope&) = delete; 21 | explicit ExecutorScope(const std::shared_ptr& current); 22 | 23 | explicit ExecutorScope(const std::string& scope_name, 24 | const std::shared_ptr& current); 25 | 26 | virtual ~ExecutorScope(); 27 | 28 | static const std::shared_ptr Current(); 29 | }; 30 | 31 | } // namespace MNN 32 | } // namespace Express 33 | #endif // MNN_EXPR_EXECUTOR_SCOPE_HPP_ 34 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn/MNN/include/MNN/expr/ExprCreator.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExprCreator.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2019/06/27. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef ExprCreator_hpp 10 | #define ExprCreator_hpp 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn/MNN/include/MNN/expr/Optimizer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Optimizer.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2019/08/20. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | #ifndef Optimizer_hpp 9 | #define Optimizer_hpp 10 | #include 11 | #include 12 | 13 | namespace MNN { 14 | namespace Express { 15 | class MNN_PUBLIC Optimizer { 16 | public: 17 | enum Device { 18 | CPU = 0, 19 | GPU = 1, 20 | OTHER = 2, 21 | AUTO = 3 22 | }; 23 | struct Config { 24 | Device device = CPU; 25 | MNNForwardType forwardType = MNN_FORWARD_ALL; 26 | int numThread = 4; 27 | }; 28 | static std::shared_ptr create(Config config); 29 | struct Cost { 30 | float compute; // MFlops 31 | float memory; // MB 32 | }; 33 | class Parameters { 34 | public: 35 | Parameters(int n); 36 | virtual ~Parameters(); 37 | 38 | float* get() const { 39 | return mValue; 40 | } 41 | int size() const { 42 | return mSize; 43 | } 44 | 45 | private: 46 | float* mValue; 47 | int mSize; 48 | }; 49 | virtual std::shared_ptr onGetParameters(const std::vector& outputs) { 50 | return nullptr; 51 | } 52 | 53 | //Given paramters and measure cost, the parameters must be the same as onGetParameters 54 | virtual Cost onMeasure(const std::vector& outputs, std::shared_ptr parameters = nullptr) = 0; 55 | 56 | //Modify the output directly, the parameters must be the same as onGetParameters 57 | virtual bool onExecute(const std::vector& outputs, std::shared_ptr parameters = nullptr) = 0; 58 | 59 | Optimizer() = default; 60 | virtual ~Optimizer() = default; 61 | }; 62 | } // namespace Express 63 | } // namespace MNN 64 | #endif 65 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn/MNN/include/MNN/plugin/PluginShapeInference.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ShapeInference.h 3 | // MNN 4 | // 5 | // Created by MNN on 2020/04/05. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNN_PLUGIN_PLUGIN_SHAPE_INFERENCE_HPP_ 10 | #define MNN_PLUGIN_PLUGIN_SHAPE_INFERENCE_HPP_ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace MNN { 19 | namespace plugin { 20 | 21 | class MNN_PUBLIC InferShapeKernel { 22 | public: 23 | virtual ~InferShapeKernel() = default; 24 | virtual bool compute(InferShapeContext* ctx) = 0; 25 | }; 26 | 27 | class MNN_PUBLIC InferShapeKernelRegister { 28 | public: 29 | // typedef InferShapeKernel* (*Factory)(); 30 | typedef std::function Factory; 31 | static std::unordered_map* getFactoryMap(); 32 | 33 | static bool add(const std::string& name, Factory factory); 34 | 35 | static InferShapeKernel* get(const std::string& name); 36 | }; 37 | 38 | template 39 | struct InferShapeKernelRegistrar { 40 | InferShapeKernelRegistrar(const std::string& name) { 41 | InferShapeKernelRegister::add(name, []() { // NOLINT 42 | return new PluginKernel; // NOLINT 43 | }); 44 | } 45 | }; 46 | 47 | #define REGISTER_PLUGIN_OP(name, inferShapeKernel) \ 48 | namespace { \ 49 | static auto _plugin_infer_shape_##name##_ __attribute__((unused)) = \ 50 | InferShapeKernelRegistrar(#name); \ 51 | } // namespace 52 | 53 | } // namespace plugin 54 | } // namespace MNN 55 | 56 | #endif // MNN_PLUGIN_PLUGIN_SHAPE_INFERENCE_HPP_ 57 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn/host_mnn.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/host_mnn/MNN/include) 2 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/alg/engine_manager/MNN/ HOST_MNN_SRC) 3 | 4 | # link_directories(F:/VSproject/NceAlg/platform/host_mnn/MNN/lib) 5 | 6 | set(PLATFORM_SRC 7 | ${HOST_MNN_SRC} 8 | ) 9 | set( 10 | PLATFORM_LIB 11 | ${PROJECT_SOURCE_DIR}/platform/host_mnn/MNN/libMNN.so 12 | ) 13 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/host_mnn_windows.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/host_mnn/MNN/include) 2 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/alg/engine_manager/MNN/ HOST_MNN_SRC) 3 | 4 | # link_directories(F:/VSproject/NceAlg/platform/host_mnn/MNN/lib) 5 | 6 | set(PLATFORM_SRC 7 | ${HOST_MNN_SRC} 8 | ) 9 | set( 10 | PLATFORM_LIB 11 | ${PROJECT_SOURCE_DIR}/platform/host_mnn_windows/lib/MNN.lib 12 | ) 13 | 14 | 15 | file(WRITE "${PROJECT_SOURCE_DIR}/../build_host_mnn/demo/nce_alg_test_common.vcxproj.user" [=[ 16 | 17 | 18 | 19 | PATH=..\..\nce_alg\platform\host_mnn_windows\lib;..\lib\Debug 20 | WindowsLocalDebugger 21 | 22 | 23 | ]=]) 24 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/include/MNN/AutoTime.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AutoTime.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2018/07/27. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef AutoTime_hpp 10 | #define AutoTime_hpp 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace MNN { 17 | 18 | class MNN_PUBLIC Timer { 19 | public: 20 | Timer(); 21 | ~Timer(); 22 | Timer(const Timer&) = delete; 23 | Timer(const Timer&&) = delete; 24 | Timer& operator=(const Timer&) = delete; 25 | Timer& operator=(const Timer&&) = delete; 26 | 27 | // reset timer 28 | void reset(); 29 | // get duration (us) from init or latest reset. 30 | uint64_t durationInUs(); 31 | 32 | protected: 33 | uint64_t mLastResetTime; 34 | }; 35 | 36 | /** time tracing util. prints duration between init and deinit. */ 37 | class MNN_PUBLIC AutoTime : Timer { 38 | public: 39 | AutoTime(int line, const char* func); 40 | ~AutoTime(); 41 | AutoTime(const AutoTime&) = delete; 42 | AutoTime(const AutoTime&&) = delete; 43 | AutoTime& operator=(const AutoTime&) = delete; 44 | AutoTime& operator=(const AutoTime&&) = delete; 45 | 46 | private: 47 | int mLine; 48 | char* mName; 49 | }; 50 | } // namespace MNN 51 | 52 | #ifdef MNN_OPEN_TIME_TRACE 53 | #define AUTOTIME MNN::AutoTime ___t(__LINE__, __func__) 54 | #else 55 | #define AUTOTIME 56 | #endif 57 | 58 | #endif /* AutoTime_hpp */ 59 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/include/MNN/ErrorCode.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ErrorCode.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2018/09/18. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef ErrorCode_h 10 | #define ErrorCode_h 11 | 12 | namespace MNN { 13 | enum ErrorCode { 14 | #ifdef NO_ERROR 15 | #undef NO_ERROR 16 | #endif // NO_ERROR 17 | NO_ERROR = 0, 18 | OUT_OF_MEMORY = 1, 19 | NOT_SUPPORT = 2, 20 | COMPUTE_SIZE_ERROR = 3, 21 | NO_EXECUTION = 4, 22 | INVALID_VALUE = 5, 23 | 24 | // User error 25 | INPUT_DATA_ERROR = 10, 26 | CALL_BACK_STOP = 11, 27 | 28 | // Op Resize Error 29 | TENSOR_NOT_SUPPORT = 20, 30 | TENSOR_NEED_DIVIDE = 21, 31 | }; 32 | } // namespace MNN 33 | 34 | #endif /* ErrorCode_h */ 35 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/include/MNN/MNNDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // MNNDefine.h 3 | // MNN 4 | // 5 | // Created by MNN on 2018/08/09. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNNDefine_h 10 | #define MNNDefine_h 11 | 12 | #include 13 | #include 14 | 15 | #if defined(__APPLE__) 16 | #include 17 | #if TARGET_OS_IPHONE 18 | #define MNN_BUILD_FOR_IOS 19 | #endif 20 | #endif 21 | 22 | #ifdef MNN_USE_LOGCAT 23 | #include 24 | #define MNN_ERROR(format, ...) __android_log_print(ANDROID_LOG_ERROR, "MNNJNI", format, ##__VA_ARGS__) 25 | #define MNN_PRINT(format, ...) __android_log_print(ANDROID_LOG_INFO, "MNNJNI", format, ##__VA_ARGS__) 26 | #else 27 | #define MNN_PRINT(format, ...) printf(format, ##__VA_ARGS__) 28 | #define MNN_ERROR(format, ...) printf(format, ##__VA_ARGS__) 29 | #endif 30 | 31 | #ifdef DEBUG 32 | #define MNN_ASSERT(x) \ 33 | { \ 34 | int res = (x); \ 35 | if (!res) { \ 36 | MNN_ERROR("Error for %s, %d\n", __FILE__, __LINE__); \ 37 | assert(res); \ 38 | } \ 39 | } 40 | #else 41 | #define MNN_ASSERT(x) 42 | #endif 43 | 44 | #define FUNC_PRINT(x) MNN_PRINT(#x "=%d in %s, %d \n", x, __func__, __LINE__); 45 | #define FUNC_PRINT_ALL(x, type) MNN_PRINT(#x "=" #type " %" #type " in %s, %d \n", x, __func__, __LINE__); 46 | 47 | #define MNN_CHECK(success, log) \ 48 | if(!(success)){ \ 49 | MNN_ERROR("Check failed: %s ==> %s\n", #success, #log); \ 50 | } 51 | 52 | #if defined(_MSC_VER) 53 | #if defined(BUILDING_MNN_DLL) 54 | #define MNN_PUBLIC __declspec(dllexport) 55 | #elif defined(USING_MNN_DLL) 56 | #define MNN_PUBLIC __declspec(dllimport) 57 | #else 58 | #define MNN_PUBLIC 59 | #endif 60 | #else 61 | #define MNN_PUBLIC __attribute__((visibility("default"))) 62 | #endif 63 | 64 | #endif /* MNNDefine_h */ 65 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/include/MNN/MNNSharedContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // MNNSharedContext.h 3 | // MNN 4 | // 5 | // Created by MNN on 2018/10/11. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNNSharedContext_h 10 | #define MNNSharedContext_h 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include /*uint32_t*/ 16 | 17 | #ifndef VK_DEFINE_HANDLE 18 | #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; 19 | VK_DEFINE_HANDLE(VkInstance) 20 | VK_DEFINE_HANDLE(VkPhysicalDevice) 21 | VK_DEFINE_HANDLE(VkDevice) 22 | VK_DEFINE_HANDLE(VkQueue) 23 | #endif 24 | struct MNNVulkanContext { 25 | VkInstance pInstance; 26 | VkPhysicalDevice pPhysicalDevice; 27 | VkDevice pDevice; 28 | VkQueue pQueue; 29 | uint32_t iQueueFamilyIndex; 30 | }; 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* MNNSharedContext_h */ 36 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/include/MNN/expr/ExecutorScope.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExecutorScope.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2020/10/26. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNN_EXPR_EXECUTOR_SCOPE_HPP_ 10 | #define MNN_EXPR_EXECUTOR_SCOPE_HPP_ 11 | 12 | #include 13 | 14 | namespace MNN { 15 | namespace Express { 16 | 17 | struct MNN_PUBLIC ExecutorScope final { 18 | public: 19 | ExecutorScope() = delete; 20 | explicit ExecutorScope(const ExecutorScope&) = delete; 21 | explicit ExecutorScope(const std::shared_ptr& current); 22 | 23 | explicit ExecutorScope(const std::string& scope_name, 24 | const std::shared_ptr& current); 25 | 26 | virtual ~ExecutorScope(); 27 | 28 | static const std::shared_ptr Current(); 29 | }; 30 | 31 | } // namespace MNN 32 | } // namespace Express 33 | #endif // MNN_EXPR_EXECUTOR_SCOPE_HPP_ 34 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/include/MNN/expr/ExprCreator.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ExprCreator.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2019/06/27. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef ExprCreator_hpp 10 | #define ExprCreator_hpp 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/include/MNN/expr/Optimizer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Optimizer.hpp 3 | // MNN 4 | // 5 | // Created by MNN on 2019/08/20. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | #ifndef Optimizer_hpp 9 | #define Optimizer_hpp 10 | #include 11 | #include 12 | 13 | namespace MNN { 14 | namespace Express { 15 | class MNN_PUBLIC Optimizer { 16 | public: 17 | enum Device { 18 | CPU = 0, 19 | GPU = 1, 20 | OTHER = 2, 21 | AUTO = 3 22 | }; 23 | struct Config { 24 | Device device = CPU; 25 | MNNForwardType forwardType = MNN_FORWARD_ALL; 26 | int numThread = 4; 27 | }; 28 | static std::shared_ptr create(Config config); 29 | struct Cost { 30 | float compute; // MFlops 31 | float memory; // MB 32 | }; 33 | class Parameters { 34 | public: 35 | Parameters(int n); 36 | virtual ~Parameters(); 37 | 38 | float* get() const { 39 | return mValue; 40 | } 41 | int size() const { 42 | return mSize; 43 | } 44 | 45 | private: 46 | float* mValue; 47 | int mSize; 48 | }; 49 | virtual std::shared_ptr onGetParameters(const std::vector& outputs) { 50 | return nullptr; 51 | } 52 | 53 | //Given paramters and measure cost, the parameters must be the same as onGetParameters 54 | virtual Cost onMeasure(const std::vector& outputs, std::shared_ptr parameters = nullptr) = 0; 55 | 56 | //Modify the output directly, the parameters must be the same as onGetParameters 57 | virtual bool onExecute(const std::vector& outputs, std::shared_ptr parameters = nullptr) = 0; 58 | 59 | Optimizer() = default; 60 | virtual ~Optimizer() = default; 61 | }; 62 | } // namespace Express 63 | } // namespace MNN 64 | #endif 65 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/include/MNN/plugin/PluginShapeInference.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ShapeInference.h 3 | // MNN 4 | // 5 | // Created by MNN on 2020/04/05. 6 | // Copyright © 2018, Alibaba Group Holding Limited 7 | // 8 | 9 | #ifndef MNN_PLUGIN_PLUGIN_SHAPE_INFERENCE_HPP_ 10 | #define MNN_PLUGIN_PLUGIN_SHAPE_INFERENCE_HPP_ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace MNN { 19 | namespace plugin { 20 | 21 | class MNN_PUBLIC InferShapeKernel { 22 | public: 23 | virtual ~InferShapeKernel() = default; 24 | virtual bool compute(InferShapeContext* ctx) = 0; 25 | }; 26 | 27 | class MNN_PUBLIC InferShapeKernelRegister { 28 | public: 29 | // typedef InferShapeKernel* (*Factory)(); 30 | typedef std::function Factory; 31 | static std::unordered_map* getFactoryMap(); 32 | 33 | static bool add(const std::string& name, Factory factory); 34 | 35 | static InferShapeKernel* get(const std::string& name); 36 | }; 37 | 38 | template 39 | struct InferShapeKernelRegistrar { 40 | InferShapeKernelRegistrar(const std::string& name) { 41 | InferShapeKernelRegister::add(name, []() { // NOLINT 42 | return new PluginKernel; // NOLINT 43 | }); 44 | } 45 | }; 46 | 47 | #define REGISTER_PLUGIN_OP(name, inferShapeKernel) \ 48 | namespace { \ 49 | static auto _plugin_infer_shape_##name##_ __attribute__((unused)) = \ 50 | InferShapeKernelRegistrar(#name); \ 51 | } // namespace 52 | 53 | } // namespace plugin 54 | } // namespace MNN 55 | 56 | #endif // MNN_PLUGIN_PLUGIN_SHAPE_INFERENCE_HPP_ 57 | -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/lib/MNN.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/nce_alg/platform/host_mnn_windows/lib/MNN.dll -------------------------------------------------------------------------------- /nce_alg/platform/host_mnn_windows/lib/MNN.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/nce_alg/platform/host_mnn_windows/lib/MNN.lib -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_deconvolution_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for Deconvolution layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(DeconvolutionLayer): public ConvolutionLayer { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit DeconvolutionLayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit DeconvolutionLayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit DeconvolutionLayer(const Layer::CPtr& layer); 40 | }; 41 | IE_SUPPRESS_DEPRECATED_END 42 | 43 | } // namespace Builder 44 | } // namespace InferenceEngine 45 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_deformable_convolution_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for Deconvolution layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(DeformableConvolutionLayer): public ConvolutionLayer { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit DeformableConvolutionLayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit DeformableConvolutionLayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit DeformableConvolutionLayer(const Layer::CPtr& layer); 40 | /** 41 | * @brief Return deformable_group size 42 | * @return Deformable group size 43 | */ 44 | size_t getDeformableGroup() const; 45 | /** 46 | * @brief Sets deformable group size 47 | * @param deformableGroup Deformable group 48 | * @return reference to layer builder 49 | */ 50 | Builder::DeformableConvolutionLayer& setDeformableGroup(size_t deformableGroup); 51 | }; 52 | IE_SUPPRESS_DEPRECATED_END 53 | 54 | } // namespace Builder 55 | } // namespace InferenceEngine 56 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_elu_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for ELU layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(ELULayer): public LayerDecorator { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit ELULayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit ELULayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit ELULayer(const Layer::CPtr& layer); 40 | /** 41 | * @brief Sets the name for the layer 42 | * @param name Layer name 43 | * @return reference to layer builder 44 | */ 45 | ELULayer& setName(const std::string& name); 46 | 47 | /** 48 | * @brief Returns port with shapes for the layer 49 | * @return Port with shapes 50 | */ 51 | const Port& getPort() const; 52 | /** 53 | * @brief Sets port shapes for the layer 54 | * @param port Port with shapes 55 | * @return reference to layer builder 56 | */ 57 | ELULayer& setPort(const Port& port); 58 | 59 | /** 60 | * @brief Returns alpha 61 | * @return alpha 62 | */ 63 | float getAlpha() const; 64 | /** 65 | * @brief Sets alpha 66 | * @param alpha Alpha 67 | * @return reference to layer builder 68 | */ 69 | ELULayer& setAlpha(float alpha); 70 | }; 71 | IE_SUPPRESS_DEPRECATED_END 72 | 73 | } // namespace Builder 74 | } // namespace InferenceEngine 75 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_grn_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for GRN layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(GRNLayer): public LayerDecorator { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit GRNLayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit GRNLayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit GRNLayer(const Layer::CPtr& layer); 40 | /** 41 | * @brief Sets the name for the layer 42 | * @param name Layer name 43 | * @return reference to layer builder 44 | */ 45 | GRNLayer& setName(const std::string& name); 46 | 47 | /** 48 | * @brief Returns port with shapes for the layer 49 | * @return Port with shapes 50 | */ 51 | const Port& getPort() const; 52 | /** 53 | * @brief Sets port shapes for the layer 54 | * @param port Port with shapes 55 | * @return reference to layer builder 56 | */ 57 | GRNLayer& setPort(const Port& port); 58 | /** 59 | * @brief Returns beta 60 | * @return Beta 61 | */ 62 | float getBeta() const; 63 | /** 64 | * @brief Sets beta 65 | * @param beta Beta 66 | * @return reference to layer builder 67 | */ 68 | GRNLayer& setBeta(float beta); 69 | }; 70 | IE_SUPPRESS_DEPRECATED_END 71 | 72 | } // namespace Builder 73 | } // namespace InferenceEngine 74 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_input_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for Input layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(InputLayer): public LayerDecorator { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit InputLayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit InputLayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit InputLayer(const Layer::CPtr& layer); 40 | 41 | /** 42 | * @brief Sets the name for the layer 43 | * @param name Layer name 44 | * @return reference to layer builder 45 | */ 46 | InputLayer& setName(const std::string& name); 47 | 48 | /** 49 | * @brief Returns port with shapes for the layer 50 | * @return Port with shapes 51 | */ 52 | const Port& getPort() const; 53 | /** 54 | * @brief Sets port shapes for the layer 55 | * @param port Port with shapes 56 | * @return reference to layer builder 57 | */ 58 | InputLayer& setPort(const Port& port); 59 | }; 60 | IE_SUPPRESS_DEPRECATED_END 61 | 62 | } // namespace Builder 63 | } // namespace InferenceEngine 64 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_output_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for Output layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(OutputLayer): public LayerDecorator { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit OutputLayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit OutputLayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit OutputLayer(const Layer::CPtr& layer); 40 | /** 41 | * @brief Sets the name for the layer 42 | * @param name Layer name 43 | * @return reference to layer builder 44 | */ 45 | OutputLayer& setName(const std::string& name); 46 | 47 | /** 48 | * @brief Returns port with shapes for the layer 49 | * @return Port with shapes 50 | */ 51 | const Port& getPort() const; 52 | /** 53 | * @brief Sets port shapes for the layer 54 | * @param port Port with shapes 55 | * @return reference to layer builder 56 | */ 57 | OutputLayer& setPort(const Port& port); 58 | }; 59 | IE_SUPPRESS_DEPRECATED_END 60 | 61 | } // namespace Builder 62 | } // namespace InferenceEngine 63 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_relu6_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for ReLU6 layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(ReLU6Layer): public LayerDecorator { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit ReLU6Layer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit ReLU6Layer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit ReLU6Layer(const Layer::CPtr& layer); 40 | /** 41 | * @brief Sets the name for the layer 42 | * @param name Layer name 43 | * @return reference to layer builder 44 | */ 45 | ReLU6Layer& setName(const std::string& name); 46 | 47 | /** 48 | * @brief Returns port with shapes for the layer 49 | * @return Port with shapes 50 | */ 51 | const Port& getPort() const; 52 | /** 53 | * @brief Sets port shapes for the layer 54 | * @param port Port with shapes 55 | * @return reference to layer builder 56 | */ 57 | ReLU6Layer& setPort(const Port& port); 58 | 59 | /** 60 | * @brief Returns N value 61 | * @return N 62 | */ 63 | float getN() const; 64 | /** 65 | * @brief Sets N value 66 | * @param n N value (6 by default) 67 | * @return reference to layer builder 68 | */ 69 | ReLU6Layer& setN(float n); 70 | }; 71 | IE_SUPPRESS_DEPRECATED_END 72 | 73 | } // namespace Builder 74 | } // namespace InferenceEngine 75 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_scale_shift_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for ScaleShift layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(ScaleShiftLayer): public LayerDecorator { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit ScaleShiftLayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit ScaleShiftLayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit ScaleShiftLayer(const Layer::CPtr& layer); 40 | /** 41 | * @brief Sets the name for the layer 42 | * @param name Layer name 43 | * @return reference to layer builder 44 | */ 45 | ScaleShiftLayer& setName(const std::string& name); 46 | 47 | /** 48 | * @brief Returns port with shapes for the layer 49 | * @return Port with shapes 50 | */ 51 | const Port& getPort() const; 52 | /** 53 | * @brief Sets port shapes for the layer 54 | * @param port Port with shapes 55 | * @return reference to layer builder 56 | */ 57 | ScaleShiftLayer& setPort(const Port& port); 58 | }; 59 | IE_SUPPRESS_DEPRECATED_END 60 | 61 | } // namespace Builder 62 | } // namespace InferenceEngine 63 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_sigmoid_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for Sigmoid layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(SigmoidLayer): public LayerDecorator { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit SigmoidLayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit SigmoidLayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit SigmoidLayer(const Layer::CPtr& layer); 40 | /** 41 | * @brief Sets the name for the layer 42 | * @param name Layer name 43 | * @return reference to layer builder 44 | */ 45 | SigmoidLayer& setName(const std::string& name); 46 | 47 | /** 48 | * @brief Returns port with shapes for the layer 49 | * @return Port with shapes 50 | */ 51 | const Port& getPort() const; 52 | /** 53 | * @brief Sets port shapes for the layer 54 | * @param port Port with shapes 55 | * @return reference to layer builder 56 | */ 57 | SigmoidLayer& setPort(const Port& port); 58 | }; 59 | IE_SUPPRESS_DEPRECATED_END 60 | 61 | } // namespace Builder 62 | } // namespace InferenceEngine 63 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_softmax_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for SoftMax layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(SoftMaxLayer): public LayerDecorator { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit SoftMaxLayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit SoftMaxLayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit SoftMaxLayer(const Layer::CPtr& layer); 40 | /** 41 | * @brief Sets the name for the layer 42 | * @param name Layer name 43 | * @return reference to layer builder 44 | */ 45 | SoftMaxLayer& setName(const std::string& name); 46 | 47 | /** 48 | * @brief Returns port with shapes for the layer 49 | * @return Port with shapes 50 | */ 51 | const Port& getPort() const; 52 | /** 53 | * @brief Sets port shapes for the layer 54 | * @param port Port with shapes 55 | * @return reference to layer builder 56 | */ 57 | SoftMaxLayer& setPort(const Port& port); 58 | /** 59 | * @brief Returns axis 60 | * @return Axis 61 | */ 62 | size_t getAxis() const; 63 | /** 64 | * @brief Sets axis 65 | * @param axis Axis 66 | * @return reference to layer builder 67 | */ 68 | SoftMaxLayer& setAxis(size_t axis); 69 | }; 70 | IE_SUPPRESS_DEPRECATED_END 71 | 72 | } // namespace Builder 73 | } // namespace InferenceEngine 74 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/builders/ie_tanh_layer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace InferenceEngine { 16 | namespace Builder { 17 | 18 | /** 19 | * @deprecated Use ngraph API instead. 20 | * @brief The class represents a builder for TanH layer 21 | */ 22 | IE_SUPPRESS_DEPRECATED_START 23 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(TanHLayer): public LayerDecorator { 24 | public: 25 | /** 26 | * @brief The constructor creates a builder with the name 27 | * @param name Layer name 28 | */ 29 | explicit TanHLayer(const std::string& name = ""); 30 | /** 31 | * @brief The constructor creates a builder from generic builder 32 | * @param layer pointer to generic builder 33 | */ 34 | explicit TanHLayer(const Layer::Ptr& layer); 35 | /** 36 | * @brief The constructor creates a builder from generic builder 37 | * @param layer constant pointer to generic builder 38 | */ 39 | explicit TanHLayer(const Layer::CPtr& layer); 40 | /** 41 | * @brief Sets the name for the layer 42 | * @param name Layer name 43 | * @return reference to layer builder 44 | */ 45 | TanHLayer& setName(const std::string& name); 46 | 47 | /** 48 | * @brief Returns port with shapes for the layer 49 | * @return Port with shapes 50 | */ 51 | const Port& getPort() const; 52 | /** 53 | * @brief Sets port shapes for the layer 54 | * @param port Port with shapes 55 | * @return reference to layer builder 56 | */ 57 | TanHLayer& setPort(const Port& port); 58 | }; 59 | IE_SUPPRESS_DEPRECATED_END 60 | 61 | } // namespace Builder 62 | } // namespace InferenceEngine 63 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/cpp/ie_memory_state.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @file 7 | */ 8 | 9 | #pragma once 10 | #include 11 | 12 | namespace InferenceEngine { 13 | 14 | /** 15 | * @brief C++ exception based error reporting wrapper of API class IMemoryState 16 | */ 17 | class MemoryState { 18 | IMemoryState::Ptr actual = nullptr; 19 | 20 | public: 21 | /** 22 | * constructs MemoryState from the initialized shared_pointer 23 | * @param pState Initialized shared pointer 24 | */ 25 | explicit MemoryState(IMemoryState::Ptr pState): actual(pState) { 26 | if (actual == nullptr) { 27 | THROW_IE_EXCEPTION << "MemoryState wrapper was not initialized."; 28 | } 29 | } 30 | 31 | /** 32 | * @copybrief IMemoryState::Reset 33 | * 34 | * Wraps IMemoryState::Reset 35 | */ 36 | void Reset() { 37 | CALL_STATUS_FNC_NO_ARGS(Reset); 38 | } 39 | 40 | /** 41 | * @copybrief IMemoryState::GetName 42 | * 43 | * Wraps IMemoryState::GetName 44 | * @return A string representing a state name 45 | */ 46 | std::string GetName() const { 47 | char name[256]; 48 | CALL_STATUS_FNC(GetName, name, sizeof(name)); 49 | return name; 50 | } 51 | 52 | /** 53 | * @copybrief IMemoryState::GetLastState 54 | * 55 | * Wraps IMemoryState::GetLastState 56 | * @return A blob representing a last state 57 | */ 58 | Blob::CPtr GetLastState() const { 59 | Blob::CPtr stateBlob; 60 | CALL_STATUS_FNC(GetLastState, stateBlob); 61 | return stateBlob; 62 | } 63 | 64 | /** 65 | * @copybrief IMemoryState::SetState 66 | * 67 | * Wraps IMemoryState::SetState 68 | * @param state The current state to set 69 | */ 70 | void SetState(Blob::Ptr state) { 71 | CALL_STATUS_FNC(SetState, state); 72 | } 73 | }; 74 | 75 | } // namespace InferenceEngine -------------------------------------------------------------------------------- /nce_alg/platform/openvino/details/ie_cnn_network_tools.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header file for CNNNetwork tools 7 | * 8 | * @file ie_cnn_network_tools.h 9 | */ 10 | #pragma once 11 | #include 12 | 13 | #include "ie_common.h" 14 | #include "ie_icnn_network.hpp" 15 | 16 | namespace InferenceEngine { 17 | namespace details { 18 | 19 | INFERENCE_ENGINE_API_CPP(std::vector) CNNNetSortTopologically(const ICNNNetwork& network); 20 | 21 | } // namespace details 22 | } // namespace InferenceEngine 23 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/details/ie_irelease.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header file for the Inference Engine plugins destruction mechanism 7 | * 8 | * @file ie_irelease.hpp 9 | */ 10 | #pragma once 11 | 12 | #include 13 | 14 | #include "ie_api.h" 15 | #include "ie_no_copy.hpp" 16 | 17 | namespace InferenceEngine { 18 | namespace details { 19 | /** 20 | * @brief This class is used for objects allocated by a shared module (in *.so) 21 | */ 22 | class IRelease : public no_copy { 23 | public: 24 | /** 25 | * @brief Releases current allocated object and all related resources. 26 | * Once this method is called, the pointer to this interface is no longer valid 27 | */ 28 | virtual void Release() noexcept = 0; 29 | 30 | protected: 31 | /** 32 | * @brief Default destructor 33 | */ 34 | ~IRelease() override = default; 35 | }; 36 | 37 | IE_SUPPRESS_DEPRECATED_START 38 | 39 | template 40 | inline std::shared_ptr shared_from_irelease(T* ptr) { 41 | IE_SUPPRESS_DEPRECATED_START 42 | std::shared_ptr pointer(ptr, [](IRelease* p) { 43 | if (p) 44 | p->Release(); 45 | }); 46 | IE_SUPPRESS_DEPRECATED_END 47 | return pointer; 48 | } 49 | 50 | IE_SUPPRESS_DEPRECATED_END 51 | 52 | } // namespace details 53 | } // namespace InferenceEngine 54 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/details/ie_no_copy.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief header file for no_copy class 7 | * 8 | * @file ie_no_copy.hpp 9 | */ 10 | #pragma once 11 | 12 | namespace InferenceEngine { 13 | namespace details { 14 | /** 15 | * @brief This class is used for objects returned from the shared library factory to prevent copying 16 | */ 17 | class no_copy { 18 | protected: 19 | /** 20 | * @brief A default constructor 21 | */ 22 | no_copy() = default; 23 | 24 | /** 25 | * @brief A default destructor 26 | */ 27 | virtual ~no_copy() = default; 28 | 29 | /** 30 | * @brief A removed copy constructor 31 | */ 32 | no_copy(no_copy const&) = delete; 33 | 34 | /** 35 | * @brief A removed assign operator 36 | */ 37 | no_copy& operator=(no_copy const&) = delete; 38 | 39 | /** 40 | * @brief A removed move constructor 41 | */ 42 | no_copy(no_copy&&) = delete; 43 | 44 | /** 45 | * @brief A removed move operator 46 | */ 47 | no_copy& operator=(no_copy&&) = delete; 48 | }; 49 | } // namespace details 50 | } // namespace InferenceEngine 51 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/details/ie_no_release.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief Utility header file. Provides no release base class 7 | * 8 | * @file ie_no_release.hpp 9 | */ 10 | #pragma once 11 | 12 | namespace InferenceEngine { 13 | namespace details { 14 | 15 | /** 16 | * @brief prevent Release method from being called on specific objects 17 | */ 18 | template 19 | class NoReleaseOn : public T { 20 | private: 21 | void Release() noexcept = 0; 22 | }; 23 | 24 | } // namespace details 25 | } // namespace InferenceEngine -------------------------------------------------------------------------------- /nce_alg/platform/openvino/details/ie_so_loader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header file for definition of abstraction over platform specific shared objects 7 | * 8 | * @file ie_so_loader.h 9 | */ 10 | #pragma once 11 | 12 | #ifndef _WIN32 13 | #include "os/lin_shared_object_loader.h" 14 | #else 15 | #include "os/win_shared_object_loader.h" 16 | #endif 17 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/details/os/os_filesystem.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief This is a header file with functions related to filesystem operations 7 | * 8 | * @file os_filesystem.hpp 9 | */ 10 | #pragma once 11 | 12 | #include 13 | 14 | #ifdef ENABLE_UNICODE_PATH_SUPPORT 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | 21 | namespace InferenceEngine { 22 | namespace details { 23 | 24 | template 25 | using enableIfSupportedChar = typename std::enable_if<(std::is_same::value || std::is_same::value)>::type; 26 | 27 | #ifdef ENABLE_UNICODE_PATH_SUPPORT 28 | 29 | /** 30 | * @brief Conversion from wide character string to a single-byte chain. 31 | */ 32 | inline const std::string wStringtoMBCSstringChar(const std::wstring& wstr) { 33 | std::wstring_convert> wstring_decoder; 34 | return wstring_decoder.to_bytes(wstr); 35 | } 36 | 37 | /** 38 | * @brief Conversion from single-byte chain to wide character string. 39 | */ 40 | inline const std::wstring multiByteCharToWString(const char* str) { 41 | std::wstring_convert> wstring_encoder; 42 | std::wstring result = wstring_encoder.from_bytes(str); 43 | return result; 44 | } 45 | 46 | #endif // ENABLE_UNICODE_PATH_SUPPORT 47 | 48 | } // namespace details 49 | } // namespace InferenceEngine 50 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/gpu/gpu_ocl_wrapper.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief a header that defines wrappers for internal GPU plugin-specific 7 | * OpenCL context and OpenCL shared memory blobs 8 | * 9 | * @file gpu_context_api_ocl.hpp 10 | */ 11 | #pragma once 12 | 13 | /** 14 | * @brief Definitions required by Khronos headers 15 | */ 16 | #define CL_HPP_ENABLE_EXCEPTIONS 17 | #define CL_HPP_MINIMUM_OPENCL_VERSION 120 18 | #define CL_HPP_TARGET_OPENCL_VERSION 120 19 | 20 | #if defined __GNUC__ 21 | # pragma GCC system_header 22 | #endif 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/hetero/hetero_plugin_config.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header that defines advanced related properties for Heterogeneous plugins. 7 | * These properties should be used in SetConfig() and LoadNetwork() methods of plugins 8 | * 9 | * @file hetero_plugin_config.hpp 10 | */ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | #include "ie_plugin_config.hpp" 18 | 19 | namespace InferenceEngine { 20 | 21 | /** 22 | * @brief Heterogeneous plugin configuration 23 | */ 24 | namespace HeteroConfigParams { 25 | 26 | /** 27 | * @def HETERO_CONFIG_KEY(name) 28 | * @brief Shortcut for defining HETERO configuration keys 29 | */ 30 | #define HETERO_CONFIG_KEY(name) InferenceEngine::HeteroConfigParams::_CONFIG_KEY(HETERO_##name) 31 | #define DECLARE_HETERO_CONFIG_KEY(name) DECLARE_CONFIG_KEY(HETERO_##name) 32 | #define DECLARE_HETERO_CONFIG_VALUE(name) DECLARE_CONFIG_VALUE(HETERO_##name) 33 | 34 | /** 35 | * @brief The key for enabling of dumping the topology with details of layers and details how 36 | * this network would be executed on different devices to the disk in GraphViz format. 37 | * This option should be used with values: CONFIG_VALUE(NO) (default) or CONFIG_VALUE(YES) 38 | */ 39 | DECLARE_HETERO_CONFIG_KEY(DUMP_GRAPH_DOT); 40 | 41 | } // namespace HeteroConfigParams 42 | } // namespace InferenceEngine 43 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/ie_context.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief This is a header file for the IE Context class 7 | * 8 | * @file ie_context.hpp 9 | */ 10 | #pragma once 11 | 12 | #include 13 | 14 | #include
15 | #include 16 | #include 17 | #include 18 | 19 | namespace InferenceEngine { 20 | 21 | /** 22 | * @deprecated Use ngraph API instead. 23 | * @brief This class implements object 24 | */ 25 | class INFERENCE_ENGINE_NN_BUILDER_API_CLASS(Context) { 26 | public: 27 | Context(); 28 | 29 | /** 30 | * @brief Registers extension within the context 31 | * 32 | * @param ext Pointer to already loaded extension 33 | */ 34 | void addExtension(const IShapeInferExtensionPtr& ext); 35 | 36 | /** 37 | * @brief Registers Shape Infer implementation within the Context 38 | * 39 | * @param type Layer type 40 | * @param impl Shape Infer implementation 41 | */ 42 | IE_SUPPRESS_DEPRECATED_START 43 | void addShapeInferImpl(const std::string& type, const IShapeInferImpl::Ptr& impl); 44 | 45 | /** 46 | * @brief Returns the shape infer implementation by layer type 47 | * 48 | * @param type Layer type 49 | * @return Shape Infer implementation 50 | */ 51 | IShapeInferImpl::Ptr getShapeInferImpl(const std::string& type); 52 | 53 | private: 54 | details::caseless_map shapeInferImpls; 55 | IE_SUPPRESS_DEPRECATED_END 56 | }; 57 | 58 | } // namespace InferenceEngine 59 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/ie_error.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header file for a plugin logging mechanism 7 | * 8 | * @file ie_error.hpp 9 | */ 10 | #pragma once 11 | 12 | namespace InferenceEngine { 13 | /** 14 | * @deprecated IErrorListener is not used anymore. An exception is thrown / StatusCode set in case of any unexpected situations 15 | * @brief This class represents a custom error listener. 16 | */ 17 | class 18 | INFERENCE_ENGINE_DEPRECATED("IErrorListener is not used anymore. An exception is thrown / StatusCode set in case of any unexpected situations") 19 | IErrorListener { 20 | public: 21 | /** 22 | * @brief The plugin calls this method with a null terminated error message (in case of error) 23 | * @param msg Error message 24 | */ 25 | virtual void onError(const char* msg) noexcept = 0; 26 | }; 27 | } // namespace InferenceEngine 28 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/ie_plugin_dispatcher.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header for a class to handle plugin loading. 7 | * 8 | * @file ie_plugin_dispatcher.hpp 9 | */ 10 | #pragma once 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include "ie_plugin_ptr.hpp" 17 | 18 | namespace InferenceEngine { 19 | 20 | /** 21 | * @deprecated Use InferenceEngine::Core instead. Will be removed in 2020.3 22 | * @brief This is a class to load a suitable plugin 23 | */ 24 | class INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::Core instead which dispatches plugin automatically." 25 | "Will be removed in 2020.3") INFERENCE_ENGINE_API_CLASS(PluginDispatcher) { 26 | public: 27 | /** 28 | * @brief A constructor 29 | * 30 | * @param pp Vector of paths to plugin directories 31 | */ 32 | explicit PluginDispatcher(const std::vector& pp = {file_name_t()}); 33 | 34 | IE_SUPPRESS_DEPRECATED_START 35 | 36 | /** 37 | * @brief Loads a plugin from plugin directories 38 | * 39 | * @param name Plugin name 40 | * @return A pointer to the loaded plugin 41 | */ 42 | virtual InferencePlugin getPluginByName(const file_name_t& name) const; 43 | 44 | /** 45 | * @deprecated Use InferenceEngine::Core to work with devices by name 46 | * @brief Loads a plugin from directories that is suitable for the device string 47 | * 48 | * @param deviceName A string value representing target device 49 | * @return A pointer to the plugin 50 | */ 51 | InferencePlugin getPluginByDevice(const std::string& deviceName) const; 52 | 53 | IE_SUPPRESS_DEPRECATED_END 54 | 55 | protected: 56 | /** 57 | * @brief Creates path to the plugin 58 | * 59 | * @param path Path to the plugin 60 | * @param input Plugin name 61 | * @return The path to the plugin 62 | */ 63 | file_name_t make_plugin_name(const file_name_t& path, const file_name_t& input) const; 64 | 65 | private: 66 | std::vector pluginDirs; 67 | }; 68 | } // namespace InferenceEngine 69 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/ie_plugin_ptr.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header file contains a wrapper class for handling plugin instantiation and releasing resources 7 | * 8 | * @file ie_plugin_ptr.hpp 9 | */ 10 | #pragma once 11 | 12 | #include 13 | 14 | #include "details/ie_so_pointer.hpp" 15 | #include "ie_extension.h" 16 | #include "ie_plugin.hpp" 17 | 18 | namespace InferenceEngine { 19 | namespace details { 20 | 21 | IE_SUPPRESS_DEPRECATED_START 22 | 23 | /** 24 | * @deprecated Use InferenceEngine::Core instead. 25 | * @brief This class defines the name of the fabric for creating an IInferencePlugin object in DLL 26 | */ 27 | template <> 28 | class INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::Core instead") SOCreatorTrait { 29 | public: 30 | /** 31 | * @brief A name of the fabric for creating IInferencePlugin object in DLL 32 | */ 33 | static constexpr auto name = "CreatePluginEngine"; 34 | }; 35 | 36 | } // namespace details 37 | 38 | /** 39 | * @brief A C++ helper to work with objects created by the plugin. 40 | * 41 | * Implements different interfaces. 42 | */ 43 | using InferenceEnginePluginPtr = InferenceEngine::details::SOPointer; 44 | 45 | IE_SUPPRESS_DEPRECATED_END 46 | 47 | } // namespace InferenceEngine 48 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/ie_primitive_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header file for the PrimitiveInfo struct 7 | * 8 | * @file ie_primitive_info.hpp 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "ie_tensor_info.hpp" 19 | 20 | namespace InferenceEngine { 21 | 22 | /** 23 | * @deprecated Use ExecutableNetwork::GetExecGraphInfo to get information about an internal graph. 24 | * @brief Structure with information about Primitive 25 | */ 26 | struct INFERENCE_ENGINE_DEPRECATED("Use ExecutableNetwork::GetExecGraphInfo to get information about an internal graph") PrimitiveInfo { 27 | /** 28 | * @brief A shared pointer to PrimitiveInfo object 29 | */ 30 | IE_SUPPRESS_DEPRECATED_START 31 | using Ptr = std::shared_ptr; 32 | IE_SUPPRESS_DEPRECATED_END 33 | 34 | /** 35 | * @brief Some internal id, could be used as a name 36 | */ 37 | std::string sId; 38 | 39 | /** 40 | * @brief Implementation type of this kernel 41 | */ 42 | std::string sType; 43 | 44 | /** 45 | * @brief Mainly the allocation of the output tensor 46 | */ 47 | int iPreAllocatedMemory; 48 | 49 | IE_SUPPRESS_DEPRECATED_START 50 | 51 | /** 52 | * @brief Vector of TensorInfo objects that are related to input tensors 53 | */ 54 | std::vector inputs; 55 | 56 | /** 57 | * @brief Vector of TensorInfo object that are related to outputs tensors 58 | */ 59 | std::vector outputs; 60 | 61 | IE_SUPPRESS_DEPRECATED_END 62 | 63 | /** 64 | * @brief Any other important textual information user might find interesting about this kernel 65 | */ 66 | std::map extraInfo; 67 | }; 68 | 69 | } // namespace InferenceEngine 70 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/ie_tensor_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header file for the TensorInfo structure 7 | * 8 | * @file ie_tensor_info.hpp 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | namespace InferenceEngine { 20 | 21 | /** 22 | * @deprecated Use ExecutableNetwork::GetExecGraphInfo to get information about an internal graph. 23 | * @struct TensorInfo 24 | * @brief This structure describes tensor information 25 | */ 26 | struct INFERENCE_ENGINE_DEPRECATED("Use ExecutableNetwork::GetExecGraphInfo to get information about an internal graph") TensorInfo { 27 | /** 28 | * @brief A shared pointer to the TensorInfo object 29 | */ 30 | IE_SUPPRESS_DEPRECATED_START 31 | using Ptr = std::shared_ptr; 32 | IE_SUPPRESS_DEPRECATED_END 33 | 34 | /** 35 | * @brief A map of extra info: 36 | * - memory layout BFYX, BXYF (enum) 37 | * - size 38 | * - precision 39 | */ 40 | std::map extraInfo; 41 | }; 42 | 43 | } // namespace InferenceEngine 44 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/ie_unicode.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief This is a header file with common inference engine definitions 7 | * 8 | * @file ie_unicode.hpp 9 | */ 10 | #pragma once 11 | 12 | #include 13 | #include 14 | #include
15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #ifdef UNICODE 21 | typedef wchar_t tchar; 22 | typedef std::wstring file_name_t; 23 | #else 24 | typedef char tchar; 25 | typedef std::string file_name_t; 26 | #endif 27 | 28 | namespace InferenceEngine { 29 | 30 | /** 31 | * @brief Conversion from possibly-wide character string to a single-byte chain. 32 | */ 33 | inline std::string fileNameToString(const file_name_t& str) { 34 | #ifdef UNICODE 35 | size_t maxlen = (str.length() + 1) * sizeof(wchar_t) / sizeof(char); 36 | std::vector mbstr(maxlen); 37 | mbstr[0] = 0; 38 | std::wcstombs(&mbstr[0], str.c_str(), maxlen); 39 | std::string res = std::string(&mbstr[0]); 40 | return res; 41 | #else 42 | return str; 43 | #endif 44 | } 45 | 46 | /** 47 | * @brief Conversion from single-byte character string to a possibly-wide one 48 | */ 49 | inline file_name_t stringToFileName(const std::string& str) { 50 | #ifdef UNICODE 51 | size_t maxlen = str.length() + 1; 52 | std::vector wcstr(maxlen); 53 | wcstr[0] = 0; 54 | std::mbstowcs(&wcstr[0], str.c_str(), maxlen); 55 | file_name_t res = file_name_t(&wcstr[0]); 56 | return res; 57 | #else 58 | return str; 59 | #endif 60 | } 61 | 62 | } // namespace InferenceEngine 63 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/ie_version.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header file that provides versioning information for the inference engine shared library 7 | * 8 | * @file ie_version.hpp 9 | */ 10 | #pragma once 11 | 12 | #include "ie_api.h" 13 | 14 | namespace InferenceEngine { 15 | 16 | /** 17 | * @struct Version 18 | * @brief Represents version information that describes plugins and the inference engine runtime library 19 | */ 20 | #pragma pack(push, 1) 21 | struct Version { 22 | /** 23 | * @brief An API version reflects the set of supported features 24 | */ 25 | struct { 26 | int major; 27 | int minor; 28 | } apiVersion; 29 | /** 30 | * @brief A null terminated string with build number 31 | */ 32 | const char* buildNumber; 33 | /** 34 | * @brief A null terminated description string 35 | */ 36 | const char* description; 37 | }; 38 | #pragma pack(pop) 39 | 40 | /** 41 | * @brief Gets the current Inference Engine version 42 | * 43 | * @return The current Inference Engine version 44 | */ 45 | INFERENCE_ENGINE_API(const Version*) GetInferenceEngineVersion() noexcept; 46 | 47 | } // namespace InferenceEngine 48 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/multi-device/multi_device_config.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header that defines advanced related properties for Multi_Device plugin. 7 | * These properties should be used in SetConfig() and LoadNetwork() methods 8 | * 9 | * @file multi_device_config.hpp 10 | */ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include "ie_plugin_config.hpp" 16 | 17 | namespace InferenceEngine { 18 | 19 | /** 20 | * @brief Multi Device plugin configuration 21 | */ 22 | namespace MultiDeviceConfigParams { 23 | 24 | /** 25 | * @def MULTI_CONFIG_KEY(name) 26 | * @brief A macro which provides a MULTI-mangled name for configuration key with name `name` 27 | */ 28 | #define MULTI_CONFIG_KEY(name) InferenceEngine::MultiDeviceConfigParams::_CONFIG_KEY(MULTI_##name) 29 | 30 | #define DECLARE_MULTI_CONFIG_KEY(name) DECLARE_CONFIG_KEY(MULTI_##name) 31 | #define DECLARE_MULTI_CONFIG_VALUE(name) DECLARE_CONFIG_VALUE(MULTI_##name) 32 | 33 | /** 34 | * @brief Device Priorities config option, with comma-separated devices listed in the desired priority 35 | */ 36 | DECLARE_MULTI_CONFIG_KEY(DEVICE_PRIORITIES); 37 | 38 | } // namespace MultiDeviceConfigParams 39 | } // namespace InferenceEngine 40 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/openvino.cmake: -------------------------------------------------------------------------------- 1 | add_definitions(-DPLATFORM=${PLATFORM}) 2 | 3 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/openvino/) 4 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/openvino/common/) 5 | 6 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/alg/engine_manager/openvino_backend/ OPENVINO_SRC) 7 | 8 | #设置hisi3516dv300所需源文件 9 | set(PLATFORM_SRC ${OPENVINO_SRC}) 10 | 11 | #设置hisi3516dv300所需库文件 12 | set(PLATFORM_LIB 13 | "${PROJECT_SOURCE_DIR}/platform/openvino/lib/openvino_2020_3/lib/x64/${CMAKE_BUILD_TYPE}/static/inference_engine${CMAKE_BUILD_TYPE_POSTFIX}.lib" 14 | "${PROJECT_SOURCE_DIR}/platform/openvino/lib/openvino_2020_3/lib/x64/${CMAKE_BUILD_TYPE}/static/inference_engine_legacy${CMAKE_BUILD_TYPE_POSTFIX}.lib" 15 | "${PROJECT_SOURCE_DIR}/platform/openvino/lib/openvino_2020_3/lib/x64/${CMAKE_BUILD_TYPE}/static/inference_engine_c_api${CMAKE_BUILD_TYPE_POSTFIX}.lib" 16 | "${PROJECT_SOURCE_DIR}/platform/openvino/lib/openvino_2020_3/lib/x64/${CMAKE_BUILD_TYPE}/static/inference_engine_nn_builder${CMAKE_BUILD_TYPE_POSTFIX}.lib" 17 | ) 18 | 19 | 20 | -------------------------------------------------------------------------------- /nce_alg/platform/openvino/vpu/myriad_plugin_config.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018-2020 Intel Corporation 2 | // SPDX-License-Identifier: Apache-2.0 3 | // 4 | 5 | /** 6 | * @brief A header that defines advanced related properties for VPU plugins. 7 | * These properties should be used in SetConfig() and LoadNetwork() methods of plugins 8 | * 9 | * @file 10 | */ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | #include "ie_plugin_config.hpp" 17 | #include "ie_api.h" 18 | 19 | /** 20 | * @def VPU_MYRIAD_CONFIG_KEY(name) 21 | * @brief Shortcut for defining VPU MYRIAD configuration key 22 | */ 23 | #define VPU_MYRIAD_CONFIG_KEY(name) InferenceEngine::VPUConfigParams::_CONFIG_KEY(VPU_MYRIAD_##name) 24 | /** 25 | * @def VPU_MYRIAD_CONFIG_VALUE(name) 26 | * @brief Shortcut for defining VPU MYRIAD configuration value 27 | */ 28 | #define VPU_MYRIAD_CONFIG_VALUE(name) InferenceEngine::VPUConfigParams::VPU_MYRIAD_##name 29 | 30 | #define DECLARE_VPU_MYRIAD_CONFIG_KEY(name) DECLARE_CONFIG_KEY(VPU_MYRIAD_##name) 31 | #define DECLARE_VPU_MYRIAD_CONFIG_VALUE(name) DECLARE_CONFIG_VALUE(VPU_MYRIAD_##name) 32 | 33 | namespace InferenceEngine { 34 | 35 | namespace VPUConfigParams { 36 | 37 | /** 38 | * @brief The flag to reset stalled devices: CONFIG_VALUE(YES) or CONFIG_VALUE(NO) (default) 39 | * This is a plugin scope option and must be used with the plugin's SetConfig method 40 | */ 41 | DECLARE_VPU_MYRIAD_CONFIG_KEY(FORCE_RESET); 42 | 43 | /** 44 | * @brief This option allows to specify device. 45 | * If specified device is not available then creating infer request will throw an exception. 46 | */ 47 | DECLARE_VPU_MYRIAD_CONFIG_KEY(PLATFORM); 48 | 49 | /** 50 | * @brief Supported keys definition for VPU_MYRIAD_CONFIG_KEY(PLATFORM) option. 51 | */ 52 | DECLARE_VPU_MYRIAD_CONFIG_VALUE(2450); 53 | DECLARE_VPU_MYRIAD_CONFIG_VALUE(2480); 54 | 55 | } // namespace VPUConfigParams 56 | 57 | } // namespace InferenceEngine 58 | -------------------------------------------------------------------------------- /nce_alg/platform/rv1126/lib/librknn_api.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/nce_alg/platform/rv1126/lib/librknn_api.so -------------------------------------------------------------------------------- /nce_alg/platform/rv1126/rv1126.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -Os") 4 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Os") 5 | SET(HISI_4096 1.0f) 6 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/rv1126/include/) 7 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/rv1126/) 8 | 9 | AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/alg/engine_manager/rv1126/ ENGINE_RV1126_SRC) 10 | 11 | 12 | 13 | #设置hisi3516dv300所需源文件 14 | set(PLATFORM_SRC 15 | ${ENGINE_RV1126_SRC}) 16 | 17 | #设置hisi3516dv300所需库文件 18 | set(PLATFORM_LIB 19 | -lrknn_api 20 | -ldl 21 | -lpthread 22 | -lm 23 | -lrt 24 | ) 25 | 26 | link_directories(${PROJECT_SOURCE_DIR}/platform/rv1126/lib) 27 | -------------------------------------------------------------------------------- /third-party/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(ExternalProject) 2 | add_subdirectory(yaml) 3 | -------------------------------------------------------------------------------- /third-party/modules.cmake: -------------------------------------------------------------------------------- 1 | #include module for include_dir and link_dir and lib_name 2 | include(module_yaml) 3 | #include(XXX) 4 | 5 | 6 | 7 | #for target link 8 | set(THIRD_PARTY_LIB 9 | ${YAML_LIB} 10 | ) 11 | 12 | set(THIRD_PARTY_NEED 13 | build-yaml 14 | #build-xxx 15 | ) -------------------------------------------------------------------------------- /third-party/modules/module_yaml.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | ################################################################ 4 | if(CMAKE_BUILD_TYPE MATCHES "Debug") 5 | #set(YAML_LIB yaml-cpp) 6 | set(YAML_LIB yaml-cppd) 7 | endif() 8 | if(CMAKE_BUILD_TYPE MATCHES "Release") 9 | set(YAML_LIB yaml-cpp) 10 | endif() 11 | 12 | message("YAML_BUILD_TYPE IS ${CMAKE_BUILD_TYPE}") 13 | include_directories(${YAMLCPP_HEADER_DIR}) 14 | link_directories(${YAMLCPP_LINK_DIR}) 15 | 16 | ################################################################ -------------------------------------------------------------------------------- /third-party/yaml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(yaml) 2 | ExternalProject_Add(build-${PROJECT_NAME} 3 | URL ${PROJECT_SOURCE_DIR}/yaml-cpp-master.tar.gz 4 | BUILD_COMMAND "" 5 | CMAKE_ARGS 6 | # "-DCMAKE_DEBUG_POSTFIX=" 7 | "-DCMAKE_BUILD_TYPE=${NCE_BUILD}" 8 | "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" 9 | "-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/build-${PROJECT_NAME}-prefix" 10 | INSTALL_COMMAND 11 | cmake 12 | --build . 13 | --target install 14 | --config ${NCE_BUILD} 15 | ) 16 | # set search path 17 | set(YAMLCPP_HEADER_DIR "${PROJECT_BINARY_DIR}/build-${PROJECT_NAME}-prefix/include" 18 | CACHE PATH INTERNAL FORCE) 19 | set(YAMLCPP_LINK_DIR "${PROJECT_BINARY_DIR}/build-${PROJECT_NAME}-prefix/lib" 20 | CACHE PATH INTERNAL FORCE) 21 | -------------------------------------------------------------------------------- /third-party/yaml/yaml-cpp-master.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NceBoy/NceAlg/9a4d12118b47b7d9a2f3e2ce074fc0eda694d8fc/third-party/yaml/yaml-cpp-master.tar.gz --------------------------------------------------------------------------------