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_ROI_INFO = 0x1 << 7, 46 VIDEO_INFO_TYPE_CROP_INFO = 0x1 << 8, 47 } ExynosVideoInfoType; 48 49 typedef struct _ExynosVideoYSUMData { 50 unsigned int high; 51 unsigned int low; 52 } ExynosVideoYSUMData; 53 54 typedef struct _ExynosColorAspects { 55 int mRange; 56 int mPrimaries; 57 int mTransfer; 58 int mMatrixCoeffs; 59 } ExynosColorAspects; 60 61 typedef struct _ExynosPrimaries { 62 unsigned int x; 63 unsigned int y; 64 } ExynosPrimaries; 65 66 typedef struct _ExynosType1 { 67 ExynosPrimaries mR; 68 ExynosPrimaries mG; 69 ExynosPrimaries mB; 70 ExynosPrimaries mW; 71 unsigned int mMaxDisplayLuminance; 72 unsigned int mMinDisplayLuminance; 73 unsigned int mMaxContentLightLevel; 74 unsigned int mMaxFrameAverageLightLevel; 75 } ExynosType1; 76 77 typedef struct _ExynosHdrStaticInfo { 78 int mID; 79 union { 80 ExynosType1 sType1; 81 }; 82 } ExynosHdrStaticInfo; 83 84 typedef struct _ExynosHdrData_ST2094_40 { 85 unsigned char country_code; 86 unsigned short provider_code; 87 unsigned short provider_oriented_code; 88 89 unsigned char application_identifier; 90 unsigned char application_version; 91 92 unsigned char num_windows; 93 94 unsigned short window_upper_left_corner_x[2]; 95 unsigned short window_upper_left_corner_y[2]; 96 unsigned short window_lower_right_corner_x[2]; 97 unsigned short window_lower_right_corner_y[2]; 98 unsigned short center_of_ellipse_x[2]; 99 unsigned short center_of_ellipse_y[2]; 100 unsigned char rotation_angle[2]; 101 unsigned short semimajor_axis_internal_ellipse[2]; 102 unsigned short semimajor_axis_external_ellipse[2]; 103 unsigned short semiminor_axis_external_ellipse[2]; 104 unsigned char overlap_process_option[2]; 105 106 unsigned int targeted_system_display_maximum_luminance; 107 unsigned char targeted_system_display_actual_peak_luminance_flag; 108 unsigned char num_rows_targeted_system_display_actual_peak_luminance; 109 unsigned char num_cols_targeted_system_display_actual_peak_luminance; 110 unsigned char targeted_system_display_actual_peak_luminance[25][25]; 111 112 unsigned int maxscl[3][3]; 113 unsigned int average_maxrgb[3]; 114 115 unsigned char num_maxrgb_percentiles[3]; 116 unsigned char maxrgb_percentages[3][15]; 117 unsigned int maxrgb_percentiles[3][15]; 118 119 unsigned short fraction_bright_pixels[3]; 120 121 unsigned char mastering_display_actual_peak_luminance_flag; 122 unsigned char num_rows_mastering_display_actual_peak_luminance; 123 unsigned char num_cols_mastering_display_actual_peak_luminance; 124 unsigned char mastering_display_actual_peak_luminance[25][25]; 125 126 struct { 127 unsigned char tone_mapping_flag[3]; 128 unsigned short knee_point_x[3]; 129 unsigned short knee_point_y[3]; 130 unsigned char num_bezier_curve_anchors[3]; 131 unsigned short bezier_curve_anchors[3][15]; 132 } tone_mapping; 133 134 unsigned char color_saturation_mapping_flag[3]; 135 unsigned char color_saturation_weight[3]; 136 } ExynosHdrData_ST2094_40; 137 138 typedef struct _ExynosHdrDynamicInfo { 139 unsigned int valid; 140 unsigned int reserved[42]; 141 142 ExynosHdrData_ST2094_40 data; 143 } ExynosHdrDynamicInfo; 144 145 typedef struct _ExynosHdrDynamicBlob { 146 int nSize; 147 char pData[1020]; 148 } ExynosHdrDynamicBlob; 149 150 typedef struct _ExynosVideoCrop { 151 int left; 152 int top; 153 int width; 154 int height; 155 } ExynosVideoCrop; 156 157 #define MAX_ROIINFO_SIZE 32400 158 typedef struct _ExynosVideoROIData { 159 int nUpperQpOffset; 160 int nLowerQpOffset; 161 int bUseRoiInfo; 162 int nRoiMBInfoSize; 163 char pRoiMBInfo[MAX_ROIINFO_SIZE]; 164 } ExynosVideoROIData; 165 166 typedef struct _ExynosVideoDecData { 167 int nInterlacedType; 168 } ExynosVideoDecData; 169 170 typedef struct _ExynosVideoEncData { 171 ExynosVideoYSUMData sYsumData; 172 unsigned long long pRoiData; /* for fixing byte alignment on 64x32 problem */ 173 } ExynosVideoEncData; 174 175 typedef struct _ExynosVideoMeta { 176 /***********************************************/ 177 /****** WARNING: DO NOT MODIFY THIS AREA *******/ 178 /**/ /**/ 179 /**/ ExynosVideoInfoType eType; /**/ 180 /**/ int nHDRType; /**/ 181 /**/ /**/ 182 /**/ ExynosColorAspects sColorAspects; /**/ 183 /**/ ExynosHdrStaticInfo sHdrStaticInfo; /**/ 184 /**/ ExynosHdrDynamicInfo sHdrDynamicInfo; /**/ 185 /**/ /**/ 186 /****** WARNING: DO NOT MODIFY THIS AREA *******/ 187 /***********************************************/ 188 189 int nPixelFormat; 190 ExynosVideoCrop crop; 191 192 union { 193 ExynosVideoDecData dec; 194 ExynosVideoEncData enc; 195 } data; 196 197 int reserved[20]; /* reserved filed for additional info */ 198 } ExynosVideoMeta; 199 200 int Exynos_parsing_user_data_registered_itu_t_t35(ExynosHdrDynamicInfo *dest, void *src, int size); 201 int Exynos_dynamic_meta_to_itu_t_t35(ExynosHdrDynamicInfo *src, char *dst); 202 203 #ifdef __cplusplus 204 } 205 #endif 206 207 #endif /* VENDOR_VIDEO_API_H_ */ 208