Commit 3c2078c96eb38fcab861c124eb024126b4968a9f
1 parent
8af3795e
原版jni
Showing
3 changed files
with
1008 additions
and
87 deletions
src/Makefile deleted
1 | -XX = g++ | |
2 | - | |
3 | - | |
4 | -PROJECT_ROOT= /data1/cmhu/vpt_ascend | |
5 | - | |
6 | -DEPEND_DIR = $(PROJECT_ROOT)/bin | |
7 | -SRC_ROOT = $(PROJECT_ROOT)/src | |
8 | - | |
9 | -TARGET= $(PROJECT_ROOT)/bin/vpt_proj | |
10 | - | |
11 | -THIRDPARTY_ROOT = $(PROJECT_ROOT)/3rdparty | |
12 | -SPDLOG_ROOT = $(THIRDPARTY_ROOT)/spdlog-1.9.2/release | |
13 | -OPENCV_ROOT = $(THIRDPARTY_ROOT)/opencv-4.5.4/release | |
14 | -JSON_ROOT = $(THIRDPARTY_ROOT)/jsoncpp-1.9.5/release | |
15 | -FFMPEG_ROOT = $(THIRDPARTY_ROOT)/ffmpeg-4.2.2/release | |
16 | - | |
17 | -DEFS = -DENABLE_DVPP_INTERFACE | |
18 | - | |
19 | -include_dir=-I/usr/local/Ascend/ascend-toolkit/6.3.RC1/x86_64-linux/include \ | |
20 | - -I $(SPDLOG_ROOT)/include \ | |
21 | - -I $(SRC_ROOT)/common \ | |
22 | - -I $(OPENCV_ROOT)/include/opencv4 \ | |
23 | - -I $(JSON_ROOT)/include \ | |
24 | - -I $(FFMPEG_ROOT)/include \ | |
25 | - | |
26 | -lib_dir=-L/usr/local/Ascend/ascend-toolkit/6.3.RC1/runtime/lib64 \ | |
27 | - -L/usr/local/Ascend/ascend-toolkit/latest/lib64 \ | |
28 | - -L/usr/local/Ascend/ascend-toolkit/latest/runtime/lib64 \ | |
29 | - -L/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64 \ | |
30 | - -L/usr/local/Ascend/ascend-toolkit/6.3.RC1/runtime/lib64/stub \ | |
31 | - | |
32 | -lib=-lacl_dvpp -lascendcl -lacl_dvpp_mpi -lruntime -lascendalog -lc_sec -lmsprofiler -lgert -lmmpa -lascend_hal -lexe_graph -lge_executor -lgraph -lprofapi -lascend_protobuf -lerror_manager -lopencv_dnn -lopencv_calib3d -lhybrid_executor -lregister -ldavinci_executor -lge_common -lge_common_base \ | |
33 | - -lplatform -lgraph_base -lqos_manager | |
34 | - | |
35 | -LIBS= -L $(SPDLOG_ROOT)/lib -l:libspdlog.a \ | |
36 | - -L $(DEPEND_DIR) -lvpt_det -lsycheck \ | |
37 | - -L $(OPENCV_ROOT)/lib -lopencv_video -lopencv_highgui -lopencv_imgproc -lopencv_core -lopencv_features2d -lopencv_flann\ | |
38 | - -L $(JSON_ROOT)/lib -ljsoncpp \ | |
39 | - -L $(FFMPEG_ROOT)/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice \ | |
40 | - | |
41 | -CXXFLAGS= -g -O0 -fPIC $(include_dir) $(lib_dir) $(lib) $(LIBS) $(DEFS) -lpthread -lrt -lz -fexceptions -std=c++11 -fvisibility=hidden -Wall -Wno-deprecated -Wdeprecated-declarations -Wl,-Bsymbolic -ldl | |
42 | - | |
43 | - | |
44 | - | |
45 | -SRCS:=$(wildcard $(SRC_ROOT)/ai_platform/*.cpp) \ | |
46 | - $(wildcard $(SRC_ROOT)/decoder/interface/*.cpp) \ | |
47 | - $(wildcard $(SRC_ROOT)/decoder/dvpp/*.cpp) \ | |
48 | - $(wildcard $(SRC_ROOT)/demo/*.cpp) \ | |
49 | - $(wildcard $(SRC_ROOT)/ai_engine_module/sort/*.cpp) \ | |
50 | - $(wildcard $(SRC_ROOT)/ai_engine_module/*.cpp) \ | |
51 | - $(wildcard $(SRC_ROOT)/util/*.cpp) \ | |
52 | - $(wildcard $(SRC_ROOT)/reprocessing_module/*.cpp) \ | |
53 | - | |
54 | -OBJS = $(patsubst %.cpp, %.o, $(notdir $(SRCS))) | |
55 | - | |
56 | - | |
57 | -$(TARGET):$(OBJS) | |
58 | - rm -f $(TARGET) | |
59 | - $(XX) -o $@ $^ $(CXXFLAGS) | |
60 | - rm -f *.o | |
61 | - | |
62 | -%.o:$(SRC_ROOT)/decoder/dvpp/%.cpp | |
63 | - $(XX) $(CXXFLAGS) -c $< | |
64 | - | |
65 | -%.o:$(SRC_ROOT)/decoder/interface/%.cpp | |
66 | - $(XX) $(CXXFLAGS) -c $< | |
67 | - | |
68 | -%.o:$(SRC_ROOT)/ai_platform/%.cpp | |
69 | - $(XX) $(CXXFLAGS) -c $< | |
70 | - | |
71 | -%.o:$(SRC_ROOT)/ai_engine_module/sort/%.cpp | |
72 | - $(XX) $(CXXFLAGS) -c $< | |
73 | - | |
74 | -%.o:$(SRC_ROOT)/ai_engine_module/%.cpp | |
75 | - $(XX) $(CXXFLAGS) -c $< | |
76 | - | |
77 | -%.o:$(SRC_ROOT)/demo/%.cpp | |
78 | - $(XX) $(CXXFLAGS) -c $< | |
79 | - | |
80 | -%.o:$(SRC_ROOT)/util/%.cpp | |
81 | - $(XX) $(CXXFLAGS) -c $< | |
82 | - | |
83 | -%.o:$(SRC_ROOT)/reprocessing_module/%.cpp | |
84 | - $(XX) $(CXXFLAGS) -c $< | |
85 | - | |
86 | -clean: | |
87 | - rm -f *.o $(TARGET) | |
88 | 0 | \ No newline at end of file |
src/tsl_aiplatform_jni/AiEngineNativeInterface.cpp
0 → 100644
1 | +#include "com_objecteye_nativeinterface_TSLAiEngineNativeInterface.h" | |
2 | +#include "header.h" | |
3 | +#include "iostream" | |
4 | +#include "stl_aiplatform.h" | |
5 | +#include "sy_common.h" | |
6 | +#include "sy_errorinfo.h" | |
7 | +#include <map> | |
8 | +#include <string.h> | |
9 | +using namespace std; | |
10 | + | |
11 | +/** | |
12 | + * */ | |
13 | +JavaVM *g_jvm = NULL; | |
14 | +jclass g_jcls_vptdtJavaCallBack; //callback函数的class | |
15 | +jobject g_obj_vptdtJavaCallBack; //callback函数的obj | |
16 | + | |
17 | +ai_log_level getLogLevel(int logLevel); | |
18 | + | |
19 | +/* | |
20 | + * Class: com_objecteye_nativeinterface_AiEngineNativeInterface | |
21 | + * Method: load | |
22 | + * Signature: ()I | |
23 | + */ | |
24 | +JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_load(JNIEnv *env, jclass jcls) { | |
25 | + printf("strat VPTDTJNI_load \n"); | |
26 | + int ret = env->GetJavaVM(&g_jvm); | |
27 | + if (ret == 0) { | |
28 | + JNIEnv *g_env; | |
29 | + int getEnvStatus = g_jvm->GetEnv((void **)&g_env, JNI_VERSION_1_8); | |
30 | + if (getEnvStatus == JNI_OK){ | |
31 | + printf(" GetEnv successed \n"); | |
32 | + g_jcls_vptdtJavaCallBack = (jclass)env->NewGlobalRef(env->FindClass("com/objecteye/vehicle/vptdtJavaCallBack")); | |
33 | + printf(" NewGlobalRef successed \n"); | |
34 | + jmethodID mid_vptdtJavaCallBack = env->GetMethodID(g_jcls_vptdtJavaCallBack, "<init>", "()V"); | |
35 | + printf(" GetMethodID successed \n"); | |
36 | + g_obj_vptdtJavaCallBack = env->NewGlobalRef(env->NewObject(g_jcls_vptdtJavaCallBack, mid_vptdtJavaCallBack)); | |
37 | + } | |
38 | + ret = getEnvStatus; | |
39 | + } | |
40 | + printf("end VPTDTJNI_load \n"); | |
41 | + return ret; | |
42 | +} | |
43 | + | |
44 | +/* | |
45 | + * Class: com_objecteye_nativeinterface_AiEngineNativeInterface | |
46 | + * Method: init | |
47 | + * Signature: ([Ljava/lang/Long;Lcom/objecteye/pojo/ruijin/AiEngineParam;)I | |
48 | + */ | |
49 | +JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_init(JNIEnv *env, jobject obj, | |
50 | + jlongArray handleArray, | |
51 | + jobject aiEngineParam) { | |
52 | + | |
53 | + // getFieldID | |
54 | + jclass cls_aiEngineParam = env->GetObjectClass(aiEngineParam); | |
55 | + jfieldID fid_aiEngineParam_gpuid = env->GetFieldID(cls_aiEngineParam, "gpuID", "I"); | |
56 | + jfieldID fid_aiEngineParam_sipServerPort = env->GetFieldID(cls_aiEngineParam, "sipServerPort", "I"); | |
57 | + jfieldID fid_aiEngineParam_trtSerializeFileFolder = env->GetFieldID(cls_aiEngineParam, "trtSerializeFileFolder", "Ljava/lang/String;"); | |
58 | + jfieldID fid_aiEngineParam_modelsDir = env->GetFieldID(cls_aiEngineParam, "modelsDir", "Ljava/lang/String;"); | |
59 | + jfieldID fid_aiEngineParam_logLevel = env->GetFieldID(cls_aiEngineParam, "logLevel", "I"); | |
60 | + jfieldID fid_aiEngineParam_logPath = env->GetFieldID(cls_aiEngineParam, "logPath", "Ljava/lang/String;"); | |
61 | + jfieldID fid_aiEngineParam_logDays = env->GetFieldID(cls_aiEngineParam, "logDays", "I"); | |
62 | + jfieldID fid_aiEngineParam_logMem = env->GetFieldID(cls_aiEngineParam, "logMem", "D"); | |
63 | + | |
64 | + | |
65 | + // getObjectField | |
66 | + jint aiEngineParam_gpuid = env->GetIntField(aiEngineParam, fid_aiEngineParam_gpuid); | |
67 | + jint aiEngineParam_sipServerPort = env->GetIntField(aiEngineParam, fid_aiEngineParam_sipServerPort); | |
68 | + jstring str_aiEngineParam_trtSerializeFileFolder = | |
69 | + (jstring)env->GetObjectField(aiEngineParam, fid_aiEngineParam_trtSerializeFileFolder); | |
70 | + const char *aiEngineParam_trtSerializeFileFolder = | |
71 | + env->GetStringUTFChars(str_aiEngineParam_trtSerializeFileFolder, JNI_FALSE); | |
72 | + jstring str_aiEngineParam_modelsDir = | |
73 | + (jstring)env->GetObjectField(aiEngineParam, fid_aiEngineParam_modelsDir); | |
74 | + const char *aiEngineParam_modelsDir = | |
75 | + env->GetStringUTFChars(str_aiEngineParam_modelsDir, JNI_FALSE); | |
76 | + | |
77 | + // log | |
78 | + jstring str_aiEngineParam_logPath = (jstring)env->GetObjectField(aiEngineParam, fid_aiEngineParam_logPath); | |
79 | + const char *aiEngineParam_logPath = env->GetStringUTFChars(str_aiEngineParam_logPath, JNI_FALSE); | |
80 | + | |
81 | + jint aiEngineParam_logDays = env->GetIntField(aiEngineParam, fid_aiEngineParam_logDays); | |
82 | + jdouble aiEngineParam_logMem = env->GetDoubleField(aiEngineParam, fid_aiEngineParam_logMem); | |
83 | + jint aiEngineParam_logLevel = env->GetIntField(aiEngineParam, fid_aiEngineParam_logLevel); | |
84 | + | |
85 | + // jobject to c++ | |
86 | + void *aiEngineHandle = nullptr; | |
87 | + | |
88 | + tsl_aiplatform_param mAiEngineParam; | |
89 | + mAiEngineParam.gpuid = aiEngineParam_gpuid; | |
90 | + mAiEngineParam.sip_server_port= aiEngineParam_sipServerPort; | |
91 | + mAiEngineParam.trt_serialize_file = (char *)aiEngineParam_trtSerializeFileFolder; | |
92 | + mAiEngineParam.models_dir = (char *)aiEngineParam_modelsDir; | |
93 | + | |
94 | + mAiEngineParam.log_level = getLogLevel(aiEngineParam_logLevel); | |
95 | + mAiEngineParam.log_path = (char *)aiEngineParam_logPath; | |
96 | + mAiEngineParam.log_days = aiEngineParam_logDays; | |
97 | + mAiEngineParam.log_mem = aiEngineParam_logMem; | |
98 | + | |
99 | + printf("-- *************** Summary **********************.\n"); | |
100 | + printf("-- sip server port:%d \n", (int)aiEngineParam_sipServerPort); | |
101 | + printf("-- [logger]\n"); | |
102 | + printf("-- level :%d(int)\n", (int)aiEngineParam_logLevel); | |
103 | + printf("-- path :%s(str)\n", (char *)aiEngineParam_logPath); | |
104 | + printf("-- kp :%d(int)\n", (int)aiEngineParam_logDays); | |
105 | + printf("-- mem :%d(int)\n", (int)aiEngineParam_logMem); | |
106 | + printf("-- **********************************************.\n"); | |
107 | + | |
108 | + | |
109 | + // init | |
110 | + int ret = tsl_aiplatform_init(&aiEngineHandle, mAiEngineParam); | |
111 | + if (ret == 0) { | |
112 | + jlong temp[1]; | |
113 | + temp[0] = (jlong)aiEngineHandle; | |
114 | + env->SetLongArrayRegion(handleArray, 0, 1, temp); | |
115 | + } | |
116 | + env->ReleaseStringUTFChars(str_aiEngineParam_trtSerializeFileFolder, aiEngineParam_trtSerializeFileFolder); | |
117 | + env->ReleaseStringUTFChars(str_aiEngineParam_logPath, aiEngineParam_logPath); | |
118 | + | |
119 | + return ret; | |
120 | +} | |
121 | + | |
122 | +jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_addMqConn(JNIEnv *env, jobject thisObject, | |
123 | + jlong handle, jint task_type, | |
124 | + jobject rabbitmq_conn) { | |
125 | + // rabbitmq | |
126 | + jclass cls_rabbitmq_conn = env->GetObjectClass(rabbitmq_conn); | |
127 | + | |
128 | + jfieldID fid_aiEngineParam_rbmq_ip = env->GetFieldID(cls_rabbitmq_conn, "ip", "Ljava/lang/String;"); | |
129 | + jfieldID fid_aiEngineParam_rbmq_port = env->GetFieldID(cls_rabbitmq_conn, "port", "I"); | |
130 | + | |
131 | + jfieldID fid_aiEngineParam_rbmq_username = env->GetFieldID(cls_rabbitmq_conn, "username", "Ljava/lang/String;"); | |
132 | + jfieldID fid_aiEngineParam_rbmq_password = env->GetFieldID(cls_rabbitmq_conn, "password", "Ljava/lang/String;"); | |
133 | + jfieldID fid_aiEngineParam_rbmq_vhost = env->GetFieldID(cls_rabbitmq_conn, "vhost", "Ljava/lang/String;"); | |
134 | + jfieldID fid_aiEngineParam_rbmq_exchange = env->GetFieldID(cls_rabbitmq_conn, "exchange", "Ljava/lang/String;"); | |
135 | + jfieldID fid_aiEngineParam_rbmq_exchange_type = | |
136 | + env->GetFieldID(cls_rabbitmq_conn, "exchangeType", "Ljava/lang/String;"); | |
137 | + jfieldID fid_aiEngineParam_rbmq_queue = env->GetFieldID(cls_rabbitmq_conn, "queue", "Ljava/lang/String;"); | |
138 | + jfieldID fid_aiEngineParam_rbmq_routingKey = env->GetFieldID(cls_rabbitmq_conn, "routingKey", "Ljava/lang/String;"); | |
139 | + | |
140 | + jfieldID fid_aiEngineParam_rbmq_durable_exchange = env->GetFieldID(cls_rabbitmq_conn, "durable_exchange", "Z"); | |
141 | + jfieldID fid_aiEngineParam_rbmq_durable_queue = env->GetFieldID(cls_rabbitmq_conn, "durable_queue", "Z"); | |
142 | + | |
143 | + jstring str_rbmq_ip = (jstring)env->GetObjectField(rabbitmq_conn, fid_aiEngineParam_rbmq_ip); | |
144 | + const char *str_rbmq_ip_c = env->GetStringUTFChars(str_rbmq_ip, JNI_FALSE); | |
145 | + jint int_rbmq_port = env->GetIntField(rabbitmq_conn, fid_aiEngineParam_rbmq_port); | |
146 | + jstring str_rbmq_username = (jstring)env->GetObjectField(rabbitmq_conn, fid_aiEngineParam_rbmq_username); | |
147 | + const char *str_rbmq_username_c = env->GetStringUTFChars(str_rbmq_username, JNI_FALSE); | |
148 | + jstring str_rbmq_password = (jstring)env->GetObjectField(rabbitmq_conn, fid_aiEngineParam_rbmq_password); | |
149 | + const char *str_rbmq_password_c = env->GetStringUTFChars(str_rbmq_password, JNI_FALSE); | |
150 | + jstring str_rbmq_vhost = (jstring)env->GetObjectField(rabbitmq_conn, fid_aiEngineParam_rbmq_vhost); | |
151 | + const char *str_rbmq_vhost_c = env->GetStringUTFChars(str_rbmq_vhost, JNI_FALSE); | |
152 | + jstring str_rbmq_exchange = (jstring)env->GetObjectField(rabbitmq_conn, fid_aiEngineParam_rbmq_exchange); | |
153 | + const char *str_rbmq_exchange_c = env->GetStringUTFChars(str_rbmq_exchange, JNI_FALSE); | |
154 | + jstring str_rbmq_exchange_type = (jstring)env->GetObjectField(rabbitmq_conn, fid_aiEngineParam_rbmq_exchange_type); | |
155 | + const char *str_rbmq_exchange_type_c = env->GetStringUTFChars(str_rbmq_exchange_type, JNI_FALSE); | |
156 | + jstring str_rbmq_queue = (jstring)env->GetObjectField(rabbitmq_conn, fid_aiEngineParam_rbmq_queue); | |
157 | + const char *str_rbmq_queue_c = env->GetStringUTFChars(str_rbmq_queue, JNI_FALSE); | |
158 | + jstring str_rbmq_routingKey = (jstring)env->GetObjectField(rabbitmq_conn, fid_aiEngineParam_rbmq_routingKey); | |
159 | + const char *str_rbmq_routingKey_c = env->GetStringUTFChars(str_rbmq_routingKey, JNI_FALSE); | |
160 | + | |
161 | + jboolean bool_rbmq_durable_exchange = env->GetBooleanField(rabbitmq_conn, fid_aiEngineParam_rbmq_durable_exchange); | |
162 | + jboolean bool_rbmq_durable_queue = env->GetBooleanField(rabbitmq_conn, fid_aiEngineParam_rbmq_durable_queue); | |
163 | + | |
164 | + rabbitmq_conn_params_t mq_conn_params; | |
165 | + { | |
166 | + | |
167 | + strcpy(mq_conn_params.ip, str_rbmq_ip_c); | |
168 | + strcpy(mq_conn_params.uname, str_rbmq_username_c); | |
169 | + strcpy(mq_conn_params.passwd, str_rbmq_password_c); | |
170 | + strcpy(mq_conn_params.vhost, str_rbmq_vhost_c); | |
171 | + strcpy(mq_conn_params.exchange, str_rbmq_exchange_c); | |
172 | + strcpy(mq_conn_params.exchange_type, str_rbmq_exchange_type_c); | |
173 | + strcpy(mq_conn_params.queue, str_rbmq_queue_c); | |
174 | + strcpy(mq_conn_params.routing_key, str_rbmq_routingKey_c); | |
175 | + mq_conn_params.port = int_rbmq_port; | |
176 | + mq_conn_params.durable_queue = bool_rbmq_durable_queue; | |
177 | + mq_conn_params.durable_exchange = bool_rbmq_durable_exchange; | |
178 | + } | |
179 | + | |
180 | + env->ReleaseStringUTFChars(str_rbmq_ip, str_rbmq_ip_c); | |
181 | + env->ReleaseStringUTFChars(str_rbmq_username, str_rbmq_username_c); | |
182 | + env->ReleaseStringUTFChars(str_rbmq_password, str_rbmq_password_c); | |
183 | + env->ReleaseStringUTFChars(str_rbmq_vhost, str_rbmq_vhost_c); | |
184 | + env->ReleaseStringUTFChars(str_rbmq_exchange, str_rbmq_exchange_c); | |
185 | + env->ReleaseStringUTFChars(str_rbmq_exchange_type, str_rbmq_exchange_type_c); | |
186 | + env->ReleaseStringUTFChars(str_rbmq_queue, str_rbmq_queue_c); | |
187 | + env->ReleaseStringUTFChars(str_rbmq_routingKey, str_rbmq_routingKey_c); | |
188 | + | |
189 | + printf("[RabbitMQ] Init\n\t task type: %d ip: %s port is %d username is %s password is %s vhost is %s exchange is %s " | |
190 | + "exchange_type is %s queue is %s routing key is %s durable_exchange is %d durable_queue is %d\n", | |
191 | + (int)task_type, mq_conn_params.ip, mq_conn_params.port, mq_conn_params.uname, mq_conn_params.passwd, | |
192 | + mq_conn_params.vhost, mq_conn_params.exchange, mq_conn_params.exchange_type, mq_conn_params.queue, | |
193 | + mq_conn_params.routing_key, mq_conn_params.durable_exchange, mq_conn_params.durable_queue); | |
194 | + | |
195 | + int status = 0; | |
196 | + void *aiEngineHanle = (void *)handle; | |
197 | + if (0 != (status = add_mq_conn(aiEngineHanle, static_cast<mq_type_t>(task_type), mq_conn_params))) | |
198 | + fprintf(stderr, "add mq conn failed.\n"); | |
199 | + return status; | |
200 | +} | |
201 | + | |
202 | + | |
203 | +// 请求视频流 | |
204 | +bool gb28181_request_stream_callback(const char *task_id){ | |
205 | + | |
206 | + printf("request stream. taskId :%s.\n", task_id); | |
207 | + | |
208 | + //java回调---------------------------------------- | |
209 | + void *p; | |
210 | + // printf("1 \n"); | |
211 | + g_jvm->AttachCurrentThread(&p, NULL); | |
212 | + // printf("2 \n"); | |
213 | + JNIEnv *callBack_env = (JNIEnv *)p; | |
214 | + | |
215 | + jint ret = 0; | |
216 | + if(callBack_env != nullptr){ | |
217 | + jmethodID mid_requestStreamhCallback = callBack_env->GetMethodID(g_jcls_vptdtJavaCallBack, "vptdtEventJavaCallBack", "(Ljava/lang/String;)I"); | |
218 | + // printf("3 \n"); | |
219 | + if(mid_requestStreamhCallback != nullptr){ | |
220 | + // printf("4 \n"); | |
221 | + ret = (jint)callBack_env->CallIntMethod(g_obj_vptdtJavaCallBack, mid_requestStreamhCallback, callBack_env->NewStringUTF(task_id)); | |
222 | + } | |
223 | + // printf("5 \n"); | |
224 | + } | |
225 | + g_jvm->DetachCurrentThread(); | |
226 | + | |
227 | + printf("request stream. taskId :%s ret: %d \n", task_id, ret); | |
228 | + | |
229 | + if(ret == 0){ | |
230 | + return false; | |
231 | + } | |
232 | + | |
233 | + printf("request stream end .\n"); | |
234 | + | |
235 | + return true; | |
236 | +} | |
237 | + | |
238 | + | |
239 | +/* | |
240 | + * Class: com_objecteye_nativeinterface_AiEngineNativeInterface | |
241 | + * Method: addTask | |
242 | + * Signature: (JLcom/objecteye/pojo/ruijin/TaskParam;)I | |
243 | + */ | |
244 | +JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_addTask(JNIEnv *env, jobject obj, | |
245 | + jlong handle, | |
246 | + jobject taskParam) { | |
247 | + int code = 0; | |
248 | + | |
249 | + // getFieldID | |
250 | + jclass cls_taskParam = env->GetObjectClass(taskParam); | |
251 | + jfieldID fid_taskParam_ipcUrl = env->GetFieldID(cls_taskParam, "ipcUrl", "Ljava/lang/String;"); | |
252 | + jfieldID fid_taskParam_algorConfigParams = | |
253 | + env->GetFieldID(cls_taskParam, "algorConfigParams", "Ljava/util/ArrayList;"); | |
254 | + jfieldID fid_taskParam_algorCounts = env->GetFieldID(cls_taskParam, "algorCounts", "I"); | |
255 | + jfieldID fid_taskParam_taskId = env->GetFieldID(cls_taskParam, "taskId", "Ljava/lang/String;"); | |
256 | + | |
257 | + jfieldID fid_taskParam_dec_type = env->GetFieldID(cls_taskParam, "decType", "I"); | |
258 | + jfieldID fid_taskParam_port = env->GetFieldID(cls_taskParam, "port", "I"); | |
259 | + jfieldID fid_taskParam_protocal = env->GetFieldID(cls_taskParam, "protocal", "I"); | |
260 | + | |
261 | + // getObjectField | |
262 | + jstring str_taskParam_ipcUrl = (jstring)env->GetObjectField(taskParam, fid_taskParam_ipcUrl); | |
263 | + const char *taskParam_ipcUrl = env->GetStringUTFChars(str_taskParam_ipcUrl, JNI_FALSE); | |
264 | + jint taskParam_algorCounts = env->GetIntField(taskParam, fid_taskParam_algorCounts); | |
265 | + jstring str_taskParam_taskId = (jstring)env->GetObjectField(taskParam, fid_taskParam_taskId); | |
266 | + const char *taskParam_taskId = env->GetStringUTFChars(str_taskParam_taskId, JNI_FALSE); | |
267 | + jobject taskParam_algorConfigParams = env->GetObjectField(taskParam, fid_taskParam_algorConfigParams); | |
268 | + | |
269 | + jint taskParam_dec_type = env->GetIntField(taskParam, fid_taskParam_dec_type); | |
270 | + jint taskParam_port = env->GetIntField(taskParam, fid_taskParam_port); | |
271 | + jint taskParam_protocal = env->GetIntField(taskParam, fid_taskParam_protocal); | |
272 | + | |
273 | + jclass cls_syRectParam = env->FindClass("com/objecteye/pojo/common/SyRectParam"); | |
274 | + jfieldID fid_syRectParam_left = env->GetFieldID(cls_syRectParam, "left", "I"); | |
275 | + jfieldID fid_syRectParam_top = env->GetFieldID(cls_syRectParam, "top", "I"); | |
276 | + jfieldID fid_syRectParam_width = env->GetFieldID(cls_syRectParam, "width", "I"); | |
277 | + jfieldID fid_syRectParam_height = env->GetFieldID(cls_syRectParam, "height", "I"); | |
278 | + | |
279 | + // java to C++ | |
280 | + task_param mTaskParam; | |
281 | + mTaskParam.ipc_url = taskParam_ipcUrl; | |
282 | + mTaskParam.algor_counts = taskParam_algorCounts; | |
283 | + mTaskParam.task_id = taskParam_taskId; | |
284 | + mTaskParam.algor_config_params = new algor_config_param[mTaskParam.algor_counts]; | |
285 | + mTaskParam.dec_type = taskParam_dec_type; | |
286 | + mTaskParam.port = taskParam_port; | |
287 | + mTaskParam.protocal = taskParam_protocal; | |
288 | + mTaskParam.gb28181_request_stream_callback = gb28181_request_stream_callback; | |
289 | + | |
290 | + map<int, jstring> snapshot_little_AlgorConfigParamResSnapshotFolderMap; | |
291 | + map<int, char *> psnapshot_little_AlgorConfigParamResSnapshotFolderMap; | |
292 | + map<int, jstring> snapshot_AlgorConfigParamResSnapshotFolderMap; | |
293 | + map<int, char *> psnapshot_AlgorConfigParamResSnapshotFolderMap; | |
294 | + map<int, jstring> snapshot_AlgorConfigParamResVideoFolderMap; | |
295 | + map<int, char *> psnapshot_AlgorConfigParamResVideoFolderMap; | |
296 | + | |
297 | + jclass cls_arraylist = env->FindClass("java/util/ArrayList"); | |
298 | + // method in class ArrayList | |
299 | + jmethodID mid_arraylist_get = env->GetMethodID(cls_arraylist, "get", "(I)Ljava/lang/Object;"); | |
300 | + | |
301 | + for (size_t i = 0; i < taskParam_algorCounts; i++) { | |
302 | + jobject obj_algorConfigParam = env->CallObjectMethod(taskParam_algorConfigParams, mid_arraylist_get, i); | |
303 | + jclass cls_algorConfigParam = env->GetObjectClass(obj_algorConfigParam); | |
304 | + | |
305 | + jfieldID fid_algorConfigParam_algorType = env->GetFieldID(cls_algorConfigParam, "algorType", "I"); | |
306 | + jint algorConfigParam_algorType = env->GetIntField(obj_algorConfigParam, fid_algorConfigParam_algorType); | |
307 | + | |
308 | + jfieldID fid_algorConfigParam_algorInitParam = | |
309 | + env->GetFieldID(cls_algorConfigParam, "algorInitParam", "Ljava/lang/Object;"); | |
310 | + jobject algorConfigParam_algorInitParam = | |
311 | + env->GetObjectField(obj_algorConfigParam, fid_algorConfigParam_algorInitParam); | |
312 | + | |
313 | + jclass cls_AlgorConfigParam = env->GetObjectClass(algorConfigParam_algorInitParam); | |
314 | + | |
315 | + /* assign public variables. */ | |
316 | + auto algor_basic_param = new algor_basic_config_param_t; | |
317 | + { | |
318 | + jfieldID fid_ssAlgorConfigParam_algorRect = | |
319 | + env->GetFieldID(cls_AlgorConfigParam, "algor_valid_rect", "Lcom/objecteye/pojo/common/SyRectParam;"); | |
320 | + jobject ssAlgorConfigParam_algorRect = | |
321 | + env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_algorRect); | |
322 | + | |
323 | + jint ssAlgorConfigParam_algorRect_left = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_left); | |
324 | + jint ssAlgorConfigParam_algorRect_top = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_top); | |
325 | + jint ssAlgorConfigParam_algorRect_width = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_width); | |
326 | + jint ssAlgorConfigParam_algorRect_height = env->GetIntField(ssAlgorConfigParam_algorRect, fid_syRectParam_height); | |
327 | + | |
328 | + jfieldID fid_ssAlgorConfigParam_snapshotLittleFolder = | |
329 | + env->GetFieldID(cls_AlgorConfigParam, "result_folder_little", "Ljava/lang/String;"); | |
330 | + jfieldID fid_ssAlgorConfigParam_snapshotFolder = | |
331 | + env->GetFieldID(cls_AlgorConfigParam, "result_folder", "Ljava/lang/String;"); | |
332 | + jfieldID fid_ssAlgorConfigParam_videoFolder = | |
333 | + env->GetFieldID(cls_AlgorConfigParam, "video_folder", "Ljava/lang/String;"); //视频存储地址 | |
334 | + | |
335 | + snapshot_little_AlgorConfigParamResSnapshotFolderMap[i] = | |
336 | + (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_snapshotLittleFolder); | |
337 | + psnapshot_little_AlgorConfigParamResSnapshotFolderMap[i] = | |
338 | + (char *)env->GetStringUTFChars(snapshot_little_AlgorConfigParamResSnapshotFolderMap[i], JNI_FALSE); | |
339 | + snapshot_AlgorConfigParamResSnapshotFolderMap[i] = | |
340 | + (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_snapshotFolder); | |
341 | + psnapshot_AlgorConfigParamResSnapshotFolderMap[i] = | |
342 | + (char *)env->GetStringUTFChars(snapshot_AlgorConfigParamResSnapshotFolderMap[i], JNI_FALSE); | |
343 | + snapshot_AlgorConfigParamResVideoFolderMap[i] = | |
344 | + (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_videoFolder); | |
345 | + psnapshot_AlgorConfigParamResVideoFolderMap[i] = | |
346 | + (char *)env->GetStringUTFChars(snapshot_AlgorConfigParamResVideoFolderMap[i], JNI_FALSE); | |
347 | + | |
348 | + auto algor_init_config_param = new algor_init_config_param_t; | |
349 | + | |
350 | + | |
351 | + algor_basic_param->algor_valid_rect.top_ = ssAlgorConfigParam_algorRect_top; | |
352 | + algor_basic_param->algor_valid_rect.left_ = ssAlgorConfigParam_algorRect_left; | |
353 | + algor_basic_param->algor_valid_rect.width_ = ssAlgorConfigParam_algorRect_width; | |
354 | + algor_basic_param->algor_valid_rect.height_ = ssAlgorConfigParam_algorRect_height; | |
355 | + | |
356 | + algor_basic_param->result_folder = psnapshot_AlgorConfigParamResSnapshotFolderMap[i]; | |
357 | + algor_basic_param->result_folder_little = psnapshot_little_AlgorConfigParamResSnapshotFolderMap[i]; | |
358 | + algor_basic_param->video_folder = psnapshot_AlgorConfigParamResVideoFolderMap[i]; | |
359 | + | |
360 | + algor_init_config_param->basic_param = algor_basic_param; | |
361 | + mTaskParam.algor_config_params[i].algor_init_config_param = algor_init_config_param; | |
362 | + mTaskParam.algor_config_params[i].algor_type = static_cast<algorithm_type_t>(algorConfigParam_algorType); | |
363 | + } | |
364 | + | |
365 | + switch (static_cast<algorithm_type_t>(algorConfigParam_algorType)) { | |
366 | + case algorithm_type_t::FACE_SNAPSHOT: | |
367 | + // printf("FACE_SNAPSHOT result_folder: %s result_folder_little: %s \n", algor_basic_param->result_folder, algor_basic_param->result_folder_little); | |
368 | + case algorithm_type_t::HUMAN_SNAPSHOT: | |
369 | + case algorithm_type_t::VEHICLE_SNAPSHOT: | |
370 | + case algorithm_type_t::NONMOTOR_VEHICLE_SNAPSHOT: { | |
371 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); | |
372 | + jfieldID fid_snap_frame_interval = env->GetFieldID(cls_AlgorConfigParam, "snap_frame_interval", "I"); | |
373 | + jfloat j_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
374 | + jfloat j_snap_frame_interval = env->GetFloatField(algorConfigParam_algorInitParam, fid_snap_frame_interval); | |
375 | + | |
376 | + typedef algor_config_param_snapshot algor_config_param_type; | |
377 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
378 | + auto algor_param = | |
379 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
380 | + algor_param->threshold = (float)j_threshold; | |
381 | + algor_param->snap_frame_interval = (int)j_snap_frame_interval; | |
382 | + } break; | |
383 | + | |
384 | + //农村违法分析 | |
385 | + case algorithm_type_t::NONMOTOR_VEHICLE_NOHELMET: | |
386 | + case algorithm_type_t::NONMOTOR_VEHICLE_OVERMAN: | |
387 | + case algorithm_type_t::NONMOTOR_VEHICLE_USEPHONE: | |
388 | + case algorithm_type_t::NONMOTOR_VEHICLE_REFIT: | |
389 | + case algorithm_type_t::NONMOTOR_RUNNING_REDLIGHTS: | |
390 | + case algorithm_type_t::NONMOTOR_IN_VEHICLELANE: | |
391 | + case algorithm_type_t::NONMOTOR_CEOSSPARKLINE: | |
392 | + case algorithm_type_t::NONMOTOR_WRONGDIRECTION: | |
393 | + case algorithm_type_t::PERSON_IN_VEHICLELANE: | |
394 | + case algorithm_type_t::PERSON_CROSS: | |
395 | + case algorithm_type_t::PERSON_RUNNING_REDLIGHTS: | |
396 | + case algorithm_type_t::TRICYCLE_MANNED: | |
397 | + case algorithm_type_t::VEHICLE_WRONGDIRECTION: | |
398 | + case algorithm_type_t::VEHICLE_SOLIDLINETURNAROUND: | |
399 | + case algorithm_type_t::VEHICLE_NOTGIVEWAY: | |
400 | + case algorithm_type_t::VEHICLE_NOTDECELERATION: | |
401 | + case algorithm_type_t::TRUCK_MANNED: { | |
402 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "hs_threshold", "I"); | |
403 | + jint j_hs_threshold = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
404 | + fid = env->GetFieldID(cls_AlgorConfigParam, "m_frame", "I"); | |
405 | + jint j_m_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
406 | + fid = env->GetFieldID(cls_AlgorConfigParam, "n_frame", "I"); | |
407 | + jint j_n_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
408 | + fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_width", "I"); | |
409 | + jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
410 | + fid = env->GetFieldID(cls_AlgorConfigParam, "obj_min_height", "I"); | |
411 | + jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
412 | + fid = env->GetFieldID(cls_AlgorConfigParam, "obj_confidence_threshold", "F"); | |
413 | + jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
414 | + std::printf("%s:%d i is %d mn is [%d %d] threshold is %d\n", __FILE__, __LINE__, i, (int)j_m_frame, | |
415 | + (int)j_n_frame, (int)j_hs_threshold); | |
416 | + | |
417 | + typedef algor_config_param_manned_incident algor_config_param_type; | |
418 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
419 | + auto algor_param = | |
420 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
421 | + | |
422 | + algor_param->m = (int)j_m_frame; | |
423 | + algor_param->n = (int)j_n_frame; | |
424 | + algor_param->hs_count_threshold = (int)j_hs_threshold; | |
425 | + | |
426 | + algor_param->obj_min_width = (int)j_min_width; | |
427 | + algor_param->obj_min_height = (int)j_min_height; | |
428 | + algor_param->obj_confidence_threshold = (float)j_confidence_threshold; | |
429 | + } break; | |
430 | + | |
431 | + | |
432 | + case algorithm_type_t::HUMAN_GATHER: { | |
433 | + | |
434 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "frame_stride", "I"); | |
435 | + jint j_frame_stride = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
436 | + | |
437 | + fid = env->GetFieldID(cls_AlgorConfigParam, "human_count_threshold", "I"); | |
438 | + jint j_human_count_thre = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
439 | + | |
440 | + typedef algor_config_param_human_gather algor_config_param_type; | |
441 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
442 | + auto algor_param = | |
443 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
444 | + algor_param->frame_stride = (int)j_frame_stride; | |
445 | + algor_param->human_count_threshold = (int)j_human_count_thre; | |
446 | + } break; | |
447 | + //221026byzsh-------------------------------------------------------------------------------------------- | |
448 | + case algorithm_type_t::ROAD_WORK_DET: { | |
449 | + | |
450 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "frame_stride", "I"); | |
451 | + jint j_frame_stride = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
452 | + | |
453 | + fid = env->GetFieldID(cls_AlgorConfigParam, "rblock_count_threshold", "I"); | |
454 | + jint j_rblock_count_thre = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
455 | + | |
456 | + typedef algor_config_param_road_work algor_config_param_type; | |
457 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
458 | + auto algor_param = | |
459 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
460 | + algor_param->frame_stride = (int)j_frame_stride; | |
461 | + algor_param->rblock_count_threshold = (int)j_rblock_count_thre; | |
462 | + } break; | |
463 | + //-------------------------------------------------------------------------------------------------------- | |
464 | + | |
465 | + //230220byzsh-------------------------------------------------------------------------------------------- | |
466 | + case algorithm_type_t::VIDEO_TIMING_SNAPSHOT: { | |
467 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "frame_stride", "I"); | |
468 | + jint j_frame_stride = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
469 | + typedef algor_config_param_road_work algor_config_param_type; | |
470 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
471 | + auto algor_param = | |
472 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
473 | + algor_param->frame_stride = (int)j_frame_stride; | |
474 | + printf("VIDEO_TIMING_SNAPSHOT j_frame_stride: %d \n", algor_param->frame_stride); | |
475 | + | |
476 | + } break; | |
477 | + //-------------------------------------------------------------------------------------------------------- | |
478 | + | |
479 | + case algorithm_type_t::TAKEAWAY_MEMBER_CLASSIFICATION: { | |
480 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); | |
481 | + jfloat j_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
482 | + | |
483 | + fid = env->GetFieldID(cls_AlgorConfigParam, "m_frame", "I"); | |
484 | + jint j_m_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
485 | + | |
486 | + fid = env->GetFieldID(cls_AlgorConfigParam, "n_frame", "I"); | |
487 | + jint j_n_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
488 | + | |
489 | + // std::printf("%s:%d i is %d mn is [%d %d] threshold is %f\n", __FILE__, __LINE__, i, (int)j_m_frame, | |
490 | + // (int)j_n_frame, (float)j_threshold); | |
491 | + | |
492 | + typedef algor_config_param_takeaway_member_classification algor_config_param_type; | |
493 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
494 | + auto algor_param = | |
495 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
496 | + | |
497 | + // std::printf("%s:%d i is %d CKPT:2\n", __FILE__, __LINE__, i); | |
498 | + | |
499 | + algor_param->m = (int)j_m_frame; | |
500 | + algor_param->n = (int)j_n_frame; | |
501 | + algor_param->threshold = (float)j_threshold; | |
502 | + | |
503 | + std::printf("%s:%d i is %d mn is [%d %d] threshold is %f\n", __FILE__, __LINE__, i, algor_param->m, | |
504 | + algor_param->n, algor_param->threshold); | |
505 | + } break; | |
506 | + case algorithm_type_t::PEDESTRIAN_FIGHT: { | |
507 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); | |
508 | + jfloat j_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
509 | + | |
510 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_width", "I"); | |
511 | + jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
512 | + | |
513 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_height", "I"); | |
514 | + jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
515 | + | |
516 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_confidence_threshold", "F"); | |
517 | + jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
518 | + | |
519 | + // std::printf("%s:%d i is %d threshold is %f\n", __FILE__, __LINE__, i, (float)j_threshold); | |
520 | + | |
521 | + typedef algor_config_param_pedestrian_fight algor_config_param_type; | |
522 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
523 | + auto algor_param = | |
524 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
525 | + | |
526 | + algor_param->threshold = (float)j_threshold; | |
527 | + algor_param->pedestrian_min_width = (int)j_min_width; | |
528 | + algor_param->pedestrian_min_height = (int)j_min_height; | |
529 | + algor_param->pedestrian_confidence_threshold = (float)j_confidence_threshold; | |
530 | + | |
531 | + } break; | |
532 | + case algorithm_type_t::PEDESTRIAN_FALL: { | |
533 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); | |
534 | + jfloat j_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
535 | + | |
536 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_width", "I"); | |
537 | + jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
538 | + | |
539 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_height", "I"); | |
540 | + jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
541 | + | |
542 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_confidence_threshold", "F"); | |
543 | + jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
544 | + | |
545 | + // std::printf("%s:%d i is %d threshold is %f\n", __FILE__, __LINE__, i, (float)j_threshold); | |
546 | + | |
547 | + typedef algor_config_param_pedestrian_fall algor_config_param_type; | |
548 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
549 | + auto algor_param = | |
550 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
551 | + | |
552 | + algor_param->threshold = (float)j_threshold; | |
553 | + algor_param->pedestrian_min_width = (int)j_min_width; | |
554 | + algor_param->pedestrian_min_height = (int)j_min_height; | |
555 | + algor_param->pedestrian_confidence_threshold = (float)j_confidence_threshold; | |
556 | + | |
557 | + // std::printf("%s:%d i is %d threshold is %f\n", __FILE__, __LINE__, i, algor_param->threshold); | |
558 | + } break; | |
559 | + | |
560 | + case algorithm_type_t::SMOKING_DET: | |
561 | + case algorithm_type_t::CALL_PHONE_DET: | |
562 | + case algorithm_type_t::NO_SAFETY_HELMET: | |
563 | + case algorithm_type_t::NO_REFLECTIVE_CLOTHING: { | |
564 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); | |
565 | + jfloat j_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
566 | + | |
567 | + fid = env->GetFieldID(cls_AlgorConfigParam, "m_frame", "I"); | |
568 | + jint j_m_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
569 | + | |
570 | + fid = env->GetFieldID(cls_AlgorConfigParam, "n_frame", "I"); | |
571 | + jint j_n_frame = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
572 | + | |
573 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_width", "I"); | |
574 | + jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
575 | + | |
576 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_height", "I"); | |
577 | + jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
578 | + | |
579 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_confidence_threshold", "F"); | |
580 | + jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
581 | + | |
582 | + std::printf("[%s:%d] tereshold %.2f mn [%d %d] minimum wh [%d %d] minimum_threshold %.2f\n", __FILE__, __LINE__, | |
583 | + (float)j_threshold, (int)j_m_frame, (int)j_n_frame, (int)j_min_width, (int)j_min_height, | |
584 | + (float)j_confidence_threshold); | |
585 | + | |
586 | + using algor_config_param_type = algor_config_param_pedestrian_safety_detector_basic; | |
587 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
588 | + auto algor_param = | |
589 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
590 | + | |
591 | + algor_param->m = (int)j_m_frame; | |
592 | + algor_param->n = (int)j_n_frame; | |
593 | + algor_param->conf_threshold = (float)j_threshold; | |
594 | + algor_param->pedestrian_min_width = (int)j_min_width; | |
595 | + algor_param->pedestrian_min_height = (int)j_min_height; | |
596 | + algor_param->pedestrian_confidence_threshold = (float)j_confidence_threshold; | |
597 | + | |
598 | + // std::printf("%s:%d i is %d threshold is %f\n", __FILE__, __LINE__, i, algor_param->threshold); | |
599 | + } break; | |
600 | + | |
601 | + case algorithm_type_t::VEHICLE_RETROGRADE: | |
602 | + case algorithm_type_t::PEDESTRIAN_RETROGRADE: { | |
603 | + | |
604 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "px1", "I"); | |
605 | + jint j_px1 = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
606 | + | |
607 | + fid = env->GetFieldID(cls_AlgorConfigParam, "py1", "I"); | |
608 | + jint j_py1 = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
609 | + | |
610 | + fid = env->GetFieldID(cls_AlgorConfigParam, "px2", "I"); | |
611 | + jint j_px2 = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
612 | + | |
613 | + fid = env->GetFieldID(cls_AlgorConfigParam, "py2", "I"); | |
614 | + jint j_py2 = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
615 | + | |
616 | + fid = env->GetFieldID(cls_AlgorConfigParam, "direction", "I"); | |
617 | + jint j_direction = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
618 | + | |
619 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_width", "I"); | |
620 | + jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
621 | + | |
622 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_height", "I"); | |
623 | + jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
624 | + | |
625 | + fid = env->GetFieldID(cls_AlgorConfigParam, "threshold", "F"); | |
626 | + jfloat j_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
627 | + | |
628 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_confidence_threshold", "F"); | |
629 | + jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
630 | + | |
631 | + std::printf( | |
632 | + "[%s:%d] point [(%d, %d), (%d, %d)] direction %d threshold %.2f minimum wh [%d %d] minimum_threshold %.2f\n", | |
633 | + __FILE__, __LINE__, (int)j_px1, (int)j_py1, (int)j_px2, (int)j_py2, (int)j_direction, (float)j_threshold, | |
634 | + (int)j_min_width, (int)j_min_height, (float)j_confidence_threshold); | |
635 | + | |
636 | + using algor_config_param_type = algor_config_param_retrograde_basic; | |
637 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
638 | + auto algor_param = | |
639 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
640 | + | |
641 | + algor_param->px1 = (int)j_px1; | |
642 | + algor_param->px2 = (int)j_px2; | |
643 | + algor_param->py1 = (int)j_py1; | |
644 | + algor_param->py2 = (int)j_py2; | |
645 | + algor_param->conf_threshold = (float)j_confidence_threshold; | |
646 | + algor_param->minmum_width = std::max(0, (int)j_min_width); | |
647 | + algor_param->minmum_height = std::max(0, (int)j_min_height); | |
648 | + algor_param->direction = (int)j_direction; | |
649 | + } break; | |
650 | + | |
651 | + case algorithm_type_t::PEDESTRIAN_TRESPASS: | |
652 | + case algorithm_type_t::VEHICLE_TRESPASS: { | |
653 | + | |
654 | + jfieldID fid = env->GetFieldID(cls_AlgorConfigParam, "points_count", "I"); | |
655 | + jint j_points_count = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
656 | + | |
657 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_width", "I"); | |
658 | + jint j_min_width = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
659 | + | |
660 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_min_height", "I"); | |
661 | + jint j_min_height = env->GetIntField(algorConfigParam_algorInitParam, fid); | |
662 | + | |
663 | + fid = env->GetFieldID(cls_AlgorConfigParam, "pedestrian_confidence_threshold", "F"); | |
664 | + jfloat j_confidence_threshold = env->GetFloatField(algorConfigParam_algorInitParam, fid); | |
665 | + | |
666 | + using algor_config_param_type = algor_config_param_trespass_basic; | |
667 | + mTaskParam.algor_config_params[i].algor_init_config_param->algor_param = new algor_config_param_type; | |
668 | + auto algor_param = | |
669 | + (algor_config_param_type *)mTaskParam.algor_config_params[i].algor_init_config_param->algor_param; | |
670 | + | |
671 | + fid = env->GetFieldID(cls_AlgorConfigParam, "points", "[I"); | |
672 | + jintArray j_points = (jintArray)env->GetObjectField(algorConfigParam_algorInitParam, fid); | |
673 | + jint *points = (jint *)env->GetIntArrayElements(j_points, 0); | |
674 | + | |
675 | + for (size_t i = 0; i < (int)j_points_count; i++) { | |
676 | + /* | |
677 | + jobject obj_pointConfigParam = env->CallObjectMethod(j_points, mid_arraylist_points_get, i); | |
678 | + jclass cls_pointConfigParam = env->GetObjectClass(obj_pointConfigParam); | |
679 | + printf("33333333333"); | |
680 | + jfieldID fid_pointConfigParam_x = env->GetFieldID(cls_pointConfigParam, "x", "I"); | |
681 | + jint point_x = env->GetIntField(obj_pointConfigParam, fid_pointConfigParam_x); | |
682 | + | |
683 | + jfieldID fid_pointConfigParam_y = env->GetFieldID(cls_pointConfigParam, "y", "I"); | |
684 | + jint point_y = env->GetIntField(obj_pointConfigParam, fid_pointConfigParam_y); | |
685 | + */ | |
686 | + algor_param->points[i].x_ = (int)points[i * 2]; | |
687 | + algor_param->points[i].y_ = (int)points[i * 2 + 1]; | |
688 | + } | |
689 | + | |
690 | + algor_param->conf_threshold = (float)j_confidence_threshold; | |
691 | + algor_param->minmum_width = std::max(0, (int)j_min_width); | |
692 | + algor_param->minmum_height = std::max(0, (int)j_min_height); | |
693 | + algor_param->points_count = (int)j_points_count; | |
694 | + | |
695 | + std::printf("[%s:%d] points_count %d minmum_width %df minmum_height %d conf_threshold %.2f\n", __FILE__, __LINE__, | |
696 | + (int)j_points_count, (int)j_min_width, (int)j_min_height, (float)j_confidence_threshold); | |
697 | + | |
698 | + for (size_t i = 0; i < (int)j_points_count; i++) | |
699 | + printf(" i %d point (%d %d)\n", i, algor_param->points[i].x_, algor_param->points[i].y_); | |
700 | + } break; | |
701 | + | |
702 | + default: { | |
703 | + fprintf(stderr, "%s:%d Add Task Failed (Invalid algorithm type). \n", __FILE__, __LINE__); | |
704 | + code = -1; | |
705 | + } break; | |
706 | + } | |
707 | + } | |
708 | + | |
709 | + void *aiEngineHanle = (void *)handle; | |
710 | + code = add_task(aiEngineHanle, mTaskParam); | |
711 | + | |
712 | + if (!snapshot_little_AlgorConfigParamResSnapshotFolderMap.empty()) { | |
713 | + map<int, jstring>::iterator iter = snapshot_little_AlgorConfigParamResSnapshotFolderMap.begin(); | |
714 | + while (iter != snapshot_little_AlgorConfigParamResSnapshotFolderMap.end()) { | |
715 | + env->ReleaseStringUTFChars(snapshot_little_AlgorConfigParamResSnapshotFolderMap[iter->first], | |
716 | + psnapshot_little_AlgorConfigParamResSnapshotFolderMap[iter->first]); | |
717 | + env->ReleaseStringUTFChars(snapshot_AlgorConfigParamResSnapshotFolderMap[iter->first], | |
718 | + psnapshot_AlgorConfigParamResSnapshotFolderMap[iter->first]); | |
719 | + iter++; | |
720 | + } | |
721 | + snapshot_little_AlgorConfigParamResSnapshotFolderMap.clear(); | |
722 | + psnapshot_little_AlgorConfigParamResSnapshotFolderMap.clear(); | |
723 | + snapshot_AlgorConfigParamResSnapshotFolderMap.clear(); | |
724 | + psnapshot_AlgorConfigParamResSnapshotFolderMap.clear(); | |
725 | + } | |
726 | + | |
727 | + env->ReleaseStringUTFChars(str_taskParam_ipcUrl, taskParam_ipcUrl); | |
728 | + env->ReleaseStringUTFChars(str_taskParam_taskId, taskParam_taskId); | |
729 | + return code; | |
730 | +} | |
731 | + | |
732 | +JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_getTaskStatus(JNIEnv *env, | |
733 | + jobject thisObject, | |
734 | + jlong handle, | |
735 | + jstring task_id) { | |
736 | + int code = -1; | |
737 | + void *aiEngineHanle = (void *)handle; | |
738 | + if (aiEngineHanle != NULL) { | |
739 | + const char *p_taskId = env->GetStringUTFChars(task_id, JNI_FALSE); | |
740 | + code = get_task_status(aiEngineHanle, (char *)p_taskId); | |
741 | + env->ReleaseStringUTFChars(task_id, p_taskId); | |
742 | + } | |
743 | + return code; | |
744 | +} | |
745 | + | |
746 | +JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_pauseTask(JNIEnv *env, jobject obj, | |
747 | + jlong handle, | |
748 | + jstring taskId, | |
749 | + jint max_timeout_ms) { | |
750 | + int code = -1; | |
751 | + void *aiEngineHanle = (void *)handle; | |
752 | + const char *p_taskId = env->GetStringUTFChars(taskId, JNI_FALSE); | |
753 | + code = pause_task(aiEngineHanle, (char *)p_taskId, (int)max_timeout_ms); | |
754 | + env->ReleaseStringUTFChars(taskId, p_taskId); | |
755 | + return code; | |
756 | +} | |
757 | + | |
758 | +JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_restartTask( | |
759 | + JNIEnv *env, jobject obj, jlong handle, jstring taskId, jint max_timeout_ms) { | |
760 | + int code = -1; | |
761 | + void *aiEngineHanle = (void *)handle; | |
762 | + const char *p_taskId = env->GetStringUTFChars(taskId, JNI_FALSE); | |
763 | + code = restart_task(aiEngineHanle, (char *)p_taskId, (int)max_timeout_ms); | |
764 | + env->ReleaseStringUTFChars(taskId, p_taskId); | |
765 | + return code; | |
766 | +} | |
767 | + | |
768 | +JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_finishTask( | |
769 | + JNIEnv *env, jobject obj, jlong handle, jstring taskId, jint max_timeout_ms) { | |
770 | + int code = -1; | |
771 | + void *aiEngineHanle = (void *)handle; | |
772 | + const char *p_taskId = env->GetStringUTFChars(taskId, JNI_FALSE); | |
773 | + code = finish_task(aiEngineHanle, (char *)p_taskId, (int)max_timeout_ms); | |
774 | + env->ReleaseStringUTFChars(taskId, p_taskId); | |
775 | + return code; | |
776 | +} | |
777 | + | |
778 | +JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_release(JNIEnv *env, jobject obj, | |
779 | + jlong handle) { | |
780 | + int error_code = -1; | |
781 | + void *aiEngineHanle = (void *)handle; | |
782 | + if (aiEngineHanle != NULL) | |
783 | + error_code = tsl_aiplatform_release(&aiEngineHanle); | |
784 | + return error_code; | |
785 | +} | |
786 | + | |
787 | +JNIEXPORT jstring JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_getVersion(JNIEnv *env, | |
788 | + jobject obj) { | |
789 | + const char *version = get_tsl_aiplatform_version(); | |
790 | + return env->NewStringUTF(version); | |
791 | +} | |
792 | + | |
793 | + | |
794 | +/* | |
795 | + * Class: com_objecteye_nativeinterface_AiEngineNativeInterface | |
796 | + * Method: screenshot_task | |
797 | + * Signature: (JLcom/objecteye/pojo/TaskParam;)I | |
798 | + * added by zsh 220802 | |
799 | + */ | |
800 | +JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_screenShotTask(JNIEnv *env, jobject obj, | |
801 | + jlong handle, | |
802 | + jobject taskParam) { | |
803 | + int code = 0; | |
804 | + | |
805 | + // getFieldID | |
806 | + jclass cls_taskParam = env->GetObjectClass(taskParam); | |
807 | + jfieldID fid_taskParam_ipcUrl = env->GetFieldID(cls_taskParam, "ipcUrl", "Ljava/lang/String;"); | |
808 | + jfieldID fid_taskParam_algorConfigParams = | |
809 | + env->GetFieldID(cls_taskParam, "algorConfigParams", "Ljava/util/ArrayList;"); | |
810 | + jfieldID fid_taskParam_algorCounts = env->GetFieldID(cls_taskParam, "algorCounts", "I"); | |
811 | + jfieldID fid_taskParam_taskId = env->GetFieldID(cls_taskParam, "taskId", "Ljava/lang/String;"); | |
812 | + | |
813 | + // getObjectField | |
814 | + jstring str_taskParam_ipcUrl = (jstring)env->GetObjectField(taskParam, fid_taskParam_ipcUrl); | |
815 | + const char *taskParam_ipcUrl = env->GetStringUTFChars(str_taskParam_ipcUrl, JNI_FALSE); | |
816 | + jint taskParam_algorCounts = env->GetIntField(taskParam, fid_taskParam_algorCounts); | |
817 | + jstring str_taskParam_taskId = (jstring)env->GetObjectField(taskParam, fid_taskParam_taskId); | |
818 | + const char *taskParam_taskId = env->GetStringUTFChars(str_taskParam_taskId, JNI_FALSE); | |
819 | + jobject taskParam_algorConfigParams = env->GetObjectField(taskParam, fid_taskParam_algorConfigParams); | |
820 | + | |
821 | + // java to C++ | |
822 | + task_param mTaskParam; | |
823 | + mTaskParam.ipc_url = taskParam_ipcUrl; | |
824 | + mTaskParam.algor_counts = taskParam_algorCounts; | |
825 | + mTaskParam.task_id = taskParam_taskId; | |
826 | + mTaskParam.algor_config_params = new algor_config_param[mTaskParam.algor_counts]; | |
827 | + | |
828 | + map<int, jstring> snapshot_AlgorConfigParamResSnapshotFolderMap; | |
829 | + map<int, char *> psnapshot_AlgorConfigParamResSnapshotFolderMap; | |
830 | + | |
831 | + jclass cls_arraylist = env->FindClass("java/util/ArrayList"); | |
832 | + // method in class ArrayList | |
833 | + jmethodID mid_arraylist_get = env->GetMethodID(cls_arraylist, "get", "(I)Ljava/lang/Object;"); | |
834 | + | |
835 | + for (size_t i = 0; i < taskParam_algorCounts; i++) { | |
836 | + jobject obj_algorConfigParam = env->CallObjectMethod(taskParam_algorConfigParams, mid_arraylist_get, i); | |
837 | + jclass cls_algorConfigParam = env->GetObjectClass(obj_algorConfigParam); | |
838 | + | |
839 | + jfieldID fid_algorConfigParam_algorType = env->GetFieldID(cls_algorConfigParam, "algorType", "I"); | |
840 | + jint algorConfigParam_algorType = env->GetIntField(obj_algorConfigParam, fid_algorConfigParam_algorType); | |
841 | + | |
842 | + jfieldID fid_algorConfigParam_algorInitParam = | |
843 | + env->GetFieldID(cls_algorConfigParam, "algorInitParam", "Ljava/lang/Object;"); //可去掉? | |
844 | + jobject algorConfigParam_algorInitParam = | |
845 | + env->GetObjectField(obj_algorConfigParam, fid_algorConfigParam_algorInitParam); //可去掉 | |
846 | + | |
847 | + jclass cls_AlgorConfigParam = env->GetObjectClass(algorConfigParam_algorInitParam); | |
848 | + | |
849 | + | |
850 | + /* assign public variables. */ | |
851 | + { | |
852 | + jfieldID fid_ssAlgorConfigParam_snapshotFolder = | |
853 | + env->GetFieldID(cls_AlgorConfigParam, "result_folder", "Ljava/lang/String;"); | |
854 | + | |
855 | + snapshot_AlgorConfigParamResSnapshotFolderMap[i] = | |
856 | + (jstring)env->GetObjectField(algorConfigParam_algorInitParam, fid_ssAlgorConfigParam_snapshotFolder); | |
857 | + psnapshot_AlgorConfigParamResSnapshotFolderMap[i] = | |
858 | + (char *)env->GetStringUTFChars(snapshot_AlgorConfigParamResSnapshotFolderMap[i], JNI_FALSE); | |
859 | + | |
860 | + auto algor_init_config_param = new algor_init_config_param_t; | |
861 | + auto algor_basic_param = new algor_basic_config_param_t; | |
862 | + | |
863 | + algor_basic_param->result_folder = psnapshot_AlgorConfigParamResSnapshotFolderMap[i]; | |
864 | + | |
865 | + algor_init_config_param->basic_param = algor_basic_param; | |
866 | + mTaskParam.algor_config_params[i].algor_init_config_param = algor_init_config_param; | |
867 | + mTaskParam.algor_config_params[i].algor_type = static_cast<algorithm_type_t>(algorConfigParam_algorType); | |
868 | + } | |
869 | + | |
870 | + } | |
871 | + | |
872 | + void *aiEngineHanle = (void *)handle; | |
873 | + code = screenshot_task(aiEngineHanle, mTaskParam); | |
874 | + | |
875 | + if (!snapshot_AlgorConfigParamResSnapshotFolderMap.empty()) { | |
876 | + map<int, jstring>::iterator iter = snapshot_AlgorConfigParamResSnapshotFolderMap.begin(); | |
877 | + while (iter != snapshot_AlgorConfigParamResSnapshotFolderMap.end()) { | |
878 | + env->ReleaseStringUTFChars(snapshot_AlgorConfigParamResSnapshotFolderMap[iter->first], | |
879 | + psnapshot_AlgorConfigParamResSnapshotFolderMap[iter->first]); | |
880 | + iter++; | |
881 | + } | |
882 | + snapshot_AlgorConfigParamResSnapshotFolderMap.clear(); | |
883 | + psnapshot_AlgorConfigParamResSnapshotFolderMap.clear(); | |
884 | + } | |
885 | + | |
886 | + env->ReleaseStringUTFChars(str_taskParam_ipcUrl, taskParam_ipcUrl); | |
887 | + env->ReleaseStringUTFChars(str_taskParam_taskId, taskParam_taskId); | |
888 | + return code; | |
889 | +} | |
890 | + | |
891 | + | |
892 | +ai_log_level getLogLevel(int logLevel) { | |
893 | + switch (logLevel) { | |
894 | + case -1: | |
895 | + return AI_LOG_LEVEL_CLOSE; | |
896 | + case 0: | |
897 | + return AI_LOG_LEVEL_TRACE; | |
898 | + case 1: | |
899 | + return AI_LOG_LEVEL_DEBUG; | |
900 | + case 2: | |
901 | + return AI_LOG_LEVEL_INFO; | |
902 | + case 3: | |
903 | + return AI_LOG_LEVEL_WARNING; | |
904 | + case 4: | |
905 | + return AI_LOG_LEVEL_ERROR; | |
906 | + } | |
907 | + return AI_LOG_LEVEL_DEBUG; | |
908 | +} | ... | ... |
src/tsl_aiplatform_jni/com_objecteye_nativeinterface_TSLAiEngineNativeInterface.h
0 → 100644
1 | +/* | |
2 | + * @Author: zhaoshuaihua | |
3 | + * @Date: 2022-08-02 20:01:51 | |
4 | + * @Last Modified by: zhaoshuaihua | |
5 | + * @Email: zhaoshuaihua@objecteye.com | |
6 | + * @Description: | |
7 | + */ | |
8 | +/* DO NOT EDIT THIS FILE - it is machine generated */ | |
9 | +#include <jni.h> | |
10 | +/* Header for class com_objecteye_nativeinterface_TSLAiEngineNativeInter */ | |
11 | + | |
12 | +#ifndef _Included_com_objecteye_nativeinterface_TSLAiEngineNativeInter | |
13 | +#define _Included_com_objecteye_nativeinterface_TSLAiEngineNativeInter | |
14 | +#ifdef __cplusplus | |
15 | +extern "C" | |
16 | +{ | |
17 | +#endif | |
18 | + | |
19 | + | |
20 | + /* | |
21 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
22 | + * Method: load | |
23 | + * Signature: ()I | |
24 | + */ | |
25 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_load(JNIEnv *, jclass); | |
26 | + /* | |
27 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
28 | + * Method: init | |
29 | + * Signature: ([Ljava/lang/Long;Lcom/objecteye/pojo/ruijin/TSLAiEngineParam;)I | |
30 | + */ | |
31 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_init(JNIEnv *, jobject, jlongArray, jobject); | |
32 | + | |
33 | + | |
34 | + /* | |
35 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
36 | + * Method: addMqConn | |
37 | + * Signature: (JLcom/objecteye/pojo/ruijin/MqParam;)I | |
38 | + */ | |
39 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_addMqConn(JNIEnv *, jobject, jlong, jint, jobject); | |
40 | + | |
41 | + /* | |
42 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
43 | + * Method: addTask | |
44 | + * Signature: (JLcom/objecteye/pojo/ruijin/TaskParam;)I | |
45 | + */ | |
46 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_addTask(JNIEnv *, jobject, jlong, jobject); | |
47 | + /* | |
48 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
49 | + * Method: getTaskStatus | |
50 | + * Signature: (JLjava/lang/String;)I | |
51 | + */ | |
52 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_getTaskStatus(JNIEnv *, jobject, jlong, jstring); | |
53 | + /* | |
54 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
55 | + * Method: pauseTask | |
56 | + * Signature: (JLjava/lang/String;I)I | |
57 | + */ | |
58 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_pauseTask(JNIEnv *, jobject, jlong, jstring, jint); | |
59 | + | |
60 | + /* | |
61 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
62 | + * Method: restartTask | |
63 | + * Signature: (JLjava/lang/String;I)I | |
64 | + */ | |
65 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_restartTask(JNIEnv *, jobject, jlong, jstring, jint); | |
66 | + | |
67 | + /* | |
68 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
69 | + * Method: finishTask | |
70 | + * Signature: (JLjava/lang/String;I)I | |
71 | + */ | |
72 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_finishTask(JNIEnv *, jobject, jlong, jstring, jint); | |
73 | + | |
74 | + /* | |
75 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
76 | + * Method: release | |
77 | + * Signature: (J)I | |
78 | + */ | |
79 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_release(JNIEnv *, jobject, jlong); | |
80 | + | |
81 | + /* | |
82 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
83 | + * Method: getVersion | |
84 | + * Signature: ()Ljava/lang/String; | |
85 | + */ | |
86 | + JNIEXPORT jstring JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_getVersion(JNIEnv *, jobject); | |
87 | + | |
88 | + /* | |
89 | + * Class: com_objecteye_nativeinterface_TSLAiEngineNativeInterface | |
90 | + * Method: screenshot_task | |
91 | + * Signature: (JLcom/objecteye/pojo/TaskParam;)I | |
92 | + * added by zsh 220802 | |
93 | + */ | |
94 | + JNIEXPORT jint JNICALL Java_com_objecteye_nativeinterface_TSLAiEngineNativeInterface_screenShotTask(JNIEnv *, jobject, jlong, jobject); | |
95 | + | |
96 | + | |
97 | +#ifdef __cplusplus | |
98 | +} | |
99 | +#endif | |
100 | +#endif | ... | ... |