17777dab0Sopenharmony_ci/*
27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License.
57777dab0Sopenharmony_ci * You may obtain a copy of the License at
67777dab0Sopenharmony_ci *
77777dab0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
87777dab0Sopenharmony_ci *
97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and
137777dab0Sopenharmony_ci * limitations under the License.
147777dab0Sopenharmony_ci */
157777dab0Sopenharmony_ci
167777dab0Sopenharmony_ci#ifndef NDK_INCLUDE_BUFFER_COMMON_H_
177777dab0Sopenharmony_ci#define NDK_INCLUDE_BUFFER_COMMON_H_
187777dab0Sopenharmony_ci
197777dab0Sopenharmony_ci/**
207777dab0Sopenharmony_ci * @addtogroup OH_NativeBuffer
217777dab0Sopenharmony_ci * @{
227777dab0Sopenharmony_ci *
237777dab0Sopenharmony_ci * @brief Provides the common types for native buffer.
247777dab0Sopenharmony_ci *
257777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
267777dab0Sopenharmony_ci * @since 12
277777dab0Sopenharmony_ci * @version 1.0
287777dab0Sopenharmony_ci */
297777dab0Sopenharmony_ci
307777dab0Sopenharmony_ci/**
317777dab0Sopenharmony_ci * @file native_buffer.h
327777dab0Sopenharmony_ci *
337777dab0Sopenharmony_ci * @brief Defines the common types for native buffer.
347777dab0Sopenharmony_ci *
357777dab0Sopenharmony_ci * @kit ArkGraphics2D
367777dab0Sopenharmony_ci * @library libnative_buffer.so
377777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
387777dab0Sopenharmony_ci * @since 12
397777dab0Sopenharmony_ci * @version 1.0
407777dab0Sopenharmony_ci */
417777dab0Sopenharmony_ci
427777dab0Sopenharmony_ci#ifdef __cplusplus
437777dab0Sopenharmony_ciextern "C" {
447777dab0Sopenharmony_ci#endif
457777dab0Sopenharmony_ci
467777dab0Sopenharmony_ci/**
477777dab0Sopenharmony_ci * @brief Indicates the color space of a native buffer.
487777dab0Sopenharmony_ci *
497777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
507777dab0Sopenharmony_ci * @since 11
517777dab0Sopenharmony_ci * @version 1.0
527777dab0Sopenharmony_ci */
537777dab0Sopenharmony_ci/**
547777dab0Sopenharmony_ci * @brief Indicates the color space of a native buffer.
557777dab0Sopenharmony_ci * Move from native_buffer.h to native_common.h
567777dab0Sopenharmony_ci *
577777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
587777dab0Sopenharmony_ci * @since 12
597777dab0Sopenharmony_ci * @version 1.0
607777dab0Sopenharmony_ci */
617777dab0Sopenharmony_citypedef enum OH_NativeBuffer_ColorSpace {
627777dab0Sopenharmony_ci    /** None color space */
637777dab0Sopenharmony_ci    OH_COLORSPACE_NONE,
647777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_FULL << 21) */
657777dab0Sopenharmony_ci    OH_COLORSPACE_BT601_EBU_FULL,
667777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_FULL << 21)*/
677777dab0Sopenharmony_ci    OH_COLORSPACE_BT601_SMPTE_C_FULL,
687777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_FULL << 21) */
697777dab0Sopenharmony_ci    OH_COLORSPACE_BT709_FULL,
707777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */
717777dab0Sopenharmony_ci    OH_COLORSPACE_BT2020_HLG_FULL,
727777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT2020 | (TRANSFUNC_PQ << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */
737777dab0Sopenharmony_ci    OH_COLORSPACE_BT2020_PQ_FULL,
747777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_LIMITED << 21) */
757777dab0Sopenharmony_ci    OH_COLORSPACE_BT601_EBU_LIMIT,
767777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_LIMITED << 21) */
777777dab0Sopenharmony_ci    OH_COLORSPACE_BT601_SMPTE_C_LIMIT,
787777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_LIMITED << 21) */
797777dab0Sopenharmony_ci    OH_COLORSPACE_BT709_LIMIT,
807777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) */
817777dab0Sopenharmony_ci    OH_COLORSPACE_BT2020_HLG_LIMIT,
827777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT2020 | (TRANSFUNC_PQ << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) */
837777dab0Sopenharmony_ci    OH_COLORSPACE_BT2020_PQ_LIMIT,
847777dab0Sopenharmony_ci    /** COLORPRIMARIES_SRGB | (TRANSFUNC_SRGB << 8) | (MATRIX_BT601_N << 16) | (RANGE_FULL << 21) */
857777dab0Sopenharmony_ci    OH_COLORSPACE_SRGB_FULL,
867777dab0Sopenharmony_ci    /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_SRGB << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) */
877777dab0Sopenharmony_ci    OH_COLORSPACE_P3_FULL,
887777dab0Sopenharmony_ci    /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_HLG << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) */
897777dab0Sopenharmony_ci    OH_COLORSPACE_P3_HLG_FULL,
907777dab0Sopenharmony_ci    /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_PQ << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) */
917777dab0Sopenharmony_ci    OH_COLORSPACE_P3_PQ_FULL,
927777dab0Sopenharmony_ci    /** COLORPRIMARIES_ADOBERGB | (TRANSFUNC_ADOBERGB << 8) | (MATRIX_ADOBERGB << 16) | (RANGE_FULL << 21) */
937777dab0Sopenharmony_ci    OH_COLORSPACE_ADOBERGB_FULL,
947777dab0Sopenharmony_ci    /** COLORPRIMARIES_SRGB | (TRANSFUNC_SRGB << 8) | (MATRIX_BT601_N << 16) | (RANGE_LIMITED << 21) */
957777dab0Sopenharmony_ci    OH_COLORSPACE_SRGB_LIMIT,
967777dab0Sopenharmony_ci    /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_SRGB << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) */
977777dab0Sopenharmony_ci    OH_COLORSPACE_P3_LIMIT,
987777dab0Sopenharmony_ci    /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_HLG << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) */
997777dab0Sopenharmony_ci    OH_COLORSPACE_P3_HLG_LIMIT,
1007777dab0Sopenharmony_ci    /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_PQ << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) */
1017777dab0Sopenharmony_ci    OH_COLORSPACE_P3_PQ_LIMIT,
1027777dab0Sopenharmony_ci    /** COLORPRIMARIES_ADOBERGB | (TRANSFUNC_ADOBERGB << 8) | (MATRIX_ADOBERGB << 16) | (RANGE_LIMITED << 21) */
1037777dab0Sopenharmony_ci    OH_COLORSPACE_ADOBERGB_LIMIT,
1047777dab0Sopenharmony_ci    /** COLORPRIMARIES_SRGB | (TRANSFUNC_LINEAR << 8) */
1057777dab0Sopenharmony_ci    OH_COLORSPACE_LINEAR_SRGB,
1067777dab0Sopenharmony_ci    /** equal to OH_COLORSPACE_LINEAR_SRGB */
1077777dab0Sopenharmony_ci    OH_COLORSPACE_LINEAR_BT709,
1087777dab0Sopenharmony_ci    /** COLORPRIMARIES_P3_D65 | (TRANSFUNC_LINEAR << 8) */
1097777dab0Sopenharmony_ci    OH_COLORSPACE_LINEAR_P3,
1107777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT2020 | (TRANSFUNC_LINEAR << 8) */
1117777dab0Sopenharmony_ci    OH_COLORSPACE_LINEAR_BT2020,
1127777dab0Sopenharmony_ci    /** equal to OH_COLORSPACE_SRGB_FULL */
1137777dab0Sopenharmony_ci    OH_COLORSPACE_DISPLAY_SRGB,
1147777dab0Sopenharmony_ci    /** equal to OH_COLORSPACE_P3_FULL */
1157777dab0Sopenharmony_ci    OH_COLORSPACE_DISPLAY_P3_SRGB,
1167777dab0Sopenharmony_ci    /** equal to OH_COLORSPACE_P3_HLG_FULL */
1177777dab0Sopenharmony_ci    OH_COLORSPACE_DISPLAY_P3_HLG,
1187777dab0Sopenharmony_ci    /** equal to OH_COLORSPACE_P3_PQ_FULL */
1197777dab0Sopenharmony_ci    OH_COLORSPACE_DISPLAY_P3_PQ,
1207777dab0Sopenharmony_ci    /** COLORPRIMARIES_BT2020 | (TRANSFUNC_SRGB << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) */
1217777dab0Sopenharmony_ci    OH_COLORSPACE_DISPLAY_BT2020_SRGB,
1227777dab0Sopenharmony_ci    /** equal to OH_COLORSPACE_BT2020_HLG_FULL */
1237777dab0Sopenharmony_ci    OH_COLORSPACE_DISPLAY_BT2020_HLG,
1247777dab0Sopenharmony_ci    /** equal to OH_COLORSPACE_BT2020_PQ_FULL */
1257777dab0Sopenharmony_ci    OH_COLORSPACE_DISPLAY_BT2020_PQ,
1267777dab0Sopenharmony_ci} OH_NativeBuffer_ColorSpace;
1277777dab0Sopenharmony_ci
1287777dab0Sopenharmony_ci/**
1297777dab0Sopenharmony_ci * @brief Indicates the HDR metadata type of a native buffer.
1307777dab0Sopenharmony_ci *
1317777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
1327777dab0Sopenharmony_ci * @since 12
1337777dab0Sopenharmony_ci * @version 1.0
1347777dab0Sopenharmony_ci */
1357777dab0Sopenharmony_citypedef enum OH_NativeBuffer_MetadataType {
1367777dab0Sopenharmony_ci    /** HLG */
1377777dab0Sopenharmony_ci    OH_VIDEO_HDR_HLG,
1387777dab0Sopenharmony_ci    /** HDR10 */
1397777dab0Sopenharmony_ci    OH_VIDEO_HDR_HDR10,
1407777dab0Sopenharmony_ci    /** HDR VIVID */
1417777dab0Sopenharmony_ci    OH_VIDEO_HDR_VIVID,
1427777dab0Sopenharmony_ci    /**
1437777dab0Sopenharmony_ci     * NONE Metadata
1447777dab0Sopenharmony_ci     * @since 13
1457777dab0Sopenharmony_ci     */
1467777dab0Sopenharmony_ci    OH_VIDEO_NONE = -1
1477777dab0Sopenharmony_ci} OH_NativeBuffer_MetadataType;
1487777dab0Sopenharmony_ci
1497777dab0Sopenharmony_ci/**
1507777dab0Sopenharmony_ci * @brief Indicates the color x and y.
1517777dab0Sopenharmony_ci *
1527777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
1537777dab0Sopenharmony_ci * @since 12
1547777dab0Sopenharmony_ci * @version 1.0
1557777dab0Sopenharmony_ci */
1567777dab0Sopenharmony_citypedef struct OH_NativeBuffer_ColorXY {
1577777dab0Sopenharmony_ci    /** color X */
1587777dab0Sopenharmony_ci    float x;
1597777dab0Sopenharmony_ci    /** color Y */
1607777dab0Sopenharmony_ci    float y;
1617777dab0Sopenharmony_ci} OH_NativeBuffer_ColorXY;
1627777dab0Sopenharmony_ci
1637777dab0Sopenharmony_ci/**
1647777dab0Sopenharmony_ci * @brief Indicates the smpte2086 metadata.
1657777dab0Sopenharmony_ci *
1667777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
1677777dab0Sopenharmony_ci * @since 12
1687777dab0Sopenharmony_ci * @version 1.0
1697777dab0Sopenharmony_ci */
1707777dab0Sopenharmony_citypedef struct OH_NativeBuffer_Smpte2086 {
1717777dab0Sopenharmony_ci    /** primary red */
1727777dab0Sopenharmony_ci    OH_NativeBuffer_ColorXY displayPrimaryRed;
1737777dab0Sopenharmony_ci    /** primary green */
1747777dab0Sopenharmony_ci    OH_NativeBuffer_ColorXY displayPrimaryGreen;
1757777dab0Sopenharmony_ci    /** primary blue */
1767777dab0Sopenharmony_ci    OH_NativeBuffer_ColorXY displayPrimaryBlue;
1777777dab0Sopenharmony_ci    /** white point */
1787777dab0Sopenharmony_ci    OH_NativeBuffer_ColorXY whitePoint;
1797777dab0Sopenharmony_ci    /** max luminance */
1807777dab0Sopenharmony_ci    float maxLuminance;
1817777dab0Sopenharmony_ci    /** min luminance */
1827777dab0Sopenharmony_ci    float minLuminance;
1837777dab0Sopenharmony_ci} OH_NativeBuffer_Smpte2086;
1847777dab0Sopenharmony_ci
1857777dab0Sopenharmony_ci/**
1867777dab0Sopenharmony_ci * @brief Indicates the cta861.3 metadata.
1877777dab0Sopenharmony_ci *
1887777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
1897777dab0Sopenharmony_ci * @since 12
1907777dab0Sopenharmony_ci * @version 1.0
1917777dab0Sopenharmony_ci */
1927777dab0Sopenharmony_citypedef struct OH_NativeBuffer_Cta861 {
1937777dab0Sopenharmony_ci    /** max content lightLevel */
1947777dab0Sopenharmony_ci    float maxContentLightLevel;
1957777dab0Sopenharmony_ci    /** max frame average light level */
1967777dab0Sopenharmony_ci    float maxFrameAverageLightLevel;
1977777dab0Sopenharmony_ci} OH_NativeBuffer_Cta861;
1987777dab0Sopenharmony_ci
1997777dab0Sopenharmony_ci/**
2007777dab0Sopenharmony_ci * @brief Indicates the HDR static metadata.
2017777dab0Sopenharmony_ci *
2027777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
2037777dab0Sopenharmony_ci * @since 12
2047777dab0Sopenharmony_ci * @version 1.0
2057777dab0Sopenharmony_ci */
2067777dab0Sopenharmony_citypedef struct OH_NativeBuffer_StaticMetadata {
2077777dab0Sopenharmony_ci    /** smpte 2086 metadata*/
2087777dab0Sopenharmony_ci    OH_NativeBuffer_Smpte2086 smpte2086;
2097777dab0Sopenharmony_ci    /** CTA-861.3 metadata*/
2107777dab0Sopenharmony_ci    OH_NativeBuffer_Cta861 cta861;
2117777dab0Sopenharmony_ci} OH_NativeBuffer_StaticMetadata;
2127777dab0Sopenharmony_ci
2137777dab0Sopenharmony_ci/**
2147777dab0Sopenharmony_ci * @brief Indicates the HDR metadata key of a native buffer.
2157777dab0Sopenharmony_ci *
2167777dab0Sopenharmony_ci * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer
2177777dab0Sopenharmony_ci * @since 12
2187777dab0Sopenharmony_ci * @version 1.0
2197777dab0Sopenharmony_ci */
2207777dab0Sopenharmony_citypedef enum OH_NativeBuffer_MetadataKey {
2217777dab0Sopenharmony_ci    /** value: OH_NativeBuffer_MetadataType*/
2227777dab0Sopenharmony_ci    OH_HDR_METADATA_TYPE,
2237777dab0Sopenharmony_ci    /** value: OH_NativeBuffer_StaticMetadata*/
2247777dab0Sopenharmony_ci    OH_HDR_STATIC_METADATA,
2257777dab0Sopenharmony_ci    /** byte stream of SEI in video stream*/
2267777dab0Sopenharmony_ci    OH_HDR_DYNAMIC_METADATA
2277777dab0Sopenharmony_ci} OH_NativeBuffer_MetadataKey;
2287777dab0Sopenharmony_ci
2297777dab0Sopenharmony_ci#ifdef __cplusplus
2307777dab0Sopenharmony_ci}
2317777dab0Sopenharmony_ci#endif
2327777dab0Sopenharmony_ci
2337777dab0Sopenharmony_ci/** @} */
2347777dab0Sopenharmony_ci#endif