- 收藏
- 点赞
- 分享
- 举报
hi3615dv500 sensor:os04a10 测量从 VPSS(视频处理子系统)获取一帧 YUV 数据的耗时
我把咱们示例的smple_vio裁剪了一下,变成了单摄像头 VI → VPSS → VENC/VO 链路。可以正常运行,可以查看到相关信息和摄像头画面。
我后边想要测量从 VPSS(视频处理子系统)获取一帧 YUV 数据的耗时:
使用了一个性能测试线程函数
将其放在sample_vio_start_route中
static td_s32 sample_vio_start_route(sample_vi_cfg vi_cfg, sample_vpss_cfg vpss_cfg, td_s32 route_num)
{
td_s32 i, j, ret;
ot_vpss_grp vpss_grp[SAMPLE_VIO_MAX_ROUTE_NUM] = {0, 1, 2, 3};
sample_comm_vi_get_size_by_sns_type(SENSOR0_TYPE, &g_vb_param.vb_size);
if (sample_vio_sys_init() != TD_SUCCESS) {
return TD_FAILURE;
}
// 启动VI
for (i = 0; i < route_num; i++) {
ret = sample_comm_vi_start_vi(&vi_cfg[i]);
if (ret != TD_SUCCESS) {
goto start_vi_failed;
}
}
// 绑定VI和VPSS并使能通道
for (i = 0; i < route_num; i++) {
sample_comm_vi_bind_vpss(i, 0, vpss_grp[i], 0);
if (ss_mpi_vi_enable_chn(i, 0) != TD_SUCCESS) {
goto start_vi_failed;
}
}
// 启动VPSS
for (i = 0; i < route_num; i++) {
ret = sample_vio_start_vpss(vpss_grp[i], vpss_cfg);
if (ret != TD_SUCCESS) {
goto start_vpss_failed;
}
if (ss_mpi_vpss_enable_chn(vpss_grp[i], 0) != TD_SUCCESS) {
goto start_vpss_failed;
}
}
// 启动VENC和VO(链路完全建立)
ret = sample_vio_start_venc_and_vo(vpss_grp, SAMPLE_VIO_MAX_ROUTE_NUM, route_num);
if (ret != TD_SUCCESS) {
goto start_venc_and_vo_failed;
}
// 链路启动成功后,启动计时线程
pthread_t tid;
if (pthread_create(&tid, NULL, perf_thread, (void*)&vpss_grp[0]) != 0) {
printf("创建计时线程失败!\n");
} else {
pthread_detach(tid); // 分离线程,独立运行
}
return TD_SUCCESS;
// 错误处理部分(保持不变)
start_venc_and_vo_failed:
start_vpss_failed:
for (j = i - 1; j >= 0; j—) {
sample_vio_stop_vpss(vpss_grp[j]);
}
for (i = 0; i < route_num; i++) {
sample_comm_vi_un_bind_vpss(i, 0, vpss_grp[i], 0);
}
start_vi_failed:
for (j = i - 1; j >= 0; j—) {
sample_comm_vi_stop_vi(&vi_cfg[j]);
}
sample_comm_sys_exit();
return TD_FAILURE;
}
这是线程函数的代码:
static void perf_thread(void arg)
{
ot_vpss_grp grp = (ot_vpss_grp)arg;
ot_vpss_chn chn = 0;
int cnt = 0;
double total = 0, min = 1e9, max = 0;
printf("\n=== VI->VPSS->VENC/VO 链路性能计时开始 ===\n");
printf("从 VPSS GRP%d CH%d 拿 YUV 帧(链路出口)\n", grp, chn);
while (cnt < 100 && !g_sig_flag) {
ot_video_frame_info frame= {0};
double t0 = now_ms();
td_s32 ret = ss_mpi_vpss_get_chn_frame(grp, chn, &frame, 100);
if (ret != TD_SUCCESS) {
// 修正:使用OT_ERR_TIMEOUT替代TD_TIMEOUT
if (ret == OT_ERR_TIMEOUT) {
printf("获取帧超时(%d次)\n", cnt);
} else {
printf("获取帧失败(错误码:0x%x)\n", ret);
}
usleep(10000);
continue;
}
double t1 = now_ms();
double delta = t1 - t0;
total += delta;
min = (delta < min) ? delta : min;
max = (delta > max) ? delta : max;
cnt++;
ss_mpi_vpss_release_chn_frame(grp, chn, &frame);
if (cnt % 10 == 0) {
printf("已获取 %03d 帧,当前帧耗时: %.2f ms\n", cnt, delta);
}
}
if (cnt > 0) {
printf("=== 计时结束 ===\n");
printf("总帧数: %d\n", cnt);
printf("平均耗时: %.2f ms\n", total / cnt);
printf("最小耗时: %.2f ms\n", min);
printf("最大耗时: %.2f ms\n", max);
} else {
printf("=== 计时结束:未获取到有效帧 ===\n");
}
return NULL;
}
```
目前的情况是开发板打印信息:
~ # ./mpp_enc 1
Sample VIO Start!
vi vpss mode list:
(0) VI_ONLINE_VPSS_ONLINE, FMU OFF
(1) VI_ONLINE_VPSS_OFFLINE, FMU OFF
(2) VI_OFFLINE_VPSS_OFFLINE, FMU DIRECT
(3) VI_OFFLINE_VPSS_OFFLINE, FMU OFF
please select mode:
3
[MPP] Version: [HI3519DV500_MPP_V2.0.2.0 B050 Release], Build Time[Dec 20 2024, 16:23:07]
linear mode
vi_pipe:0,== os04a10 24Mclk 4M30fps(MIPI) 12bit linear init success! ==
ISP Dev 0 running !
start vo dhd0.
mipi intf sync = 23
———————-press enter key to exit!———————-
=== VI->VPSS->VENC/VO 链路性能计时开始 ===
从 VPSS GRP0 CH0 拿 YUV 帧(链路出口)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
获取帧失败(错误码:0xa0078016)
^C[sample_signal_handler]-638: catch signal 2, stop…
=== 计时结束:未获取到有效帧 ===
exit
[sample_comm_venc_get_venc_stream_proc]-2463: get venc stream time out, exit thread
Sample VIO Exit!
~ # ls
通过hdmi接口仍可看到相关画面vi正常
cat /proc/umap/vi
[VI] Version: [HI3519DV500_MPP_V2.0.2.0 B050 Release], Build Time[Dec 20 2024, 16:23:07]
————————————————————vi module param————————————————————————————————-
max_out_width max_out_height detect_err_frame drop_err_frame
8192 8192 0 0
————————————————————vi vpss mode & vi aiisp mode & fmu mode————————————————————-
pipe_id vi_vpss_mode vi_aiisp_mode fmu_mode
0 vi_online_vpss_offline default off
1 vi_offline_vpss_offline default off
2 vi_offline_vpss_offline default off
3 vi_offline_vpss_offline default off
4 vi_offline_vpss_offline default off
5 vi_offline_vpss_offline default off
6 vi_offline_vpss_offline default off
7 vi_offline_vpss_offline default off
8 vi_offline_vpss_offline default off
9 vi_offline_vpss_offline default off
10 vi_offline_vpss_offline default off
11 vi_offline_vpss_offline default off
12 vi_offline_vpss_offline default off
13 vi_offline_vpss_offline default off
14 vi_offline_vpss_offline default off
————————————————————vi dev attr1——————————————————————————————————
dev_id dev_status intf_mode work_mode comp_mask0 comp_mask1 scan_mode
0 enable mipi 1mux fff00000 0 progressive
————————————————————vi dev attr2——————————————————————————————————
dev_id data_seq data_type data_reverse width height data_rate irq_affinity
0 yvyu raw N 2688 1520 x1 0
————————————————————vi thermo sns attr———————————————————————————————
dev_id work_mode ooc_width ooc_height ooc_bitwidth cfg_num frame_rate sd_mux0 sd_mux1 sd_mux2 sd_mux3
————————————————————vi dev detect info———————————————————————————————
dev_id valid_width valid_height em_data_size total_width vfb_height vbb_height
0 2688 1520 0 9738 0 107
————————————————————vi stitch grp attr———————————————————————————————
grp_id stitch_en cfg_mode max_pts_gap pipe_num pipe_id
————————————————————vi bind attr——————————————————————————————————
dev_id pipe_num pipe_id
0 1 0
————————————————————vi wdr fusion grp attr—————————————————————————————
grp_id wdr_mode cache_line pipe_num pipe_id pipe_reverse
0 none 1520 1 0 N
————————————————————vi pipe attr1—————————————————————————————————-
pipe_id bypass_mode isp_bypass width height pixel_format compress_mode
0 bypass_none N 2688 1520 raw12 line
————————————————————vi pipe attr2—————————————————————————————————-
pipe_id bit_align_mode src_rate dst_rate frame_source vc_num vb_src vb_pool
0 high -1 -1 src_fe 0 common -1
————————————————————vi pipe psfm attr———————————————————————————————-
pipe_id enable rect_x rect_y rect_width rect_height
0 N 0 0 0 0
————————————————————vi aiisp pool attr———————————————————————————————
pipe_id aiisp_type in_pool_id out_pool_id net_type
————————————————————vi pipe param—————————————————————————————————-
pipe_id discard_pro_pic_en out_mode data_rate yuv_skip_en signed_bit_extend_en bnr_info_en nr_effect_mode
0 N norm x1 Y N N advance
————————————————————vi pipe bnr buf num——————————————————————————————-
pipe_id bnr_buf_num
0 2
————————————————————vi pipe mcf info————————————————————————————————
pipe_id mcf_vi_en queue_full ref_ok last_pts ref_pts
————————————————————vi pipe pre crop attr—————————————————————————————-
pipe_id enable rect_x rect_y rect_width rect_height
0 N 0 0 0 0
————————————————————vi pipe post crop attr—————————————————————————————
pipe_id enable rect_x rect_y rect_width rect_height
0 N 0 0 0 0
————————————————————vi pipe 3dnr attr———————————————————————————————-
pipe_id enable nr_type compress_mode nr_motion_mode
0 Y NORM frame NORM
————————————————————vi pipe 3dnr param———————————————————————————————
————————————————————vi pipe0 3dnr param——————————————————————————————-
pipe version opt_mode iso ref1_en
0 VER_1 MANUAL 0 1
nry0_en nry1_en nry2_en nry3_en nrc0_en nrc1_en limit_range_en
0 1 1 1 1 1 0
sfs1_0 sfs2_1 sfs2_2 sfs2_3 sfc sfs2_c
3 0 30 0 10 10
sfs1_1 sfs4_1 sfs4_2 sfs4_3 trc
8 0 30 0 20
tfs0_1 tfs0_2
0 12
tfs1_1 tfs1_2 adv_math
0 12 0
sfn_1 sfn_2 sfn_3
0_2_4_0 4_2_4_0 0_2_4_0
sfn_4
0_2_4_0
math_0 math0_1 math0_2
128 200 400
math1_1 math1_2
200 999
————————————————————vi pipe frame dump attr————————————————————————————-
pipe_id enable depth
0 N 0
————————————————————vi pipe private data dump attr—————————————————————————
pipe_id enable data_mode depth data_size
0 N back 0 0
————————————————————vi pipe low delay attr—————————————————————————————
pipe_id enable line_cnt one_buf
0 N 0 N
————————————————————vi pipe frame interrupt attr——————————————————————————
pipe_id interrupt_type early_line
0 start 0
————————————————————vi pipe user pic attr—————————————————————————————-
pipe_id enable width height stride pixel_format pool_id phy_addr
0 N 0 0 0 n/a 0 0
————————————————————vi pipe snap attr———————————————————————————————-
pipe_id snap_type load_ccm_en frame_cnt repeat_send_times zsl_en frame_depth rollback_ms interval op_mode
————————————————————vi pipe status—————————————————————————————————
pipe_id enable int_en width height int_cnt send_cnt lost_cnt vb_fail_cnt frame_rate
0 Y Y 2688 1520 738 0 0 0 0
————————————————————vi pipe offline task statistics————————————————————————-
pipe_id receive_pic_cnt busy_num task_submit_cnt task_fail_cnt task_cost_time max_cost_time
0 0 0 0 0 0 0
————————————————————vi phys chn attr1———————————————————————————————-
pipe_id chn_id width height pixel_format dynamic_range video_format compress_mode mirror flip
0 0 2688 1520 yvu-sp420 sdr8 linear seg N N
————————————————————vi phys chn attr2———————————————————————————————-
pipe_id chn_id depth src_rate dst_rate vb_src vb_pool align
0 0 0 -1 -1 common -1 0
————————————————————vi phys chn motion_denoise status———————————————————————-
pipe_id chn_id motion_denoise
————————————————————vi phys chn dis config—————————————————————————————
pipe_id chn_id mode motion_level pdt_type buf_num crop_ratio frame_rate camera_steady scale ref_num
0 0 4_DOF_GME Low RECORDER 0 0 0 0 0 0
————————————————————vi phys chn dis attr1—————————————————————————————-
pipe_id chn_id enable gdc_bypass mov_sub roef timelag hor_limit ver_limit still_crop strength ref_slope
0 0 N N 0 0 0 0 0 N 0 0
————————————————————vi phys chn dis attr2—————————————————————————————-
pipe_id chn_id dis_ldc_en focal_len_x focal_len_y coord_shift_x coord_shift_y max_du
0 0 N 0 0 0 0 0
————————————————————vi phys chn dis attr3—————————————————————————————-
pipe_id chn_id rotation_compensation_en max_roll_delta final_roll
0 0 N 0 0
————————————————————vi phys chn dis param—————————————————————————————-
pipe_id chn_id large_motion_stable_coef low_freq_motion_preserve low_freq_motion_freq
0 0 100 10 100
————————————————————vi phys chn dis wdr_attr————————————————————————————
pipe_id chn_id match_frame
0 0 0
————————————————————vi chn low delay attr—————————————————————————————-
pipe_id chn_id enable line_cnt one_buf
0 0 N 0 N
————————————————————vi chn crop info————————————————————————————————
pipe_id chn_id crop_en coord x y width height trim_x trim_y trim_width trim_height
0 0 N ABS 0 0 0 0
————————————————————vi chn status—————————————————————————————————-
pipe_id chn_id enable width height send_cnt vb_fail_cnt lost_frame_cnt frame_rate
0 0 Y 2688 1520 737 0 0 30
————————————————————vi chn out frame info—————————————————————————————-
pipe_id chn_id width height compress_mode low_delay_frame delay
0 0 2688 1520 seg N 33883
————————————————————vi interrupt cost time statistics———————————————————————-
isp_time isp_max_time vicap_time vicap_max_time viproc_time viproc_max_time int_time_per_sec load_ratio_0
62 295 66 353 719 766 34642 NA
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片
-
2021-07-29 11:58:34
-
2016-01-05 13:41:29
-
2014-01-02 11:32:38
-
2019-05-05 14:19:27
-
2021-01-13 13:40:57
-
2025-07-14 13:41:39
-
2025-11-19 17:10:06
-
2025-02-19 11:28:09
-
2021-05-12 18:05:46
-
2024-03-07 11:13:43
-
2016-11-06 23:18:26
-
2020-07-23 17:45:58
-
2016-11-14 16:58:35
-
2019-04-11 15:13:48
-
2018-01-31 17:32:48
-
2023-11-09 09:43:11
-
2025-02-06 10:32:33
-
2020-07-20 10:09:42
-
2020-07-20 10:08:47
-
5hisi3516cv610 + gc4336p 夜晚很模糊
-
5AIISP(功能演示,SC4336P为BGGR,强制转RGGB,会导致颜色异常)
-
5rv1106使用luckfox的SDK,设备树和驱动都写好了,结果设备文件没有生成
-
5海思3516cv610中如何进行SD卡升级,根据官方文档操作,烧录进板子时,走的默认uboot,没有执行uboot升级。
-
5G610Q-IPC-38E 夜晚很暗 有什么办法解决吗 已经补光了
-
10转换模型时,SoC版本里没显示hi3516cv610芯片
-
5hisi3516cv610 使用 yolov8n 模型训练 要如何提高 这里识别的是人
-
10有人在海思平台接过SC035HGS吗
-
5关于hi3519dv500,以SD卡虚拟 U 盘操作
-
5ss928 sample_venc代码移植到openEuler24.03上执行报错 [sample_comm_vi_start_dev]-1068: vi set dev attr failed wi
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明

微信扫码分享
QQ好友