diff --git a/thirdparty/libde265/HPKBUILD b/thirdparty/libde265/HPKBUILD new file mode 100644 index 0000000000000000000000000000000000000000..dc07ddac1d66f152eb59af05ca3a56c6fb37dc0b --- /dev/null +++ b/thirdparty/libde265/HPKBUILD @@ -0,0 +1,51 @@ +# Contributor: zhengxiaoqing +# Maintainer: zhengxiaoqing + +pkgname=libde265 +pkgver=v1.0.15 +pkgrel=0 +pkgdesc="libde265 is an open source implementation of the h.265 video codec." +url="https://github.com/strukturag/libde265" +archs=("armeabi-v7a" "arm64-v8a") +license=("GNU Lesser") +depends=() +makedepends=() +source="https://github.com/strukturag/$pkgname/archive/refs/tags/$pkgver.tar.gz" + +downloadpackage=true +autounpack=true +buildtools="cmake" + +builddir=$pkgname-${pkgver:1} +packagename=$builddir.tar.gz + +prepare() { + mkdir -p $builddir/$ARCH-build +} + +build() { + cd $builddir + ${OHOS_SDK}/native/build-tools/cmake/bin/cmake "$@" -DENABLE_ENCODER=ON -DENABLE_SDL=OFF -B$ARCH-build -S./ > $buildlog 2>&1 + $MAKE VERBOSE=1 -C $ARCH-build >> $buildlog 2>&1 + ret=$? + cd $OLDPWD + return $ret +} + +package() { + cd $builddir + $MAKE VERBOSE=1 -C $ARCH-build install >> $buildlog 2>&1 + cd $OLDPWD +} + +check() { + echo "The test must be on an OpenHarmony device!" + # 测试方式 + # 进入构建目录 + # 执行: ./dec265/dec265 ../testdata/girlshy.h265 +} + +# 清理环境 +cleanbuild(){ + rm -rf ${PWD}/$builddir #${PWD}/$packagename +} \ No newline at end of file diff --git a/thirdparty/libde265/HPKCHECK b/thirdparty/libde265/HPKCHECK new file mode 100644 index 0000000000000000000000000000000000000000..c718d8e9a77ad661481df5cbf15f2de7a02f72d9 --- /dev/null +++ b/thirdparty/libde265/HPKCHECK @@ -0,0 +1,24 @@ +# Contributor: zhengxiaoqing +# Maintainer: zhengxiaoqing + +source HPKBUILD > /dev/null 2>&1 # 导入HPKBUILD文件 +logfile=${LYCIUM_THIRDPARTY_ROOT}/${pkgname}/${pkgname}_${ARCH}_${OHOS_SDK_VER}_test.log + +# 在OH环境执行测试的接口 +openharmonycheck() { + res=1 + cd ${builddir}/${ARCH}-build + + # OH环境测试结果与原库在linux测试结果进行比对,实现自动化测试 + # 原库在linux测试结果:nFrames decoded: 75 (316x240 @ 947.57 fps) + # 其中帧率值受硬件条件影响,非固定值,不进行对比 + result=$(./dec265/dec265 ../testdata/girlshy.h265 2>&1) + echo $result > ${logfile} 2>&1 + result1=`echo $result|awk -F '@' '{print $1}'` + if [ "$result1" == "nFrames decoded: 75 (316x240 " ];then + res=0 + fi + cd $OLDPWD + + return $res +} \ No newline at end of file diff --git a/thirdparty/libde265/README.OpenSource b/thirdparty/libde265/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..9d3b16c55b3bd377379cc34064dab37a23623d82 --- /dev/null +++ b/thirdparty/libde265/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name": "libde265", + "License": "GNU Lesser", + "License File": "README.md", + "Version Number": "v1.0.15", + "Owner": "zhaoxiaoqing17@h-partners.com", + "Upstream URL": "https://github.com/strukturag/libde265", + "Description": "libde265 is an open source implementation of the h.265 video codec." + } +] \ No newline at end of file diff --git a/thirdparty/libde265/README_zh.md b/thirdparty/libde265/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..1ecab505092c2bde4a0351cc9a56b4602ffcc06e --- /dev/null +++ b/thirdparty/libde265/README_zh.md @@ -0,0 +1,11 @@ +# libdash三方库说明 +## 功能简介 +libde265用于h265格式视频编解码 +## 使用约束 +- IDE版本:DevEco Studio 3.1 Release +- SDK版本:ohos_sdk_public 4.0.8.1 (API Version 10 Release) +- 三方库版本:v1.0.15 +- 当前适配的功能:支持h265格式的视频解码,暂不支持编码 + +## 集成方式 ++ [应用hap包集成](docs/hap_integrate.md) diff --git a/thirdparty/libde265/SHA512SUM b/thirdparty/libde265/SHA512SUM new file mode 100644 index 0000000000000000000000000000000000000000..a0cba07e6c688d0e9878e94e8b9c8b5109bf81fa --- /dev/null +++ b/thirdparty/libde265/SHA512SUM @@ -0,0 +1 @@ +df380f1ea6345e20ed1f907df3c7cdaaac44358a6746e29e16699005783ce96524d30fec7bba457c9f9773a6373250aaaf0b9cd41224057b269798117964b8b5 libde265-1.0.15.tar.gz \ No newline at end of file diff --git a/thirdparty/libde265/docs/hap_integrate.md b/thirdparty/libde265/docs/hap_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..81a65a8e034abaa6f047b75344704e3e157fa8a8 --- /dev/null +++ b/thirdparty/libde265/docs/hap_integrate.md @@ -0,0 +1,82 @@ +# libde265 集成到应用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)](http://download.ci.openharmony.cn/version/Master_Version/OpenHarmony_4.0.8.1/20230608_091016/version-Master_Version-OpenHarmony_4.0.8.1-20230608_091016-ohos-sdk-full.tar.gz) +- [DevEco Studio 3.1 Release](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/81/v3/tgRUB84wR72nTfE8Ir_xMw/devecostudio-windows-3.1.0.501.zip?HW-CC-KV=V1&HW-CC-Date=20230621T074329Z&HW-CC-Expire=315360000&HW-CC-Sign=22F6787DF6093ECB4D4E08F9379B114280E1F65DA710599E48EA38CB24F3DBF2) +- [准备三方库构建环境](../../../lycium/README.md#1编译环境准备) +- [准备三方库测试环境](../../../lycium/README.md#3ci环境准备) + +## 编译三方库 + +- 下载本仓库 + + ```shell + git clone https://gitee.com/openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 三方库目录结构 + + ```shell + tpc_c_cplusplus/thirdparty/libde265 #三方库libde265的目录结构如下 + ├── docs #三方库相关文档的文件夹 + ├── HPKBUILD #构建脚本 + ├── SHA512SUM #三方库校验文件 + ├── README.OpenSource #说明三方库源码的下载地址,版本,license等信息 + ├── README_zh.md + ``` + +- 在lycium目录下编译三方库 + + 编译环境的搭建参考[准备三方库构建环境](../../../lycium/README.md#1编译环境准备) + + ```shell + cd lycium + ./build.sh libde265 + ``` + +- 三方库头文件及生成的库 + + 在lycium目录下会生成usr目录,该目录下存在已编译完成的32位和64位三方库 + + ```shell + libde265/arm64-v8a libde265/armeabi-v7a + ``` + +- [测试三方库](#测试三方库) + +## 应用中使用三方库 + +- 在IDE的cpp目录下新增thirdparty目录,将编译生成的头文件拷贝到该目录下,将编译生成的三方库以及依赖库全部(动态库名字带版本号和不带版本号的都需要)拷贝到工程的libs目录下,如下图所示: +   + +  ![thirdparty_install_dir](pic/libde265_install_dir.png) + +- 在最外层(cpp目录下)CMakeLists.txt中添加如下语句 + + ```shell + #将三方库加入工程中 + target_link_libraries(entry PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libde265/${OHOS_ARCH}/lib/libde265.so) + #将三方库的头文件加入工程中 + target_include_directories(entry PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libde265/${OHOS_ARCH}/include) + ``` + +## 测试三方库 + +三方库的测试使用原库自带的测试用例来做测试 + +进入到构建目录执行(arm64-v8a-build为构建64位的目录,armeabi-v7a-build为构建32位的目录) +```shell + chmod 777 ./dec265/dec265 #添加权限 + ./dec265/dec265 ../testdata/girlshy.h265 #执行测试用例 +``` +## 参考资料 + +- [润和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) \ No newline at end of file diff --git a/thirdparty/libde265/docs/pic/libde265_install_dir.png b/thirdparty/libde265/docs/pic/libde265_install_dir.png new file mode 100644 index 0000000000000000000000000000000000000000..cf40c1a501f54e7e29d8e9919f3a7f314ea722b8 Binary files /dev/null and b/thirdparty/libde265/docs/pic/libde265_install_dir.png differ diff --git a/thirdparty/libde265/docs/pic/libde265_usage.png b/thirdparty/libde265/docs/pic/libde265_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..1067b837b6cd1ee4ca41511dfaec4e24462b08d4 Binary files /dev/null and b/thirdparty/libde265/docs/pic/libde265_usage.png differ