From 463b828b2a6867fa577853190f94da8778e6b083 Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 11:01:27 +0000
Subject: [PATCH 01/13] =?UTF-8?q?update=20cplusplus/level1=5Fsingle=5Fapi/?=
=?UTF-8?q?7=5Fdvpp/jpegd=5Fsample/src/sample=5Fcomm=5Fjpegd.cpp.=20dvpp?=
=?UTF-8?q?=E6=94=AF=E6=8C=81device=20id=E5=91=BD=E4=BB=A4=E8=A1=8C?=
=?UTF-8?q?=E4=BC=A0=E5=8F=82=E8=AE=BE=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
.../jpegd_sample/src/sample_comm_jpegd.cpp | 22 ++++++++++++-------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/jpegd_sample/src/sample_comm_jpegd.cpp b/cplusplus/level1_single_api/7_dvpp/jpegd_sample/src/sample_comm_jpegd.cpp
index 26d781562..13cb0123c 100644
--- a/cplusplus/level1_single_api/7_dvpp/jpegd_sample/src/sample_comm_jpegd.cpp
+++ b/cplusplus/level1_single_api/7_dvpp/jpegd_sample/src/sample_comm_jpegd.cpp
@@ -71,6 +71,7 @@ char g_input_file_name[FILE_NAME_LEN] = "infile";
char g_output_file_name[FILE_NAME_LEN] = "outfile";
char g_compatible_dir_name[FILE_NAME_LEN] = "./";
+int32_t g_device_id = 0;
aclrtContext g_context = nullptr;
aclrtRunMode g_run_mode = ACL_DEVICE;
hi_vdec_send_mode g_video_mode = HI_VDEC_SEND_MODE_FRAME;
@@ -168,6 +169,7 @@ void jpegd_usage(char *sPrgNm)
SAMPLE_PRT("\t delay_time: start decode after input seconds.\n");
SAMPLE_PRT("\t performance_mode: mode to test decode fps.\n");
SAMPLE_PRT("\t wait_time: max wait input seconds,\n");
+ SAMPLE_PRT("\t device_id: device id,\n");
SAMPLE_PRT("\t JpegdDemo would exit after input seconds if it still running.\n");
SAMPLE_PRT("\t whole_dir: compatible mode decode dir path. JPEGD would decode all jpeg to test compatibility\n");
SAMPLE_PRT("\t If you want to check whether pics in folder can be decoded, run like:\n");
@@ -208,13 +210,14 @@ int32_t get_option(int32_t argc, char **argv)
{"offset_bottom", 1, nullptr, 'B'},
{"offset_left", 1, nullptr, 'L'},
{"offset_right", 1, nullptr, 'R'},
+ {"device_id", 1, nullptr, 'i'},
{nullptr, 0, nullptr, 0}
};
while (1) {
option_index = 0;
- c = getopt_long(argc, argv, "w:h:b:c:d:g:e:s:p:C:D:F:O:W:H:S:Y:a:P:", long_options, &option_index);
+ c = getopt_long(argc, argv, "w:h:b:c:d:g:e:s:p:C:D:F:O:W:H:S:Y:a:P:i", long_options, &option_index);
if (c == -1) {
break;
}
@@ -286,6 +289,9 @@ int32_t get_option(int32_t argc, char **argv)
case 'R':
g_offset_right = atoi(optarg);
break;
+ case 'i':
+ g_device_id = atoi(optarg);
+ break;
default:
SAMPLE_PRT("unsupport option!\n");
break;
@@ -1753,18 +1759,18 @@ int32_t setup_acl_device()
}
SAMPLE_PRT("aclInit succ.\n");
- aclRet = aclrtSetDevice(0);
+ aclRet = aclrtSetDevice(g_device_id);
if (aclRet != ACL_SUCCESS) {
- SAMPLE_PRT("aclrtSetDevice(0) fail with %d.\n", aclRet);
+ SAMPLE_PRT("aclrtSetDevice(%d) fail with %d.\n", g_device_id, aclRet);
aclFinalize();
return aclRet;
}
- SAMPLE_PRT("aclrtSetDevice(0) succ.\n");
+ SAMPLE_PRT("aclrtSetDevice(%d) succ.\n", g_device_id);
- aclRet = aclrtCreateContext(&g_context, 0);
+ aclRet = aclrtCreateContext(&g_context, g_device_id);
if (aclRet != ACL_SUCCESS) {
SAMPLE_PRT("acl create context failed with %d.\n", aclRet);
- aclrtResetDevice(0);
+ aclrtResetDevice(g_device_id);
aclFinalize();
return aclRet;
}
@@ -1775,7 +1781,7 @@ int32_t setup_acl_device()
SAMPLE_PRT("get current context failed\n");
aclrtDestroyContext(g_context);
g_context = nullptr;
- aclrtResetDevice(0);
+ aclrtResetDevice(g_device_id);
aclFinalize();
return aclRet;
}
@@ -1789,7 +1795,7 @@ void destroy_acl_device()
if (g_context) {
aclrtDestroyContext(g_context);
g_context = nullptr;
- aclrtResetDevice(0);
+ aclrtResetDevice(g_device_id);
aclFinalize();
}
}
--
Gitee
From edb52f0c29c7a6fda3f1bed171e465402f299258 Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 11:08:17 +0000
Subject: [PATCH 02/13] =?UTF-8?q?update=20cplusplus/level1=5Fsingle=5Fapi/?=
=?UTF-8?q?7=5Fdvpp/jpegd=5Fsample/readme.md.=20dvpp=E6=94=AF=E6=8C=81devi?=
=?UTF-8?q?ce=20id=E5=91=BD=E4=BB=A4=E8=A1=8C=E4=BC=A0=E5=8F=82=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
cplusplus/level1_single_api/7_dvpp/jpegd_sample/readme.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/cplusplus/level1_single_api/7_dvpp/jpegd_sample/readme.md b/cplusplus/level1_single_api/7_dvpp/jpegd_sample/readme.md
index 4240b627a..664e52ea2 100644
--- a/cplusplus/level1_single_api/7_dvpp/jpegd_sample/readme.md
+++ b/cplusplus/level1_single_api/7_dvpp/jpegd_sample/readme.md
@@ -137,6 +137,7 @@ DVPP中的JPEGD功能模块,实现.jpg、.jpeg、.JPG、.JPEG图片的解码
- delay\_time:发送前的等待时间,所有通道等待输入所定的秒之后,一齐发送码流。该参数用于性能测试时减小通道之间因为启动时间不同步引起的性能参数差异,非性能模式下无效。
- wait\_time:最大等待时间,以秒为单位。超出设定时间后进入退出流程。
- whole_dir:兼容性测试的输入文件夹路径。设置后将交给JPEGD解码该文件夹下所有以.jpg或.JPEG为后缀的文件,不设置则不会触发该模式。
+ - device\_id:device id,默认为0。
## JPEGD基础功能
--
Gitee
From 2fe4904f2235fbc74e1975bb8689bea68030559c Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 12:20:41 +0000
Subject: [PATCH 03/13] update
cplusplus/level1_single_api/7_dvpp/jpege_sample/readme.md.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
cplusplus/level1_single_api/7_dvpp/jpege_sample/readme.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/cplusplus/level1_single_api/7_dvpp/jpege_sample/readme.md b/cplusplus/level1_single_api/7_dvpp/jpege_sample/readme.md
index 91c87b842..65ffef293 100644
--- a/cplusplus/level1_single_api/7_dvpp/jpege_sample/readme.md
+++ b/cplusplus/level1_single_api/7_dvpp/jpege_sample/readme.md
@@ -145,3 +145,4 @@ DVPP中的JPEGE功能模块,实现将YUV格式图片编码成.jpg图片。
- zero\_copy:是否指定编码结果的输出地址。
- 默认0:不指定输出地址
- 非0:指定输出地址
+ - device\_id:device id, 默认为0。
--
Gitee
From 8ab14417d199fd976eaee8ade6bb13301e4d238d Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 12:28:48 +0000
Subject: [PATCH 04/13] update
cplusplus/level1_single_api/7_dvpp/jpege_sample/src/sample_jpege.cpp.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
.../7_dvpp/jpege_sample/src/sample_jpege.cpp | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/jpege_sample/src/sample_jpege.cpp b/cplusplus/level1_single_api/7_dvpp/jpege_sample/src/sample_jpege.cpp
index 0d3129a9b..5e08709fc 100644
--- a/cplusplus/level1_single_api/7_dvpp/jpege_sample/src/sample_jpege.cpp
+++ b/cplusplus/level1_single_api/7_dvpp/jpege_sample/src/sample_jpege.cpp
@@ -69,6 +69,7 @@ uint32_t g_isZeroCopy = 0;
aclrtContext g_context = NULL;
// ACL_HOST or ACL_DEVICE
aclrtRunMode g_run_mode = ACL_HOST;
+int32_t g_device_id = 0;
/*
* function: jpege_usage(int argc, char **argv)
@@ -96,6 +97,7 @@ void jpege_usage()
printf("\t\t 9: HI_PIXEL_FORMAT_YVYU_PACKED_422\n");
printf("\t\t 10: HI_PIXEL_FORMAT_VYUY_PACKED_422\n");
printf("\t chn_num: jpege channel num.\n");
+ printf("\t device_id: device id.\n");
printf("/*********************************************************/\n\n");
}
@@ -133,9 +135,10 @@ void get_option(int argc, char **argv)
{"sync_enc" , 1, 0, 'S'},
{"frame_count" , 1, 0, 'n'},
{"zero_copy" , 1, 0, 'z'},
+ {"device_id" , 1, 0, 'd'},
{NULL, 0, 0, 0}
};
- c = getopt_long(argc, argv, "W:H:w:h:f:b:c:i:o:l:s:B:p:O:Q:T:S:n:z", longOptions, &optionIndex);
+ c = getopt_long(argc, argv, "W:H:w:h:f:b:c:i:o:l:s:B:p:O:Q:T:S:n:z:d", longOptions, &optionIndex);
if (c == -1) {
break;
}
@@ -198,6 +201,9 @@ void get_option(int argc, char **argv)
case 'z':
g_isZeroCopy = atoi(optarg);
break;
+ case 'd':
+ g_device_id = atoi(optarg);
+ break;
default:
SAMPLE_PRT("bad arg!\n");
break;
@@ -224,13 +230,13 @@ int32_t jpege_sys_init()
return HI_FAILURE;
}
- acl_ret = aclrtSetDevice(0);
+ acl_ret = aclrtSetDevice(g_device_id);
if (acl_ret != ACL_SUCCESS) {
- SAMPLE_PRT("aclrtSetDevice(0) fail with %d.\n", acl_ret);
+ SAMPLE_PRT("aclrtSetDevice(%d) fail with %d.\n", g_device_id, acl_ret);
return HI_FAILURE;
}
- acl_ret = aclrtCreateContext(&g_context, 0);
+ acl_ret = aclrtCreateContext(&g_context, g_device_id);
if (acl_ret != ACL_SUCCESS) {
SAMPLE_PRT("acl create context failed with %d.\n", acl_ret);
return HI_FAILURE;
@@ -277,9 +283,9 @@ hi_s32 jpege_sys_exit()
if (acl_ret != ACL_SUCCESS) {
SAMPLE_PRT("destroy context failed with %d.\n", acl_ret);
}
- acl_ret = aclrtResetDevice(0);
+ acl_ret = aclrtResetDevice(g_device_id);
if (acl_ret != ACL_SUCCESS) {
- SAMPLE_PRT("reset device(0) fail with %d.\n", acl_ret);
+ SAMPLE_PRT("reset device(%d) fail with %d.\n", g_device_id, acl_ret);
}
acl_ret = aclFinalize();
if (acl_ret != ACL_SUCCESS) {
--
Gitee
From 02e317b52c0651666b6effb4b353f37b0342ed80 Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 12:31:11 +0000
Subject: [PATCH 05/13] update
cplusplus/level1_single_api/7_dvpp/pngd_sample/readme.md.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
cplusplus/level1_single_api/7_dvpp/pngd_sample/readme.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/pngd_sample/readme.md b/cplusplus/level1_single_api/7_dvpp/pngd_sample/readme.md
index 5d7d17df4..684e03a45 100644
--- a/cplusplus/level1_single_api/7_dvpp/pngd_sample/readme.md
+++ b/cplusplus/level1_single_api/7_dvpp/pngd_sample/readme.md
@@ -130,7 +130,7 @@ DVPP中的PNGD功能模块,实现.png图片的解码。
- delay\_time:发送前的等待时间,所有通道等待输入所定的秒之后,一齐发送码流。该参数用于性能测试时减小通道之间因为启动时间不同步引起的性能参数差异,非性能模式下无效。
- wait\_time:最大等待时间,以秒为单位。超出设定时间后进入退出流程。
- whole_dir:兼容性测试的输入文件夹路径。设置后将交给PNGD解码该文件夹下所有以.jpg或.JPEG为后缀的文件,不设置则不会触发该模式。
-
+ - device\_id:device id,默认为0。
## PNGD基础功能
--
Gitee
From 63a4c8dcafa56be16b415ee59569f5cbab6f7d7f Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 12:37:31 +0000
Subject: [PATCH 06/13] update
cplusplus/level1_single_api/7_dvpp/pngd_sample/src/sample_comm_pngd.cpp.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
.../pngd_sample/src/sample_comm_pngd.cpp | 22 ++++++++++++-------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/pngd_sample/src/sample_comm_pngd.cpp b/cplusplus/level1_single_api/7_dvpp/pngd_sample/src/sample_comm_pngd.cpp
index 7f431bec9..8b03be87b 100644
--- a/cplusplus/level1_single_api/7_dvpp/pngd_sample/src/sample_comm_pngd.cpp
+++ b/cplusplus/level1_single_api/7_dvpp/pngd_sample/src/sample_comm_pngd.cpp
@@ -58,6 +58,7 @@ char g_input_file_name[FILE_NAME_LEN] = "infile";
char g_output_file_name[FILE_NAME_LEN] = "outfile";
char g_compatible_dir_name[FILE_NAME_LEN] = "./";
+int32_t g_device_id = 0;
aclrtContext g_context = nullptr;
aclrtRunMode g_run_mode = ACL_DEVICE;
hi_pixel_format g_pixel_format = HI_PIXEL_FORMAT_RGB_888;
@@ -158,6 +159,7 @@ void pngd_usage(char *sPrgNm)
SAMPLE_PRT("\t delay_time: start decode after input seconds.\n");
SAMPLE_PRT("\t performance_mode: mode to test decode fps.\n");
SAMPLE_PRT("\t wait_time: max wait input seconds,\n");
+ SAMPLE_PRT("\t device_id: device id,\n");
SAMPLE_PRT("\t PngdDemo would exit after input seconds if it still running.\n");
SAMPLE_PRT("\t whole_dir: compatible mode decode dir path. PNGD would decode all png to test compatibility\n");
SAMPLE_PRT("\t If you want to check whether pics in folder can be decoded, run like:\n");
@@ -189,13 +191,14 @@ int32_t get_option(int32_t argc, char **argv)
{"wait_time", 1, nullptr, 'a'},
{"performance_mode", 1, nullptr, 'P'},
{"align", 1, nullptr, 'b'},
+ {"device_id", 1, nullptr, 'd'},
{nullptr, 0, nullptr, 0}
};
while (1) {
option_index = 0;
- c = getopt_long(argc, argv, "w:h:c:s:p:F:O:W:H:S:Y:a:P:b:", long_options, &option_index);
+ c = getopt_long(argc, argv, "w:h:c:s:p:F:O:W:H:S:Y:a:P:b:d:", long_options, &option_index);
if (c == -1) {
break;
}
@@ -243,6 +246,9 @@ int32_t get_option(int32_t argc, char **argv)
case 'b':
g_align = atoi(optarg);
break;
+ case 'd':
+ g_device_id = atoi(optarg);
+ break;
default:
SAMPLE_PRT("unsupport option!\n");
break;
@@ -1390,18 +1396,18 @@ int32_t setup_acl_device()
}
SAMPLE_PRT("aclInit succ.\n");
- aclRet = aclrtSetDevice(0);
+ aclRet = aclrtSetDevice(g_device_id);
if (aclRet != ACL_SUCCESS) {
- SAMPLE_PRT("aclrtSetDevice(0) fail with %d.\n", aclRet);
+ SAMPLE_PRT("aclrtSetDevice(%d) fail with %d.\n", g_device_id, aclRet);
aclFinalize();
return aclRet;
}
- SAMPLE_PRT("aclrtSetDevice(0) succ.\n");
+ SAMPLE_PRT("aclrtSetDevice(%d) succ.\n", g_device_id);
- aclRet = aclrtCreateContext(&g_context, 0);
+ aclRet = aclrtCreateContext(&g_context, g_device_id);
if (aclRet != ACL_SUCCESS) {
SAMPLE_PRT("acl create context failed with %d.\n", aclRet);
- aclrtResetDevice(0);
+ aclrtResetDevice(g_device_id);
aclFinalize();
return aclRet;
}
@@ -1412,7 +1418,7 @@ int32_t setup_acl_device()
SAMPLE_PRT("get current context failed\n");
aclrtDestroyContext(g_context);
g_context = nullptr;
- aclrtResetDevice(0);
+ aclrtResetDevice(g_device_id);
aclFinalize();
return aclRet;
}
@@ -1426,7 +1432,7 @@ void destroy_acl_device()
if (g_context) {
aclrtDestroyContext(g_context);
g_context = nullptr;
- aclrtResetDevice(0);
+ aclrtResetDevice(g_device_id);
aclFinalize();
}
}
--
Gitee
From 45426dfac799025802848d9943dce71d1dde439c Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 12:46:59 +0000
Subject: [PATCH 07/13] update
cplusplus/level1_single_api/7_dvpp/venc_sample/readme.md.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
cplusplus/level1_single_api/7_dvpp/venc_sample/readme.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cplusplus/level1_single_api/7_dvpp/venc_sample/readme.md b/cplusplus/level1_single_api/7_dvpp/venc_sample/readme.md
index 01b3e392f..3b2c0653d 100644
--- a/cplusplus/level1_single_api/7_dvpp/venc_sample/readme.md
+++ b/cplusplus/level1_single_api/7_dvpp/venc_sample/readme.md
@@ -174,6 +174,8 @@ DVPP 中的VENC功能模块,实现将YUV420SP、YVU420SP格式的视频编码
- 非0:性能测试(考虑读取YUV文件耗时,对性能有影响,性能测试只读取一帧,循环发送,指定帧数编码完成后结束流程)。
- PerfFrameNum:性能测试输入帧数,默认为300。
+ - DeviceId:device id,默认为0。
+
--
Gitee
From 0ffe9dfa3b245aa1cb8a41b1ee758054a1e6a660 Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 12:53:41 +0000
Subject: [PATCH 08/13] update
cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
.../7_dvpp/venc_sample/src/sample_debug.cpp | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp b/cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp
index 62ca00875..df305ba4d 100644
--- a/cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp
+++ b/cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp
@@ -58,6 +58,7 @@ std::map g_mbuf_map;
pthread_mutex_t g_mbuf_mutex;
aclrtContext g_context = NULL;
+inr32_t g_device_id = 0;
// save the output stream
hi_s32 venc_save_stream(FILE* fp, VencOutStream* outStream, uint64_t packCount)
@@ -556,13 +557,13 @@ int32_t venc_sys_init()
return HI_FAILURE;
}
- aclRet = aclrtSetDevice(0);
+ aclRet = aclrtSetDevice(g_device_id);
if (aclRet != ACL_SUCCESS) {
- HMEV_HISDK_PRT(ERROR, "aclrtSetDevice(0) fail with %d.\n", aclRet);
+ HMEV_HISDK_PRT(ERROR, "aclrtSetDevice(%d) fail with %d.\n", g_device_id, aclRet);
return HI_FAILURE;
}
- aclRet = aclrtCreateContext(&g_context, 0);
+ aclRet = aclrtCreateContext(&g_context, g_device_id);
if (aclRet != ACL_SUCCESS) {
HMEV_HISDK_PRT(ERROR, "acl create context failed with %d.", aclRet);
return HI_FAILURE;
@@ -609,9 +610,9 @@ int32_t venc_sys_exit()
if (aclRet != ACL_SUCCESS) {
HMEV_HISDK_PRT(ERROR, "destroy context failed with %d.", aclRet);
}
- aclRet = aclrtResetDevice(0);
+ aclRet = aclrtResetDevice(g_device_id);
if (aclRet != ACL_SUCCESS) {
- HMEV_HISDK_PRT(ERROR, "reset device(0) fail with %d.\n", aclRet);
+ HMEV_HISDK_PRT(ERROR, "reset device(%d) fail with %d.\n", g_device_id, aclRet);
}
aclRet = aclFinalize();
if (aclRet != ACL_SUCCESS) {
@@ -645,9 +646,10 @@ void venc_get_option(int argc, char** argv)
{"SaveOutData", 1, 0, 's'}, // 0:do not save stream 1:save stream
{"IFrameGop", 1, 0, 'g'}, // I frame interval[1, 65536],set 1 for all I frame,65536 as default
{"StartChnlId", 1, 0, 'd'}, // specify the start channel id for current process in multi-process test
+ {"DeviceId", 1, 0, 'I'},
{0, 0, 0, 0},
};
- int c = getopt_long(argc, argv, "w:h:r:n:c:b:f:D:H:i:o:p:l:P:m:s:g:d:", longOptions, &optionIndex);
+ int c = getopt_long(argc, argv, "w:h:r:n:c:b:f:D:H:i:o:p:l:P:m:s:g:d:I:", longOptions, &optionIndex);
if (c == -1) {
break;
}
@@ -707,6 +709,9 @@ void venc_get_option(int argc, char** argv)
case 'd':
g_start_chnl = atoi(optarg);
break;
+ case 'I':
+ g_device_id = atoi(optarg);
+ break;
default:
break;
}
@@ -739,6 +744,7 @@ hi_void venc_print_usage()
HMEV_HISDK_PRT(INFO, "--PerfTest(-P): test type 0:function test 1:performance test");
HMEV_HISDK_PRT(INFO, "--PerfFrameNum(-m): performance test frame number");
HMEV_HISDK_PRT(INFO, "--SaveOutData(-s): save output stream 0:do not save 1:save ");
+ HMEV_HISDK_PRT(INFO, "--DeviceId(-I): device id");
HMEV_HISDK_PRT(INFO, "*********************************************************");
}
--
Gitee
From eff04ca219487eb6dd31327be5114eacfa08d545 Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 12:56:11 +0000
Subject: [PATCH 09/13] update
cplusplus/level1_single_api/7_dvpp/vpc_sample/readme.md.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
cplusplus/level1_single_api/7_dvpp/vpc_sample/readme.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/vpc_sample/readme.md b/cplusplus/level1_single_api/7_dvpp/vpc_sample/readme.md
index cffd3589b..c84360efd 100644
--- a/cplusplus/level1_single_api/7_dvpp/vpc_sample/readme.md
+++ b/cplusplus/level1_single_api/7_dvpp/vpc_sample/readme.md
@@ -172,7 +172,7 @@ DVPP中的VPC功能模块,实现图片的抠图、缩放、边界填充、色
- 11:多图抠图+缩放+贴图
- 12:多图抠图+缩放+边界填充
- 20:图片宽/高对齐预处理
-
+ - device_id:设备id
--
Gitee
From af2318ca30bb09bf0dcf8cafa5f448e8ab3fac02 Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 13:17:24 +0000
Subject: [PATCH 10/13] update
cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.cpp.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
.../vpc_sample/src/common/sample_comm.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.cpp b/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.cpp
index 1152e2523..2b098ce4a 100644
--- a/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.cpp
+++ b/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.cpp
@@ -45,7 +45,7 @@ int32_t get_run_mode()
return HI_SUCCESS;
}
-int32_t acl_init()
+int32_t acl_init(int32_t device_id)
{
aclError aclRet = aclInit(nullptr);
if (aclRet != ACL_SUCCESS) {
@@ -54,9 +54,9 @@ int32_t acl_init()
}
// By default, the program is running on device 0.
// On a multi-P environment, you can choose target device by the following interface.
- aclRet = aclrtSetDevice(0);
+ aclRet = aclrtSetDevice(device_id);
if (aclRet != ACL_SUCCESS) {
- SAMPLE_PRT("aclrtSetDevice(0) failed with %d.\n", aclRet);
+ SAMPLE_PRT("aclrtSetDevice(%d) failed with %d.\n", device_id, aclRet);
aclRet = aclFinalize();
if (aclRet != ACL_SUCCESS) {
SAMPLE_PRT("finalize acl failed with %d.\n", aclRet);
@@ -64,12 +64,12 @@ int32_t acl_init()
return HI_FAILURE;
}
- aclRet = aclrtCreateContext(&g_context, 0);
+ aclRet = aclrtCreateContext(&g_context, device_id);
if (aclRet != ACL_SUCCESS) {
SAMPLE_PRT("acl create context failed with %d.", aclRet);
- aclRet = aclrtResetDevice(0);
+ aclRet = aclrtResetDevice(device_id);
if (aclRet != ACL_SUCCESS) {
- SAMPLE_PRT("reset device(0) failed with %d.\n", aclRet);
+ SAMPLE_PRT("reset device(%d) failed with %d.\n", device_id, aclRet);
}
aclRet = aclFinalize();
if (aclRet != ACL_SUCCESS) {
@@ -81,15 +81,15 @@ int32_t acl_init()
return HI_SUCCESS;
}
-int32_t acl_deinit()
+int32_t acl_deinit(int32_t device_id)
{
aclError aclRet = aclrtDestroyContext(g_context);
if (aclRet != ACL_SUCCESS) {
SAMPLE_PRT("destroy context failed with %d.", aclRet);
}
- aclRet = aclrtResetDevice(0);
+ aclRet = aclrtResetDevice(device_id);
if (aclRet != ACL_SUCCESS) {
- SAMPLE_PRT("reset device(0) failed with %d.\n", aclRet);
+ SAMPLE_PRT("reset device(%d) failed with %d.\n", device_id, aclRet);
}
aclRet = aclFinalize();
if (aclRet != ACL_SUCCESS) {
--
Gitee
From 86b3c1ed8d86bb5e9e89b58f26604864d64b1888 Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 13:19:49 +0000
Subject: [PATCH 11/13] update
cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.h.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
.../7_dvpp/vpc_sample/src/common/sample_comm.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.h b/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.h
index 4b3708bdb..ca8f1a5af 100644
--- a/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.h
+++ b/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/common/sample_comm.h
@@ -141,15 +141,17 @@ int32_t get_run_mode();
/*
* @brief : initialize acl environment
+* @param [in] device_id: device id
* @return : 0: success; -1: failed
*/
-int32_t acl_init();
+int32_t acl_init(int32_t device_id);
/*
* @brief : deinitialization acl environment
+* @param [in] device_id: device id
* @return : 0: success; -1: fail
*/
-int32_t acl_deinit();
+int32_t acl_deinit(int32_t device_id);
/*
* @brief : malloc buffer in device
--
Gitee
From 3b4789ed46ec986d10422ff1fd26dc79cfaa29bd Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Tue, 19 Aug 2025 13:25:00 +0000
Subject: [PATCH 12/13] update
cplusplus/level1_single_api/7_dvpp/vpc_sample/src/sample_vpc.cpp.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
.../7_dvpp/vpc_sample/src/sample_vpc.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/sample_vpc.cpp b/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/sample_vpc.cpp
index bcbaf024a..94b3a3ade 100644
--- a/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/sample_vpc.cpp
+++ b/cplusplus/level1_single_api/7_dvpp/vpc_sample/src/sample_vpc.cpp
@@ -35,6 +35,7 @@ vector> test_entry;
VpcAttr g_vpc_attribute;
aclrtRunMode g_run_mode;
+int32_t g_device_id = 0;
void sample_vpc_handle_sig(int32_t signo)
{
@@ -150,11 +151,12 @@ void get_option(int argc, char **argv)
{"in_height_align", 1, 0, 'Y'},
{"out_width_align", 1, 0, 'Z'},
{"out_height_align", 1, 0, 'V'},
+ {"device_id", 1, 0, 'a'},
{nullptr, 1, 0, 'U'},
};
int32_t c = getopt_long(argc, argv,
- "w:h:f:b:c:l:t:d:g:e:m:r:s:p:u:v:x:y:i:L:T:C:D:F:O:W:M:I:0:1:2:3:4:5:6:7:8:Q:U:P:N:X:Y:Z:V",
+ "w:h:f:b:c:l:t:d:g:e:m:r:s:p:u:v:x:y:i:L:T:C:D:F:O:W:M:I:0:1:2:3:4:5:6:7:8:Q:U:P:N:X:Y:Z:V:a",
long_options, &option_index);
if (c == -1) {
break;
@@ -250,6 +252,9 @@ void get_option(int argc, char **argv)
case 'N':
g_vpc_attribute.srcPicNum = atoi(optarg);
break;
+ case 'a':
+ g_device_id = atoi(optarg);
+ break;
default:
get_option_1(c);
break;
@@ -265,7 +270,7 @@ int32_t test_entry_single_chnl(TEST_FUNC test_func)
return s32Ret;
}
- s32Ret = acl_init();
+ s32Ret = acl_init(g_device_id);
if (s32Ret != HI_SUCCESS) {
return s32Ret;
}
@@ -273,7 +278,7 @@ int32_t test_entry_single_chnl(TEST_FUNC test_func)
s32Ret = hi_mpi_sys_init();
if (s32Ret != HI_SUCCESS) {
SAMPLE_PRT("hi_mpi_sys_init failed, ret = %#x!\n", s32Ret);
- acl_deinit();
+ acl_deinit(g_device_id);
return s32Ret;
}
@@ -285,7 +290,7 @@ int32_t test_entry_single_chnl(TEST_FUNC test_func)
if (s32Ret != HI_SUCCESS) {
SAMPLE_PRT("Call hi_mpi_vpc_sys_create_chn failed, ret = %#x\n", s32Ret);
hi_mpi_sys_exit();
- acl_deinit();
+ acl_deinit(g_device_id);
return s32Ret;
}
@@ -317,7 +322,7 @@ int32_t test_entry_single_chnl(TEST_FUNC test_func)
}
hi_mpi_sys_exit();
- acl_deinit();
+ acl_deinit(g_device_id);
if (s32Ret == HI_SUCCESS) {
SAMPLE_PRT("program exit normally!\n");
--
Gitee
From 7d7632a2dff4ada7e437f334976a5b5966913895 Mon Sep 17 00:00:00 2001
From: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
Date: Wed, 20 Aug 2025 08:41:23 +0000
Subject: [PATCH 13/13] update
cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp.
Signed-off-by: gitee_hw_lxc <16163253+giteehwlxc@user.noreply.gitee.com>
---
.../level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp b/cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp
index df305ba4d..5e57a1c30 100644
--- a/cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp
+++ b/cplusplus/level1_single_api/7_dvpp/venc_sample/src/sample_debug.cpp
@@ -58,7 +58,7 @@ std::map g_mbuf_map;
pthread_mutex_t g_mbuf_mutex;
aclrtContext g_context = NULL;
-inr32_t g_device_id = 0;
+int32_t g_device_id = 0;
// save the output stream
hi_s32 venc_save_stream(FILE* fp, VencOutStream* outStream, uint64_t packCount)
--
Gitee