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 4240b627ad064487ca7d082c4c1c81de10af210d..664e52ea21c05b003f348c0bc15fd27ba025e261 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基础功能
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 26d781562caa1460fbbcfdd4e37ae9b34f934aff..13cb0123c165e9f7c2af03a41524a3e13639a5f1 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();
}
}
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 91c87b8427acde741a259322c1fa5d8ef68538b6..65ffef29390ee00758a24e3d64b54fb2d54fa31f 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。
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 0d3129a9ba20ab7d390126da5f7112100fcd7ba4..5e08709fc26c994b3e1a7b762ea426270971b727 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) {
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 5d7d17df43f2acdd222a3e8647ab9e0b7db1c724..684e03a45bb2937c2b26dbc1a796b5e38c68d70d 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基础功能
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 7f431bec9cdd5eaeaf123cc470c121e2c732ff02..8b03be87b9f9dab7d354fa4c8adb3e54120e3518 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();
}
}
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 01b3e392feb858171ba7483d7d5fd9e19319a8d6..3b2c0653ddea52b0f818e3737e2e541f211fd909 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。
+
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 62ca008750faf579948fae687c0cd5f89d5373ff..5e57a1c304366d8211e273786921c8f2f2935cd0 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;
+int32_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, "*********************************************************");
}
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 cffd3589b0ad8de113ce0f295d3de7aeb80072ad..c84360efdbb75c0777330836022673a364e5fed6 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
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 1152e2523589b663cdc193d249983ec7b922a1d1..2b098ce4ac9812eef897a22a545bd2498cc1e32f 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) {
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 4b3708bdb42b1d37a7a9bece5450862f746ff501..ca8f1a5af10c0fb05c37df3623c02eb0350f829b 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
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 bcbaf024a19cca817138baf7d19294cd7f509d53..94b3a3ade2ef0901ddfded7d83f2278c74915add 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");