1 /* 2 * Copyright (c) 2019 Rockchip Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 18 #ifndef _RK_AIQ_TYPES_H_ 19 #define _RK_AIQ_TYPES_H_ 20 21 #include <stdint.h> 22 #include <stdlib.h> 23 #include <stdio.h> 24 #include "rk_aiq_comm.h" 25 #include "rk_aiq_mems_sensor.h" 26 #include "common/rk-camera-module.h" 27 #include "adebayer/rk_aiq_types_adebayer_algo.h" 28 #include "ae/rk_aiq_types_ae_algo.h" 29 #include "afd/rk_aiq_types_afd_algo.h" 30 #include "awb/rk_aiq_types_awb_algo.h" 31 #include "alsc/rk_aiq_types_alsc_algo.h" 32 #include "accm/rk_aiq_types_accm_algo.h" 33 #include "a3dlut/rk_aiq_types_a3dlut_algo.h" 34 #include "amerge/rk_aiq_types_amerge_algo_int.h" 35 #include "atmo/rk_aiq_types_atmo_algo_int.h" 36 #include "atmo/rk_aiq_types_atmo_algo.h" 37 #include "adrc/rk_aiq_types_adrc_algo_int.h" 38 #include "adrc/rk_aiq_types_adrc_algo.h" 39 #include "agamma/rk_aiq_types_agamma_algo_int.h" 40 #include "adegamma/rk_aiq_types_adegamma_algo_int.h" 41 #include "adehaze/rk_aiq_types_adehaze_algo_int.h" 42 #include "adehaze/rk_aiq_types_adehaze_algo.h" 43 #include "acp/rk_aiq_types_acp_algo.h" 44 #include "aie/rk_aiq_types_aie_algo_int.h" 45 #include "aorb/rk_aiq_types_orb_algo.h" 46 #include "asd/rk_aiq_types_asd_algo.h" 47 #include "anr/rk_aiq_types_anr_algo.h" 48 #include "anr/rk_aiq_types_anr_algo_int.h" 49 #include "asharp/rk_aiq_types_asharp_algo.h" 50 #include "asharp/rk_aiq_types_asharp_algo_int.h" 51 #include "adpcc/rk_aiq_types_adpcc_algo.h" 52 #include "adpcc/rk_aiq_types_adpcc_algo_int.h" 53 #include "ablc/rk_aiq_types_ablc_algo.h" 54 #include "ablc/rk_aiq_types_ablc_algo_int.h" 55 #include "agic/rk_aiq_types_algo_agic_int.h" 56 #include "aldch/rk_aiq_types_aldch_algo.h" 57 #include "afec/rk_aiq_types_afec_algo.h" 58 #include "asharp3/rk_aiq_types_asharp_algo_v3.h" 59 #include "aynr2/rk_aiq_types_aynr_algo_v2.h" 60 #include "acnr/rk_aiq_types_acnr_algo_v1.h" 61 #include "arawnr2/rk_aiq_types_abayernr_algo_v2.h" 62 #include "amd/rk_aiq_types_amd_algo.h" 63 #include "arawnr/rk_aiq_types_abayernr_algo_v1.h" 64 #include "amfnr/rk_aiq_types_amfnr_algo_v1.h" 65 #include "aynr/rk_aiq_types_aynr_algo_v1.h" 66 #include "auvnr/rk_aiq_types_auvnr_algo_v1.h" 67 #include "again/rk_aiq_types_again_algo.h" 68 #include "acsm/rk_aiq_types_acsm_algo.h" 69 #include "acgc/rk_aiq_types_acgc_algo.h" 70 71 #ifdef RK_SIMULATOR_HW 72 #include "simulator/isp20_hw_simulator.h" 73 #include "af/rk_aiq_af_hw_v200.h" 74 #else 75 #include "af/rk_aiq_types_af_algo.h" 76 77 #endif 78 79 #include "rk_aiq_types_v3x.h" /*< v3x types */ 80 #include "rk_aiq_types_v32.h" 81 82 #define ANR_NO_SEPERATE_MARCO (0) 83 84 85 #define rk_fmt_fourcc(a, b, c, d)\ 86 ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) 87 #define rk_fmt_fourcc_be(a, b, c, d) (rk_fmt_fourcc(a, b, c, d) | (1 << 31)) 88 89 typedef struct rk_aiq_range_s { 90 float min; 91 float max; 92 float step; 93 } rk_aiq_range_t; 94 95 typedef struct rk_aiq_rect_s { 96 int left; 97 int top; 98 int width; 99 int height; 100 } rk_aiq_rect_t; 101 102 typedef enum rk_aiq_rotation_e { 103 RK_AIQ_ROTATION_0, 104 RK_AIQ_ROTATION_90, 105 RK_AIQ_ROTATION_270 106 } rk_aiq_rotation_t; 107 108 typedef enum rk_aiq_af_sec_stat_e 109 { 110 RK_AIQ_AF_SEARCH_INVAL = 0, 111 RK_AIQ_AF_SEARCH_RUNNING = 1, 112 RK_AIQ_AF_SEARCH_END = 2, 113 RK_AIQ_AF_ZOOM_MOVING = 3, 114 RK_AIQ_AF_ZOOM_MOVE_END = 4 115 } rk_aiq_af_sec_stat_t; 116 117 typedef enum { 118 /* Pixel format FOURCC depth Description */ 119 120 /* RGB formats */ 121 RK_PIX_FMT_RGB332 = rk_fmt_fourcc('R', 'G', 'B', '1'), /* 8 RGB-3-3-2 */ 122 RK_PIX_FMT_RGB444 = rk_fmt_fourcc('R', '4', '4', '4'), /* 16 xxxxrrrr ggggbbbb */ 123 RK_PIX_FMT_ARGB444 = rk_fmt_fourcc('A', 'R', '1', '2'), /* 16 aaaarrrr ggggbbbb */ 124 RK_PIX_FMT_XRGB444 = rk_fmt_fourcc('X', 'R', '1', '2'), /* 16 xxxxrrrr ggggbbbb */ 125 RK_PIX_FMT_RGB555 = rk_fmt_fourcc('R', 'G', 'B', 'O'), /* 16 RGB-5-5-5 */ 126 RK_PIX_FMT_ARGB555 = rk_fmt_fourcc('A', 'R', '1', '5'), /* 16 ARGB-1-5-5-5 */ 127 RK_PIX_FMT_XRGB555 = rk_fmt_fourcc('X', 'R', '1', '5'), /* 16 XRGB-1-5-5-5 */ 128 RK_PIX_FMT_RGB565 = rk_fmt_fourcc('R', 'G', 'B', 'P'), /* 16 RGB-5-6-5 */ 129 RK_PIX_FMT_RGB555X = rk_fmt_fourcc('R', 'G', 'B', 'Q'), /* 16 RGB-5-5-5 BE */ 130 RK_PIX_FMT_ARGB555X = rk_fmt_fourcc_be('A', 'R', '1', '5'), /* 16 ARGB-5-5-5 BE */ 131 RK_PIX_FMT_XRGB555X = rk_fmt_fourcc_be('X', 'R', '1', '5'), /* 16 XRGB-5-5-5 BE */ 132 RK_PIX_FMT_RGB565X = rk_fmt_fourcc('R', 'G', 'B', 'R'), /* 16 RGB-5-6-5 BE */ 133 RK_PIX_FMT_BGR666 = rk_fmt_fourcc('B', 'G', 'R', 'H'), /* 18 BGR-6-6-6 */ 134 RK_PIX_FMT_BGR24 = rk_fmt_fourcc('B', 'G', 'R', '3'), /* 24 BGR-8-8-8 */ 135 RK_PIX_FMT_RGB24 = rk_fmt_fourcc('R', 'G', 'B', '3'), /* 24 RGB-8-8-8 */ 136 RK_PIX_FMT_BGR32 = rk_fmt_fourcc('B', 'G', 'R', '4'), /* 32 BGR-8-8-8-8 */ 137 RK_PIX_FMT_ABGR32 = rk_fmt_fourcc('A', 'R', '2', '4'), /* 32 BGRA-8-8-8-8 */ 138 RK_PIX_FMT_XBGR32 = rk_fmt_fourcc('X', 'R', '2', '4'), /* 32 BGRX-8-8-8-8 */ 139 RK_PIX_FMT_RGB32 = rk_fmt_fourcc('R', 'G', 'B', '4'), /* 32 RGB-8-8-8-8 */ 140 RK_PIX_FMT_ARGB32 = rk_fmt_fourcc('B', 'A', '2', '4'), /* 32 ARGB-8-8-8-8 */ 141 RK_PIX_FMT_XRGB32 = rk_fmt_fourcc('B', 'X', '2', '4'), /* 32 XRGB-8-8-8-8 */ 142 143 /* Grey formats */ 144 RK_PIX_FMT_GREY = rk_fmt_fourcc('G', 'R', 'E', 'Y'), /* 8 Greyscale */ 145 RK_PIX_FMT_Y4 = rk_fmt_fourcc('Y', '0', '4', ' '), /* 4 Greyscale */ 146 RK_PIX_FMT_Y6 = rk_fmt_fourcc('Y', '0', '6', ' '), /* 6 Greyscale */ 147 RK_PIX_FMT_Y10 = rk_fmt_fourcc('Y', '1', '0', ' '), /* 10 Greyscale */ 148 RK_PIX_FMT_Y12 = rk_fmt_fourcc('Y', '1', '2', ' '), /* 12 Greyscale */ 149 RK_PIX_FMT_Y16 = rk_fmt_fourcc('Y', '1', '6', ' '), /* 16 Greyscale */ 150 RK_PIX_FMT_Y16_BE = rk_fmt_fourcc_be('Y', '1', '6', ' '), /* 16 Greyscale BE */ 151 152 /* Grey bit-packed formats */ 153 RK_PIX_FMT_Y10BPACK = rk_fmt_fourcc('Y', '1', '0', 'B'), /* 10 Greyscale bit-packed */ 154 155 /* Palette formats */ 156 RK_PIX_FMT_PAL8 = rk_fmt_fourcc('P', 'A', 'L', '8'), /* 8 8-bit palette */ 157 158 /* Chrominance formats */ 159 RK_PIX_FMT_UV8 = rk_fmt_fourcc('U', 'V', '8', ' '), /* 8 UV 4:4 */ 160 161 /* Luminance+Chrominance formats */ 162 RK_PIX_FMT_YVU410 = rk_fmt_fourcc('Y', 'V', 'U', '9'), /* 9 YVU 4:1:0 */ 163 RK_PIX_FMT_YVU420 = rk_fmt_fourcc('Y', 'V', '1', '2'), /* 12 YVU 4:2:0 */ 164 RK_PIX_FMT_YUYV = rk_fmt_fourcc('Y', 'U', 'Y', 'V'), /* 16 YUV 4:2:2 */ 165 RK_PIX_FMT_YYUV = rk_fmt_fourcc('Y', 'Y', 'U', 'V'), /* 16 YUV 4:2:2 */ 166 RK_PIX_FMT_YVYU = rk_fmt_fourcc('Y', 'V', 'Y', 'U'), /* 16 YVU 4:2:2 */ 167 RK_PIX_FMT_UYVY = rk_fmt_fourcc('U', 'Y', 'V', 'Y'), /* 16 YUV 4:2:2 */ 168 RK_PIX_FMT_VYUY = rk_fmt_fourcc('V', 'Y', 'U', 'Y'), /* 16 YUV 4:2:2 */ 169 RK_PIX_FMT_YUV422P = rk_fmt_fourcc('4', '2', '2', 'P'), /* 16 YVU422 planar */ 170 RK_PIX_FMT_YUV411P = rk_fmt_fourcc('4', '1', '1', 'P'), /* 16 YVU411 planar */ 171 RK_PIX_FMT_Y41P = rk_fmt_fourcc('Y', '4', '1', 'P'), /* 12 YUV 4:1:1 */ 172 RK_PIX_FMT_YUV444 = rk_fmt_fourcc('Y', '4', '4', '4'), /* 16 xxxxyyyy uuuuvvvv */ 173 RK_PIX_FMT_YUV555 = rk_fmt_fourcc('Y', 'U', 'V', 'O'), /* 16 YUV-5-5-5 */ 174 RK_PIX_FMT_YUV565 = rk_fmt_fourcc('Y', 'U', 'V', 'P'), /* 16 YUV-5-6-5 */ 175 RK_PIX_FMT_YUV32 = rk_fmt_fourcc('Y', 'U', 'V', '4'), /* 32 YUV-8-8-8-8 */ 176 RK_PIX_FMT_YUV410 = rk_fmt_fourcc('Y', 'U', 'V', '9'), /* 9 YUV 4:1:0 */ 177 RK_PIX_FMT_YUV420 = rk_fmt_fourcc('Y', 'U', '1', '2'), /* 12 YUV 4:2:0 */ 178 RK_PIX_FMT_HI240 = rk_fmt_fourcc('H', 'I', '2', '4'), /* 8 8-bit color */ 179 RK_PIX_FMT_HM12 = rk_fmt_fourcc('H', 'M', '1', '2'), /* 8 YUV 4:2:0 16x16 macroblocks */ 180 RK_PIX_FMT_M420 = rk_fmt_fourcc('M', '4', '2', '0'), /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ 181 182 /* two planes -- one Y, one Cr + Cb interleaved */ 183 RK_PIX_FMT_NV12 = rk_fmt_fourcc('N', 'V', '1', '2'), /* 12 Y/CbCr 4:2:0 */ 184 RK_PIX_FMT_NV21 = rk_fmt_fourcc('N', 'V', '2', '1'), /* 12 Y/CrCb 4:2:0 */ 185 RK_PIX_FMT_NV16 = rk_fmt_fourcc('N', 'V', '1', '6'), /* 16 Y/CbCr 4:2:2 */ 186 RK_PIX_FMT_NV61 = rk_fmt_fourcc('N', 'V', '6', '1'), /* 16 Y/CrCb 4:2:2 */ 187 RK_PIX_FMT_NV24 = rk_fmt_fourcc('N', 'V', '2', '4'), /* 24 Y/CbCr 4:4:4 */ 188 RK_PIX_FMT_NV42 = rk_fmt_fourcc('N', 'V', '4', '2'), /* 24 Y/CrCb 4:4:4 */ 189 190 /* two non contiguous planes - one Y, one Cr + Cb interleaved */ 191 RK_PIX_FMT_NV12M = rk_fmt_fourcc('N', 'M', '1', '2'), /* 12 Y/CbCr 4:2:0 */ 192 RK_PIX_FMT_NV21M = rk_fmt_fourcc('N', 'M', '2', '1'), /* 21 Y/CrCb 4:2:0 */ 193 RK_PIX_FMT_NV16M = rk_fmt_fourcc('N', 'M', '1', '6'), /* 16 Y/CbCr 4:2:2 */ 194 RK_PIX_FMT_NV61M = rk_fmt_fourcc('N', 'M', '6', '1'), /* 16 Y/CrCb 4:2:2 */ 195 RK_PIX_FMT_NV12MT = rk_fmt_fourcc('T', 'M', '1', '2'), /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ 196 RK_PIX_FMT_NV12MT_16X16 = rk_fmt_fourcc('V', 'M', '1', '2'), /* 12 Y/CbCr 4:2:0 16x16 macroblocks */ 197 198 /* three non contiguous planes - Y, Cb, Cr */ 199 RK_PIX_FMT_YUV420M = rk_fmt_fourcc('Y', 'M', '1', '2'), /* 12 YUV420 planar */ 200 RK_PIX_FMT_YVU420M = rk_fmt_fourcc('Y', 'M', '2', '1'), /* 12 YVU420 planar */ 201 RK_PIX_FMT_YUV422M = rk_fmt_fourcc('Y', 'M', '1', '6'), /* 16 YUV422 planar */ 202 RK_PIX_FMT_YVU422M = rk_fmt_fourcc('Y', 'M', '6', '1'), /* 16 YVU422 planar */ 203 RK_PIX_FMT_YUV444M = rk_fmt_fourcc('Y', 'M', '2', '4'), /* 24 YUV444 planar */ 204 RK_PIX_FMT_YVU444M = rk_fmt_fourcc('Y', 'M', '4', '2'), /* 24 YVU444 planar */ 205 206 /* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ 207 RK_PIX_FMT_SBGGR8 = rk_fmt_fourcc('B', 'A', '8', '1'), /* 8 BGBG.. GRGR.. */ 208 RK_PIX_FMT_SGBRG8 = rk_fmt_fourcc('G', 'B', 'R', 'G'), /* 8 GBGB.. RGRG.. */ 209 RK_PIX_FMT_SGRBG8 = rk_fmt_fourcc('G', 'R', 'B', 'G'), /* 8 GRGR.. BGBG.. */ 210 RK_PIX_FMT_SRGGB8 = rk_fmt_fourcc('R', 'G', 'G', 'B'), /* 8 RGRG.. GBGB.. */ 211 RK_PIX_FMT_SBGGR10 = rk_fmt_fourcc('B', 'G', '1', '0'), /* 10 BGBG.. GRGR.. */ 212 RK_PIX_FMT_SGBRG10 = rk_fmt_fourcc('G', 'B', '1', '0'), /* 10 GBGB.. RGRG.. */ 213 RK_PIX_FMT_SGRBG10 = rk_fmt_fourcc('B', 'A', '1', '0'), /* 10 GRGR.. BGBG.. */ 214 RK_PIX_FMT_SRGGB10 = rk_fmt_fourcc('R', 'G', '1', '0'), /* 10 RGRG.. GBGB.. */ 215 /* 10bit raw bayer packed, 5 bytes for every 4 pixels */ 216 RK_PIX_FMT_SBGGR10P = rk_fmt_fourcc('p', 'B', 'A', 'A'), 217 RK_PIX_FMT_SGBRG10P = rk_fmt_fourcc('p', 'G', 'A', 'A'), 218 RK_PIX_FMT_SGRBG10P = rk_fmt_fourcc('p', 'g', 'A', 'A'), 219 RK_PIX_FMT_SRGGB10P = rk_fmt_fourcc('p', 'R', 'A', 'A'), 220 /* 10bit raw bayer a-law compressed to 8 bits */ 221 RK_PIX_FMT_SBGGR10ALAW8 = rk_fmt_fourcc('a', 'B', 'A', '8'), 222 RK_PIX_FMT_SGBRG10ALAW8 = rk_fmt_fourcc('a', 'G', 'A', '8'), 223 RK_PIX_FMT_SGRBG10ALAW8 = rk_fmt_fourcc('a', 'g', 'A', '8'), 224 RK_PIX_FMT_SRGGB10ALAW8 = rk_fmt_fourcc('a', 'R', 'A', '8'), 225 /* 10bit raw bayer DPCM compressed to 8 bits */ 226 RK_PIX_FMT_SBGGR10DPCM8 = rk_fmt_fourcc('b', 'B', 'A', '8'), 227 RK_PIX_FMT_SGBRG10DPCM8 = rk_fmt_fourcc('b', 'G', 'A', '8'), 228 RK_PIX_FMT_SGRBG10DPCM8 = rk_fmt_fourcc('B', 'D', '1', '0'), 229 RK_PIX_FMT_SRGGB10DPCM8 = rk_fmt_fourcc('b', 'R', 'A', '8'), 230 RK_PIX_FMT_SBGGR12 = rk_fmt_fourcc('B', 'G', '1', '2'), /* 12 BGBG.. GRGR.. */ 231 RK_PIX_FMT_SGBRG12 = rk_fmt_fourcc('G', 'B', '1', '2'), /* 12 GBGB.. RGRG.. */ 232 RK_PIX_FMT_SGRBG12 = rk_fmt_fourcc('B', 'A', '1', '2'), /* 12 GRGR.. BGBG.. */ 233 RK_PIX_FMT_SRGGB12 = rk_fmt_fourcc('R', 'G', '1', '2'), /* 12 RGRG.. GBGB.. */ 234 RK_PIX_FMT_SBGGR14 = rk_fmt_fourcc('B', 'G', '1', '4'), /* 14 BGBG.. GRGR.. */ 235 RK_PIX_FMT_SGBRG14 = rk_fmt_fourcc('G', 'B', '1', '4'), /* 14 GBGB.. RGRG.. */ 236 RK_PIX_FMT_SGRBG14 = rk_fmt_fourcc('B', 'A', '1', '4'), /* 14 GRGR.. BGBG.. */ 237 RK_PIX_FMT_SRGGB14 = rk_fmt_fourcc('R', 'G', '1', '4'), /* 14 RGRG.. GBGB.. */ 238 RK_PIX_FMT_SBGGR16 = rk_fmt_fourcc('B', 'Y', 'R', '6'), /* 16 BGBG.. GRGR.. */ 239 240 /* compressed formats */ 241 RK_PIX_FMT_MJPEG = rk_fmt_fourcc('M', 'J', 'P', 'G'), /* Motion-JPEG */ 242 RK_PIX_FMT_JPEG = rk_fmt_fourcc('J', 'P', 'E', 'G'), /* JFIF JPEG */ 243 RK_PIX_FMT_DV = rk_fmt_fourcc('d', 'v', 's', 'd'), /* 1394 */ 244 RK_PIX_FMT_MPEG = rk_fmt_fourcc('M', 'P', 'E', 'G'), /* MPEG-1/2/4 Multiplexed */ 245 RK_PIX_FMT_H264 = rk_fmt_fourcc('H', '2', '6', '4'), /* H264 with start codes */ 246 RK_PIX_FMT_H264_NO_SC = rk_fmt_fourcc('A', 'V', 'C', '1'), /* H264 without start codes */ 247 RK_PIX_FMT_H264_MVC = rk_fmt_fourcc('M', '2', '6', '4'), /* H264 MVC */ 248 RK_PIX_FMT_H264_SLICE = rk_fmt_fourcc('S', '2', '6', '4'), /* H264 parsed slices */ 249 RK_PIX_FMT_H263 = rk_fmt_fourcc('H', '2', '6', '3'), /* H263 */ 250 RK_PIX_FMT_MPEG1 = rk_fmt_fourcc('M', 'P', 'G', '1'), /* MPEG-1 ES */ 251 RK_PIX_FMT_MPEG2 = rk_fmt_fourcc('M', 'P', 'G', '2'), /* MPEG-2 ES */ 252 RK_PIX_FMT_MPEG4 = rk_fmt_fourcc('M', 'P', 'G', '4'), /* MPEG-4 part 2 ES */ 253 RK_PIX_FMT_XVID = rk_fmt_fourcc('X', 'V', 'I', 'D'), /* Xvid */ 254 RK_PIX_FMT_VC1_ANNEX_G = rk_fmt_fourcc('V', 'C', '1', 'G'), /* SMPTE 421M Annex G compliant stream */ 255 RK_PIX_FMT_VC1_ANNEX_L = rk_fmt_fourcc('V', 'C', '1', 'L'), /* SMPTE 421M Annex L compliant stream */ 256 RK_PIX_FMT_VP8 = rk_fmt_fourcc('V', 'P', '8', '0'), /* VP8 */ 257 RK_PIX_FMT_VP8_FRAME = rk_fmt_fourcc('V', 'P', '8', 'F'), /* VP8 parsed frames */ 258 259 /* Vendor-specific formats */ 260 RK_PIX_FMT_CPIA1 = rk_fmt_fourcc('C', 'P', 'I', 'A'), /* cpia1 YUV */ 261 RK_PIX_FMT_WNVA = rk_fmt_fourcc('W', 'N', 'V', 'A'), /* Winnov hw compress */ 262 RK_PIX_FMT_SN9C10X = rk_fmt_fourcc('S', '9', '1', '0'), /* SN9C10x compression */ 263 RK_PIX_FMT_SN9C20X_I420 = rk_fmt_fourcc('S', '9', '2', '0'), /* SN9C20x YUV 4:2:0 */ 264 RK_PIX_FMT_PWC1 = rk_fmt_fourcc('P', 'W', 'C', '1'), /* pwc older webcam */ 265 RK_PIX_FMT_PWC2 = rk_fmt_fourcc('P', 'W', 'C', '2'), /* pwc newer webcam */ 266 RK_PIX_FMT_ET61X251 = rk_fmt_fourcc('E', '6', '2', '5'), /* ET61X251 compression */ 267 RK_PIX_FMT_SPCA501 = rk_fmt_fourcc('S', '5', '0', '1'), /* YUYV per line */ 268 RK_PIX_FMT_SPCA505 = rk_fmt_fourcc('S', '5', '0', '5'), /* YYUV per line */ 269 RK_PIX_FMT_SPCA508 = rk_fmt_fourcc('S', '5', '0', '8'), /* YUVY per line */ 270 RK_PIX_FMT_SPCA561 = rk_fmt_fourcc('S', '5', '6', '1'), /* compressed GBRG bayer */ 271 RK_PIX_FMT_PAC207 = rk_fmt_fourcc('P', '2', '0', '7'), /* compressed BGGR bayer */ 272 RK_PIX_FMT_MR97310A = rk_fmt_fourcc('M', '3', '1', '0'), /* compressed BGGR bayer */ 273 RK_PIX_FMT_JL2005BCD = rk_fmt_fourcc('J', 'L', '2', '0'), /* compressed RGGB bayer */ 274 RK_PIX_FMT_SN9C2028 = rk_fmt_fourcc('S', 'O', 'N', 'X'), /* compressed GBRG bayer */ 275 RK_PIX_FMT_SQ905C = rk_fmt_fourcc('9', '0', '5', 'C'), /* compressed RGGB bayer */ 276 RK_PIX_FMT_PJPG = rk_fmt_fourcc('P', 'J', 'P', 'G'), /* Pixart 73xx JPEG */ 277 RK_PIX_FMT_OV511 = rk_fmt_fourcc('O', '5', '1', '1'), /* ov511 JPEG */ 278 RK_PIX_FMT_OV518 = rk_fmt_fourcc('O', '5', '1', '8'), /* ov518 JPEG */ 279 RK_PIX_FMT_STV0680 = rk_fmt_fourcc('S', '6', '8', '0'), /* stv0680 bayer */ 280 RK_PIX_FMT_TM6000 = rk_fmt_fourcc('T', 'M', '6', '0'), /* tm5600/tm60x0 */ 281 RK_PIX_FMT_CIT_YYVYUY = rk_fmt_fourcc('C', 'I', 'T', 'V'), /* one line of Y then 1 line of VYUY */ 282 RK_PIX_FMT_KONICA420 = rk_fmt_fourcc('K', 'O', 'N', 'I'), /* YUV420 planar in blocks of 256 pixels */ 283 RK_PIX_FMT_JPGL = rk_fmt_fourcc('J', 'P', 'G', 'L'), /* JPEG-Lite */ 284 RK_PIX_FMT_SE401 = rk_fmt_fourcc('S', '4', '0', '1'), /* se401 janggu compressed rgb */ 285 RK_PIX_FMT_S5C_UYVY_JPG = rk_fmt_fourcc('S', '5', 'C', 'I'), /* S5C73M3 interleaved UYVY/JPEG */ 286 RK_PIX_FMT_Y8I = rk_fmt_fourcc('Y', '8', 'I', ' '), /* Greyscale 8-bit L/R interleaved */ 287 RK_PIX_FMT_Y12I = rk_fmt_fourcc('Y', '1', '2', 'I'), /* Greyscale 12-bit L/R interleaved */ 288 RK_PIX_FMT_Z16 = rk_fmt_fourcc('Z', '1', '6', ' '), /* Depth data 16-bit */ 289 } rk_aiq_format_t; 290 291 typedef struct rk_frame_fmt_s { 292 int32_t width; 293 int32_t height; 294 rk_aiq_format_t format; 295 int32_t fps; 296 int32_t hdr_mode; 297 } rk_frame_fmt_t; 298 299 #define SUPPORT_FMT_MAX 10 300 typedef struct { 301 char sensor_name[32]; 302 rk_frame_fmt_t support_fmt[SUPPORT_FMT_MAX]; 303 int32_t num; 304 /* binded pp stream media index */ 305 int8_t binded_strm_media_idx; 306 int phyId; 307 } rk_aiq_sensor_info_t; 308 309 typedef struct { 310 char len_name[32]; 311 } rk_aiq_lens_info_t; 312 313 typedef struct { 314 rk_aiq_sensor_info_t sensor_info; 315 rk_aiq_lens_info_t lens_info; 316 int isp_hw_ver; 317 bool has_lens_vcm; /*< has lens vcm */ 318 bool has_fl; /*< has flash light */ 319 bool fl_strth_adj_sup; 320 bool has_irc; /*< has ircutter */ 321 bool fl_ir_strth_adj_sup; 322 bool _is_1608_sensor; /*< for sensor sync mode verify. */ 323 uint8_t is_multi_isp_mode; 324 uint16_t multi_isp_extended_pixel; 325 uint8_t reserved[13]; 326 // supported Antibanding modes 327 // supported lock modes 328 // supported ae compensation range/step 329 // supported ae measure mode 330 // supported af modes 331 // other from iq 332 } rk_aiq_static_info_t; 333 334 typedef struct rk_aiq_sensor_nr_switch_s { 335 bool valid; 336 uint32_t direct; 337 uint32_t up_thres; 338 uint32_t down_thres; 339 uint32_t div_coeff; 340 } rk_aiq_sensor_nr_switch_t; 341 342 typedef struct { 343 bool focus_support; 344 bool iris_support; 345 bool zoom_support; 346 bool otp_valid; 347 float posture; 348 float hysteresis; 349 float startCurrent; 350 float endCurrent; 351 352 int32_t focus_minimum; 353 int32_t focus_maximum; 354 int32_t zoom_minimum; 355 int32_t zoom_maximum; 356 } rk_aiq_lens_descriptor; 357 358 typedef struct { 359 int start_ma; 360 int rated_ma; 361 int step_mode; 362 } rk_aiq_lens_vcmcfg; 363 364 typedef struct { 365 rk_aiq_af_sec_stat_t stat; 366 int32_t search_num; 367 int32_t pos[64]; 368 float sharpness[64]; 369 } rk_aiq_af_sec_path_t; 370 371 typedef struct { 372 rk_aiq_af_sec_stat_t stat; 373 int32_t final_pos; 374 } rk_aiq_af_result_t; 375 376 typedef struct { 377 int min_pos; 378 int max_pos; 379 float min_fl; 380 float max_fl; 381 } rk_aiq_af_zoomrange; 382 383 typedef struct { 384 int min_pos; 385 int max_pos; 386 } rk_aiq_af_focusrange; 387 388 // sensor 389 typedef struct { 390 unsigned short line_periods_vertical_blanking; 391 unsigned short fine_integration_time_min; 392 unsigned short fine_integration_time_max_margin; 393 unsigned short coarse_integration_time_min; 394 unsigned short coarse_integration_time_max_margin; 395 unsigned int frame_length_lines; 396 unsigned int line_length_pck; 397 unsigned int vt_pix_clk_freq_hz; 398 float pixel_clock_freq_mhz; 399 unsigned short pixel_periods_per_line; 400 unsigned short line_periods_per_field; 401 uint32_t sensor_output_width; 402 uint32_t sensor_output_height; 403 uint32_t sensor_pixelformat; 404 uint32_t isp_acq_width; 405 uint32_t isp_acq_height; 406 rk_aiq_sensor_nr_switch_t nr_switch; 407 rk_aiq_lens_descriptor lens_des; 408 struct rkmodule_awb_inf otp_awb; 409 struct rkmodule_lsc_inf *otp_lsc; 410 struct rkmodule_af_inf *otp_af; 411 struct rkmodule_pdaf_inf *otp_pdaf; 412 } rk_aiq_exposure_sensor_descriptor; 413 414 // exposure 415 typedef RkAiqExpRealParam_t rk_aiq_exposure_real_params; 416 typedef RkAiqExpSensorParam_t rk_aiq_exposure_sensor_params; 417 typedef RkAiqExpParamComb_t rk_aiq_exposure_params_comb_t; 418 typedef RKAiqAecExpInfo_t rk_aiq_exposure_params_t; 419 420 // focus 421 typedef rk_aiq_af_algo_focus_pos_t rk_aiq_focus_params_t; 422 // isp 423 424 #pragma pack(1) 425 struct rk_aiq_isp_window { 426 uint16_t h_offs; 427 uint16_t v_offs; 428 uint16_t h_size; 429 uint16_t v_size; 430 }; 431 #pragma pack() 432 433 434 typedef RKAiqAecStats_t rk_aiq_isp_aec_stats_t; 435 436 typedef rk_aiq_af_algo_stat_v20_t rk_aiq_isp_af_stats_t; 437 typedef rk_aiq_af_algo_meas_v20_t rk_aiq_isp_af_meas_t; 438 typedef rk_aiq_af_algo_focus_pos_t rk_aiq_af_focus_pos_meas_t; 439 440 typedef rk_aiq_pdaf_algo_stat_t rk_aiq_isp_pdaf_stats_t; 441 typedef rk_aiq_pdaf_algo_meas_t rk_aiq_isp_pdaf_meas_t; 442 443 typedef rk_aiq_ae_meas_params_t rk_aiq_isp_aec_meas_t; 444 typedef rk_aiq_hist_meas_params_t rk_aiq_isp_hist_meas_t; 445 446 typedef rk_aiq_afd_cfg_t rk_aiq_isp_afd_t; 447 448 /**wb gain **/ 449 450 #ifdef RK_SIMULATOR_HW 451 typedef sim_orb_stat_t rk_aiq_isp_orb_stats_t; 452 #else 453 typedef rk_aiq_orb_algo_stat_t rk_aiq_isp_orb_stats_t; 454 #endif 455 typedef rk_aiq_orb_algo_meas_t rk_aiq_isp_orb_meas_t; 456 typedef struct { 457 unsigned char orb_en; 458 unsigned char limit_value; 459 unsigned int max_feature; 460 } rk_aiq_isp_orb_t; 461 462 463 typedef AgicProcResult_t rk_aiq_isp_gic_t; 464 465 typedef AdebayerHwConfigV1_t rk_aiq_isp_debayer_t; 466 467 typedef struct { 468 unsigned char equ_segm; 469 unsigned short offset; 470 unsigned short gamma_y[45]; 471 } rk_aiq_isp_goc_t; 472 473 typedef struct { 474 int UNKNOWN; 475 } rk_aiq_isp_wdr_t; 476 477 typedef rk_aiq_acsm_params_t rk_aiq_isp_csm_t; 478 479 typedef struct { 480 int UNKNOWN; 481 } rk_aiq_isp_conv422_t; 482 483 typedef struct { 484 int UNKNOWN; 485 } rk_aiq_isp_yuvconv_t; 486 487 typedef ldch_process_result_t rk_aiq_isp_ldch_t; 488 489 typedef fec_preprocess_result_t rk_aiq_isp_fec_t; 490 491 typedef rk_aiq_acgc_params_t rk_aiq_isp_cgc_t; 492 493 typedef struct { 494 uint32_t frame_id; 495 rk_aiq_isp_aec_stats_t aec_stats; 496 int awb_hw_ver; 497 union { 498 rk_aiq_awb_stat_res_v200_t awb_stats_v200; 499 rk_aiq_awb_stat_res2_v201_t awb_stats_v21; 500 rk_aiq_isp_awb_stats2_v3x_t awb_stats_v3x; 501 rk_aiq_isp_awb_stats_v32_t awb_stats_v32; 502 }; 503 int af_hw_ver; 504 union { 505 rk_aiq_isp_af_stats_t af_stats; 506 rk_aiq_isp_af_stats_v3x_t af_stats_v3x; 507 }; 508 } rk_aiq_isp_stats_t; 509 510 typedef RkAiqAmergeProcResult_t rk_aiq_isp_merge_t; 511 typedef RkAiqAtmoProcResult_t rk_aiq_isp_tmo_t; 512 513 typedef RkAiqAdrcProcResult_t rk_aiq_isp_drc_t; 514 515 typedef RkAiqAdehazeProcResult_t rk_aiq_isp_dehaze_t; 516 517 518 #if ANR_NO_SEPERATE_MARCO 519 typedef RKAnr_Bayernr_Fix_t rk_aiq_isp_rawnr_t; 520 typedef RKAnr_Mfnr_Fix_t rk_aiq_isp_tnr_t; 521 typedef RKAnr_Ynr_Fix_t rk_aiq_isp_ynr_t; 522 typedef RKAnr_Uvnr_Fix_t rk_aiq_isp_uvnr_t; 523 typedef ANRProcResult_t rkaiq_anr_procRes_t; 524 #else 525 typedef RK_Bayernr_Fix_V1_t rk_aiq_isp_rawnr_t; 526 typedef RK_MFNR_Fix_V1_t rk_aiq_isp_tnr_t; 527 typedef RK_YNR_Fix_V1_t rk_aiq_isp_ynr_t; 528 typedef RK_UVNR_Fix_V1_t rk_aiq_isp_uvnr_t; 529 typedef ANRProcResult_t rkaiq_anr_procRes_t; 530 #endif 531 532 #if 1 533 typedef RKAsharp_Sharp_Fix_t rk_aiq_isp_sharpen_t; 534 typedef RKAsharp_Edgefilter_Fix_t rk_aiq_isp_edgeflt_t; 535 typedef AsharpProcResult_t rkaiq_asharp_procRes_t; 536 #endif 537 538 typedef AblcProc_t rk_aiq_isp_blc_t; 539 typedef AdpccProcResult_t rk_aiq_isp_dpcc_t; 540 541 typedef RKAnr_Gain_Fix_t rk_aiq_isp_gain_t; 542 543 typedef struct rk_aiq_isp_ie_s { 544 rk_aiq_aie_params_t base; 545 rk_aiq_aie_params_int_t extra; 546 } rk_aiq_isp_ie_t; 547 548 typedef enum rk_aiq_gray_mode_e { 549 RK_AIQ_GRAY_MODE_CPSL, /*!< controlled by cpsl*/ 550 RK_AIQ_GRAY_MODE_OFF, 551 RK_AIQ_GRAY_MODE_ON, 552 } rk_aiq_gray_mode_t; 553 554 /* Flash modes. Default is off. 555 * Setting a flash to TORCH or INDICATOR mode will automatically 556 * turn it on. Setting it to FLASH mode will not turn on the flash 557 * until the FLASH_STROBE command is sent. */ 558 enum rk_aiq_flash_mode { 559 RK_AIQ_FLASH_MODE_OFF, 560 RK_AIQ_FLASH_MODE_FLASH, 561 RK_AIQ_FLASH_MODE_FLASH_PRE, 562 RK_AIQ_FLASH_MODE_FLASH_MAIN, 563 RK_AIQ_FLASH_MODE_TORCH, 564 RK_AIQ_FLASH_MODE_INDICATOR, 565 }; 566 567 /* Flash statuses, used by rk_aiq driver to check before starting 568 * flash and after having started flash. */ 569 enum rk_aiq_flash_status { 570 RK_AIQ_FLASH_STATUS_OK, 571 RK_AIQ_FLASH_STATUS_HW_ERROR, 572 RK_AIQ_FLASH_STATUS_INTERRUPTED, 573 RK_AIQ_FLASH_STATUS_TIMEOUT, 574 }; 575 576 /* Frame status. This is used to detect corrupted frames and cpsl(compensation 577 * light) exposed frames. Usually, the first 2 frames coming out of the sensor 578 * are corrupted. When using flash, the frame before and the frame after 579 * the cpsl exposed frame may be partially exposed by cpsl. The ISP 580 * statistics for these frames should not be used by the 3A library. 581 * The frame status value can be found in the "reserved" field in the 582 * v4l2_buffer struct. */ 583 enum rk_aiq_frame_status { 584 RK_AIQ_FRAME_STATUS_OK, 585 RK_AIQ_FRAME_STATUS_CORRUPTED, 586 RK_AIQ_FRAME_STATUS_EXPOSED, 587 RK_AIQ_FRAME_STATUS_PARTIAL, 588 RK_AIQ_FRAME_STATUS_FAILED, 589 }; 590 591 #define RK_AIQ_FLASH_NUM_MAX 2 592 593 typedef struct rk_aiq_flash_setting_s { 594 enum rk_aiq_flash_mode flash_mode; 595 enum rk_aiq_frame_status frame_status; 596 float power[RK_AIQ_FLASH_NUM_MAX]; 597 bool strobe; 598 int timeout_ms; 599 int64_t effect_ts; 600 } rk_aiq_flash_setting_t; 601 602 typedef struct rk_aiq_ir_setting_s { 603 bool irc_on; /*< true means cut the IR, vice versa */ 604 } rk_aiq_ir_setting_t; 605 606 typedef enum rk_aiq_cpsls_e { 607 RK_AIQ_CPSLS_INVALID = -1, 608 RK_AIQ_CPSLS_LED = 1, 609 RK_AIQ_CPSLS_IR = 2, 610 RK_AIQ_CPSLS_MIX = 3, /*< led and ir mixture */ 611 RK_AIQ_CPSLS_MAX 612 } rk_aiq_cpsls_t; 613 614 /*! 615 * \brief compensation light configs 616 * 617 * user data types of compensation lights, applied to IR and 618 * full colour light source. 619 */ 620 621 typedef struct rk_aiq_cpsl_cfg_s { 622 RKAiqOPMode_t mode; 623 rk_aiq_cpsls_t lght_src; 624 bool gray_on; /*!< force to gray if light on */ 625 union { 626 struct { 627 float sensitivity; /*!< Range [0-100] */ 628 uint32_t sw_interval; /*!< switch interval time, unit seconds */ 629 } a; /*< auto mode */ 630 struct { 631 uint8_t on; /*!< disable 0, enable 1 */ 632 float strength_led; /*!< Range [0-100] */ 633 float strength_ir; /*!< Range [0-100] */ 634 } m; /*!< manual mode */ 635 } u; 636 } rk_aiq_cpsl_cfg_t; 637 638 typedef struct rk_aiq_cpsl_info_s { 639 int32_t mode; 640 uint8_t on; 641 bool gray; 642 float strength_led; 643 float strength_ir; 644 float sensitivity; 645 uint32_t sw_interval; 646 int32_t lght_src; 647 } rk_aiq_cpsl_info_t; 648 649 typedef struct rk_aiq_cpsl_cap_s { 650 int32_t supported_modes[RK_AIQ_OP_MODE_MAX]; 651 uint8_t modes_num; 652 int32_t supported_lght_src[RK_AIQ_CPSLS_MAX]; 653 uint8_t lght_src_num; 654 rk_aiq_range_t strength_led; 655 rk_aiq_range_t sensitivity; 656 rk_aiq_range_t strength_ir; 657 } rk_aiq_cpsl_cap_t; 658 659 // v21 types 660 661 typedef RkAiqAdrcProcResult_t rk_aiq_isp_drc_v21_t; 662 663 typedef struct rk_aiq_isp_blc_v21_s { 664 rk_aiq_isp_blc_t v0; 665 //TODO: additional blc1 params 666 } rk_aiq_isp_blc_v21_t; 667 668 typedef struct rk_aiq_isp_wb_gain_v21_s { 669 //TODO: 670 void* place_holder; 671 } rk_aiq_isp_wb_gain_v21_t; 672 673 typedef AgicProcResult_t rk_aiq_isp_gic_v21_t; 674 typedef rk_aiq_isp_gic_v21_t rk_aiq_isp_gic_v3x_t; 675 676 typedef struct rk_aiq_isp_ccm_v21_s { 677 //TODO: 678 void* place_holder; 679 } rk_aiq_isp_ccm_v21_t; 680 /* 681 typedef struct rk_aiq_isp_dhaz_cfg_v21_s { 682 //TODO: 683 void* place_holder; 684 } rk_aiq_isp_dhaz_cfg_v21_t;*/ 685 686 typedef RkAiqAdehazeProcResult_t rk_aiq_isp_dehaze_v21_t; 687 688 typedef struct rk_aiq_isp_dhaz_stats_v21_s { 689 //TODO: 690 void* place_holder; 691 } rk_aiq_isp_dhaz_stats_v21_t; 692 693 // baynr, alias name of rawnr 694 #if 0 695 typedef struct rk_aiq_isp_baynr_v21_s { 696 //TODO: 697 void* place_holder; 698 } rk_aiq_isp_baynr_v21_t; 699 #else 700 typedef RK_Bayernr_Fix_V2_t rk_aiq_isp_baynr_v21_t ; 701 702 #endif 703 typedef struct rk_aiq_isp_bay3d_v21_s { 704 //TODO: 705 void* place_holder; 706 } rk_aiq_isp_bay3d_v21_t; 707 708 #if 0 709 typedef struct rk_aiq_isp_ynr_v21_s { 710 //TODO: 711 void* place_holder; 712 } rk_aiq_isp_ynr_v21_t; 713 #else 714 typedef RK_YNR_Fix_V2_t rk_aiq_isp_ynr_v21_t ; 715 716 #endif 717 718 #if 0 719 typedef struct rk_aiq_isp_cnr_v21_s { 720 //TODO: 721 void* place_holder; 722 } rk_aiq_isp_cnr_v21_t; 723 #else 724 typedef RK_CNR_Fix_V1_t rk_aiq_isp_cnr_v21_t ; 725 726 #endif 727 728 #if 0 729 typedef struct rk_aiq_isp_sharp_v21_s { 730 //TODO: 731 void* place_holder; 732 } rk_aiq_isp_sharp_v21_t; 733 #else 734 typedef RK_SHARP_Fix_V3_t rk_aiq_isp_sharp_v21_t ; 735 736 #endif 737 738 typedef struct rk_aiq_awb_stat_res_v201_s rk_aiq_isp_raw_awb_meas_v21_t; 739 typedef struct rk_aiq_awb_stat_res_v200_s rk_aiq_isp_raw_awb_meas_v20_t; 740 741 typedef enum capture_raw_e { 742 CAPTURE_RAW_ASYNC, 743 CAPTURE_RAW_SYNC, 744 CAPTURE_RAW_AND_YUV_SYNC, 745 } capture_raw_t; 746 747 typedef enum rk_aiq_rawbuf_type_s { 748 RK_AIQ_RAW_ADDR, 749 RK_AIQ_RAW_FD, 750 RK_AIQ_RAW_DATA, 751 RK_AIQ_RAW_FILE 752 } rk_aiq_rawbuf_type_t; 753 754 typedef struct rk_aiq_raw_prop_s { 755 uint32_t frame_width; 756 uint32_t frame_height; 757 rk_aiq_format_t format; 758 rk_aiq_rawbuf_type_t rawbuf_type; 759 } rk_aiq_raw_prop_t; 760 761 typedef struct { 762 uint32_t frame_id; 763 uint16_t hdrProcessCnt; 764 unsigned int luma[3][16]; 765 } rk_aiq_luma_params_t; 766 767 typedef enum rk_isp_stream_mode_e { 768 RK_ISP_STREAM_MODE_INVALID = -1, 769 RK_ISP_STREAM_MODE_ONLNIE, 770 RK_ISP_STREAM_MODE_OFFLNIE, 771 } rk_isp_stream_mode_t; 772 773 #define RK_AIQ_CAM_GROUP_MAX_CAMS (8) 774 775 #endif 776