@@ -143,6 +143,9 @@ int cvi_channel_bind(char index)
143143 if (ret = cvi_vpss .fnEnableChannel (_cvi_vpss_grp , index ))
144144 return ret ;
145145
146+ if (ret = cvi_vpss .fnAttachChannelPool (_cvi_vpss_grp , index , index ))
147+ return ret ;
148+
146149 {
147150 cvi_sys_bind source = { .module = CVI_SYS_MOD_VPSS ,
148151 .device = _cvi_vpss_grp , .channel = index };
@@ -169,7 +172,8 @@ int cvi_channel_create(char index, short width, short height, char mirror, char
169172 channel .dstFps = -1 ;
170173 channel .mirror = mirror ;
171174 channel .flip = flip ;
172- channel .depth = 0 ;
175+ channel .depth = 1 ;
176+ channel .aspectRatio = 1 ;
173177 if (ret = cvi_vpss .fnSetChannelConfig (_cvi_vpss_grp , index , & channel ))
174178 return ret ;
175179 }
@@ -198,6 +202,8 @@ int cvi_channel_unbind(char index)
198202{
199203 int ret ;
200204
205+ cvi_vpss .fnDetachChannelPool (_cvi_vpss_grp , index );
206+
201207 if (ret = cvi_vpss .fnDisableChannel (_cvi_vpss_grp , index ))
202208 return ret ;
203209
@@ -231,7 +237,7 @@ int cvi_pipeline_create(void)
231237 {
232238 cvi_sys_vimd mode [4 ];
233239 cvi_sys .fnGetViVpssMode ((cvi_sys_vimd * * )& mode );
234- mode [0 ] = CVI_SYS_VIMD_VION_VPSSON ;
240+ mode [0 ] = CVI_SYS_VIMD_VIOFF_VPSSON ;
235241 if (ret = cvi_sys .fnSetViVpssMode ((cvi_sys_vimd * * )& mode ))
236242 return ret ;
237243 }
@@ -241,9 +247,12 @@ int cvi_pipeline_create(void)
241247 if (ret = cvi_vi .fnEnableDevice (_cvi_vi_dev ))
242248 return ret ;
243249
250+ if (ret = cvi_snr_drv .obj -> pfnRegisterCallback (_cvi_vi_pipe , & cvi_ae_lib , & cvi_awb_lib ))
251+ return ret ;
252+
244253 {
245254 cvi_vi_bind bind ;
246- bind .num = 1 ;
255+ bind .num = 0 ;
247256 bind .pipeId [0 ] = _cvi_vi_pipe ;
248257 if (ret = cvi_vi .fnBindPipe (_cvi_vi_dev , & bind ))
249258 return ret ;
@@ -259,7 +268,7 @@ int cvi_pipeline_create(void)
259268 pipe .pixFmt = CVI_PIXFMT_RGB_BAYER_8BPP + cvi_config .mipi .prec ;
260269 pipe .compress = CVI_COMPR_NONE ;
261270 pipe .prec = cvi_config .mipi .prec ;
262- pipe .nRedOn = 0 ;
271+ pipe .nRedOn = 1 ;
263272 pipe .sharpenOn = 0 ;
264273 pipe .srcFps = -1 ;
265274 pipe .dstFps = -1 ;
@@ -268,6 +277,20 @@ int cvi_pipeline_create(void)
268277 }
269278 if (ret = cvi_vi .fnStartPipe (_cvi_vi_pipe ))
270279 return ret ;
280+
281+ if (ret = cvi_isp .fnRegisterAE (_cvi_vi_pipe , & cvi_ae_lib ))
282+ return ret ;
283+ if (ret = cvi_isp .fnRegisterAWB (_cvi_vi_pipe , & cvi_awb_lib ))
284+ return ret ;
285+ if (ret = cvi_isp .fnMemInit (_cvi_vi_pipe ))
286+ return ret ;
287+
288+ cvi_config .isp .capt .x = 0 ;
289+ cvi_config .isp .capt .y = 0 ;
290+ if (ret = cvi_isp .fnSetDeviceConfig (_cvi_vi_pipe , & cvi_config .isp ))
291+ return ret ;
292+ if (ret = cvi_isp .fnInit (_cvi_vi_pipe ))
293+ return ret ;
271294
272295 {
273296 cvi_vi_chn channel ;
@@ -287,28 +310,11 @@ int cvi_pipeline_create(void)
287310 if (ret = cvi_vi .fnEnableChannel (_cvi_vi_pipe , _cvi_vi_chn ))
288311 return ret ;
289312
290- if (ret = cvi_snr_drv .obj -> pfnRegisterCallback (_cvi_vi_pipe , & cvi_ae_lib , & cvi_awb_lib ))
291- return ret ;
292-
293- if (ret = cvi_isp .fnRegisterAE (_cvi_vi_pipe , & cvi_ae_lib ))
294- return ret ;
295- if (ret = cvi_isp .fnRegisterAWB (_cvi_vi_pipe , & cvi_awb_lib ))
296- return ret ;
297- if (ret = cvi_isp .fnMemInit (_cvi_vi_pipe ))
298- return ret ;
299-
300- cvi_config .isp .capt .x = 0 ;
301- cvi_config .isp .capt .y = 0 ;
302- if (ret = cvi_isp .fnSetDeviceConfig (_cvi_vi_pipe , & cvi_config .isp ))
303- return ret ;
304- if (ret = cvi_isp .fnInit (_cvi_vi_pipe ))
305- return ret ;
306-
307313 {
308314 cvi_sys_vpcf config = {
309- .mode = CVI_SYS_VPSS_SINGLE ,
310- .inputIsIsp = {1 , 0 },
311- .pipeId = {_cvi_vi_pipe , 0 }
315+ .mode = CVI_SYS_VPSS_DUAL ,
316+ .inputIsIsp = {0 , 1 },
317+ .pipeId = {0 , _cvi_vi_pipe }
312318 };
313319 if (ret = cvi_sys .fnSetVpssMode (& config ))
314320 return ret ;
@@ -589,7 +595,7 @@ int cvi_video_create(char index, hal_vidconfig *config)
589595 } else HAL_ERROR ("cvi_venc" , "This codec is not supported by the hardware!" );
590596 channel .attrib .maxPic .width = config -> width ;
591597 channel .attrib .maxPic .height = config -> height ;
592- channel .attrib .bufSize = ALIGN_UP (config -> height * config -> width * 3 / 4 , 64 ) ;
598+ channel .attrib .bufSize = ALIGN_UP (config -> height , 64 ) * ALIGN_UP ( config -> width , 64 ) * 3 / 2 ;
593599 if (channel .attrib .codec == CVI_VENC_CODEC_H264 )
594600 channel .attrib .profile = MAX (config -> profile , 2 );
595601 channel .attrib .byFrame = 1 ;
@@ -881,26 +887,26 @@ int cvi_system_init(char *snrConfig)
881887 puts (version .version );
882888 }
883889
890+ cvi_sys .fnExit ();
891+ cvi_vb .fnExit ();
892+
884893 if (cvi_parse_sensor_config (snrConfig , & cvi_config ) != CONFIG_OK )
885894 HAL_ERROR ("cvi_sys" , "Can't load sensor config\n" );
886895
887896 if (ret = cvi_sensor_init (cvi_config .dll_file , cvi_config .sensor_type ))
888897 return ret ;
889898
890- cvi_sys .fnExit ();
891- cvi_vb .fnExit ();
892-
893899 {
894900 cvi_vb_pool pool ;
895901 memset (& pool , 0 , sizeof (pool ));
896902
897903 pool .count = 2 ;
898- pool .comm [0 ].blockSize = cvi_config .videv .size .width *
899- cvi_config .videv .size .height * 3 / 2 ;
904+ pool .comm [0 ].blockSize = ALIGN_UP ( cvi_config .videv .size .width , 64 ) *
905+ ALIGN_UP ( cvi_config .videv .size .height , 64 ) * 3 / 2 ;
900906 pool .comm [0 ].blockCnt = 3 ;
901907 pool .comm [0 ].rempVirt = 2 ;
902- pool .comm [1 ].blockSize = cvi_config .videv .size .width *
903- cvi_config .videv .size .height * 3 / 2 ;
908+ pool .comm [1 ].blockSize = ALIGN_UP ( cvi_config .videv .size .width , 64 ) *
909+ ALIGN_UP ( cvi_config .videv .size .height , 64 ) * 3 / 2 ;
904910 pool .comm [1 ].blockCnt = 3 ;
905911 pool .comm [1 ].rempVirt = 2 ;
906912
0 commit comments