Skip to content

Commit 5228c32

Browse files
committed
less verbose output for highgui hw info
1 parent 6e6eea7 commit 5228c32

File tree

7 files changed

+109
-165
lines changed

7 files changed

+109
-165
lines changed

highgui/src/capture_cvi.cpp

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -84,35 +84,17 @@ static int get_device_model()
8484
}
8585
}
8686

87+
if (device_model > 0)
88+
{
89+
fprintf(stderr, "opencv-mobile MIPI CSI camera with cvi\n");
90+
}
91+
8792
return device_model;
8893
}
8994

9095
static bool is_device_whitelisted()
9196
{
92-
const int device_model = get_device_model();
93-
94-
if (device_model == 1)
95-
{
96-
// milkv duo
97-
return true;
98-
}
99-
if (device_model == 2)
100-
{
101-
// milkv duo 256
102-
return true;
103-
}
104-
if (device_model == 3)
105-
{
106-
// licheerv nano
107-
return true;
108-
}
109-
if (device_model == 4)
110-
{
111-
// milkv duo s
112-
return true;
113-
}
114-
115-
return false;
97+
return get_device_model() > 0;
11698
}
11799

118100
extern "C"
@@ -258,7 +240,6 @@ static int load_sys_library()
258240
bool whitelisted = is_device_whitelisted();
259241
if (!whitelisted)
260242
{
261-
fprintf(stderr, "this device is not whitelisted for capture cvi\n");
262243
return -1;
263244
}
264245

@@ -975,7 +956,6 @@ static int load_vpu_library()
975956
bool whitelisted = is_device_whitelisted();
976957
if (!whitelisted)
977958
{
978-
fprintf(stderr, "this device is not whitelisted for capture cvi\n");
979959
return -1;
980960
}
981961

@@ -1827,7 +1807,6 @@ static int load_sns_obj_library()
18271807
bool whitelisted = is_device_whitelisted();
18281808
if (!whitelisted)
18291809
{
1830-
fprintf(stderr, "this device is not whitelisted for capture cvi\n");
18311810
return -1;
18321811
}
18331812

@@ -2199,7 +2178,6 @@ static int load_ae_library()
21992178
bool whitelisted = is_device_whitelisted();
22002179
if (!whitelisted)
22012180
{
2202-
fprintf(stderr, "this device is not whitelisted for capture cvi\n");
22032181
return -1;
22042182
}
22052183

@@ -2266,7 +2244,6 @@ static int load_awb_library()
22662244
bool whitelisted = is_device_whitelisted();
22672245
if (!whitelisted)
22682246
{
2269-
fprintf(stderr, "this device is not whitelisted for capture cvi\n");
22702247
return -1;
22712248
}
22722249

@@ -2346,7 +2323,6 @@ static int load_isp_library()
23462323
bool whitelisted = is_device_whitelisted();
23472324
if (!whitelisted)
23482325
{
2349-
fprintf(stderr, "this device is not whitelisted for capture cvi\n");
23502326
return -1;
23512327
}
23522328

@@ -2454,7 +2430,6 @@ static int load_cvi_bin_library()
24542430
bool whitelisted = is_device_whitelisted();
24552431
if (!whitelisted)
24562432
{
2457-
fprintf(stderr, "this device is not whitelisted for capture cvi\n");
24582433
return -1;
24592434
}
24602435

highgui/src/capture_v4l2_aw_isp.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,17 @@ static int get_device_model()
6565
}
6666
}
6767

68+
if (device_model > 0)
69+
{
70+
fprintf(stderr, "opencv-mobile MIPI CSI camera with v4l2 awispapi\n");
71+
}
72+
6873
return device_model;
6974
}
7075

7176
static bool is_device_whitelisted()
7277
{
73-
const int device_model = get_device_model();
74-
75-
if (device_model == 1)
76-
{
77-
// tinyvision
78-
return true;
79-
}
80-
81-
return false;
78+
return get_device_model() > 0;
8279
}
8380

