diff --git a/thirdparty/vid.stab/HPKBUILD b/thirdparty/vid.stab/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..ad94aaa32b91f2938e655065774420a18d303f69 --- /dev/null +++ b/thirdparty/vid.stab/HPKBUILD @@ -0,0 +1,63 @@ +# Contributor: wupingyuan <3415239542@qq.com> +# Maintainer: wupingyuan <3415239542@qq.com> +pkgname=vid.stab +pkgver=v1.1.1 +pkgrel=0 +pkgdesc="Vidstab is a video stabilization library which can be plugged-in with Ffmpeg and Transcode." +url="https://github.com/georgmartius/vid.stab" +archs=("armeabi-v7a" "arm64-v8a") +license=("GPL") +depends=("openmp") +makedepends=() + +source="https://github.com/georgmartius/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +autounpack=true +downloadpackage=true +patchflag=true +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + if $patchflag + then + cd $builddir + # 打补丁说明以下: + # 1、添加测试用例到编译脚本 + # 2、链接不到gomp库 + # 3、找不到符号__STRING + patch -p1 < `pwd`/../vid.stab_oh_pkg.patch + patchflag=false + cd $OLDPWD + fi + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DGOMP_LIBRARIES="$LYCIUM_ROOT/usr/openmp/$ARCH/lib/libgomp.so" \ + -DBUILD_SHARED_LIBS=OFF -DOHOS_ARCH=$ARCH -B$ARCH-build -S./ -L > `pwd`/$ARCH-build/build.log 2>&1 + make VERBOSE=1 -j4 -C $ARCH-build >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + make -C $ARCH-build install >> `pwd`/$ARCH-build/build.log 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 在OpenHarmony开发板中执行用例 + # 注意:需要把openmp下的libomp.so推到开发板中/system/lib64 + # ./tests/tests +} + +cleanbuild() { + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} diff --git a/thirdparty/vid.stab/HPKCHECK b/thirdparty/vid.stab/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..2c97f5a46271e761be317a672ee06ba7b07a0e42 --- /dev/null +++ b/thirdparty/vid.stab/HPKCHECK @@ -0,0 +1,14 @@ +# Contributor: wupingyuan <3415239542@qq.com> +# Maintainer: wupingyuan <3415239542@qq.com> + +source HPKBUILD > /dev/null 2>&1 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +openharmonycheck() { + res=0 + cd ${builddir}/${ARCH}-build + ./tests/tests > $logfile 2>&1 + res=$? + cd $OLDPWD + return $res +} diff --git a/thirdparty/vid.stab/OAT.xml b/thirdparty/vid.stab/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..9a171314c1b137260a7af12af4d7d1a3f53d9c4b --- /dev/null +++ b/thirdparty/vid.stab/OAT.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/thirdparty/vid.stab/README.OpenSource b/thirdparty/vid.stab/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..74640dc313f1d9327fac7c1c09b5a8d5b69e6449 --- /dev/null +++ b/thirdparty/vid.stab/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "vid.stab", + "License": "GPL", + "License File": "LICENSE", + "Version Number": "v1.1.1", + "Owner": "3415239542@qq.com", + "Upstream URL": "https://github.com/georgmartius/vid.stab/archive/refs/tags/v1.1.1.tar.gz", + "Description": "Vidstab is a video stabilization library which can be plugged-in with Ffmpeg and Transcode." + } +] diff --git a/thirdparty/vid.stab/README_zh.md b/thirdparty/vid.stab/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..577f1dbb2fe3bd4f9bfffef5f04cb8f57e8037f2 --- /dev/null +++ b/thirdparty/vid.stab/README_zh.md @@ -0,0 +1,11 @@ +# vid.stab三方库说明 +## 功能简介 +vid.stab是一个处理视频抖动的库。 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Release +- SDK版本:ohos_sdk_public 4.0.8.1 (API Version 10 Release) +- 三方库版本:v1.1.1 +- 当前适配的功能:处理视频抖动 + +## 集成方式 ++ [应用hap包集成](docs/hap_ingtegrate.md) diff --git a/thirdparty/vid.stab/SHA512SUM b/thirdparty/vid.stab/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..82cc393bec34a36985a265716c61dc130c55be90 --- /dev/null +++ b/thirdparty/vid.stab/SHA512SUM @@ -0,0 +1,2 @@ +b27ac95ab5302e9500af5a52cb09f557b9dacbdc4dc57a9781e2f9ae65a6ffea396f9819bca1f6a103f9d1896bf3061f1cb647166b14b8de8e89a1b15f010e5c vid.stab-1.1.1.tar.gz +e01a56ef294a58b22d7f5f944d856e79925677298c1bd19ffbe879257a0601994e81dd96286c0d0a90dc1bcf99e757a76ddc2daaa44d7ef12f195c5403e887a9 vid.stab_oh_pkg.patch diff --git a/thirdparty/vid.stab/docs/hap_ingtegrate.md b/thirdparty/vid.stab/docs/hap_ingtegrate.md new file mode 100644 index 0000000000000000000000000000000000000000..492e5090d5bcef2c1735eacd44a278cc21046621 --- /dev/null +++ b/thirdparty/vid.stab/docs/hap_ingtegrate.md @@ -0,0 +1,75 @@ +# vid.stab集成到应用hap + +本库是在RK3568开发板上基于OpenHarmony3.2 Release版本的镜像验证的,如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + +## 开发环境 + +- ubuntu20.04 +- [OpenHarmony3.2Release镜像](https://gitee.com/link?target=https%3A%2F%2Frepo.huaweicloud.com%2Fopenharmony%2Fos%2F3.2-Release%2Fdayu200_standard_arm32.tar.gz) +- [ohos_sdk_public 4.0.8.1 (API Version 10 Release)](https://gitee.com/link?target=http%3A%2F%2Fdownload.ci.openharmony.cn%2Fversion%2FMaster_Version%2FOpenHarmony_4.0.8.1%2F20230608_091058%2Fversion-Master_Version-OpenHarmony_4.0.8.1-20230608_091058-ohos-sdk-public.tar.gz) +- [DevEco Studio 3.1 Release](https://gitee.com/link?target=https%3A%2F%2Fcontentcenter-vali-drcn.dbankcdn.cn%2Fpvt_2%2FDeveloperAlliance_package_901_9%2F81%2Fv3%2FtgRUB84wR72nTfE8Ir_xMw%2Fdevecostudio-windows-3.1.0.501.zip%3FHW-CC-KV%3DV1%26HW-CC-Date%3D20230621T074329Z%26HW-CC-Expire%3D315360000%26HW-CC-Sign%3D22F6787DF6093ECB4D4E08F9379B114280E1F65DA710599E48EA38CB24F3DBF2) +- [准备三方库构建环境](../../../lycium/README.md#1编译环境准备) +- [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +## 编译三方库 +- 下载本仓库 + ``` + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` +- 三方库目录结构 + ``` + tpc_c_cplusplus/thirdparty/vid.stab #三方库vid.stab的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── HPKCHECK #自动化脚本 + ├── OAT.xml #OAT文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md #说明文档简介 + ├── SHA512SUM #三方库校验文件 + ├── vid.stab_oh_pkg.patch #补丁 + ``` + +- 在lycium目录下编译三方库 + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ``` + cd lycium + ./build.sh vid.stab + ``` +- 三方库头文件及生成的库 + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + ``` + vid.stab/arm64-v8a vid.stab/armeabi-v7a + openmp/arm64-v8a openmp/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的库和依赖库拷贝到该目录下,如下图所示 +   + ![thirdparty_install_dir](pic/vid.stab_install_dir.jpg) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + ```shell + #将三方库加入工程中 + target_link_libraries(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/vid.stab/${OHOS_ARCH}/lib/libvidstab.a) + #将三方库的头文件加入工程中 + target_include_directories(entry PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/vid.stab/${OHOS_ARCH}/include) + ``` + +## 测试三方库 +三方库的测试使用原库自带的测试用例来做测试,[准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +- 将编译生成的可执行文件及生成的动态库准备好 + +- 将准备好的文件推送到开发板,进入到构建的目录执行:./tests/tests + + ![vid.stab_test](pic/vid.stab_test.jpg) + +## 参考资料 +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld) +- [OpenHarmony三方库地址](https://gitee.com/openharmony-tpc) +- [OpenHarmony知识体系](https://gitee.com/openharmony-sig/knowledge) +- [通过DevEco Studio开发一个NAPI工程](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/napi_study/docs/hello_napi.md) diff --git a/thirdparty/vid.stab/docs/pic/vid.stab_install_dir.jpg b/thirdparty/vid.stab/docs/pic/vid.stab_install_dir.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fa1df484dd1e8a0c5d4cc4417eabec3e930c98c3 Binary files /dev/null and b/thirdparty/vid.stab/docs/pic/vid.stab_install_dir.jpg differ diff --git a/thirdparty/vid.stab/docs/pic/vid.stab_test.jpg b/thirdparty/vid.stab/docs/pic/vid.stab_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a9b052b996f1a9d3078212f36d94ba53c7913eb8 Binary files /dev/null and b/thirdparty/vid.stab/docs/pic/vid.stab_test.jpg differ diff --git a/thirdparty/vid.stab/vid.stab_oh_pkg.patch b/thirdparty/vid.stab/vid.stab_oh_pkg.patch new file mode 100644 index 0000000000000000000000000000000000000000..5dab374c6e7c8b52100704bf75ee55d893989e1a --- /dev/null +++ b/thirdparty/vid.stab/vid.stab_oh_pkg.patch @@ -0,0 +1,36 @@ +diff -Naur vid.stab-1.1.1/CMakeLists.txt vid.stab-1.1.1-patch/CMakeLists.txt +--- vid.stab-1.1.1/CMakeLists.txt 2022-05-30 08:49:01.000000000 -0700 ++++ vid.stab-1.1.1-patch/CMakeLists.txt 2023-07-06 18:51:12.523800096 -0700 +@@ -95,3 +95,5 @@ + + include(create_pkgconfig_file) + create_pkgconfig_file(vidstab "Vid.Stab, a library for stabilizing video clips") ++ ++add_subdirectory(tests) +diff -Naur vid.stab-1.1.1/tests/CMakeLists.txt vid.stab-1.1.1-patch/tests/CMakeLists.txt +--- vid.stab-1.1.1/tests/CMakeLists.txt 2022-05-30 08:49:01.000000000 -0700 ++++ vid.stab-1.1.1-patch/tests/CMakeLists.txt 2023-07-09 22:49:42.164374561 -0700 +@@ -47,5 +47,5 @@ + target_link_libraries(tests ${ORC_LIBRARIES}) + endif() + if(USE_OMP) +-target_link_libraries(tests gomp) ++target_link_libraries(tests ${GOMP_LIBRARIES}) + endif() +diff -Naur vid.stab-1.1.1/tests/testframework.h vid.stab-1.1.1-patch/tests/testframework.h +--- vid.stab-1.1.1/tests/testframework.h 2022-05-30 08:49:01.000000000 -0700 ++++ vid.stab-1.1.1-patch/tests/testframework.h 2023-07-11 19:30:12.434193038 -0700 +@@ -18,11 +18,11 @@ + #define test_bool(expr) \ + ((expr) \ + ? tests_success++ \ +- : test_fails (__STRING(expr), __FILE__, __LINE__, ___FUNCTION)) ++ : test_fails (___FUNCTION, __FILE__, __LINE__, ___FUNCTION)) + + #define UNIT(func) \ + if(!help_mode){tests_init(); \ +- fprintf(stderr,"\033[1;34m*** UNIT TEST %s ***\033[0m\n",__STRING(func)); \ ++ fprintf(stderr,"\033[1;34m*** UNIT TEST %s ***\033[0m\n",__FUNCTION__); \ + (func); \ + fprintf(stderr,"---->\t"); \ + if(test_summary()){ fprintf(stderr, "\t\t\033[1;32m PASSED\033[0m\n"); \