diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..cf007af3df1352a594c13700cac7b4106c12efc0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,152 @@
+## c/c++
+# Prerequisites
+*.d
+
+# Compiled Object files
+*.ko
+*.slo
+*.lo
+*.o
+*.obj
+*.elf
+
+# Linker output
+*.ilk
+*.map
+*.exp
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.so.*
+*.dylib
+*.dll
+
+# module files
+*.mod
+*.smod
+*.cmd
+.tmp_versions/
+modules.order
+Module.symvers
+Mkfile.old
+dkms.conf
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+*.lo
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# Debug files
+*.dSYM/
+*.su
+*.idb
+*.pdb
+
+## cmake
+CMakeLists.txt.user
+CMakeCache.txt
+CMakeFiles
+CMakeScripts
+Testing
+Makefile
+cmake_install.cmake
+install_manifest.txt
+compile_commands.json
+CTestTestfile.cmake
+_deps
+
+## ninja
+.ninja_deps
+.ninja_log
+
+## vscode
+.vscode
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+## jetbrains
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+.clang-format
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..286962c9913af8889dc38cd4e77917e0a3ff845e
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,22 @@
+# Copyright (c) 2023 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build/config/ohos/config.gni")
+import("//build/ohos.gni")
+
+group("video_processing_engine_packages") {
+ public_deps = [
+ "framework:videoprocessingengine",
+ "services:videoprocessingservice"
+ ]
+}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..f433b1a53f5b830a205fd2df78e2b34974656c7b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/OAT.xml b/OAT.xml
new file mode 100644
index 0000000000000000000000000000000000000000..550c0339841e1911f0e008ac8270d5e524ac3053
--- /dev/null
+++ b/OAT.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
index 29b25708a7d6c42db9b13123c7e2b5ccc4cb9696..2ea58a8bee981f175229719b624103bd51c5f916 100644
--- a/README.md
+++ b/README.md
@@ -1,37 +1,68 @@
-# multimedia_video_processing_engine
+# VPE引擎
-#### 介绍
-针对视频、图片以及渲染的内容的HDR、清晰和流畅低功耗的用户体验,系统层提供统一的公共基础能力,实现简单、一致、高效的视频处理服务。
+## 简介
+VPE(Video Processing Engine)引擎是处理视频和图像数据的媒体引擎,包括细节增强、对比度增强、亮度增强、动态范围增强等基础能力,为转码、分享、显示后处理等提供色彩空间转换、缩放超分、动态元数据集生成等基础算法。
-#### 软件架构
-软件架构说明
+VPE引擎的主要结构如下图所示:
+
-#### 安装教程
+## 目录
-1. xxxx
-2. xxxx
-3. xxxx
+仓目录结构如下:
-#### 使用说明
+```
+/foundation/multimedia/video_processing_engine/
+├── framework # 框架代码
+│ ├── algorithm # 算法框架
+│ ├── aihdr_enhancer # 图像HDR增强算法框架
+│ ├── aihdr_enhancer_video # 视频HDR增强算法框架
+│ ├── colorspace_converter # 图像颜色空间转换算法框架
+│ ├── colorspace_converter_display # 图像颜色空间显示算法框架
+│ ├── colorspace_converter_video # 视频颜色空间转换算法框架
+│ ├── detail_enhancer # 图像细节增强算法框架
+│ ├── detail_enhancer_video # 视频细节增强算法框架
+│ ├── extension_manager # 插件管理
+│ ├── metadata_generator # 图像元数据生成算法框架
+│ ├── metadata_generator_video # 视频元数据生成算法框架
+│ ├── video_variable_refresh_rate # 视频可变帧率算法框架
+│ ├── capi # CAPI层
+│ ├── image_processing # 图像CAPI
+│ ├── video_processing # 视频CAPI
+│ ├── dfx # dfx代码
+├── interfaces # 接口层
+│ ├── inner_api # 系统内部接口
+│ ├── kits # 应用接口
+├── services # 服务代码
+├── sertestvices # 测试代码
+```
-1. xxxx
-2. xxxx
-3. xxxx
+## 编译构建
-#### 参与贡献
+编译32位ARM系统VPE引擎
+```
+./build.sh --product-name {product_name} --ccache --build-target video_processing_engine
+```
-1. Fork 本仓库
-2. 新建 Feat_xxx 分支
-3. 提交代码
-4. 新建 Pull Request
+编译64位ARM系统VPE引擎
+```
+./build.sh --product-name {product_name} --ccache --target-cpu arm64 --build-target video_processing_engine
+```
+{product_name}为当前支持的平台,比如rk3568。
-#### 特技
+## 说明
-1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
-2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
-3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
-4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
-5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
-6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
+### 使用说明
+VPE引擎作为OpenHarmony的组件,提供系统的视频图像能力,包含色彩空间转换、动态元数据生成以及细节增强等能力,供开发者进行图像和视频处理操作。
+
+## 相关仓
+
+- [graphic_graphic_2d](https://gitee.com/openharmony/graphic_graphic_2d)
+- [graphic_graphic_surface](https://gitee.com/openharmony/graphic_graphic_surface)
+- [multimedia_image_framework](https://gitee.com/openharmony/multimedia_image_framework)
+- [multimedia_media_foundation](https://gitee.com/openharmony/multimedia_media_foundation)
+- [third_party_egl](https://gitee.com/openharmony/third_party_egl)
+- [third_party_opengles](https://gitee.com/openharmony/third_party_opengles)
+- [third_party_opencl-headers](https://gitee.com/openharmony/third_party_opencl-headers)
+- [third_party_skia](https://gitee.com/openharmony/third_party_skia)
\ No newline at end of file
diff --git a/README_EN.md b/README_EN.md
new file mode 100644
index 0000000000000000000000000000000000000000..d300dc5b4530d934425d6d6af1c85edac6d47228
--- /dev/null
+++ b/README_EN.md
@@ -0,0 +1,68 @@
+# VPE
+
+## Overview
+The Video Processing Engine (VPE) is a media engine for processing video and image data. It offers a range of fundamental capabilities including enhancements to details, contrast, luminance, and dynamic ranges. It also supports essential algorithms for color space conversion, scaling and upscaling, and dynamic metadata generation for transcoding, sharing, and post-processing for display.
+
+The following figure demonstrates the VPE architecture.
+
+
+
+## Directory Structure
+
+The structure of the repository directory is as follows:
+
+```
+/foundation/multimedia/video_processing_engine/
+├── framework # Framework code
+│ ├── algorithm # Algorithm framework
+│ ├── aihdr_enhancer # Image HDR enhancement algorithm framework
+│ ├── aihdr_enhancer_video # Video HDR enhancement algorithm framework
+│ ├── colorspace_converter # Image color space conversion algorithm framework
+│ ├── colorspace_converter_display # Image color space display algorithm framework
+│ ├── colorspace_converter_video # Video color space conversion algorithm framework
+│ ├── detail_enhancer # Image detail enhancement algorithm framework
+│ ├── detail_enhancer_video # Video detail enhancement algorithm framework
+│ ├── extension_manager # Plugin management
+│ ├── metadata_generator # Image metadata generation algorithm framework
+│ ├── metadata_generator_video # Video metadata generation algorithm framework
+│ ├── video_variable_refresh_rate # Video variable frame rate algorithm framework
+│ ├── capi # CAPI layer
+│ ├── image_processing # Image CAPI
+│ ├── video_processing # Video CAPI
+│ ├── dfx # DFX code
+├── interfaces # API layer
+│ ├── inner_api # Internal APIs
+│ ├── kits # Application APIs
+├── services # Service code
+├── sertestvices # Test code
+```
+
+## Build
+
+Run the following command to build the VPE for the 32-bit ARM system:
+```
+./build.sh --product-name {product_name} --ccache --build-target video_processing_engine
+```
+
+Run the following command to build the VPE for the 64-bit ARM system:
+```
+./build.sh --product-name {product_name} --ccache --target-cpu arm64 --build-target video_processing_engine
+```
+
+**product_name** indicates the product supported, for example, **rk3568**.
+
+## Description
+
+### How to Use
+As a component of OpenHarmony, the VPE provides video and image processing capabilities, including color space conversion, dynamic metadata generation, and detail enhancement.
+
+## Repositories Involved
+
+- [graphic_graphic_2d](https://gitee.com/openharmony/graphic_graphic_2d)
+- [graphic_graphic_surface](https://gitee.com/openharmony/graphic_graphic_surface)
+- [multimedia_image_framework](https://gitee.com/openharmony/multimedia_image_framework)
+- [multimedia_media_foundation](https://gitee.com/openharmony/multimedia_media_foundation)
+- [third_party_egl](https://gitee.com/openharmony/third_party_egl)
+- [third_party_opengles](https://gitee.com/openharmony/third_party_opengles)
+- [third_party_opencl-headers](https://gitee.com/openharmony/third_party_opencl-headers)
+- [third_party_skia](https://gitee.com/openharmony/third_party_skia)
diff --git a/bundle.json b/bundle.json
new file mode 100644
index 0000000000000000000000000000000000000000..ce185fea03304489583a86eedcfaa0df55678117
--- /dev/null
+++ b/bundle.json
@@ -0,0 +1,140 @@
+{
+ "name": "@ohos/video_processing_engine",
+ "description": "video_processing_engine",
+ "version": "4.1",
+ "license": "Apache License 2.0",
+ "publishAs": "code-segment",
+ "segment": {
+ "destPath": "foundation/multimedia/video_processing_engine"
+ },
+ "dirs": {},
+ "scripts": {},
+ "component": {
+ "name": "video_processing_engine",
+ "subsystem": "multimedia",
+ "syscap": [],
+ "features": [],
+ "adapted_system_type": [
+ "standard"
+ ],
+ "rom": "10000KB",
+ "ram": "10000KB",
+ "hisysevent_config": [],
+ "deps": {
+ "components": [
+ "c_utils",
+ "graphic_2d",
+ "graphic_surface",
+ "hilog",
+ "hitrace",
+ "drivers_interface_display",
+ "ffrt",
+ "init",
+ "hdf_core",
+ "image_framework",
+ "media_foundation",
+ "napi",
+ "ipc",
+ "safwk",
+ "samgr",
+ "eventhandler"
+ ],
+ "third_party": [
+ "skia",
+ "egl",
+ "opengles",
+ "bounds_checking_function",
+ "opencl-headers"
+ ]
+ },
+ "build": {
+ "sub_component": [
+ "//foundation/multimedia/video_processing_engine/framework:videoprocessingengine",
+ "//foundation/multimedia/video_processing_engine/services:video_processing_service_group"
+ ],
+ "inner_kits": [
+ {
+ "type": "so",
+ "name": "//foundation/multimedia/video_processing_engine/framework:videoprocessingengine",
+ "header": {
+ "header_files": [
+ "algorithm_common.h",
+ "algorithm_errors.h",
+ "colorspace_converter.h",
+ "colorspace_converter_display.h",
+ "metadata_generator.h",
+ "colorspace_converter_video.h",
+ "colorspace_converter_video_common.h",
+ "colorspace_converter_video_description.h",
+ "detail_enhancer_common.h",
+ "detail_enhancer_image.h",
+ "detail_enhancer_video_common.h",
+ "detail_enhancer_video.h"
+ ],
+ "header_base": "//foundation/multimedia/video_processing_engine/interfaces/inner_api"
+ }
+ },
+ {
+ "name": "//foundation/multimedia/video_processing_engine/services:videoprocessingservice_idl_headers",
+ "header": {
+ "header_files": [
+ "video_processing_service_manager_proxy.h"
+ ],
+ "header_base": "//foundation/multimedia/video_processing_engine/services"
+ }
+ },
+ {
+ "type": "so",
+ "name": "//foundation/multimedia/video_processing_engine/framework:image_processing_capi_impl",
+ "header":{
+ "header_files":[
+ "image_processing_capi_impl.h"
+ ],
+ "header_base": "//foundation/multimedia/video_processing_engine/framework/capi/image_processing/include"
+ }
+ },
+ {
+ "type": "so",
+ "name": "//foundation/multimedia/video_processing_engine/framework:video_processing_capi_impl",
+ "header":{
+ "header_files":[
+ "video_processing_capi_impl.h"
+ ],
+ "header_base": "//foundation/multimedia/video_processing_engine/framework/capi/video_processing/include"
+ }
+ },
+ {
+ "type": "so",
+ "name": "//foundation/multimedia/video_processing_engine/framework:detailEnhancer",
+ "header":{
+ "header_files":[
+ "detail_enhance_napi.h"
+ ],
+ "header_base": "//foundation/multimedia/video_processing_engine/interfaces/kits/js"
+ }
+ },
+ {
+ "type": "so",
+ "name": "//foundation/multimedia/video_processing_engine/framework:videoprocessingenginenapi",
+ "header":{
+ "header_files":[
+ "detail_enhance_napi_formal.h",
+ "native_module_ohos_imageprocessing.h"
+ ],
+ "header_base": "//foundation/multimedia/video_processing_engine/interfaces/kits/js"
+ }
+ }
+ ],
+ "group_type": {
+ "base_group": [],
+ "fwk_group": [],
+ "service_group": []
+ },
+ "test": [
+ "//foundation/multimedia/video_processing_engine/test:demo_test",
+ "//foundation/multimedia/video_processing_engine/test:unit_test",
+ "//foundation/multimedia/video_processing_engine/test:module_test"
+ ]
+ }
+ }
+}
diff --git a/config.gni b/config.gni
new file mode 100644
index 0000000000000000000000000000000000000000..671cd55bab03c126385a8f38f187cb6fb1eaf17d
--- /dev/null
+++ b/config.gni
@@ -0,0 +1,90 @@
+# Copyright (c) 2023 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+VIDEO_PROCESSING_ENGINE_ROOT_DIR = "//foundation/multimedia/video_processing_engine"
+
+FRAMEWORK_DIR = "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/framework"
+ALGORITHM_DIR = "$FRAMEWORK_DIR/algorithm"
+CAPI_DIR = "$FRAMEWORK_DIR/capi"
+COMMON_DIR = "$FRAMEWORK_DIR/common"
+DFX_DIR = "$FRAMEWORK_DIR/dfx"
+PLUGIN_DIR = "$FRAMEWORK_DIR/plugin"
+
+AIHDR_ENHANCER_DIR = "$ALGORITHM_DIR/aihdr_enhancer"
+AIHDR_ENHANCER_VIDEO_DIR = "$ALGORITHM_DIR/aihdr_enhancer_video"
+COLORSPACE_CONVERTER_DIR = "$ALGORITHM_DIR/colorspace_converter"
+COLORSPACE_CONVERTER_DISPLAY_DIR = "$ALGORITHM_DIR/colorspace_converter_display"
+COLORSPACE_CONVERTER_VIDEO_DIR = "$ALGORITHM_DIR/colorspace_converter_video"
+METADATA_GENERATOR_DIR = "$ALGORITHM_DIR/metadata_generator"
+METADATA_GENERATOR_VIDEO_DIR = "$ALGORITHM_DIR/metadata_generator_video"
+ALGORITHM_EXTENSION_MANAGER_DIR = "$ALGORITHM_DIR/extension_manager"
+ALGORITHM_COMMON_DIR = "$ALGORITHM_DIR/common"
+DETAIL_ENHANCER_DIR = "$ALGORITHM_DIR/detail_enhancer"
+DETAIL_ENHANCER_VIDEO_DIR = "$ALGORITHM_DIR/detail_enhancer_video"
+VIDEO_REFRESHRATE_PREDICTION_DIR = "$ALGORITHM_DIR/video_variable_refresh_rate"
+
+#CAPI
+CAPI_IMAGE_DIR = "$FRAMEWORK_DIR/capi/image_processing"
+CAPI_COLORSPACE_CONVERTER_DIR = "$CAPI_IMAGE_DIR/colorspace_converter"
+CAPI_METADATA_GENERATOR_DIR = "$CAPI_IMAGE_DIR/metadata_generator"
+CAPI_IMAGE_DETAIL_ENHANCER_DIR = "$CAPI_IMAGE_DIR/detail_enhancer"
+CAPI_VIDEO_DIR = "$FRAMEWORK_DIR/capi/video_processing"
+CAPI_VIDEO_DETAIL_ENHANCER_DIR = "$CAPI_VIDEO_DIR/detail_enhancer"
+CAPI_VIDEO_COLORSPACE_CONVERTER_DIR = "$CAPI_VIDEO_DIR/colorspace_converter"
+CAPI_VIDEO_METADATA_GENERATOR_DIR = "$CAPI_VIDEO_DIR/metadata_generator"
+
+INTERFACES_DIR = "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/interfaces"
+INTERFACES_INNER_API_DIR = "$INTERFACES_DIR/inner_api"
+INTERFACES_CAPI_DIR = "$INTERFACES_DIR/kits/c"
+INTERFACES_PLUGIN_DIR = "$INTERFACES_DIR/plugin"
+
+SKIA_DIR = "//third_party/skia"
+EGL_DIR = "//third_party/EGL"
+OPENGLES_DIR = "//third_party/openGLES"
+
+#cuva
+CUVA_DIR = "$ALGORITHM_DIR/extensions/colorspace_converter_display/cuva_libs"
+
+#detail enhancer
+IMAGE_AISR_DIR = "$ALGORITHM_DIR/extensions/detail_enhancer/image/ai_super_resolution"
+IMAGE_EVE_DIR = "$ALGORITHM_DIR/extensions/detail_enhancer/image/extream_vision_engine"
+IMAGE_LIBYUV_DIR = "$ALGORITHM_DIR/extensions/detail_enhancer/image/libyuv"
+VIDEO_AISR_DIR = "$ALGORITHM_DIR/extensions/detail_enhancer/video/ai_super_resolution"
+
+#contrast enhancer
+CONTRAST_ENHANCER_DIR = "$ALGORITHM_DIR/contrast_enhancer"
+
+TEST_UTILS_PATH = "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/test/utils"
+UNIT_TEST_OUTPUT_PATH = "video_processing_engine/unittest"
+MODULE_TEST_OUTPUT_PATH = "video_processing_engine/moduletest"
+
+VIDEO_PROCESSING_ENGINE_CFLAGS = [
+ "-std=c++17",
+ "-fno-rtti",
+ "-fno-exceptions",
+ "-Wall",
+ "-fno-common",
+ "-fstack-protector-strong",
+ "-Wshadow",
+ "-FPIC",
+ "-FS",
+ "-O2",
+ "-D_FORTIFY_SOURCE=2",
+ "-Wformat=2",
+ "-Wdate-time",
+ "-Werror",
+ "-Wextra",
+ "-Wimplicit-fallthrough",
+ "-Wsign-compare",
+ "-Wunused-parameter"
+]
diff --git a/figures/videoProcessingEngine_architecture.png b/figures/videoProcessingEngine_architecture.png
new file mode 100644
index 0000000000000000000000000000000000000000..4cb1c857244e20365c999cd521cc72082a5a4829
Binary files /dev/null and b/figures/videoProcessingEngine_architecture.png differ
diff --git a/figures/videoProcessingEngine_architecture_english.png b/figures/videoProcessingEngine_architecture_english.png
new file mode 100644
index 0000000000000000000000000000000000000000..d9a70388c02e0d90e39f7d0990215ce34a0fc1f4
Binary files /dev/null and b/figures/videoProcessingEngine_architecture_english.png differ
diff --git a/framework/BUILD.gn b/framework/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..4641a9b5683612b07420d50954f22b743f70dad8
--- /dev/null
+++ b/framework/BUILD.gn
@@ -0,0 +1,501 @@
+# Copyright (c) 2025 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build/ohos.gni")
+import("//foundation/ability/idl_tool/idl_config.gni")
+import("//foundation/multimedia/video_processing_engine/config.gni")
+import("$CAPI_DIR/config.gni")
+
+config("export_config") {
+ include_dirs = [
+ "$AIHDR_ENHANCER_DIR/include",
+ "$INTERFACES_INNER_API_DIR",
+ "$DFX_DIR/include",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services/include",
+ "$DETAIL_ENHANCER_DIR/include",
+ "$COLORSPACE_CONVERTER_DIR/include",
+ "$METADATA_GENERATOR_DIR/include",
+ "$INTERFACES_INNER_API_DIR/native/colorspace",
+ "$COLORSPACE_CONVERTER_DISPLAY_DIR/include",
+ "$VIDEO_REFRESHRATE_PREDICTION_DIR/include",
+ "$ALGORITHM_DIR/common/include",
+ ]
+}
+config("video_process_config") {
+ cflags = [
+ "-std=c++17",
+ "-fno-rtti",
+ "-fno-exceptions",
+ "-Wall",
+ "-fno-common",
+ "-fstack-protector-strong",
+ "-Wshadow",
+ "-FPIC",
+ "-FS",
+ "-O2",
+ "-D_FORTIFY_SOURCE=2",
+ "-Wformat=2",
+
+ # "-Wfloat-equal",
+ "-Wdate-time",
+ "-Werror",
+ "-Wextra",
+ "-Wimplicit-fallthrough",
+ "-Wsign-compare",
+ "-Wunused-parameter",
+ ]
+
+ include_dirs = [
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR",
+ "$FRAMEWORK_DIR",
+ "$FRAMEWORK_DIR/common/include",
+ "$AIHDR_ENHANCER_DIR/include",
+ "$AIHDR_ENHANCER_VIDEO_DIR/include",
+ "$ALGORITHM_DIR/common/include",
+ "$ALGORITHM_DIR/extension_manager/include",
+ "$COLORSPACE_CONVERTER_DIR/include",
+ "$COLORSPACE_CONVERTER_DISPLAY_DIR/include",
+ "$COLORSPACE_CONVERTER_VIDEO_DIR/include",
+ "$METADATA_GENERATOR_DIR/include",
+ "$METADATA_GENERATOR_VIDEO_DIR/include",
+ "$DETAIL_ENHANCER_VIDEO_DIR/include",
+ "$VIDEO_REFRESHRATE_PREDICTION_DIR/include",
+ "$DETAIL_ENHANCER_DIR/include",
+ "$DFX_DIR/include",
+ "$FRAMEWORK_DIR/plugin",
+ "$FRAMEWORK_DIR/module",
+ "$INTERFACES_INNER_API_DIR",
+ "$INTERFACES_INNER_API_DIR/module",
+ "$INTERFACES_DIR/plugin",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services/include",
+
+ # temporary dir
+ "$SKIA_DIR",
+ "${target_gen_dir}/../services/",
+ "$SKIA_DIR/include/core",
+ "$SKIA_DIR/include/encode",
+ "$SKIA_DIR",
+ "$SKIA_DIR/src/ports/skia_ohos",
+ "$SKIA_DIR/src/ports",
+ "$SKIA_DIR/src/images",
+ "$SKIA_DIR/include/private",
+ "$SKIA_DIR/include/effects",
+ "$SKIA_DIR/third_party/externals/angle2/src/common",
+ "$SKIA_DIR/third_party/externals/angle2/src/",
+ "$SKIA_DIR/third_party/externals/angle2/src/common/third_party/base/",
+ "//foundation/graphic/graphic_2d/utils/color_manager/export",
+ "//base/startup/init/interfaces/innerkits/include/syspara/",
+ ]
+}
+
+ohos_prebuilt_shared_library("extream_vision_engine") {
+ if (is_asan && use_hwasan) {
+ source = "//binary/artifacts/display/AIPQ20/asan/libextream_vision_engine.so"
+ } else {
+ source = "//binary/artifacts/display/AIPQ20/libextream_vision_engine.so"
+ }
+ module_install_dir = "lib64/"
+ output = "libextream_vision_engine.so"
+ install_images = [ "system" ]
+ subsystem_name = "multimedia"
+ part_name = "video_processing_engine"
+ install_enable = true
+}
+
+ohos_prebuilt_shared_library("ai_super_resolution") {
+ if (is_asan && use_hwasan) {
+ source = "//binary/artifacts/display/AIPQ20/asan/libdisplay_aipq_imagesr.so"
+ } else {
+ source = "//binary/artifacts/display/AIPQ20/libdisplay_aipq_imagesr.so"
+ }
+ module_install_dir = "lib64/"
+ output = "libdisplay_aipq_imagesr.so"
+ install_images = [ "system" ]
+ subsystem_name = "multimedia"
+ part_name = "video_processing_engine"
+ install_enable = true
+}
+
+ohos_prebuilt_shared_library("aihdr_engine") {
+ if (is_asan && use_hwasan) {
+ source = "//binary/artifacts/display/AIPQ20/asan/libaihdr_engine.so"
+ } else {
+ source = "//binary/artifacts/display/AIPQ20/libaihdr_engine.so"
+ }
+ module_install_dir = "lib64/"
+ output = "libaihdr_engine.so"
+ install_images = [ "system" ]
+ subsystem_name = "multimedia"
+ part_name = "video_processing_engine"
+ install_enable = true
+}
+
+ohos_shared_library("videoprocessingengine") {
+ branch_protector_ret = "pac_ret"
+
+ install_enable = true
+
+ sanitize = {
+ boundary_sanitize = true
+ cfi = true
+ cfi_cross_dso = true
+ integer_overflow = true
+ ubsan = true
+ debug = false
+ }
+
+ configs = [ ":video_process_config" ]
+ public_configs = [ ":export_config" ]
+
+ include_dirs = []
+
+ sources = [
+ "$AIHDR_ENHANCER_DIR/aihdr_enhancer_fwk.cpp",
+ "$AIHDR_ENHANCER_VIDEO_DIR/aihdr_enhancer_video_impl.cpp",
+ "$ALGORITHM_DIR/common/algorithm_common.cpp",
+ "$ALGORITHM_DIR/common/algorithm_utils.cpp",
+ "$ALGORITHM_DIR/common/algorithm_video.cpp",
+ "$ALGORITHM_DIR/common/algorithm_video_common.cpp",
+ "$ALGORITHM_DIR/common/algorithm_video_impl.cpp",
+ "$ALGORITHM_DIR/common/frame_info.cpp",
+ "$ALGORITHM_DIR/common/vpe_parse_metadata.cpp",
+ "$ALGORITHM_DIR/extension_manager/extension_manager.cpp",
+ "$ALGORITHM_DIR/extension_manager/utils.cpp",
+ "$COLORSPACE_CONVERTER_DIR/colorspace_converter_fwk.cpp",
+ "$COLORSPACE_CONVERTER_VIDEO_DIR/colorspace_converter_video_impl.cpp",
+ "$COLORSPACE_CONVERTER_DISPLAY_DIR/colorspace_converter_display_fwk.cpp",
+ "$METADATA_GENERATOR_DIR/metadata_generator_fwk.cpp",
+ "$METADATA_GENERATOR_VIDEO_DIR/metadata_generator_video_impl.cpp",
+ "$DETAIL_ENHANCER_DIR/detail_enhancer_image_fwk.cpp",
+ "$DETAIL_ENHANCER_VIDEO_DIR/detail_enhancer_video_fwk.cpp",
+ "$DETAIL_ENHANCER_VIDEO_DIR/detail_enhancer_video_impl.cpp",
+ "$VIDEO_REFRESHRATE_PREDICTION_DIR/video_refreshrate_prediction_fwk.cpp",
+ "$DFX_DIR/vpe_trace.cpp",
+ "$DFX_DIR/vpe_log.cpp",
+ #client
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services/src/video_processing_client.cpp",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services/src/video_processing_load_callback.cpp",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services/src/surface_buffer_info.cpp",
+ "${target_gen_dir}/../services/video_processing_service_manager_proxy.cpp",
+ "${target_gen_dir}/../services/video_processing_service_manager_stub.cpp",
+ "$ALGORITHM_COMMON_DIR/image_opencl_wrapper.cpp",
+ "$ALGORITHM_COMMON_DIR/image_openclsetup.cpp"
+ ]
+
+ deps = [ "//third_party/skia:skia_ohos",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services:videoprocessingservice_interface",
+ ":aihdr_engine",
+ ":ai_super_resolution",
+ ":extream_vision_engine",
+ "//third_party/opencl-headers:libcl",
+ "//third_party/bounds_checking_function:libsec_static"]
+
+ external_deps = [
+ "c_utils:utils",
+ "drivers_interface_display:display_commontype_idl_headers",
+ "drivers_interface_display:libdisplay_commontype_proxy_2.1",
+ "graphic_surface:surface",
+ "graphic_surface:sync_fence",
+ "hilog:libhilog",
+ "hitrace:hitrace_meter",
+ "init:libbegetutil",
+ "hdf_core:libhdi",
+ "hdf_core:libhdf_host",
+ "hdf_core:libhdf_ipc_adapter",
+ "hdf_core:libhdf_utils",
+ "hdf_core:hdf_posix_osal",
+ "graphic_2d:2d_graphics",
+ "ipc:ipc_single",
+ "safwk:system_ability_fwk",
+ "samgr:samgr_proxy",
+ "media_foundation:media_foundation",
+ "graphic_2d:EGL",
+ "graphic_2d:GLESv3",
+ ]
+
+ subsystem_name = "multimedia"
+ part_name = "video_processing_engine"
+}
+
+config("video_processing_engine_capi_config") {
+ include_dirs = [
+ "$VIDEO_PROCESSING_ENGINE_CAPI_DIR/interface/kits/c",
+ "$VIDEO_PROCESSING_ENGINE_CAPI_DIR/interface/inner_api",
+ ]
+}
+
+ohos_shared_library("image_processing_capi_impl") {
+ sanitize = {
+ boundary_sanitize = true
+ cfi = true
+ cfi_cross_dso = true
+ integer_overflow = true
+ ubsan = true
+ debug = false
+ }
+
+ stack_protector_ret = true
+
+ cflags = VIDEO_PROCESSING_ENGINE_CFLAGS
+ cflags += [
+ "-ffunction-sections",
+ "-fdata-sections",
+ "-DIMAGE_COLORSPACE_FLAG",
+ ]
+
+ ldflags = [ "-Wl,--gc-sections" ]
+
+ configs = [ ":video_processing_engine_capi_config" ]
+
+ include_dirs = [
+ #Interface
+ "$INTERFACES_CAPI_DIR",
+ "$INTERFACES_INNER_API_DIR",
+ #Common
+ "$DFX_DIR/include",
+ "$ALGORITHM_COMMON_DIR/include",
+ #CAPI implementation
+ "$CAPI_IMAGE_DIR/include",
+ "$CAPI_IMAGE_DETAIL_ENHANCER_DIR/include",
+ "$CAPI_COLORSPACE_CONVERTER_DIR/include",
+ "$CAPI_METADATA_GENERATOR_DIR/include",
+ "$DETAIL_ENHANCER_DIR/include",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services/include",
+ "${target_gen_dir}/../services/",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/framework/algorithm/common/include",
+ ]
+
+ sources = [
+ "$CAPI_IMAGE_DIR/image_environment_native.cpp",
+ "$CAPI_IMAGE_DIR/image_processing_capi_impl.cpp",
+ "$CAPI_IMAGE_DIR/image_processing_factory.cpp",
+ "$CAPI_IMAGE_DIR/image_processing_impl.cpp",
+ "$CAPI_IMAGE_DIR/image_processing_native_base.cpp",
+ "$CAPI_IMAGE_DIR/image_processing_utils.cpp",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/framework/algorithm/common/vpe_utils_common.cpp",
+ "$CAPI_IMAGE_DETAIL_ENHANCER_DIR/detail_enhancer_image_native.cpp",
+ "$CAPI_COLORSPACE_CONVERTER_DIR/colorspace_converter_image_native.cpp",
+ "$CAPI_METADATA_GENERATOR_DIR/metadata_generator_image_native.cpp",
+ ]
+
+ deps = [
+ ":videoprocessingengine",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services:videoprocessingservice_interface",
+ ]
+
+ external_deps = [
+ "c_utils:utils",
+ "graphic_surface:surface",
+ "hilog:libhilog",
+ "graphic_2d:2d_graphics",
+ "media_foundation:media_foundation",
+ "image_framework:pixelmap",
+ "image_framework:image_native",
+ "drivers_interface_display:display_commontype_idl_headers",
+ "ipc:ipc_single",
+ "safwk:system_ability_fwk",
+ "samgr:samgr_proxy",
+ ]
+
+ output_extension = "so"
+ subsystem_name = "multimedia"
+ innerapi_tags = [ "ndk" ]
+ part_name = "video_processing_engine"
+}
+
+ohos_shared_library("video_processing_capi_impl") {
+ sanitize = {
+ boundary_sanitize = true
+ cfi = true
+ cfi_cross_dso = true
+ integer_overflow = true
+ ubsan = true
+ debug = false
+ }
+
+ stack_protector_ret = true
+
+ cflags = VIDEO_PROCESSING_ENGINE_CFLAGS
+ cflags += [
+ "-ffunction-sections",
+ "-fdata-sections",
+ ]
+
+ ldflags = [ "-Wl,--gc-sections" ]
+
+ configs = [ ":video_processing_engine_capi_config" ]
+
+ include_dirs = [
+ #Interface
+ "$INTERFACES_CAPI_DIR",
+ "$INTERFACES_INNER_API_DIR",
+ #Common
+ "$DFX_DIR/include",
+ "$ALGORITHM_COMMON_DIR/include",
+ #CAPI implementation
+ "$CAPI_VIDEO_DIR/include/",
+ "$CAPI_VIDEO_DIR/aihdr_enhancer/include/",
+ "$CAPI_VIDEO_DETAIL_ENHANCER_DIR/include/",
+ "$CAPI_VIDEO_COLORSPACE_CONVERTER_DIR/include/",
+ "//foundation/graphic/graphic_surface/interfaces/inner_api/surface/",
+ "//foundation/graphic/graphic_surface/surface/include/",
+ "//foundation/graphic/graphic_2d/interfaces/inner_api",
+ "$CAPI_VIDEO_METADATA_GENERATOR_DIR/include/",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services/include",
+ "${target_gen_dir}/../services/",
+ ]
+
+ sources = [
+ #CAPI common
+ "$CAPI_VIDEO_DIR/video_environment_native.cpp",
+ "$CAPI_VIDEO_DIR/video_processing_callback_impl.cpp",
+ "$CAPI_VIDEO_DIR/video_processing_callback_native.cpp",
+ "$CAPI_VIDEO_DIR/video_processing_capi_impl.cpp",
+ "$CAPI_VIDEO_DIR/video_processing_capi_capability.cpp",
+ "$CAPI_VIDEO_DIR/video_processing_factory.cpp",
+ "$CAPI_VIDEO_DIR/video_processing_impl.cpp",
+ "$CAPI_VIDEO_DIR/video_processing_native_base.cpp",
+ "$CAPI_VIDEO_DIR/video_processing_utils.cpp",
+ #CAPI - features
+ #CAPI - detail enhancement
+ "$CAPI_VIDEO_DETAIL_ENHANCER_DIR/detail_enhancer_video_native.cpp",
+ "$CAPI_VIDEO_COLORSPACE_CONVERTER_DIR/colorSpace_converter_video_native.cpp",
+ "$CAPI_VIDEO_METADATA_GENERATOR_DIR/metadata_generator_video_native.cpp",
+ "$CAPI_VIDEO_DIR/aihdr_enhancer/aihdr_enhancer_video_native.cpp"
+ ]
+
+ deps = [
+ ":videoprocessingengine",
+ "$VIDEO_PROCESSING_ENGINE_ROOT_DIR/services:videoprocessingservice_interface",
+ ]
+
+ external_deps = [
+ "c_utils:utils",
+ "graphic_surface:surface",
+ "hilog:libhilog",
+ "hitrace:hitrace_meter",
+ "media_foundation:media_foundation",
+ "drivers_interface_display:display_commontype_idl_headers",
+ "graphic_2d:libgraphic_utils",
+ "graphic_2d:librender_service_client",
+ "ipc:ipc_single",
+ "safwk:system_ability_fwk",
+ "samgr:samgr_proxy",
+ ]
+
+ output_extension = "so"
+ subsystem_name = "multimedia"
+ innerapi_tags = [ "ndk" ]
+ part_name = "video_processing_engine"
+}
+
+ohos_shared_library("detailEnhancer") {
+ sanitize = {
+ cfi = true
+ cfi_cross_dso = true
+ cfi_vcall_icall_only = true
+ debug = false
+ }
+
+ defines = [ "IMAGE_COLORSPACE_FLAG" ]
+
+ include_dirs = [
+ "$DFX_DIR/include",
+ "//foundation/multimedia/media_foundation/interface/kits/c",
+ "//foundation/multimedia/image_framework/interfaces/kits/native/include/image",
+ "//foundation/multimedia/image_framework/frameworks/kits/js/common/ndk/include",
+ "//foundation/multimedia/video_processing_engine/interfaces/kits/js",
+ "//foundation/multimedia/media_foundation/video_processing_engine/interface/kits/c",
+ "//foundation/multimedia/video_processing_engine/interfaces/inner_api",
+ "//foundation/multimedia/video_processing_engine/framework/capi/image_processing/include/",
+ ]
+ sources = [
+ "//foundation/multimedia/video_processing_engine/framework/capi/image_processing/detail_enhance_napi.cpp",
+ "//foundation/multimedia/image_framework/frameworks/innerkitsimpl/common/src/memory_manager.cpp",
+ ]
+
+ deps = [
+ ":videoprocessingengine",
+ ]
+
+ cflags = VIDEO_PROCESSING_ENGINE_CFLAGS
+ external_deps = [
+ "c_utils:utils",
+ "graphic_surface:surface",
+ "hilog:libhilog",
+ "hitrace:hitrace_meter",
+ "ipc:ipc_napi",
+ "media_foundation:native_media_core",
+ "napi:ace_napi",
+ "image_framework:image_utils",
+ "image_framework:image_native",
+ "image_framework:pixelmap",
+ "image_framework:image",
+ "drivers_interface_display:display_commontype_idl_headers",
+ ]
+
+ output_name = "libdetailenhancer_napi"
+ subsystem_name = "multimedia"
+ relative_install_dir = "module/multimedia"
+ part_name = "video_processing_engine"
+}
+
+ohos_shared_library("videoprocessingenginenapi") {
+ sanitize = {
+ cfi = true
+ cfi_cross_dso = true
+ cfi_vcall_icall_only = true
+ debug = false
+ }
+
+ defines = [ "IMAGE_COLORSPACE_FLAG" ]
+
+ include_dirs = [
+ "$DFX_DIR/include",
+ "$INTERFACES_DIR/kits/js",
+ "$INTERFACES_INNER_API_DIR",
+ "$CAPI_DIR/image_processing/include/",
+ "$ALGORITHM_COMMON_DIR/include/",
+ ]
+ sources = [
+ "$CAPI_DIR/image_processing/detail_enhance_napi_formal.cpp",
+ "$INTERFACES_DIR/kits/js/native_module_ohos_imageprocessing.cpp",
+ ]
+
+ deps = [
+ ":videoprocessingengine",
+ ]
+
+ cflags = VIDEO_PROCESSING_ENGINE_CFLAGS
+ external_deps = [
+ "c_utils:utils",
+ "drivers_interface_display:display_commontype_idl_headers",
+ "graphic_surface:surface",
+ "hilog:libhilog",
+ "hitrace:hitrace_meter",
+ "image_framework:image_utils",
+ "image_framework:image_native",
+ "image_framework:pixelmap",
+ "image_framework:image",
+ "ipc:ipc_napi",
+ "media_foundation:native_media_core",
+ "media_foundation:media_foundation",
+ "media_foundation:image_processing",
+ "napi:ace_napi",
+ ]
+
+ output_name = "libvideoprocessingengine_napi"
+ subsystem_name = "multimedia"
+ relative_install_dir = "module/multimedia"
+ part_name = "video_processing_engine"
+}
diff --git a/framework/algorithm/aihdr_enhancer/aihdr_enhancer_fwk.cpp b/framework/algorithm/aihdr_enhancer/aihdr_enhancer_fwk.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..616882fea919fac3293496ed2e8fb30270b205c0
--- /dev/null
+++ b/framework/algorithm/aihdr_enhancer/aihdr_enhancer_fwk.cpp
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "aihdr_enhancer_fwk.h"
+
+#include "native_buffer.h"
+#include "surface_buffer.h"
+
+#include "extension_manager.h"
+#include "video_processing_client.h"
+#include "vpe_log.h"
+#include "vpe_trace.h"
+
+namespace OHOS {
+namespace Media {
+namespace VideoProcessingEngine {
+AihdrEnhancerFwk::AihdrEnhancerFwk()
+{
+ Extension::ExtensionManager::GetInstance().IncreaseInstance();
+}
+
+AihdrEnhancerFwk::~AihdrEnhancerFwk()
+{
+ if (impl_) {
+ impl_->Deinit();
+ impl_ = nullptr;
+ }
+ Extension::ExtensionManager::GetInstance().DecreaseInstance();
+}
+
+VPEAlgoErrCode AihdrEnhancerFwk::SetParameter(const int& parameter)
+{
+ parameter_ = parameter;
+ VPE_LOGI("AihdrEnhancerFwk SetParameter Succeed");
+ return VPE_ALGO_ERR_OK;
+}
+
+VPEAlgoErrCode AihdrEnhancerFwk::GetParameter(int& parameter) const
+{
+ parameter = parameter_;
+ VPE_LOGI("AihdrEnhancerFwk GetParameter Succeed");
+ return VPE_ALGO_ERR_OK;
+}
+
+VPEAlgoErrCode AihdrEnhancerFwk::Process(const sptr& input)
+{
+ CHECK_AND_RETURN_RET_LOG(input != nullptr, VPE_ALGO_ERR_INVALID_VAL, "Input is nullptr");
+
+ VPEAlgoErrCode ret = Init(input);
+ CHECK_AND_RETURN_RET_LOG(ret == VPE_ALGO_ERR_OK, ret, "Init failed");
+
+ VPE_SYNC_TRACE;
+ ret = impl_->Process(input);
+ CHECK_AND_RETURN_RET_LOG(ret == VPE_ALGO_ERR_OK, ret, "Process failed, ret: %{public}d", ret);
+
+ return VPE_ALGO_ERR_OK;
+}
+
+VPEAlgoErrCode AihdrEnhancerFwk::Init(const sptr& input)
+{
+ if (initialized_) {
+ impl_->SetParameter(parameter_);
+ return VPE_ALGO_ERR_OK;
+ }
+ auto &manager = Extension::ExtensionManager::GetInstance();
+
+ VPE_SYNC_TRACE;
+
+ FrameInfo info(input);
+ impl_ = manager.CreateAihdrEnhancer(info, extensionInfo_);
+ CHECK_AND_RETURN_RET_LOG(impl_ != nullptr, VPE_ALGO_ERR_NOT_IMPLEMENTED, "Create failed");
+
+ int32_t ret = impl_->Init();
+ CHECK_AND_RETURN_RET_LOG(ret == VPE_ALGO_ERR_OK, VPE_ALGO_ERR_NOT_IMPLEMENTED, "Init failed");
+ impl_->SetParameter(parameter_);
+ initialized_ = true;
+ VPE_LOGI("AihdrEnhancerFwk Init Succeed");
+
+ return VPE_ALGO_ERR_OK;
+}
+
+std::shared_ptr AihdrEnhancer::Create()
+{
+ auto p = std::make_shared();
+ CHECK_AND_RETURN_RET_LOG(p != nullptr, nullptr, "Create AihdrEnhancer failed");
+ return std::static_pointer_cast(p);
+}
+
+int32_t AihdrEnhancerCreate(int32_t* instance)
+{
+ CHECK_AND_RETURN_RET_LOG(instance != nullptr, VPE_ALGO_ERR_INVALID_VAL, "invalid instance");
+ auto p = AihdrEnhancer::Create();
+ CHECK_AND_RETURN_RET_LOG(p != nullptr, VPE_ALGO_ERR_INVALID_VAL, "cannot create instance");
+ Extension::ExtensionManager::InstanceVariableType instanceVar { p };
+ int32_t newId = Extension::ExtensionManager::GetInstance().NewInstanceId(instanceVar);
+ CHECK_AND_RETURN_RET_LOG(newId != -1, VPE_ALGO_ERR_NO_MEMORY, "cannot create more instance");
+ *instance = newId;
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerProcessImage(int32_t instance, OHNativeWindowBuffer* inputImage)
+{
+ CHECK_AND_RETURN_RET_LOG((inputImage != nullptr), VPE_ALGO_ERR_INVALID_VAL,
+ "invalid parameters");
+ auto someInstance = Extension::ExtensionManager::GetInstance().GetInstance(instance);
+ CHECK_AND_RETURN_RET_LOG(someInstance != std::nullopt, VPE_ALGO_ERR_INVALID_VAL, "invalid instance");
+
+ VPEAlgoErrCode ret = VPE_ALGO_ERR_INVALID_VAL;
+ auto visitFunc = [inputImage, &ret](auto&& var) {
+ using VarType = std::decay_t;
+ if constexpr (std::is_same_v>) {
+ OH_NativeBuffer* inputImageNativeBuffer = nullptr;
+ CHECK_AND_RETURN_LOG(
+ (OH_NativeBuffer_FromNativeWindowBuffer(inputImage, &inputImageNativeBuffer) == GSERROR_OK),
+ "invalid input image");
+ sptr inputImageSurfaceBuffer(
+ SurfaceBuffer::NativeBufferToSurfaceBuffer(inputImageNativeBuffer));
+ ret = var->Process(inputImageSurfaceBuffer);
+ } else {
+ VPE_LOGE("instance may be miss used");
+ }
+ };
+ std::visit(visitFunc, *someInstance);
+
+ return ret;
+}
+
+int32_t AihdrEnhancerDestroy(int32_t* instance)
+{
+ CHECK_AND_RETURN_RET_LOG(instance != nullptr, VPE_ALGO_ERR_INVALID_VAL, "instance is null");
+ return Extension::ExtensionManager::GetInstance().RemoveInstanceReference(*instance);
+}
+} // namespace VideoProcessingEngine
+} // namespace Media
+} // namespace OHOS
diff --git a/framework/algorithm/aihdr_enhancer/include/aihdr_enhancer_base.h b/framework/algorithm/aihdr_enhancer/include/aihdr_enhancer_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..bfae48189584437551493dd2c6f9be54baf7ae1d
--- /dev/null
+++ b/framework/algorithm/aihdr_enhancer/include/aihdr_enhancer_base.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AIHDR_ENHANCER_BASE_H
+#define AIHDR_ENHANCER_BASE_H
+
+#include
+#include
+
+#include "nocopyable.h"
+
+#include "frame_info.h"
+
+namespace OHOS {
+namespace Media {
+namespace VideoProcessingEngine {
+class AihdrEnhancerBase : public NoCopyable {
+public:
+ virtual ~AihdrEnhancerBase() = default;
+ virtual VPEAlgoErrCode Init() = 0;
+ virtual VPEAlgoErrCode Deinit() = 0;
+ virtual VPEAlgoErrCode SetParameter(const int& parameter) = 0;
+ virtual VPEAlgoErrCode GetParameter(int& parameter) = 0;
+ virtual VPEAlgoErrCode Process(const sptr& input) = 0;
+};
+
+using AihdrEnhancerCreator = std::function()>;
+} // namespace VideoProcessingEngine
+} // namespace Media
+} // namespace OHOS
+
+#endif // AIHDR_ENHANCER_BASE_H
diff --git a/framework/algorithm/aihdr_enhancer/include/aihdr_enhancer_capability.h b/framework/algorithm/aihdr_enhancer/include/aihdr_enhancer_capability.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e50523483593883d16ff935dcb161c37ecba34e
--- /dev/null
+++ b/framework/algorithm/aihdr_enhancer/include/aihdr_enhancer_capability.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AIHDR_ENHANCER_CAPABILITY_H
+#define AIHDR_ENHANCER_CAPABILITY_H
+
+#include
+#include
+
+#include "frame_info.h"
+
+namespace OHOS {
+namespace Media {
+namespace VideoProcessingEngine {
+struct AihdrEnhancerCapability {
+ ColorSpaceDescription colorspaceDesc;
+ std::vector pixelFormats;
+ uint32_t rank;
+ int32_t version;
+};
+
+using AihdrEnhancerCapabilitiesBuilder = std::function()>;
+} // namespace VideoProcessingEngine
+} // namespace Media
+} // namespace OHOS
+
+#endif // AIHDR_ENHANCER_CAPABILITY_H
diff --git a/framework/algorithm/aihdr_enhancer/include/aihdr_enhancer_fwk.h b/framework/algorithm/aihdr_enhancer/include/aihdr_enhancer_fwk.h
new file mode 100644
index 0000000000000000000000000000000000000000..71fa74b3cc87c27b20700ef535b2a7edbb00ee04
--- /dev/null
+++ b/framework/algorithm/aihdr_enhancer/include/aihdr_enhancer_fwk.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AIHDR_ENHANCER_FWK_H
+#define AIHDR_ENHANCER_FWK_H
+
+#include
+#include
+#include
+
+#include "aihdr_enhancer.h"
+#include "aihdr_enhancer_base.h"
+#include "extension_base.h"
+
+namespace OHOS {
+namespace Media {
+namespace VideoProcessingEngine {
+class AihdrEnhancerFwk : public AihdrEnhancer {
+public:
+ AihdrEnhancerFwk();
+ ~AihdrEnhancerFwk();
+ VPEAlgoErrCode SetParameter(const int& parameter) override;
+ VPEAlgoErrCode GetParameter(int& parameter) const override;
+ VPEAlgoErrCode Process(const sptr& input) override;
+
+private:
+ VPEAlgoErrCode Init(const sptr& input);
+
+ std::shared_ptr impl_ { nullptr };
+ int parameter_{};
+ std::atomic initialized_ { false };
+ Extension::ExtensionInfo extensionInfo_;
+};
+} // namespace VideoProcessingEngine
+} // namespace Media
+} // namespace OHOS
+
+#endif // AIHDR_ENHANCER_FWK_H
diff --git a/framework/algorithm/aihdr_enhancer_video/aihdr_enhancer_video_impl.cpp b/framework/algorithm/aihdr_enhancer_video/aihdr_enhancer_video_impl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1f8c895154a29295bf105c0633d83c7e25b4ac57
--- /dev/null
+++ b/framework/algorithm/aihdr_enhancer_video/aihdr_enhancer_video_impl.cpp
@@ -0,0 +1,626 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "aihdr_enhancer_video_impl.h"
+
+#include
+#include
+#include
+#include
+
+#include "native_window.h"
+#include "securec.h"
+#include "surface.h"
+
+#include "algorithm_common.h"
+#include "algorithm_errors.h"
+#include "algorithm_utils.h"
+#include "extension_manager.h"
+#include "vpe_log.h"
+#include "vpe_trace.h"
+
+namespace OHOS {
+namespace Media {
+namespace VideoProcessingEngine {
+std::shared_ptr AihdrEnhancerVideo::Create()
+{
+ std::shared_ptr impl = std::make_shared();
+ int32_t ret = impl->Init();
+ CHECK_AND_RETURN_RET_LOG(ret == VPE_ALGO_ERR_OK, nullptr, "failed to init AihdrEnhancerVideoImpl");
+ return impl;
+}
+
+AihdrEnhancerVideoImpl::AihdrEnhancerVideoImpl()
+{
+ requestCfg_.timeout = 0;
+ requestCfg_.strideAlignment = 32; // 32 内存对齐
+ requestCfg_.usage = 0;
+ requestCfg_.format = 0;
+ requestCfg_.width = 0;
+ requestCfg_.height = 0;
+ flushCfg_.timestamp = 0;
+ flushCfg_.damage.x = 0;
+ flushCfg_.damage.y = 0;
+ flushCfg_.damage.w = 0;
+ flushCfg_.damage.h = 0;
+}
+
+AihdrEnhancerVideoImpl::~AihdrEnhancerVideoImpl()
+{
+ Release();
+}
+
+int32_t AihdrEnhancerVideoImpl::Init()
+{
+ std::lock_guard lock(mutex_);
+ CHECK_AND_RETURN_RET_LOG(state_ == VPEAlgoState::UNINITIALIZED, VPE_ALGO_ERR_INVALID_STATE,
+ "Init failed: not in UNINITIALIZED state");
+ csc_ = AihdrEnhancer::Create();
+ CHECK_AND_RETURN_RET_LOG(csc_ != nullptr, VPE_ALGO_ERR_UNKNOWN, "AihdrEnhancer Create failed");
+
+ isRunning_.store(true);
+ taskThread_ = std::make_shared(&AihdrEnhancerVideoImpl::OnTriggered, this);
+ CHECK_AND_RETURN_RET_LOG(taskThread_ != nullptr, VPE_ALGO_ERR_UNKNOWN, "Fatal: No memory");
+
+ state_ = VPEAlgoState::INITIALIZED;
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::SetCallback(const std::shared_ptr &callback)
+{
+ std::lock_guard lock(mutex_);
+ CHECK_AND_RETURN_RET_LOG(callback != nullptr, VPE_ALGO_ERR_INVALID_VAL, "Set callback failed: callback is NULL");
+ CHECK_AND_RETURN_RET_LOG(state_ == VPEAlgoState::INITIALIZED || state_ == VPEAlgoState::CONFIGURING,
+ VPE_ALGO_ERR_INVALID_STATE, "SetCallback failed: not in INITIALIZED or CONFIGURING state");
+ cb_ = callback;
+ state_ = VPEAlgoState::CONFIGURING;
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::AttachToNewSurface(sptr newSurface)
+{
+ std::lock_guard lockrender(renderQueMutex_);
+ for (auto it = outputBufferAvilQueBak_.begin(); it != outputBufferAvilQueBak_.end(); ++it) {
+ auto buffer = it->second;
+ GSError err = newSurface->AttachBufferToQueue(buffer->memory);
+ CHECK_AND_RETURN_RET_LOG(err == GSERROR_OK, VPE_ALGO_ERR_UNKNOWN, "outputbuffer AttachToNewSurface fail");
+ }
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::GetReleaseOutBuffer()
+{
+ std::lock_guard mapLock(renderQueMutex_);
+ for (RenderBufferAvilMapType::iterator it = renderBufferMapBak_.begin(); it != renderBufferMapBak_.end(); ++it) {
+ outputBufferAvilQue_.push(it->second);
+ }
+ renderBufferMapBak_.clear();
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::SetOutputSurfaceConfig(sptr surface)
+{
+ GSError err = surface->RegisterReleaseListener([this](sptr &buffer) {
+ (void)buffer;
+ return OnProducerBufferReleased();
+ });
+ CHECK_AND_RETURN_RET_LOG(err == GSERROR_OK, VPE_ALGO_ERR_UNKNOWN, "RegisterReleaseListener fail");
+ surface->SetQueueSize(outBufferCnt_);
+ outputSurface_ = surface;
+ state_ = VPEAlgoState::CONFIGURING;
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::SetOutputSurfaceRunning(sptr newSurface)
+{
+ std::lock_guard lockSurface(surfaceChangeMutex_);
+ std::lock_guard lockSurface2(surfaceChangeMutex2_);
+ uint64_t oldId = outputSurface_->GetUniqueId();
+ uint64_t newId = newSurface->GetUniqueId();
+ CHECK_AND_RETURN_RET_LOG(oldId != newId, VPE_ALGO_ERR_OK, "SetOutputSurfaceRunning same surface");
+
+ outputSurface_->UnRegisterReleaseListener();
+ outputSurface_->CleanCache(true);
+ GSError err = newSurface->RegisterReleaseListener([this](sptr &buffer) {
+ (void)buffer;
+ return OnProducerBufferReleased();
+ });
+ CHECK_AND_RETURN_RET_LOG(err == GSERROR_OK, VPE_ALGO_ERR_UNKNOWN, "RegisterReleaseListener fail");
+ newSurface->SetQueueSize(outBufferCnt_);
+ newSurface->Connect();
+ newSurface->CleanCache();
+ GetReleaseOutBuffer();
+ int32_t ret = AttachToNewSurface(newSurface);
+ CHECK_AND_RETURN_RET_LOG(ret == VPE_ALGO_ERR_OK, ret, "Attach new surface fail");
+
+ GraphicTransformType inTransform;
+ ScalingMode inScaleMode;
+ inTransform = inputSurface_->GetTransform();
+
+ outputSurface_ = newSurface;
+ err = outputSurface_->SetTransform(inTransform);
+ CHECK_AND_RETURN_RET_LOG(err == GSERROR_OK, VPE_ALGO_ERR_UNKNOWN, "SetTransform fail");
+
+ if (lastSurfaceSequence_ != MAX_SURFACE_SEQUENCE) {
+ err = inputSurface_->GetScalingMode(lastSurfaceSequence_, inScaleMode);
+ CHECK_AND_RETURN_RET_LOG(err == GSERROR_OK, VPE_ALGO_ERR_UNKNOWN, "GetScalingMode fail");
+ err = outputSurface_->SetScalingMode(inScaleMode);
+ CHECK_AND_RETURN_RET_LOG(err == GSERROR_OK, VPE_ALGO_ERR_UNKNOWN, "SetScalingMode fail");
+ }
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::SetOutputSurface(sptr surface)
+{
+ std::lock_guard lock(mutex_);
+ CHECK_AND_RETURN_RET_LOG(surface != nullptr, VPE_ALGO_ERR_INVALID_VAL, "surface is nullptr");
+ CHECK_AND_RETURN_RET_LOG(surface->IsConsumer() == false, VPE_ALGO_ERR_INVALID_VAL, "surface is not producer");
+ if (state_ == VPEAlgoState::INITIALIZED || state_ == VPEAlgoState::CONFIGURING) {
+ int32_t ret = SetOutputSurfaceConfig(surface);
+ CHECK_AND_RETURN_RET_LOG(ret == VPE_ALGO_ERR_OK, VPE_ALGO_ERR_INVALID_STATE, "SetOutputSurface config fail");
+ } else if (state_ == VPEAlgoState::RUNNING || state_ == VPEAlgoState::EOS || state_ == VPEAlgoState::FLUSHED) {
+ int32_t ret = SetOutputSurfaceRunning(surface);
+ CHECK_AND_RETURN_RET_LOG(ret == VPE_ALGO_ERR_OK, VPE_ALGO_ERR_INVALID_STATE, "SetOutputSurface Running fail");
+ } else {
+ CHECK_AND_RETURN_RET_LOG(false, VPE_ALGO_ERR_INVALID_STATE, "surface state not support SetOutputSurface");
+ }
+
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::SetSurface(const OHNativeWindow* window)
+{
+ CHECK_AND_RETURN_RET_LOG(window != nullptr && window->surface != nullptr, VPE_ALGO_ERR_INVALID_PARAM,
+ "window is null or surface buffer is null!");
+ return SetOutputSurface(window->surface);
+}
+
+sptr AihdrEnhancerVideoImpl::CreateInputSurface()
+{
+ std::lock_guard lock(mutex_);
+ CHECK_AND_RETURN_RET_LOG(state_ == VPEAlgoState::INITIALIZED || state_ == VPEAlgoState::CONFIGURING, nullptr,
+ "CreateInputSurface failed: not in INITIALIZED or CONFIGURING state");
+ CHECK_AND_RETURN_RET_LOG(inputSurface_ == nullptr, nullptr, "inputSurface already exists");
+
+ inputSurface_ = Surface::CreateSurfaceAsConsumer("ConvertInputSurface");
+ CHECK_AND_RETURN_RET_LOG(inputSurface_ != nullptr, nullptr, "CreateSurfaceAsConsumer fail");
+ sptr listener = new AihdrEnhancerBufferConsumerListener(this);
+ GSError err = inputSurface_->RegisterConsumerListener(listener);
+ CHECK_AND_RETURN_RET_LOG(err == GSERROR_OK, nullptr, "RegisterConsumerListener fail");
+
+ sptr producer = inputSurface_->GetProducer();
+ sptr producerSurface = Surface::CreateSurfaceAsProducer(producer);
+ CHECK_AND_RETURN_RET_LOG(producerSurface != nullptr, nullptr, "CreateSurfaceAsProducer fail");
+ producerSurface->SetDefaultUsage(BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_HW_RENDER |
+ BUFFER_USAGE_MEM_DMA | BUFFER_USAGE_MEM_MMZ_CACHE);
+ inputSurface_->SetQueueSize(inBufferCnt_);
+ state_ = VPEAlgoState::CONFIGURING;
+
+ return producerSurface;
+}
+
+int32_t AihdrEnhancerVideoImpl::GetSurface(OHNativeWindow** window)
+{
+ CHECK_AND_RETURN_RET_LOG(window != nullptr, VPE_ALGO_ERR_INVALID_VAL, "window is null!");
+ sptr surface = CreateInputSurface();
+ CHECK_AND_RETURN_RET_LOG(surface != nullptr, VPE_ALGO_ERR_INVALID_STATE, "get surface failed!");
+ *window = CreateNativeWindowFromSurface(&surface);
+ CHECK_AND_RETURN_RET_LOG(*window != nullptr, VPE_ALGO_ERR_INVALID_STATE, "create window failed!");
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::Configure()
+{
+ std::lock_guard lock(mutex_);
+ CHECK_AND_RETURN_RET_LOG(state_ == VPEAlgoState::INITIALIZED || state_ == VPEAlgoState::CONFIGURING || state_ ==
+ VPEAlgoState::STOPPED, VPE_ALGO_ERR_INVALID_STATE, "Configure failed: not in INITIALIZED or CONFIGURING state");
+ int32_t ret = VPE_ALGO_ERR_OK;
+ state_ = (ret == VPE_ALGO_ERR_OK ? VPEAlgoState::CONFIGURING : VPEAlgoState::ERROR);
+ return ret;
+}
+
+int32_t AihdrEnhancerVideoImpl::Prepare()
+{
+ std::lock_guard lock(mutex_);
+ if (state_ == VPEAlgoState::STOPPED) {
+ state_ = VPEAlgoState::CONFIGURED;
+ return VPE_ALGO_ERR_OK;
+ }
+ CHECK_AND_RETURN_RET_LOG(state_ == VPEAlgoState::CONFIGURING, VPE_ALGO_ERR_INVALID_STATE,
+ "Prepare failed: not in CONFIGURING state");
+ CHECK_AND_RETURN_RET_LOG(cb_ != nullptr && inputSurface_ != nullptr && outputSurface_ != nullptr,
+ VPE_ALGO_ERR_INVALID_OPERATION, "Prepare faled: inputSurface or outputSurface or callback is null");
+
+ state_ = VPEAlgoState::CONFIGURED;
+ return VPE_ALGO_ERR_OK;
+}
+
+void AihdrEnhancerVideoImpl::InitBuffers()
+{
+ flushCfg_.damage.x = 0;
+ flushCfg_.damage.y = 0;
+ flushCfg_.damage.w = requestCfg_.width;
+ flushCfg_.damage.h = requestCfg_.height;
+ for (uint32_t i = 0; i < outBufferCnt_; ++i) {
+ std::shared_ptr buffer = std::make_shared();
+ GSError err = outputSurface_->RequestBuffer(buffer->memory, buffer->fence, requestCfg_);
+ if (err != GSERROR_OK || buffer->memory == nullptr) {
+ VPE_LOGW("RequestBuffer %{public}u failed, GSError=%{public}d", i, err);
+ continue;
+ }
+ outputBufferAvilQue_.push(buffer);
+ outputBufferAvilQueBak_.insert(std::make_pair(buffer->memory->GetSeqNum(), buffer));
+ }
+}
+
+int32_t AihdrEnhancerVideoImpl::Start()
+{
+ std::lock_guard lock(mutex_);
+ CHECK_AND_RETURN_RET_LOG(
+ (state_ == VPEAlgoState::CONFIGURED || state_ == VPEAlgoState::STOPPED || state_ == VPEAlgoState::FLUSHED),
+ VPE_ALGO_ERR_INVALID_STATE,
+ "Start failed: not in CONFIGURED or STOPPED state");
+ if (isEos_.load()) {
+ state_ = VPEAlgoState::EOS;
+ } else {
+ state_ = VPEAlgoState::RUNNING;
+ }
+ cb_->OnState(static_cast(state_.load()));
+ cvTaskStart_.notify_all();
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::Stop()
+{
+ std::lock_guard lock(mutex_);
+ CHECK_AND_RETURN_RET_LOG(
+ state_ == VPEAlgoState::RUNNING || state_ == VPEAlgoState::EOS || state_ == VPEAlgoState::FLUSHED,
+ VPE_ALGO_ERR_INVALID_STATE,
+ "Stop failed: not in RUNNING or EOS state");
+
+ state_ = VPEAlgoState::STOPPED;
+ if (!isProcessing_) {
+ cb_->OnState(static_cast(state_.load()));
+ }
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::Reset()
+{
+ std::lock_guard lock(mutex_);
+ CHECK_AND_RETURN_RET_LOG(
+ state_ != VPEAlgoState::UNINITIALIZED, VPE_ALGO_ERR_INVALID_STATE, "Start failed: not in right state");
+ std::unique_lock lockTask(mtxTaskDone_);
+ state_ = VPEAlgoState::INITIALIZED;
+ cvTaskDone_.wait(lockTask, [this]() { return isProcessing_.load() == false; });
+
+ csc_ = AihdrEnhancer::Create();
+ CHECK_AND_RETURN_RET_LOG(csc_ != nullptr, VPE_ALGO_ERR_UNKNOWN, "ColorSpaceConverter Create failed");
+ isEos_.store(false);
+
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::Release()
+{
+ std::lock_guard lock(mutex_);
+ {
+ std::unique_lock lockTask(mtxTaskDone_);
+ state_ = VPEAlgoState::UNINITIALIZED;
+ cvTaskDone_.wait(lockTask, [this]() { return isProcessing_.load() == false; });
+
+ inputSurface_ = nullptr;
+ std::unique_lock lockSurface(surfaceChangeMutex_);
+ std::unique_lock lockSurface2(surfaceChangeMutex2_);
+ if (outputSurface_ != nullptr) {
+ outputSurface_->UnRegisterReleaseListener();
+ outputSurface_->CleanCache(true);
+ outputSurface_ = nullptr;
+ }
+ lockSurface2.unlock();
+ lockSurface.unlock();
+ cb_ = nullptr;
+ csc_ = nullptr;
+ isRunning_.store(false);
+ }
+ if (taskThread_ != nullptr && taskThread_->joinable()) {
+ cvTaskStart_.notify_all();
+ taskThread_->join();
+ }
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::Flush()
+{
+ std::lock_guard lock(mutex_);
+ {
+ std::unique_lock lockTask(mtxTaskDone_);
+ cvTaskDone_.wait(lockTask, [this]() { return isProcessing_.load() == false; });
+ }
+
+ {
+ std::unique_lock lockInQue(onBqMutex_);
+ std::queue> tempQueue;
+ inputBufferAvilQue_.swap(tempQueue);
+ for (; tempQueue.size() != 0;) {
+ auto buffer = tempQueue.front();
+ tempQueue.pop();
+ CHECK_AND_RETURN_RET_LOG(buffer && buffer->memory != nullptr, VPE_ALGO_ERR_UNKNOWN, "Invalid memory");
+ GSError err = inputSurface_->ReleaseBuffer(buffer->memory, -1);
+ CHECK_AND_RETURN_RET_LOG(err == GSERROR_OK, VPE_ALGO_ERR_UNKNOWN, "Release buffer failed");
+ }
+ }
+
+ std::lock_guard mapLock(renderQueMutex_);
+ for (auto &[id, buffer] : renderBufferAvilMap_) {
+ VPE_LOGD("Reclaim buffer %{public}" PRIu64, id);
+ outputBufferAvilQue_.push(buffer);
+ }
+ renderBufferAvilMap_.clear();
+ state_ = VPEAlgoState::FLUSHED;
+ return VPE_ALGO_ERR_OK;
+}
+
+void AihdrEnhancerVideoImpl::Process(std::shared_ptr inputBuffer,
+ std::shared_ptr outputBuffer)
+{
+ VPETrace videoTrace("AihdrEnhancerVideoImpl::Process");
+ int32_t ret = VPE_ALGO_ERR_EXTENSION_PROCESS_FAILED;
+ outputBuffer->timestamp = inputBuffer->timestamp;
+ sptr surfaceInputBuffer = inputBuffer->memory;
+ sptr surfaceOutputBuffer = outputBuffer->memory;
+ bool copyRet = AlgorithmUtils::CopySurfaceBufferToSurfaceBuffer(surfaceInputBuffer, surfaceOutputBuffer);
+ if (!copyRet) {
+ requestCfg_.width = surfaceInputBuffer->GetWidth();
+ requestCfg_.height = surfaceInputBuffer->GetHeight();
+ requestCfg_.format = surfaceInputBuffer->GetFormat();
+ surfaceOutputBuffer->EraseMetadataKey(ATTRKEY_COLORSPACE_INFO);
+ surfaceOutputBuffer->EraseMetadataKey(ATTRKEY_HDR_METADATA_TYPE);
+ if (surfaceOutputBuffer->Alloc(requestCfg_) == GSERROR_OK) {
+ copyRet = AlgorithmUtils::CopySurfaceBufferToSurfaceBuffer(surfaceInputBuffer, surfaceOutputBuffer);
+ }
+ }
+ if (copyRet) {
+ VPETrace cscTrace("AihdrEnhancerVideoImpl::csc_->Process");
+ ret = csc_->Process(surfaceOutputBuffer);
+ }
+ if (ret != 0 && cb_) {
+ cb_->OnError(ret);
+ }
+ inputSurface_->ReleaseBuffer(surfaceInputBuffer, -1);
+ if (!ret) {
+ std::unique_lock lockOnBq(renderQueMutex_);
+ renderBufferAvilMap_.emplace(outputBuffer->memory->GetSeqNum(), outputBuffer);
+ } else {
+ std::lock_guard renderLock(renderQueMutex_);
+ outputBufferAvilQue_.push(outputBuffer);
+ }
+
+ if (!ret && cb_) {
+ cb_->OnOutputBufferAvailable(surfaceOutputBuffer->GetSeqNum(), outputBuffer->bufferFlag);
+ }
+}
+
+bool AihdrEnhancerVideoImpl::WaitProcessing()
+{
+ if (!isRunning_.load()) {
+ return false;
+ }
+ {
+ std::unique_lock lock(mtxTaskStart_);
+ cvTaskStart_.wait(lock, [this]() {
+ std::lock_guard inQueueLock(onBqMutex_);
+ std::lock_guard outQueueLock(renderQueMutex_);
+ if (initBuffer_.load()) {
+ InitBuffers();
+ initBuffer_.store(false);
+ }
+ return ((inputBufferAvilQue_.size() > 0 && outputBufferAvilQue_.size() > 0) || !isRunning_.load());
+ });
+ }
+
+ return true;
+}
+
+bool AihdrEnhancerVideoImpl::AcquireInputOutputBuffers(std::shared_ptr& inputBuffer,
+ std::shared_ptr& outputBuffer)
+{
+ std::lock_guard lockOnBq(onBqMutex_);
+ std::lock_guard mapLock(renderQueMutex_);
+ if (inputBufferAvilQue_.size() == 0 || outputBufferAvilQue_.size() == 0) {
+ if (state_ == VPEAlgoState::STOPPED) {
+ cb_->OnState(static_cast(state_.load()));
+ }
+ return false;
+ }
+ inputBuffer = inputBufferAvilQue_.front();
+ outputBuffer = outputBufferAvilQue_.front();
+ inputBufferAvilQue_.pop();
+ outputBufferAvilQue_.pop();
+ return inputBuffer && outputBuffer;
+}
+
+void AihdrEnhancerVideoImpl::DoTask()
+{
+ std::shared_ptr inputBuffer = nullptr;
+ std::shared_ptr outputBuffer = nullptr;
+ while (true) {
+ std::lock_guard lockTask(mtxTaskDone_);
+ if (!isRunning_.load()) {
+ return;
+ }
+ isProcessing_.store(true);
+
+ if (!AcquireInputOutputBuffers(inputBuffer, outputBuffer)) {
+ break;
+ }
+ if (inputBuffer->bufferFlag == AIHDR_ENHANCER_BUFFER_FLAG_EOS) {
+ {
+ std::unique_lock lockOnBq(renderQueMutex_);
+ renderBufferAvilMap_.emplace(outputBuffer->memory->GetSeqNum(), outputBuffer);
+ }
+ if (cb_) {
+ cb_->OnOutputBufferAvailable(outputBuffer->memory->GetSeqNum(), AIHDR_ENHANCER_BUFFER_FLAG_EOS);
+ }
+ break;
+ }
+ Process(inputBuffer, outputBuffer);
+ }
+ isProcessing_.store(false);
+ cvTaskDone_.notify_all();
+}
+
+void AihdrEnhancerVideoImpl::OnTriggered()
+{
+ while (true) {
+ if (!WaitProcessing()) {
+ break;
+ }
+
+ DoTask();
+ }
+}
+
+int32_t AihdrEnhancerVideoImpl::ReleaseOutputBuffer(uint32_t index, bool render)
+{
+ CHECK_AND_RETURN_RET_LOG(state_ == VPEAlgoState::RUNNING || state_ == VPEAlgoState::EOS, VPE_ALGO_ERR_INVALID_STATE,
+ "ReleaseOutputBuffer failed: not in RUNNING or EOS state");
+
+ std::unique_lock lockRenderQue(renderQueMutex_);
+ auto search = renderBufferAvilMap_.find(index);
+ if (search == renderBufferAvilMap_.end()) {
+ VPE_LOGE("ReleaseOutputBuffer invalid index %{public}d ", index);
+ return VPE_ALGO_ERR_INVALID_PARAM;
+ }
+ auto buffer = search->second;
+ renderBufferAvilMap_.erase(search);
+ lockRenderQue.unlock();
+
+ if (render) {
+ flushCfg_.timestamp = buffer->timestamp;
+ {
+ std::lock_guard lockSurface(surfaceChangeMutex_);
+ CHECK_AND_RETURN_RET_LOG(outputSurface_ != nullptr, GSERROR_OK, "outputSurface_ is nullptr");
+ auto ret = outputSurface_->FlushBuffer(buffer->memory, -1, flushCfg_);
+ if (ret != 0) {
+ VPE_LOGE("ReleaseOutputBuffer flushbuffer err %{public}d ", (int)ret);
+ return VPE_ALGO_ERR_UNKNOWN;
+ }
+ }
+ std::lock_guard renderLock(renderQueMutex_);
+ renderBufferMapBak_.emplace(buffer->memory->GetSeqNum(), buffer);
+ } else {
+ std::lock_guard renderLock(renderQueMutex_);
+ outputBufferAvilQue_.push(buffer);
+ }
+ return VPE_ALGO_ERR_OK;
+}
+
+int32_t AihdrEnhancerVideoImpl::NotifyEos()
+{
+ std::lock_guard lock(mutex_);
+ std::lock_guard lockOnBq(onBqMutex_);
+ CHECK_AND_RETURN_RET_LOG(state_ == VPEAlgoState::RUNNING, VPE_ALGO_ERR_INVALID_STATE,
+ "NotifyEos failed: not in RUNNING state");
+ state_ = VPEAlgoState::EOS;
+ isEos_.store(true);
+ std::shared_ptr buf = std::make_shared();
+ buf->bufferFlag = AIHDR_ENHANCER_BUFFER_FLAG_EOS;
+ inputBufferAvilQue_.push(buf);
+
+ cvTaskStart_.notify_all();
+
+ return VPE_ALGO_ERR_OK;
+}
+
+GSError AihdrEnhancerVideoImpl::OnProducerBufferReleased()
+{
+ {
+ std::unique_lock lockSurface(surfaceChangeMutex2_);
+ std::lock_guard outQueLock(renderQueMutex_);
+ std::shared_ptr buf = std::make_shared();
+ CHECK_AND_RETURN_RET_LOG(outputSurface_ != nullptr, GSERROR_OK, "outputSurface_ is nullptr");
+ if (renderBufferMapBak_.empty()) {
+ return GSERROR_OK;
+ }
+ GSError err = outputSurface_->RequestBuffer(buf->memory, buf->fence, requestCfg_);
+ if (err != GSERROR_OK || buf->memory == nullptr) {
+ VPE_LOGE("RequestBuffer failed, GSError=%{public}d", err);
+ return err;
+ }
+ lockSurface.unlock();
+ outputBufferAvilQue_.push(buf);
+ auto bufSeqNum = buf->memory->GetSeqNum();
+ lastSurfaceSequence_ = bufSeqNum;
+ renderBufferMapBak_.erase(bufSeqNum);
+ auto it = outputBufferAvilQueBak_.find(bufSeqNum);
+ if (it == outputBufferAvilQueBak_.end()) {
+ outputBufferAvilQueBak_.insert(std::make_pair(bufSeqNum, buf));
+ auto firstSeqNum = renderBufferMapBak_.begin();
+ if (firstSeqNum != renderBufferMapBak_.end()) {
+ outputBufferAvilQueBak_.erase(firstSeqNum->first);
+ renderBufferMapBak_.erase(firstSeqNum->first);
+ }
+ }
+ }
+
+ if (state_ == VPEAlgoState::RUNNING || state_ == VPEAlgoState::EOS) {
+ cvTaskStart_.notify_all();
+ }
+
+ return GSERROR_OK;
+}
+
+GSError AihdrEnhancerVideoImpl::OnConsumerBufferAvailable()
+{
+ std::lock_guard lock(mutex_);
+ std::lock_guard lockInQue(onBqMutex_);
+ CHECK_AND_RETURN_RET_LOG(inputSurface_ != nullptr, GSERROR_OK, "inputSurface is nullptr");
+ CHECK_AND_RETURN_RET_LOG(state_ != VPEAlgoState::STOPPED, GSERROR_OK, "state change to stop");
+ std::shared_ptr buffer = std::make_shared();
+ OHOS::Rect damage;
+ GSError err = inputSurface_->AcquireBuffer(buffer->memory, buffer->fence, buffer->timestamp, damage);
+ if (err != GSERROR_OK || buffer->memory == nullptr) {
+ VPE_LOGW("AcquireBuffer failed, GSError=%{public}d", err);
+ return err;
+ }
+ inputBufferAvilQue_.push(buffer);
+
+ if (!getUsage_) {
+ requestCfg_.usage = (buffer->memory->GetUsage() | requestCfg_.usage);
+ getUsage_ = true;
+ requestCfg_.width = buffer->memory->GetWidth();
+ requestCfg_.height = buffer->memory->GetHeight();
+ requestCfg_.format = buffer->memory->GetFormat();
+ initBuffer_.store(true);
+ }
+
+ if (state_ == VPEAlgoState::RUNNING) {
+ cvTaskStart_.notify_all();
+ }
+
+ return GSERROR_OK;
+}
+
+void AihdrEnhancerBufferConsumerListener::OnBufferAvailable()
+{
+ if (process_ != nullptr) {
+ process_->OnConsumerBufferAvailable();
+ }
+}
+
+} // namespace VideoProcessingEngine
+} // namespace Media
+} // namespace OHOS
diff --git a/framework/algorithm/aihdr_enhancer_video/include/aihdr_enhancer_video_impl.h b/framework/algorithm/aihdr_enhancer_video/include/aihdr_enhancer_video_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..75e0e238ab9fbd17db3a52f23f06a9e6456d2b70
--- /dev/null
+++ b/framework/algorithm/aihdr_enhancer_video/include/aihdr_enhancer_video_impl.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AIHDR_ENHANCER_VIDEO_IMPL_H
+#define AIHDR_ENHANCER_VIDEO_IMPL_H
+
+#include
+#include
+#include