8481
extern "C" {
@@ -415,7 +412,6 @@ static int load_awispapi_library()
415412
bool whitelisted = is_device_whitelisted();
416413
if (!whitelisted)
417414
{
418-
fprintf(stderr, "this device is not whitelisted for capture v4l2 awispapi\n");
419415
return -1;
420416
}
421417

highgui/src/capture_v4l2_rk_aiq.cpp

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,44 @@
3939

4040
namespace cv {
4141

42+
// 0 = unknown
43+
// 1 = luckfox-pico
44+
static int get_device_model()
45+
{
46+
static int device_model = -1;
47+
48+
if (device_model >= 0)
49+
return device_model;
50+
51+
device_model = 0;
52+
53+
FILE* fp = fopen("/proc/device-tree/model", "rb");
54+
if (fp)
55+
{
56+
char buf[1024];
57+
fgets(buf, 1024, fp);
58+
fclose(fp);
59+
60+
if (strncmp(buf, "Luckfox Pico", 12) == 0)
61+
{
62+
// luckfox pico family and plus pro max mini variants
63+
device_model = 1;
64+
}
65+
}
66+
67+
if (device_model > 0)
68+
{
69+
fprintf(stderr, "opencv-mobile MIPI CSI camera with v4l2 rkaiq\n");
70+
}
71+
72+
return device_model;
73+
}
74+
75+
static bool is_device_whitelisted()
76+
{
77+
return get_device_model() > 0;
78+
}
79+
4280
extern "C"
4381
{
4482

@@ -348,26 +386,9 @@ static int load_rkaiq_library()
348386
return 0;
349387

350388
// check device whitelist
351-
bool whitelisted = false;
352-
{
353-
FILE* fp = fopen("/proc/device-tree/model", "rb");
354-
if (!fp)
355-
return -1;
356-
357-
char buf[1024];
358-
fgets(buf, 1024, fp);
359-
fclose(fp);
360-
361-
if (strncmp(buf, "Luckfox Pico", 12) == 0)
362-
{
363-
// luckfox pico family and plus pro max mini variants
364-
whitelisted = true;
365-
}
366-
}
367-
389+
bool whitelisted = is_device_whitelisted();
368390
if (!whitelisted)
369391
{
370-
fprintf(stderr, "this device is not whitelisted for capture v4l2 rkaiq\n");
371392
return -1;
372393
}
373394

@@ -606,26 +627,9 @@ static int load_rga_library()
606627
return 0;
607628

608629
// check device whitelist
609-
bool whitelisted = false;
610-
{
611-
FILE* fp = fopen("/proc/device-tree/model", "rb");
612-
if (!fp)
613-
return -1;
614-
615-
char buf[1024];
616-
fgets(buf, 1024, fp);
617-
fclose(fp);
618-
619-
if (strncmp(buf, "Luckfox Pico", 12) == 0)
620-
{
621-
// luckfox pico family and plus pro max mini variants
622-
whitelisted = true;
623-
}
624-
}
625-
630+
bool whitelisted = is_device_whitelisted();
626631
if (!whitelisted)
627632
{
628-
fprintf(stderr, "this device is not whitelisted for capture v4l2 rkaiq\n");
629633
return -1;
630634
}
631635

highgui/src/jpeg_decoder_aw.cpp

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,30 +75,17 @@ static int get_device_model()
7575
}
7676
}
7777

78+
if (device_model > 0)
79+
{
80+
fprintf(stderr, "opencv-mobile HW JPG decoder with aw cedarc\n");
81+
}
82+
7883
return device_model;
7984
}
8085

8186
static bool is_device_whitelisted()
8287
{
83-
const int device_model = get_device_model();
84-
85-
if (device_model == 1)
86-
{
87-
// t113-i
88-
return true;
89-
}
90-
if (device_model == 2)
91-
{
92-
// tinyvision
93-
return true;
94-
}
95-
if (device_model == 3)
96-
{
97-
// yuzuki-chameleon
98-
return true;
99-
}
100-
101-
return false;
88+
return get_device_model() > 0;
10289
}
10390

10491
extern "C" {
@@ -143,7 +130,6 @@ static int load_videoengine_library()
143130
bool whitelisted = is_device_whitelisted();
144131
if (!whitelisted)
145132
{
146-
fprintf(stderr, "this device is not whitelisted for jpeg decoder aw cedarc\n");
147133
return -1;
148134
}
149135

@@ -676,7 +662,6 @@ static int load_vdecoder_library()
676662
bool whitelisted = is_device_whitelisted();
677663
if (!whitelisted)
678664
{
679-
fprintf(stderr, "this device is not whitelisted for jpeg decoder aw cedarc\n");
680665
return -1;
681666
}
682667

highgui/src/jpeg_decoder_cvi.cpp

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -82,35 +82,17 @@ static int get_device_model()
8282
}
8383
}
8484

85+
if (device_model > 0)
86+
{
87+
fprintf(stderr, "opencv-mobile HW JPG decoder with cvi\n");
88+
}
89+
8590
return device_model;
8691
}
8792

8893
static bool is_device_whitelisted()
8994
{
90-
const int device_model = get_device_model();
91-
92-
if (device_model == 1)
93-
{
94-
// milkv duo
95-
return true;
96-
}
97-
if (device_model == 2)
98-
{
99-
// milkv duo 256
100-
return true;
101-
}
102-
if (device_model == 3)
103-
{
104-
// licheerv nano
105-
return true;
106-
}
107-
if (device_model == 4)
108-
{
109-
// milkv duo s
110-
return true;
111-
}
112-
113-
return false;
95+
return get_device_model() > 0;
11496
}
11597

11698
extern "C"
@@ -248,7 +230,6 @@ static int load_sys_library()
248230
bool whitelisted = is_device_whitelisted();
249231
if (!whitelisted)
250232
{
251-
fprintf(stderr, "this device is not whitelisted for jpeg decoder cvi\n");
252233
return -1;
253234
}
254235

@@ -657,7 +638,6 @@ static int load_vdec_library()
657638
bool whitelisted = is_device_whitelisted();
658639
if (!whitelisted)
659640
{
660-
fprintf(stderr, "this device is not whitelisted for jpeg decoder cvi\n");
661641
return -1;
662642
}
663643

@@ -925,7 +905,6 @@ static int load_vpu_library()
925905
bool whitelisted = is_device_whitelisted();
926906
if (!whitelisted)
927907
{
928-
fprintf(stderr, "this device is not whitelisted for jpeg decoder cvi\n");
929908
return -1;
930909
}
931910

0 commit comments

Comments
 (0)