Skip to content

Commit 0d221b0

Browse files
committed
(Continued)
1 parent 6a7d466 commit 0d221b0

File tree

6 files changed

+71
-77
lines changed

6 files changed

+71
-77
lines changed

src/hal/hisi/v1_config.h

+17-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ typedef struct {
2828
v1_snr_lvds lvds;
2929

3030
// [isp_image]
31-
v1_isp_dev isp;
31+
v1_isp_img img;
32+
v1_isp_tim tim;
3233

3334
// [vi_dev]
3435
v1_vi_dev videv;
@@ -404,33 +405,39 @@ static enum ConfigError v1_parse_config_vichn(
404405
}
405406

406407
static enum ConfigError v1_parse_config_isp(
407-
struct IniConfig *ini, const char *section, v1_isp_dev *isp) {
408+
struct IniConfig *ini, const char *section, v1_isp_img *img, v1_isp_tim *tim) {
408409
enum ConfigError err;
409410

410-
err = parse_int(ini, "isp_image", "isp_x", 0, INT_MAX, &isp->capt.x);
411+
int value;
412+
err = parse_int(ini, "isp_image", "isp_x", 0, INT_MAX, &value);
411413
if (err != CONFIG_OK)
412414
return err;
413-
err = parse_int(ini, "isp_image", "isp_y", 0, INT_MAX, &isp->capt.y);
415+
tim->x = value;
416+
err = parse_int(ini, "isp_image", "isp_y", 0, INT_MAX, &value);
414417
if (err != CONFIG_OK)
415418
return err;
416-
err = parse_int(ini, "isp_image", "isp_w", 0, INT_MAX, &isp->capt.width);
419+
tim->y = value;
420+
err = parse_int(ini, "isp_image", "isp_w", 0, INT_MAX, &value);
417421
if (err != CONFIG_OK)
418422
return err;
419-
err = parse_int(ini, "isp_image", "isp_h", 0, INT_MAX, &isp->capt.height);
423+
tim->width = value;
424+
img->width = tim->width;
425+
err = parse_int(ini, "isp_image", "isp_h", 0, INT_MAX, &value);
420426
if (err != CONFIG_OK)
421427
return err;
422-
int value;
428+
tim->height = value;
429+
img->height = tim->height;
423430
err = parse_int(
424431
ini, "isp_image", "isp_framerate", 0, INT_MAX, &value);
425432
if (err != CONFIG_OK)
426433
return err;
427-
else isp->framerate = value * 1.0f;
434+
img->framerate = value;
428435
{
429436
const char *possible_values[] = {
430437
"BAYER_RGGB", "BAYER_GRBG", "BAYER_GBRG", "BAYER_BGGR"};
431438
const int count = sizeof(possible_values) / sizeof(const char *);
432439
err = parse_enum(
433-
ini, "isp_image", "isp_bayer", (void*)&isp->bayer,
440+
ini, "isp_image", "isp_bayer", (void*)&img->bayer,
434441
possible_values, count, 0);
435442
if (err != CONFIG_OK)
436443
return err;
@@ -522,7 +529,7 @@ static enum ConfigError v1_parse_sensor_config(char *path, v1_config_impl *confi
522529
}
523530

524531
// [isp_image]
525-
err = v1_parse_config_isp(&ini, "isp_image", &config->isp);
532+
err = v1_parse_config_isp(&ini, "isp_image", &config->img, &config->tim);
526533
if (err != CONFIG_OK)
527534
goto RET_ERR;
528535

src/hal/hisi/v1_hal.c

+14-19
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int v1_channel_create(char index, short width, short height, char mirror, char f
161161
{
162162
v1_vpss_chn channel;
163163
memset(&channel, 0, sizeof(channel));
164-
channel.srcFps = v1_config.isp.framerate;
164+
channel.srcFps = v1_config.img.framerate;
165165
channel.dstFps = framerate;
166166
channel.mirror = mirror;
167167
channel.flip = flip;
@@ -219,7 +219,7 @@ void *v1_image_thread(void)
219219
{
220220
int ret;
221221

222-
if (ret = v1_isp.fnRun(_v1_isp_dev))
222+
if (ret = v1_isp.fnRun())
223223
HAL_DANGER("v1_isp", "Operation failed with %#x!\n", ret);
224224
HAL_INFO("v1_isp", "Shutting down ISP thread...\n");
225225
}
@@ -253,8 +253,8 @@ int v1_pipeline_create(void)
253253
channel.compress = V1_COMPR_NONE;
254254
channel.mirror = 0;
255255
channel.flip = 0;
256-
channel.srcFps = v1_config.isp.framerate;
257-
channel.dstFps = v1_config.isp.framerate;
256+
channel.srcFps = v1_config.img.framerate;
257+
channel.dstFps = v1_config.img.framerate;
258258
if (ret = v1_vi.fnSetChannelConfig(_v1_vi_chn, &channel))
259259
return ret;
260260
}
@@ -264,18 +264,18 @@ int v1_pipeline_create(void)
264264
if (ret = v1_snr_drv.fnRegisterCallback())
265265
return ret;
266266

267-
if (ret = v1_isp.fnRegisterAE(_v1_vi_dev, &v1_ae_lib))
267+
if (ret = v1_isp.fnRegisterAE(&v1_ae_lib))
268268
return ret;
269-
if (ret = v1_isp.fnRegisterAWB(_v1_vi_dev, &v1_awb_lib))
270-
return ret;
271-
if (ret = v1_isp.fnMemInit(_v1_vi_dev))
269+
if (ret = v1_isp.fnRegisterAWB(&v1_awb_lib))
272270
return ret;
273271

274-
if (ret = v1_isp.fnSetWDRMode(_v1_vi_dev, &v1_config.mode))
272+
if (ret = v1_isp.fnSetWDRMode(&v1_config.mode))
273+
return ret;
274+
if (ret = v1_isp.fnSetImageConfig(&v1_config.img))
275275
return ret;
276-
if (ret = v1_isp.fnSetDeviceConfig(_v1_vi_dev, &v1_config.isp))
276+
if (ret = v1_isp.fnSetInputTiming(&v1_config.tim))
277277
return ret;
278-
if (ret = v1_isp.fnInit(_v1_vi_dev))
278+
if (ret = v1_isp.fnInit())
279279
return ret;
280280

281281
{
@@ -308,9 +308,9 @@ int v1_pipeline_create(void)
308308

309309
void v1_pipeline_destroy(void)
310310
{
311-
v1_isp.fnExit(_v1_vi_dev);
312-
v1_isp.fnUnregisterAE(_v1_vi_dev, &v1_ae_lib);
313-
v1_isp.fnUnregisterAWB(_v1_vi_dev, &v1_awb_lib);
311+
v1_isp.fnExit();
312+
v1_isp.fnUnregisterAE(&v1_ae_lib);
313+
v1_isp.fnUnregisterAWB(&v1_awb_lib);
314314

315315
v1_snr_drv.fnUnRegisterCallback();
316316

@@ -676,8 +676,6 @@ int v1_video_snapshot_grab(char index, hal_jpegdata *jpeg)
676676
v1_venc.fnFreeStream(index, &strm);
677677
}
678678

679-
v1_venc.fnFreeDescriptor(index);
680-
681679
v1_venc.fnStopReceiving(index);
682680

683681
v1_channel_unbind(index);
@@ -841,9 +839,6 @@ int v1_system_init(char *snrConfig)
841839

842840
if (ret = v1_vb.fnConfigPool(&pool))
843841
return ret;
844-
v1_vb_supl supl = V1_VB_JPEG_MASK;
845-
if (ret = v1_vb.fnConfigSupplement(&supl))
846-
return ret;
847842
if (ret = v1_vb.fnInit())
848843
return ret;
849844

src/hal/hisi/v1_isp.h

+38-27
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,43 @@
55
extern int (*fnISP_AlgRegisterDehaze)(int);
66
extern int (*fnISP_AlgRegisterDrc)(int);
77

8+
typedef enum {
9+
V1_ISP_WIN_NONE,
10+
V1_ISP_WIN_HORIZ,
11+
V1_ISP_WIN_VERT,
12+
V1_ISP_WIN_BOTH
13+
} v1_isp_win;
14+
815
typedef struct {
916
int id;
1017
char libName[20];
1118
} v1_isp_alg;
1219

1320
typedef struct {
14-
v1_common_rect capt;
15-
float framerate;
21+
unsigned short width, height, framerate;
1622
v1_common_bayer bayer;
17-
} v1_isp_dev;
23+
} v1_isp_img;
24+
25+
typedef struct {
26+
v1_isp_win mode;
27+
unsigned short x, width, y, height;
28+
} v1_isp_tim;
1829

1930
typedef struct {
2031
void *handle, *handleAwb, *handleAe;
2132

22-
int (*fnExit)(int device);
23-
int (*fnInit)(int device);
24-
int (*fnMemInit)(int device);
25-
int (*fnRun)(int device);
33+
int (*fnExit)(void);
34+
int (*fnInit)(void);
35+
int (*fnRun)(void);
2636

27-
int (*fnSetDeviceConfig)(int device, v1_isp_dev *config);
28-
int (*fnSetWDRMode)(int device, v1_common_wdr *mode);
37+
int (*fnSetImageConfig)(v1_isp_img *config);
38+
int (*fnSetInputTiming)(v1_isp_tim *config);
39+
int (*fnSetWDRMode)(v1_common_wdr *mode);
2940

30-
int (*fnRegisterAE)(int device, v1_isp_alg *library);
31-
int (*fnRegisterAWB)(int device, v1_isp_alg *library);
32-
int (*fnUnregisterAE)(int device, v1_isp_alg *library);
33-
int (*fnUnregisterAWB)(int device, v1_isp_alg *library);
41+
int (*fnRegisterAE)(v1_isp_alg *library);
42+
int (*fnRegisterAWB)(v1_isp_alg *library);
43+
int (*fnUnregisterAE)(v1_isp_alg *library);
44+
int (*fnUnregisterAWB)(v1_isp_alg *library);
3445
} v1_isp_impl;
3546

3647
static int v1_isp_load(v1_isp_impl *isp_lib) {
@@ -43,43 +54,43 @@ static int v1_isp_load(v1_isp_impl *isp_lib) {
4354
hal_symbol_load("v1_isp", isp_lib->handle, "ISP_AlgRegisterDrc")))
4455
return EXIT_FAILURE;
4556

46-
if (!(isp_lib->fnExit = (int(*)(int device))
57+
if (!(isp_lib->fnExit = (int(*)(void))
4758
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_Exit")))
4859
return EXIT_FAILURE;
4960

50-
if (!(isp_lib->fnInit = (int(*)(int device))
61+
if (!(isp_lib->fnInit = (int(*)(void))
5162
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_Init")))
5263
return EXIT_FAILURE;
5364

54-
if (!(isp_lib->fnMemInit = (int(*)(int device))
55-
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_MemInit")))
65+
if (!(isp_lib->fnRun = (int(*)(void))
66+
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_Run")))
5667
return EXIT_FAILURE;
5768

58-
if (!(isp_lib->fnRun = (int(*)(int device))
59-
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_Run")))
69+
if (!(isp_lib->fnSetImageConfig = (int(*)(v1_isp_img *config))
70+
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_SetImageAttr")))
6071
return EXIT_FAILURE;
6172

62-
if (!(isp_lib->fnSetDeviceConfig = (int(*)(int device, v1_isp_dev *config))
63-
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_SetPubAttr")))
73+
if (!(isp_lib->fnSetInputTiming = (int(*)(v1_isp_tim *config))
74+
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_SetInputTiming")))
6475
return EXIT_FAILURE;
6576

66-
if (!(isp_lib->fnSetWDRMode = (int(*)(int device, v1_common_wdr *mode))
67-
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_SetWDRMode")))
77+
if (!(isp_lib->fnSetWDRMode = (int(*)(v1_common_wdr *mode))
78+
hal_symbol_load("v1_isp", isp_lib->handle, "HI_MPI_ISP_SetWdrAttr")))
6879
return EXIT_FAILURE;
6980

70-
if (!(isp_lib->fnRegisterAE = (int(*)(int device, v1_isp_alg *library))
81+
if (!(isp_lib->fnRegisterAE = (int(*)(v1_isp_alg *library))
7182
hal_symbol_load("v1_isp", isp_lib->handleAe, "HI_MPI_AE_Register")))
7283
return EXIT_FAILURE;
7384

74-
if (!(isp_lib->fnRegisterAWB = (int(*)(int device, v1_isp_alg *library))
85+
if (!(isp_lib->fnRegisterAWB = (int(*)(v1_isp_alg *library))
7586
hal_symbol_load("v1_isp", isp_lib->handleAwb, "HI_MPI_AWB_Register")))
7687
return EXIT_FAILURE;
7788

78-
if (!(isp_lib->fnUnregisterAE = (int(*)(int device, v1_isp_alg *library))
89+
if (!(isp_lib->fnUnregisterAE = (int(*)(v1_isp_alg *library))
7990
hal_symbol_load("v1_isp", isp_lib->handleAe, "HI_MPI_AE_UnRegister")))
8091
return EXIT_FAILURE;
8192

82-
if (!(isp_lib->fnUnregisterAWB = (int(*)(int device, v1_isp_alg *library))
93+
if (!(isp_lib->fnUnregisterAWB = (int(*)(v1_isp_alg *library))
8394
hal_symbol_load("v1_isp", isp_lib->handleAwb, "HI_MPI_AWB_UnRegister")))
8495
return EXIT_FAILURE;
8596

src/hal/hisi/v1_rgn.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static int v1_rgn_load(v1_rgn_impl *rgn_lib) {
137137
return EXIT_FAILURE;
138138

139139
if (!(rgn_lib->fnDetachChannel = (int(*)(unsigned int handle, v1_sys_bind *dest))
140-
hal_symbol_load("v1_rgn", rgn_lib->handle, "HI_MPI_RGN_DetachFromChn")))
140+
hal_symbol_load("v1_rgn", rgn_lib->handle, "HI_MPI_RGN_DetachFrmChn")))
141141
return EXIT_FAILURE;
142142

143143
if (!(rgn_lib->fnGetChannelConfig = (int(*)(unsigned int handle, v1_sys_bind *dest, v1_rgn_chn *config))

src/hal/hisi/v1_vb.h

-9
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
#include "v1_common.h"
44

5-
typedef enum {
6-
V1_VB_JPEG_MASK = 0x1
7-
} v1_vb_supl;
8-
95
typedef struct {
106
unsigned int count;
117
struct {
@@ -19,7 +15,6 @@ typedef struct {
1915
void *handle;
2016

2117
int (*fnConfigPool)(v1_vb_pool *config);
22-
int (*fnConfigSupplement)(v1_vb_supl *value);
2318
int (*fnExit)(void);
2419
int (*fnInit)(void);
2520
} v1_vb_impl;
@@ -32,10 +27,6 @@ static int v1_vb_load(v1_vb_impl *vb_lib) {
3227
hal_symbol_load("v1_vb", vb_lib->handle, "HI_MPI_VB_SetConf")))
3328
return EXIT_FAILURE;
3429

35-
if (!(vb_lib->fnConfigSupplement = (int(*)(v1_vb_supl *value))
36-
hal_symbol_load("v1_vb", vb_lib->handle, "HI_MPI_VB_SetSupplementConf")))
37-
return EXIT_FAILURE;
38-
3930
if (!(vb_lib->fnExit = (int(*)(void))
4031
hal_symbol_load("v1_vb", vb_lib->handle, "HI_MPI_VB_Exit")))
4132
return EXIT_FAILURE;

src/hal/hisi/v1_venc.h

+1-11
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,9 @@ typedef struct {
234234
int (*fnCreateChannel)(int channel, v1_venc_chn *config);
235235
int (*fnGetChannelConfig)(int channel, v1_venc_chn *config);
236236
int (*fnDestroyChannel)(int channel);
237-
int (*fnResetChannel)(int channel);
238237
int (*fnSetChannelConfig)(int channel, v1_venc_chn *config);
239238
int (*fnSetColorToGray)(int channel, int *active);
240239

241-
int (*fnFreeDescriptor)(int channel);
242240
int (*fnGetDescriptor)(int channel);
243241

244242
int (*fnGetJpegParam)(int channel, v1_venc_jpg *param);
@@ -271,20 +269,12 @@ static int v1_venc_load(v1_venc_impl *venc_lib) {
271269
hal_symbol_load("v1_venc", venc_lib->handle, "HI_MPI_VENC_GetChnAttr")))
272270
return EXIT_FAILURE;
273271

274-
if (!(venc_lib->fnResetChannel = (int(*)(int channel))
275-
hal_symbol_load("v1_venc", venc_lib->handle, "HI_MPI_VENC_ResetChn")))
276-
return EXIT_FAILURE;
277-
278272
if (!(venc_lib->fnSetChannelConfig = (int(*)(int channel, v1_venc_chn *config))
279273
hal_symbol_load("v1_venc", venc_lib->handle, "HI_MPI_VENC_SetChnAttr")))
280274
return EXIT_FAILURE;
281275

282276
if (!(venc_lib->fnSetColorToGray = (int(*)(int channel, int *active))
283-
hal_symbol_load("v1_venc", venc_lib->handle, "HI_MPI_VENC_SetColor2Grey")))
284-
return EXIT_FAILURE;
285-
286-
if (!(venc_lib->fnFreeDescriptor = (int(*)(int channel))
287-
hal_symbol_load("v1_venc", venc_lib->handle, "HI_MPI_VENC_CloseFd")))
277+
hal_symbol_load("v1_venc", venc_lib->handle, "HI_MPI_VENC_SetColor2GreyConf")))
288278
return EXIT_FAILURE;
289279

290280
if (!(venc_lib->fnGetDescriptor = (int(*)(int channel))

0 commit comments

Comments
 (0)