diff --git a/openjpeg/BUILD.gn b/openjpeg/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c1ae3597cb0acb65523e703a584f8f2ebc7f6885 --- /dev/null +++ b/openjpeg/BUILD.gn @@ -0,0 +1,244 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved. +if (defined(ohos_lite)) { + import("//build/lite/config/component/lite_component.gni") +} else { + import("//build/ohos.gni") +} + +config("openjpeg_cflag_config") { + cflags = [ + "-Wno-unused-function", + ] +} + +ohos_shared_library("openjp2") { + sources = [ + "./openjpeg/src/lib/openjp2/thread.c", + "./openjpeg/src/lib/openjp2/bio.c", + "./openjpeg/src/lib/openjp2/cio.c", + "./openjpeg/src/lib/openjp2/dwt.c", + "./openjpeg/src/lib/openjp2/event.c", + "./openjpeg/src/lib/openjp2/ht_dec.c", + "./openjpeg/src/lib/openjp2/image.c", + "./openjpeg/src/lib/openjp2/invert.c", + "./openjpeg/src/lib/openjp2/j2k.c", + "./openjpeg/src/lib/openjp2/jp2.c", + "./openjpeg/src/lib/openjp2/mct.c", + "./openjpeg/src/lib/openjp2/mqc.c", + "./openjpeg/src/lib/openjp2/openjpeg.c", + "./openjpeg/src/lib/openjp2/opj_clock.c", + "./openjpeg/src/lib/openjp2/pi.c", + "./openjpeg/src/lib/openjp2/t1.c", + "./openjpeg/src/lib/openjp2/t2.c", + "./openjpeg/src/lib/openjp2/tcd.c", + "./openjpeg/src/lib/openjp2/tgt.c", + "./openjpeg/src/lib/openjp2/function_list.c", + "./openjpeg/src/lib/openjp2/opj_malloc.c", + "./openjpeg/src/lib/openjp2/sparse_array.c", + ] + + include_dirs = [ + "./openjpeg/src/lib/openjp2", + "./adapter/include", + ] + + configs = [ + ":openjpeg_cflag_config" + ] + + part_name = "openjpeg" +} + +config("openjpeg_test_config") { + cflags = [ + "-Wno-macro-redefined", + "-Wno-unused-variable" + ] + include_dirs = [ + "./openjpeg/src/lib/openjp2/", + "./openjpeg/src/bin/common/", + "./openjpeg/src/lib/jp2/", + "./openjpeg/src/bin/jp2/", + "./adapter/include/", + "//third_party/libtiff/libtiff/" + ] +} + +ohos_executable("test_tile_decoder") { + sources = [ + "./openjpeg/tests/test_tile_decoder.c", + "./openjpeg/src/bin/common/opj_getopt.c", + ] + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + "//third_party/libtiff:libtiff_shared", + ] + part_name = "openjpeg" +} + +ohos_executable("test_tile_encoder") { + sources = [ + "./openjpeg/tests/test_tile_encoder.c", + "./openjpeg/src/bin/common/opj_getopt.c", + ] + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + "//third_party/libtiff:libtiff_shared", + ] + part_name = "openjpeg" +} + + +ohos_executable("compare_dump_files") { + sources = [ + "./openjpeg/tests/compare_dump_files.c", + "./openjpeg/src/bin/common/opj_getopt.c", + ] + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + "//third_party/libtiff:libtiff_shared", + ] + part_name = "openjpeg" +} + +ohos_executable("compare_images") { + sources = [ + "./openjpeg/tests/compare_images.c", + "./openjpeg/src/bin/jp2/convert.c", + "./openjpeg/src/bin/jp2/converttif.c", + "./openjpeg/src/bin/common/opj_getopt.c", + ] + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + "//third_party/libtiff:libtiff_shared", + ] + part_name = "openjpeg" +} + +ohos_executable("compare_raw_files") { + sources = [ + "./openjpeg/tests/compare_raw_files.c", + "./openjpeg/src/bin/common/opj_getopt.c", + ] + + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + "//third_party/libtiff:libtiff_shared", + ] + part_name = "openjpeg" +} + +ohos_executable("j2k_random_tile_access") { + sources = [ + "./openjpeg/tests/j2k_random_tile_access.c", + "./openjpeg/src/bin/common/opj_getopt.c", + ] + + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + "//third_party/libtiff:libtiff_shared", + ] + part_name = "openjpeg" +} + +ohos_executable("pdf2jp2") { + sources = [ + "./openjpeg/tests/pdf2jp2.c", + "./openjpeg/src/bin/common/opj_getopt.c", + ] + + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + "//third_party/libtiff:libtiff_shared", + ] + part_name = "openjpeg" +} + +ohos_executable("test_decode_area") { + sources = [ + "./openjpeg/tests/test_decode_area.c", + "./openjpeg/src/bin/common/opj_getopt.c", + ] + + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + "//third_party/libtiff:libtiff_shared", + ] + part_name = "openjpeg" +} + +ohos_executable("ppm2rgb3") { + sources = [ + "./openjpeg/tests/ppm2rgb3.c", + "./openjpeg/src/bin/common/opj_getopt.c", + ] + + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + "//third_party/libtiff:libtiff_shared", + ] + part_name = "openjpeg" +} + +ohos_executable("testempty0") { + sources = [ + "./openjpeg/tests/unit/testempty0.c", + ] + + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + ] + part_name = "openjpeg" +} + + +ohos_executable("testempty1") { + sources = [ + "./openjpeg/tests/unit/testempty1.c", + ] + + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + ] + part_name = "openjpeg" +} + +ohos_executable("testempty2") { + sources = [ + "./openjpeg/tests/unit/testempty2.c", + ] + + public_configs = [ ":openjpeg_test_config" ] + deps = [ + ":openjp2", + ] + part_name = "openjpeg" +} + +group("openjpeg_test") { + deps = [ + ":test_tile_decoder", + ":test_tile_encoder", + ":compare_dump_files", + ":compare_images", + ":compare_raw_files", + ":j2k_random_tile_access", + ":pdf2jp2", + ":test_decode_area", + ":ppm2rgb3", + ":testempty0", + ":testempty1", + ":testempty2", + ] +} diff --git a/openjpeg/README.OpenSource b/openjpeg/README.OpenSource new file mode 100644 index 0000000000000000000000000000000000000000..5090dee175ef68348e68bfc7a0bb7b6749644f84 --- /dev/null +++ b/openjpeg/README.OpenSource @@ -0,0 +1,20 @@ +[ + { + "Name": "openJPEG", + "License": "Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium", + "License": "Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium", + "License": "Copyright (c) 2002-2014, Professor Benoit Macq", + "License": "Copyright (c) 2003-2014, Antonin Descampe", + "License": "Copyright (c) 2003-2009, Francois-Olivier Devaux", + "License": "Copyright (c) 2005, Herve Drolon, FreeImage Team", + "License": "Copyright (c) 2002-2003, Yannick Verschueren", + "License": "Copyright (c) 2001-2003, David Janssens", + "License": "Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France", + "License": "Copyright (c) 2012, CS Systemes d'Information, France", + "License File": "LICENSE.TXT", + "Version Number": "2.5", + "Owner": "yuguans@huawei.com", + "Upstream URL": "https://github.com/uclouvain/openjpeg", + "Description": "OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of JPEG 2000, a still-image compression standard from the Joint Photographic Experts Group (JPEG). Since April 2015, it is officially recognized by ISO/IEC and ITU-T as a JPEG 2000 Reference Software." + } +] diff --git a/openjpeg/README_zh.md b/openjpeg/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..aa72722be1694a5e0f917decfdf4ef8696b82c6e --- /dev/null +++ b/openjpeg/README_zh.md @@ -0,0 +1,19 @@ +# openjpeg 三方库说明 +## 功能简介 +OpenJPEG 是用 C 语言编写的开源 JPEG 2000 编解码器。 + + + +## 使用约束 + +- ROM版本:OpenHarmony3.2 beta1 +- 三方库版本:v2.5.0 +- 当前适配的功能:[JPEG 2000](https://jpeg.org/jpeg2000/) 图像编解码 +- License:[The 2-Clause BSD License](https://github.com/uclouvain/openjpeg/blob/v2.5.0/LICENSE) + + + +## 集成方式 + ++ [系统Rom包集成](./docs/rom_integrate.md) + diff --git a/openjpeg/adapter/include/opj_apps_config.h b/openjpeg/adapter/include/opj_apps_config.h new file mode 100644 index 0000000000000000000000000000000000000000..1832c5a5f2316ea217374b21dd457b80135c9416 --- /dev/null +++ b/openjpeg/adapter/include/opj_apps_config.h @@ -0,0 +1,15 @@ +#include "opj_config_private.h" + +/* create opj_apps_config.h for CMake */ + +#define OPJ_HAVE_LIBPNG +#define OPJ_HAVE_PNG_H +#define OPJ_HAVE_LIBTIFF +#define OPJ_HAVE_TIFF_H + +/* #undef OPJ_HAVE_LIBLCMS1 */ +/* #undef OPJ_HAVE_LIBLCMS2 */ +/* #undef OPJ_HAVE_LCMS1_H */ +/* #undef OPJ_HAVE_LCMS2_H */ + + diff --git a/openjpeg/adapter/include/opj_config.h b/openjpeg/adapter/include/opj_config.h new file mode 100644 index 0000000000000000000000000000000000000000..6eae46c3452e28c0c13bed9da898cce0e99ce12a --- /dev/null +++ b/openjpeg/adapter/include/opj_config.h @@ -0,0 +1,10 @@ +/* create opj_config.h for CMake */ +#define OPJ_HAVE_STDINT_H 1 + +/*--------------------------------------------------------------------------*/ +/* OpenJPEG Versioning */ + +/* Version number. */ +#define OPJ_VERSION_MAJOR 2 +#define OPJ_VERSION_MINOR 5 +#define OPJ_VERSION_BUILD 0 diff --git a/openjpeg/adapter/include/opj_config_private.h b/openjpeg/adapter/include/opj_config_private.h new file mode 100644 index 0000000000000000000000000000000000000000..3aad25e618b008e609e5a6f63245946b24672a4b --- /dev/null +++ b/openjpeg/adapter/include/opj_config_private.h @@ -0,0 +1,49 @@ +/* create opj_config_private.h for CMake */ +#define OPJ_HAVE_INTTYPES_H 1 + +#define OPJ_PACKAGE_VERSION "2.5.0" + +/* Not used by openjp2*/ +/*#define HAVE_MEMORY_H 1*/ +/*#define HAVE_STDLIB_H 1*/ +/*#define HAVE_STRINGS_H 1*/ +/*#define HAVE_STRING_H 1*/ +/*#define HAVE_SYS_STAT_H 1*/ +/*#define HAVE_SYS_TYPES_H 1 */ +/*#define HAVE_UNISTD_H 1*/ + +/* #undef _LARGEFILE_SOURCE */ +/* #undef _LARGE_FILES */ +/* #undef _FILE_OFFSET_BITS */ +#define OPJ_HAVE_FSEEKO ON + +/* find whether or not have */ +#define OPJ_HAVE_MALLOC_H +/* check if function `aligned_alloc` exists */ +/* #undef OPJ_HAVE_ALIGNED_ALLOC */ +/* check if function `_aligned_malloc` exists */ +/* #undef OPJ_HAVE__ALIGNED_MALLOC */ +/* check if function `memalign` exists */ +#define OPJ_HAVE_MEMALIGN +/* check if function `posix_memalign` exists */ +#define OPJ_HAVE_POSIX_MEMALIGN + +#if !defined(_POSIX_C_SOURCE) +#if defined(OPJ_HAVE_FSEEKO) || defined(OPJ_HAVE_POSIX_MEMALIGN) +/* Get declarations of fseeko, ftello, posix_memalign. */ +#define _POSIX_C_SOURCE 200112L +#endif +#endif + +/* Byte order. */ +/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or +__LITTLE_ENDIAN__ to match the endianness of the architecture being +compiled for. This is not necessarily the same as the architecture of the +machine doing the building. In order to support Universal Binaries on +Mac OS X, we prefer those defines to decide the endianness. +On other platforms we use the result of the TRY_RUN. */ +#if !defined(__APPLE__) +/* #undef OPJ_BIG_ENDIAN */ +#elif defined(__BIG_ENDIAN__) +# define OPJ_BIG_ENDIAN +#endif diff --git a/openjpeg/adapter/script/test_open_jpeg.sh b/openjpeg/adapter/script/test_open_jpeg.sh new file mode 100644 index 0000000000000000000000000000000000000000..72623c9af56a5a2d8bb909855bfaa87a2de93f40 --- /dev/null +++ b/openjpeg/adapter/script/test_open_jpeg.sh @@ -0,0 +1,153 @@ +#!/bin/bash + +j2kRandomTileAccess="j2k_random_tile_access" +testDecodeArea="test_decode_area" +testTileEncoder="test_tile_encoder" +testTileDecoder="test_tile_decoder" +testempty0="testempty0" +testempty1="testempty1" +testempty2="testempty2" + + + +function exe() +{ +exe=$1 +num=$# + + if [ $exe == $j2kRandomTileAccess ] + then + tag=$2 + echo "tag= $tag,exe = $exe" + + if [ -e $tag ] + then + chmod +x $exe + ./$exe $tag + else + echo "$tag is not exist" + fi + elif [ $exe == $testDecodeArea ] + then + if [ $num == 3 ] + then + tag=$2 + flag=$1 + if [ -e $tag ] + then + ./$exe $flag $tag + fi + elif [ $num == 6 ] + then + tag=$5 + if [ -e $tag ] + then + echo "./$*" + ./$* + fi + else + echo "exe $exe cmd failed!" + fi + elif [ $exe == $testTileEncoder ] + then + if [ $num == 1 ] + then + ./$exe + else + echo "./$*" + ./$* + fi + elif [ $exe == $testTileDecoder ] + then + echo "$*" + if [ $num == 1 ] + then + ./$* + elif [ $num == 5 ] + then + if [ -e $5 ] + then + ./$* + fi + fi + else + ./$exe + fi +} + + +function check_result() +{ +exe="md5sum" +tag=$1 +sum=$2 + if [ -e $tag ] + then + tmp=`md5sum $tag` + result=${tmp%% *} + + if [ $result == $sum ] + then + echo "test ok!" + fi + fi +} + + + +function run_test() +{ + exe $testTileEncoder + check_result test.j2k d50d345b669102ce18f7da78dc076546 + exe $testTileEncoder 3 2048 2048 1024 1024 8 1 tte1.j2k + check_result tte1.j2k dcb7dbfc7a3f552f5f01c35fb077a731 + exe $testTileEncoder 3 2048 2048 1024 1024 8 1 tte2.jp2 + check_result tte2.jp2 433f8b10a513510f490651d51637b1c0 + exe $testTileEncoder 1 2048 2048 1024 1024 8 1 tte3.j2k + check_result tte3.j2k 92f6fa2693a01ea0e184a9cb79261935 + exe $testTileEncoder 1 256 256 128 128 8 0 tte4.j2k + check_result tte4.j2k ddbd0406e23e35d9d76d53eec0aba6f7 + exe $testTileEncoder 1 512 512 256 256 8 0 tte5.j2k + check_result tte5.j2k f41e019f8a879220769b3122723448f1 + exe $testTileDecoder + check_result test.j2k d50d345b669102ce18f7da78dc076546 + exe $testTileDecoder 0 0 1024 1024 tte1.j2k + check_result tte1.j2k dcb7dbfc7a3f552f5f01c35fb077a731 + exe $testTileDecoder 0 0 1024 1024 tte2.jp2 + check_result tte2.jp2 433f8b10a513510f490651d51637b1c0 + exe $j2kRandomTileAccess tte1.j2k + exe $j2kRandomTileAccess tte2.jp2 + exe $j2kRandomTileAccess tte3.j2k + exe $j2kRandomTileAccess tte4.j2k + exe $j2kRandomTileAccess tte5.j2k + exe $testTileEncoder 1 256 256 32 32 8 0 reversible_no_precinct.j2k 4 4 3 0 0 0 + check_result reversible_no_precinct.j2k 5a03aed80730bb312b93a373af2619a7 + exe $testDecodeArea -q reversible_no_precinct.j2k + check_result reversible_no_precinct.j2k 5a03aed80730bb312b93a373af2619a7 + exe $testTileEncoder 1 203 201 17 19 8 0 reversible_203_201_17_19_no_precinct.j2k 4 4 3 0 0 0 + check_result reversible_203_201_17_19_no_precinct.j2k 080fe377819420d1bbac8c2a209c3faf + exe $testDecodeArea -q reversible_203_201_17_19_no_precinct.j2k + check_result reversible_203_201_17_19_no_precinct.j2k 080fe377819420d1bbac8c2a209c3faf + exe $testTileEncoder 1 256 256 32 32 8 0 reversible_with_precinct.j2k 4 4 3 0 0 0 16 16 + check_result reversible_with_precinct.j2k 2d7074173d443ad9e348b9f4db955994 + exe $testDecodeArea -q reversible_with_precinct.j2k + check_result reversible_with_precinct.j2k 2d7074173d443ad9e348b9f4db955994 + exe $testTileEncoder 1 256 256 32 32 8 1 irreversible_no_precinct.j2k 4 4 3 0 0 0 + check_result irreversible_no_precinct.j2k 9e8c1ac0e7c920e559a8deb74cc2e094 + exe $testDecodeArea -q irreversible_no_precinct.j2k + check_result irreversible_no_precinct.j2k 9e8c1ac0e7c920e559a8deb74cc2e094 + exe $testTileEncoder 1 203 201 17 19 8 1 irreversible_203_201_17_19_no_precinct.j2k 4 4 3 0 0 0 + check_result irreversible_203_201_17_19_no_precinct.j2k d58da7bdddbbeb733474f30757a31a87 + exe $testDecodeArea -q irreversible_203_201_17_19_no_precinct.j2k + heck_result irreversible_203_201_17_19_no_precinct.j2k d58da7bdddbbeb733474f30757a31a87 + exe $testTileEncoder 1 256 256 256 256 8 0 tda_single_tile.j2k + check_result tda_single_tile.j2k 35737f347486a97cbdd9a545df382584 + exe $testDecodeArea -q -strip_height 3 -strip_check tda_single_tile.j2k + check_result tda_single_tile.j2k 35737f347486a97cbdd9a545df382584 + exe $testempty0 + exe $testempty1 + exe $testempty2 +} + +run_test + diff --git a/openjpeg/docs/rom_integrate.md b/openjpeg/docs/rom_integrate.md new file mode 100644 index 0000000000000000000000000000000000000000..7764ac58e10e84b3de1bc6573c4da50884972082 --- /dev/null +++ b/openjpeg/docs/rom_integrate.md @@ -0,0 +1,225 @@ +# openjpeg如何集成到系统Rom + + + +## 准备源码工程 + +本库是基于OpenHarmony 3.2 beta1版本,在润和RK3568开发板上验证的。如果是从未使用过RK3568,可以先查看[润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 + + + +### 准备系统Rom源码 + +源码获取方法请参照:[OpenHarmony3.2beta1源码下载](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta1/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md#源码获取) + + + +### 增加构建脚本及配置文件 + +- 下载本仓库代码 + + ``` + # cd ~/ + # git clone git@gitee.com:openharmony-sig/tpc_c_cplusplus.git --depth=1 + ``` + +- 仓库代码目录结构说明 + + ``` + # cd ~/tpc_c_cplusplus/openjpeg/ # 进入到仓库代码库目录 + ``` + + ``` + openjpeg + |-- BUILD.gn # 编译构建脚本 + |-- ohos.build # 组件定义文件 + |-- README_zh.md # openjpeg 说明文档 + |-- README.OpenSource # openjpeg 开源信息说明文档 + |-- docs # 存放 openjpeg 相关文档 + |-- media # 存放图片的文件夹 + |-- adapter + |-- include # 包含库相关配置头文件的文件夹 + | |-- opj_apps_config.h + | |-- opj_config.h + | |-- opj_config_private.h + | + |-- script # 存放库测试脚本的文件夹 + |-- test_open_jpeg.sh + ``` + +- 将本仓库文件夹拷贝到third_party下 + + ``` + # cp -arf ~/tpc_c_cplusplus/openjpeg ~/OpenHarmony/third_party + ``` + + + +### 准备三方库源码 + +- 四方库依赖 + + openjpeg三方库的测试依赖[libtiff](../../libtiff),点击链接跳转至libtiff的Rom集成方法。 + +- 三方库源码下载 + + 将openjpeg-2.5.0源码下载到openjpeg目录并将其解压出来。 + + ``` + # cd ~/OpenHarmony/third_party/openjpeg # 进入到openjpeg目录 + # wget https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.0.zip # 下载三方库 + # unzip v2.5.0.zip # 解压库 + # mv openjpeg-2.5.0 openjpeg # 修改三方库源码文件夹名称 + # rm v2.5.0.zip # 删除压缩包 + ``` + + + +## 系统Rom中引入三方库 + +准备完三方库代码后,我们需要将三方库加入到编译构建体系中。标准系统编译构建可以参考文档[标准系统编译构建指导](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.2-Beta1/zh-cn/device-dev/subsystems/subsys-build-standard-large.md)。 + +这里我们只需要将三方库作为组件添加到三方库子系统中即可(详细信息参照文档[如何为三方库组件中添加一个三方库](./add_thirdparty_component.md)) + +添加步骤: + +- 三方库子系统中添加组件 + + 打开//vendor/hihope/rk356/config.json文件,找到thirdparty子系统并添加一个openjpeg的组件 + + ``` + { + "subsystem": "thirdparty", + "components": [ + { + "component": "musl", + "features": [] + }, + { + "component": "openjpeg", + "features": [] + } + ] + }, + ``` + +- 三方库目录下添加ohos.build文件 + + ``` + { + "subsystem": "thirdparty", + "parts":{ + "openjpeg": { + "module_list": [ + "//third_party/openjpeg:openjp2" + ] + } + } + } + ``` + +- 三方库编译脚本中添加子系统组件名 + + ``` + ohos_shared_library("openjp2"){ + ... + part_name = "openjpeg" + } + ``` + + + +## 系统Rom中引入三方库测试程序 + +openjpeg原生库提供了测试程序且已完成了gn的适配,我们只需要在三方库目录下的ohos.build中添加测试程序的依赖即可,如: + +``` +{ + "subsystem": "thirdparty", + "parts":{ + "openjpeg": { + "module_list": [ + "//third_party/openjpeg:openjpeg_test" + ] + } + } +} +``` + + + +## 编译工程 + +- 选择产品 + + ``` + # hb set ## 运行hb set后会出现产品列表,在此我们选择 rk3568 + ``` + +- 运行编译 + + ``` + # hb build --target-cpu arm -f + + 参数释义: + --target-cpu arm 编译32位系统(未配置默认编译32位),如果需要编译64位的需要改为--target-cpu arm64 + -f 全量编译,不加-f则为增量编译。每次设置完产品后建议进行全量编译。 + ``` + +- 验证结果 + + 正常编译完后会在out/rk3568/packages/phone/system/bin下生成的测试用可执行文件。以及out/rk3568/packages/phone/system/lib下生成libopenjp2.z.so动态库。 + + ``` + # ls out/rk3568/packages/phone/system/lib | grep libopenjp2.z.so ## 确认是否成功编译 openjp2 动态库 + # ls out/rk3568/packages/phone/system/bin | grep -E 'testemp|compare_|test_|j2k_ran|pdf2|ppm2' ## 确认是否成功编译 openjpeg_test 包含的可执行文件 + ``` + + + +## 安装应用程序 + +1.安装应用的方式有两种: + +- 方式一:烧录带有应用程序的镜像包 + + 烧录固件请参照[rk3568镜像烧录](https://gitee.com/openharmony-sig/knowledge_demo_temp/blob/master/docs/rk3568_helloworld/镜像烧录.md)。 + +- 方式二:将应用直接推送到开发板 + + 我们可以将需要推送到开发板的文件全部打包成一个压缩文件(openjpeg.tar),然后通过[hdc_std工具](https://gitee.com/isrc_ohos/hdc-tool)推送到开发板,在推送前需要确保一点,板子的系统为可读写,如果出现推送失败且提示无权限,则需要重新加载系统权限 + + ``` + # hdc_std.exe shell ## 进入开发板系统 + # mount -o remount,rw / ## 修改系统权限 + # exit ## 退出开发板系统 + # hdc_std.exe file send .\openjpeg.tar /data/ ## 推送文件到开发板系统 + # hdc_std.exe shell + # cd /data/ + # tar -xvf openjpeg.tar ## 解压文件包 + # cd openjpeg + # cp libopenjp2.z.so /system/lib/ ## 将库文件拷贝到系统lib目录 + ``` + + + +## 运行效果 + +将[adapter/script/test_open_jpeg.sh](../adapter/script/test_open_jpeg.sh)脚本使用[hdc_std工具](https://gitee.com/isrc_ohos/hdc-tool)推送到开发板(应用安装若使用方式二,需确保脚本与应用位于同一目录下),执行如下命令运行脚本。 + +``` +# chmod 777 test_open_jpeg.sh ## 修改脚本文件权限,防止因权限不够导致执行失败 +# sh test_open_jpeg.sh ## 执行测试脚本 +``` + +运行中的日志信息会实时打印在终端,若日志信息中所有测试项目为test_ok,则说明通过了全部的测试项目。 + +![image-20220922143536085](../media/running_result.png) + +## 参考资料 + +- [润和RK3568开发板标准系统快速上手](https://gitee.com/openharmony-sig/knowledge_demo_temp/tree/master/docs/rk3568_helloworld)。 +- [OpenHarmony3.2beta1](https://gitee.com/openharmony/docs/blob/OpenHarmony-v3.2-Beta1/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md)。 +- [OpenHarmony三方库组织地址](https://gitee.com/openharmony-tpc)。 +- [知识体系](https://gitee.com/openharmony-sig/knowledge)。 + diff --git a/openjpeg/media/running_result.png b/openjpeg/media/running_result.png new file mode 100644 index 0000000000000000000000000000000000000000..1769813e9f02e2a01d07e2288e8dccd6aaf3f356 Binary files /dev/null and b/openjpeg/media/running_result.png differ diff --git a/openjpeg/ohos.build b/openjpeg/ohos.build new file mode 100644 index 0000000000000000000000000000000000000000..e48fa8b2af5ce3a1308181fd774ff6fced47e05e --- /dev/null +++ b/openjpeg/ohos.build @@ -0,0 +1,10 @@ +{ + "subsystem": "thirdparty", + "parts":{ + "openjpeg": { + "module_list": [ + "//third_party/openjpeg:openjp2" + ] + } + } +} \ No newline at end of file