1 /*
2  *
3  * Copyright 2017 Samsung Electronics S.LSI Co. LTD
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /*
19  * @file    VendorVideoAPI.h
20  * @author  TaeHwan Kim    (t_h_kim@samsung.com)
21  *          ByungGwan Kang (bk0917.kang@samsung.com)
22  * @version 1.0
23  * @history
24  *   2017.06.02 : Create
25  */
26 
27 #ifndef VENDOR_VIDEO_API_H_
28 #define VENDOR_VIDEO_API_H_
29 
30 #include <stdio.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 #define MAX_HDR10PLUS_SIZE 1024
36 
37 typedef enum _ExynosVideoInfoType {
38     VIDEO_INFO_TYPE_INVALID            = 0,
39     VIDEO_INFO_TYPE_HDR_STATIC         = 0x1 << 0,
40     VIDEO_INFO_TYPE_COLOR_ASPECTS      = 0x1 << 1,
41     VIDEO_INFO_TYPE_INTERLACED         = 0x1 << 2,
42     VIDEO_INFO_TYPE_YSUM_DATA          = 0x1 << 3,
43     VIDEO_INFO_TYPE_HDR_DYNAMIC        = 0x1 << 4,
44     VIDEO_INFO_TYPE_CHECK_PIXEL_FORMAT = 0x1 << 5,
45     VIDEO_INFO_TYPE_CROP_INFO          = 0x1 << 8,
46 } ExynosVideoInfoType;
47 
48 typedef struct _ExynosVideoYSUMData {
49     unsigned int high;
50     unsigned int low;
51 } ExynosVideoYSUMData;
52 
53 typedef struct _ExynosColorAspects {
54     int mRange;
55     int mPrimaries;
56     int mTransfer;
57     int mMatrixCoeffs;
58 } ExynosColorAspects;
59 
60 typedef struct _ExynosPrimaries {
61     unsigned int x;
62     unsigned int y;
63 } ExynosPrimaries;
64 
65 typedef struct _ExynosType1 {
66     ExynosPrimaries mR;
67     ExynosPrimaries mG;
68     ExynosPrimaries mB;
69     ExynosPrimaries mW;
70     unsigned int    mMaxDisplayLuminance;
71     unsigned int    mMinDisplayLuminance;
72     unsigned int    mMaxContentLightLevel;
73     unsigned int    mMaxFrameAverageLightLevel;
74 } ExynosType1;
75 
76 typedef struct _ExynosHdrStaticInfo {
77     int mID;
78     union {
79         ExynosType1 sType1;
80     };
81 } ExynosHdrStaticInfo;
82 
83 typedef struct _ExynosHdrDynamicInfo {
84     unsigned int valid;
85 
86     struct {
87         unsigned char  country_code;
88         unsigned short provider_code;
89         unsigned short provider_oriented_code;
90 
91         unsigned char  application_identifier;
92         unsigned short application_version;
93 
94         unsigned int  display_maximum_luminance;
95 
96         unsigned int maxscl[3];
97 
98         unsigned char num_maxrgb_percentiles;
99         unsigned char maxrgb_percentages[15];
100         unsigned int  maxrgb_percentiles[15];
101 
102         struct {
103             unsigned short  tone_mapping_flag;
104             unsigned short  knee_point_x;
105             unsigned short  knee_point_y;
106             unsigned short  num_bezier_curve_anchors;
107             unsigned short  bezier_curve_anchors[15];
108         } tone_mapping;
109     } data;
110 
111     unsigned int reserved[42];
112 } ExynosHdrDynamicInfo;
113 
114 typedef struct _ExynosVideoCrop {
115     int left;
116     int top;
117     int width;
118     int height;
119 } ExynosVideoCrop;
120 
121 typedef struct _ExynosVideoDecData {
122     int nInterlacedType;
123 } ExynosVideoDecData;
124 
125 typedef struct _ExynosVideoEncData {
126     ExynosVideoYSUMData sYsumData;
127 } ExynosVideoEncData;
128 
129 typedef struct _ExynosVideoMeta {
130     ExynosVideoInfoType eType;
131 
132     ExynosHdrStaticInfo  sHdrStaticInfo;
133     ExynosColorAspects   sColorAspects;
134 
135     union {
136         ExynosVideoDecData dec;
137         ExynosVideoEncData enc;
138     } data;
139 
140     ExynosHdrDynamicInfo sHdrDynamicInfo;
141 
142     int nPixelFormat;
143     ExynosVideoCrop crop;
144 } ExynosVideoMeta;
145 
146 int Exynos_parsing_user_data_registered_itu_t_t35(ExynosHdrDynamicInfo *dest, void *src);
147 int Exynos_dynamic_meta_to_itu_t_t35(ExynosHdrDynamicInfo *src, char *dst);
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif /* VENDOR_VIDEO_API_H_ */
154