mirror of
https://github.com/nihui/opencv-mobile.git
synced 2026-04-22 23:57:27 +08:00
support licheerv-nano new version and sdk path (#194)
This commit is contained in:
+113
-2
@@ -45,6 +45,7 @@ namespace cv {
|
||||
// 2 = milkv-duo256m
|
||||
// 3 = licheerv-nano
|
||||
// 4 = milkv-duos
|
||||
// 5 = licheerv-nano final version
|
||||
static int get_device_model()
|
||||
{
|
||||
static int device_model = -1;
|
||||
@@ -74,7 +75,14 @@ static int get_device_model()
|
||||
if (strncmp(buf, "LicheeRv Nano", 13) == 0)
|
||||
{
|
||||
// licheerv nano
|
||||
device_model = 3;
|
||||
if (access("/boot/alpha", R_OK) == 0)
|
||||
{
|
||||
device_model = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
device_model = 5;
|
||||
}
|
||||
}
|
||||
if (strncmp(buf, "Milk-V DuoS", 11) == 0)
|
||||
{
|
||||
@@ -255,6 +263,10 @@ static int load_sys_library()
|
||||
libsys = dlopen("/mnt/system/lib/libsys.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libsys)
|
||||
{
|
||||
libsys = dlopen("/mnt/system/usr/lib/libsys.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libsys)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -964,6 +976,10 @@ static int load_vpu_library()
|
||||
libvpu_sys = dlopen("/mnt/system/lib/libsys.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_sys)
|
||||
{
|
||||
libvpu_sys = dlopen("/mnt/system/usr/lib/libsys.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_sys)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -975,6 +991,10 @@ static int load_vpu_library()
|
||||
libvpu_awb = dlopen("/mnt/system/lib/libawb.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_awb)
|
||||
{
|
||||
libvpu_awb = dlopen("/mnt/system/usr/lib/libawb.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_awb)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -986,6 +1006,10 @@ static int load_vpu_library()
|
||||
libvpu_ae = dlopen("/mnt/system/lib/libae.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_ae)
|
||||
{
|
||||
libvpu_ae = dlopen("/mnt/system/usr/lib/libae.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_ae)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -997,6 +1021,10 @@ static int load_vpu_library()
|
||||
libvpu_isp_algo = dlopen("/mnt/system/lib/libisp_algo.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_isp_algo)
|
||||
{
|
||||
libvpu_isp_algo = dlopen("/mnt/system/usr/lib/libisp_algo.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_isp_algo)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1008,6 +1036,10 @@ static int load_vpu_library()
|
||||
libvpu_isp = dlopen("/mnt/system/lib/libisp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_isp)
|
||||
{
|
||||
libvpu_isp = dlopen("/mnt/system/usr/lib/libisp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_isp)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1019,6 +1051,10 @@ static int load_vpu_library()
|
||||
libvpu_cvi_bin_isp = dlopen("/mnt/system/lib/libcvi_bin_isp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_cvi_bin_isp)
|
||||
{
|
||||
libvpu_cvi_bin_isp = dlopen("/mnt/system/usr/lib/libcvi_bin_isp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_cvi_bin_isp)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1030,6 +1066,10 @@ static int load_vpu_library()
|
||||
libvpu_cvi_bin = dlopen("/mnt/system/lib/libcvi_bin.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_cvi_bin)
|
||||
{
|
||||
libvpu_cvi_bin = dlopen("/mnt/system/usr/lib/libcvi_bin.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_cvi_bin)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1041,6 +1081,10 @@ static int load_vpu_library()
|
||||
libvpu = dlopen("/mnt/system/lib/libvpu.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libvpu)
|
||||
{
|
||||
libvpu = dlopen("/mnt/system/usr/lib/libvpu.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libvpu)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1817,6 +1861,10 @@ static int load_sns_obj_library()
|
||||
libsns_obj_sys = dlopen("/mnt/system/lib/libsys.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libsns_obj_sys)
|
||||
{
|
||||
libsns_obj_sys = dlopen("/mnt/system/usr/lib/libsys.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libsns_obj_sys)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1828,6 +1876,10 @@ static int load_sns_obj_library()
|
||||
libsns_obj_ae = dlopen("/mnt/system/lib/libae.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libsns_obj_ae)
|
||||
{
|
||||
libsns_obj_ae = dlopen("/mnt/system/usr/lib/libae.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libsns_obj_ae)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1839,6 +1891,10 @@ static int load_sns_obj_library()
|
||||
libsns_obj_awb = dlopen("/mnt/system/lib/libawb.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libsns_obj_awb)
|
||||
{
|
||||
libsns_obj_awb = dlopen("/mnt/system/usr/lib/libawb.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libsns_obj_awb)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1850,6 +1906,10 @@ static int load_sns_obj_library()
|
||||
libsns_obj_isp = dlopen("/mnt/system/lib/libisp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libsns_obj_isp)
|
||||
{
|
||||
libsns_obj_isp = dlopen("/mnt/system/usr/lib/libisp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libsns_obj_isp)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1864,6 +1924,10 @@ static int load_sns_obj_library()
|
||||
libsns_obj = dlopen("/mnt/system/lib/libsns_gc2083.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libsns_obj)
|
||||
{
|
||||
libsns_obj = dlopen("/mnt/system/usr/lib/libsns_gc2083.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libsns_obj)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -1880,6 +1944,10 @@ static int load_sns_obj_library()
|
||||
libsns_obj = dlopen("/mnt/system/lib/libsns_gc4653.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libsns_obj)
|
||||
{
|
||||
libsns_obj = dlopen("/mnt/system/usr/lib/libsns_gc4653.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libsns_obj)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -2186,6 +2254,10 @@ static int load_ae_library()
|
||||
libae = dlopen("/mnt/system/lib/libae.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libae)
|
||||
{
|
||||
libae = dlopen("/mnt/system/usr/lib/libae.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libae)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -2252,6 +2324,10 @@ static int load_awb_library()
|
||||
libawb = dlopen("/mnt/system/lib/libawb.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libawb)
|
||||
{
|
||||
libawb = dlopen("/mnt/system/usr/lib/libawb.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libawb)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -2331,6 +2407,10 @@ static int load_isp_library()
|
||||
libisp = dlopen("/mnt/system/lib/libisp.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libisp)
|
||||
{
|
||||
libisp = dlopen("/mnt/system/usr/lib/libisp.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libisp)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -2438,6 +2518,10 @@ static int load_cvi_bin_library()
|
||||
libcvi_bin_cvi_bin_isp = dlopen("/mnt/system/lib/libcvi_bin_isp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libcvi_bin_cvi_bin_isp)
|
||||
{
|
||||
libcvi_bin_cvi_bin_isp = dlopen("/mnt/system/usr/lib/libcvi_bin_isp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libcvi_bin_cvi_bin_isp)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -2449,6 +2533,10 @@ static int load_cvi_bin_library()
|
||||
libcvi_bin_vpu = dlopen("/mnt/system/lib/libvpu.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libcvi_bin_vpu)
|
||||
{
|
||||
libcvi_bin_vpu = dlopen("/mnt/system/usr/lib/libvpu.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libcvi_bin_vpu)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -2460,6 +2548,10 @@ static int load_cvi_bin_library()
|
||||
libcvi_bin = dlopen("/mnt/system/lib/libcvi_bin.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libcvi_bin)
|
||||
{
|
||||
libcvi_bin = dlopen("/mnt/system/usr/lib/libcvi_bin.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libcvi_bin)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -2570,6 +2662,21 @@ static const struct sns_ini_cfg* get_sns_ini_cfg()
|
||||
|
||||
return &duos;
|
||||
}
|
||||
if (device_model == 5)
|
||||
{
|
||||
// licheerv nano new version
|
||||
static const struct sns_ini_cfg lpirvnano = {
|
||||
4, // bus_id
|
||||
29, // sns_i2c_addr
|
||||
0, // mipi_dev
|
||||
{4, 3, 2, -1, -1}, // lane_id
|
||||
{0, 0, 0, 0, 0}, // pn_swap
|
||||
true, // mclk_en
|
||||
1 // mclk
|
||||
};
|
||||
|
||||
return &lpirvnano;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -2603,7 +2710,7 @@ static const struct sensor_cfg* get_sensor_cfg()
|
||||
|
||||
return &gc2083;
|
||||
}
|
||||
if (device_model == 3)
|
||||
if (device_model == 3 || device_model == 5)
|
||||
{
|
||||
// licheerv nano
|
||||
// gc4653 info
|
||||
@@ -3199,6 +3306,10 @@ int capture_cvi_impl::open(int width, int height, float fps)
|
||||
if (ret != CVI_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "pfnSnsProbe failed %x\n", ret);
|
||||
if (get_device_model() == 5)
|
||||
{
|
||||
fprintf(stderr, "If you use an old version of licheerv-nano, run \"touch /boot/alpha\" and then \"reboot\"\n");
|
||||
}
|
||||
ret_val = -1;
|
||||
goto OUT;
|
||||
}
|
||||
|
||||
@@ -245,6 +245,10 @@ static int load_sys_library()
|
||||
libsys = dlopen("/mnt/system/lib/libsys.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libsys)
|
||||
{
|
||||
libsys = dlopen("/mnt/system/usr/lib/libsys.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libsys)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -646,6 +650,10 @@ static int load_vdec_library()
|
||||
libvdec_sys = dlopen("/mnt/system/lib/libsys.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvdec_sys)
|
||||
{
|
||||
libvdec_sys = dlopen("/mnt/system/usr/lib/libsys.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvdec_sys)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -657,6 +665,10 @@ static int load_vdec_library()
|
||||
libvdec = dlopen("/mnt/system/lib/libvdec.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libvdec)
|
||||
{
|
||||
libvdec = dlopen("/mnt/system/usr/lib/libvdec.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libvdec)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -913,6 +925,10 @@ static int load_vpu_library()
|
||||
libvpu_awb = dlopen("/mnt/system/lib/libawb.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_awb)
|
||||
{
|
||||
libvpu_awb = dlopen("/mnt/system/usr/lib/libawb.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_awb)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -924,6 +940,10 @@ static int load_vpu_library()
|
||||
libvpu_ae = dlopen("/mnt/system/lib/libae.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_ae)
|
||||
{
|
||||
libvpu_ae = dlopen("/mnt/system/usr/lib/libae.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_ae)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -935,6 +955,10 @@ static int load_vpu_library()
|
||||
libvpu_isp_algo = dlopen("/mnt/system/lib/libisp_algo.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_isp_algo)
|
||||
{
|
||||
libvpu_isp_algo = dlopen("/mnt/system/usr/lib/libisp_algo.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_isp_algo)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -946,6 +970,10 @@ static int load_vpu_library()
|
||||
libvpu_isp = dlopen("/mnt/system/lib/libisp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_isp)
|
||||
{
|
||||
libvpu_isp = dlopen("/mnt/system/usr/lib/libisp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_isp)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -957,6 +985,10 @@ static int load_vpu_library()
|
||||
libvpu_cvi_bin_isp = dlopen("/mnt/system/lib/libcvi_bin_isp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_cvi_bin_isp)
|
||||
{
|
||||
libvpu_cvi_bin_isp = dlopen("/mnt/system/usr/lib/libcvi_bin_isp.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_cvi_bin_isp)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -968,6 +1000,10 @@ static int load_vpu_library()
|
||||
libvpu_cvi_bin = dlopen("/mnt/system/lib/libcvi_bin.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_cvi_bin)
|
||||
{
|
||||
libvpu_cvi_bin = dlopen("/mnt/system/usr/lib/libcvi_bin.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
}
|
||||
if (!libvpu_cvi_bin)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
@@ -979,6 +1015,10 @@ static int load_vpu_library()
|
||||
libvpu = dlopen("/mnt/system/lib/libvpu.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libvpu)
|
||||
{
|
||||
libvpu = dlopen("/mnt/system/usr/lib/libvpu.so", RTLD_LOCAL | RTLD_NOW);
|
||||
}
|
||||
if (!libvpu)
|
||||
{
|
||||
fprintf(stderr, "%s\n", dlerror());
|
||||
goto OUT;
|
||||
|
||||
Reference in New Issue
Block a user