1 /* 2 * Copyright (c) 2021 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 __AGIC_UAPI_HEAD_H__ 19 #define __AGIC_UAPI_HEAD_H__ 20 21 #include "stdint.h" 22 #include "rk_aiq_comm.h" 23 24 typedef struct rkaiq_gic_v1_param_selected_s { 25 // M4_NUMBER_DESC("ISO", "u32", M4_RANGE(50, 65535), "50", M4_DIGIT(0)) 26 uint32_t iso; 27 // M4_BOOL_DESC("bypass", "0") 28 uint8_t bypass; 29 // M4_NUMBER_DESC("gr_ratio", "u8", M4_RANGE(0, 3), "0", M4_DIGIT(0)) 30 uint8_t gr_ratio; 31 // M4_NUMBER_DESC("min_busy_thre", "u16", M4_RANGE(0, 1023), "160", M4_DIGIT(0)) 32 uint16_t min_busy_thre; 33 // M4_NUMBER_DESC("min_grad_thr1", "u16", M4_RANGE(0, 1023), "32", M4_DIGIT(0)) 34 uint16_t min_grad_thr1; 35 // M4_NUMBER_DESC("min_grad_thr2", "u16", M4_RANGE(0, 1023), "32", M4_DIGIT(0)) 36 uint16_t min_grad_thr2; 37 // M4_NUMBER_DESC("k_grad1", "u16", M4_RANGE(0, 15), "5", M4_DIGIT(0)) 38 uint16_t k_grad1; 39 // M4_NUMBER_DESC("k_grad2", "u16", M4_RANGE(0, 15), "5", M4_DIGIT(0)) 40 uint16_t k_grad2; 41 // M4_NUMBER_DESC("gb_thre", "u16", M4_RANGE(0, 15), "7", M4_DIGIT(0)) 42 uint16_t gb_thre; 43 // M4_NUMBER_DESC("maxCorV", "u16", M4_RANGE(0, 1023), "40", M4_DIGIT(0)) 44 uint16_t maxCorV; 45 // M4_NUMBER_DESC("maxCorVboth", "u16", M4_RANGE(0, 1023), "8", M4_DIGIT(0)) 46 uint16_t maxCorVboth; 47 // M4_NUMBER_DESC("dark_thre", "u16", M4_RANGE(0, 2047), "120", M4_DIGIT(0)) 48 uint16_t dark_thre; 49 // M4_NUMBER_DESC("dark_threHi", "u16", M4_RANGE(0, 2047), "240", M4_DIGIT(0)) 50 uint16_t dark_threHi; 51 // M4_NUMBER_DESC("k_grad1_dark", "u16", M4_RANGE(0, 15), "6", M4_DIGIT(0)) 52 uint16_t k_grad1_dark; 53 // M4_NUMBER_DESC("k_grad2_dark", "u16", M4_RANGE(0, 15), "1", M4_DIGIT(0)) 54 uint16_t k_grad2_dark; 55 // M4_NUMBER_DESC("min_grad_thr_dark1", "u16", M4_RANGE(0, 1023), "64", M4_DIGIT(0)) 56 uint16_t min_grad_thr_dark1; 57 // M4_NUMBER_DESC("min_grad_thr_dark2", "u16", M4_RANGE(0, 1023), "32", M4_DIGIT(0)) 58 uint16_t min_grad_thr_dark2; 59 // M4_NUMBER_DESC("noiseCurve_0", "f32", M4_RANGE(0.0, 1023.0), "0.0", M4_DIGIT(4)) 60 float noiseCurve_0; 61 // M4_NUMBER_DESC("noiseCurve_1", "f32", M4_RANGE(0.0, 1023.0), "0.0", M4_DIGIT(4)) 62 float noiseCurve_1; 63 // M4_NUMBER_DESC("GValueLimitLo", "f32", M4_RANGE(0.0, 4095.0), "1280.0", M4_DIGIT(4)) 64 float GValueLimitLo; 65 // M4_NUMBER_DESC("GValueLimitHi", "f32", M4_RANGE(0.0, 4095.0), "1760.0", M4_DIGIT(4)) 66 float GValueLimitHi; 67 // M4_NUMBER_DESC("textureStrength", "f32", M4_RANGE(0.0, 2.0), "1.0", M4_DIGIT(4)) 68 float textureStrength; 69 // M4_NUMBER_DESC("ScaleLo", "f32", M4_RANGE(0.0, 1023.0), "0.0", M4_DIGIT(4)) 70 float ScaleLo; 71 // M4_NUMBER_DESC("ScaleHi", "f32", M4_RANGE(0.0, 1023.0), "0.0", M4_DIGIT(4)) 72 float ScaleHi; 73 // M4_NUMBER_DESC("globalStrength", "f32", M4_RANGE(0.0, 2.0), "1.0", M4_DIGIT(4)) 74 float globalStrength; 75 // M4_NUMBER_DESC("Difference Clip", "f32", M4_RANGE(0.0, 1023.0), "0.0", M4_DIGIT(4)) 76 uint16_t diff_clip; 77 } rkaiq_gic_v1_param_selected_t; 78 79 typedef struct rkaiq_gic_v2_param_selected_s { 80 // M4_NUMBER_DESC("ISO", "u32", M4_RANGE(50, 65535), "50", M4_DIGIT(0)) 81 uint32_t iso; 82 // M4_BOOL_DESC("bypass", "0") 83 uint8_t bypass; 84 // M4_NUMBER_DESC("gr_ratio", "u8", M4_RANGE(0, 3), "0", M4_DIGIT(0)) 85 uint8_t gr_ratio; 86 // M4_NUMBER_DESC("min_busy_thre", "u16", M4_RANGE(0, 1023), "160", M4_DIGIT(0)) 87 uint16_t min_busy_thre; 88 // M4_NUMBER_DESC("min_grad_thr1", "u16", M4_RANGE(0, 1023), "32", M4_DIGIT(0)) 89 uint16_t min_grad_thr1; 90 // M4_NUMBER_DESC("min_grad_thr2", "u16", M4_RANGE(0, 1023), "32", M4_DIGIT(0)) 91 uint16_t min_grad_thr2; 92 // M4_NUMBER_DESC("k_grad1", "u16", M4_RANGE(0, 15), "5", M4_DIGIT(0)) 93 uint16_t k_grad1; 94 // M4_NUMBER_DESC("k_grad2", "u16", M4_RANGE(0, 15), "5", M4_DIGIT(0)) 95 uint16_t k_grad2; 96 // M4_NUMBER_DESC("gb_thre", "u16", M4_RANGE(0, 15), "7", M4_DIGIT(0)) 97 uint16_t gb_thre; 98 // M4_NUMBER_DESC("maxCorV", "u16", M4_RANGE(0, 1023), "40", M4_DIGIT(0)) 99 uint16_t maxCorV; 100 // M4_NUMBER_DESC("maxCorVboth", "u16", M4_RANGE(0, 1023), "8", M4_DIGIT(0)) 101 uint16_t maxCorVboth; 102 // M4_NUMBER_DESC("dark_thre", "u16", M4_RANGE(0, 2047), "120", M4_DIGIT(0)) 103 uint16_t dark_thre; 104 // M4_NUMBER_DESC("dark_threHi", "u16", M4_RANGE(0, 2047), "240", M4_DIGIT(0)) 105 uint16_t dark_threHi; 106 // M4_NUMBER_DESC("k_grad1_dark", "u16", M4_RANGE(0, 15), "6", M4_DIGIT(0)) 107 uint16_t k_grad1_dark; 108 // M4_NUMBER_DESC("k_grad2_dark", "u16", M4_RANGE(0, 15), "1", M4_DIGIT(0)) 109 uint16_t k_grad2_dark; 110 // M4_NUMBER_DESC("min_grad_thr_dark1", "u16", M4_RANGE(0, 1023), "64", M4_DIGIT(0)) 111 uint16_t min_grad_thr_dark1; 112 // M4_NUMBER_DESC("min_grad_thr_dark2", "u16", M4_RANGE(0, 1023), "32", M4_DIGIT(0)) 113 uint16_t min_grad_thr_dark2; 114 // M4_NUMBER_DESC("NoiseScale", "s32", M4_RANGE(0, 1023), "0", M4_DIGIT(0)) 115 int NoiseScale; 116 // M4_NUMBER_DESC("NoiseBase", "s32", M4_RANGE(0, 1023), "0", M4_DIGIT(0)) 117 int NoiseBase; 118 // M4_NUMBER_DESC("noiseCurve_0", "f32", M4_RANGE(0.0, 1023.0), "0.0", M4_DIGIT(4)) 119 float noiseCurve_0; 120 // M4_NUMBER_DESC("noiseCurve_1", "f32", M4_RANGE(0.0, 1023.0), "0.0", M4_DIGIT(4)) 121 float noiseCurve_1; 122 // M4_NUMBER_DESC("globalStrength", "f32", M4_RANGE(0.0, 2.0), "1.0", M4_DIGIT(4)) 123 float globalStrength; 124 // M4_NUMBER_DESC("diff_clip", "u16", M4_RANGE(0, 1023), "0", M4_DIGIT(0)) 125 uint16_t diff_clip; 126 } rkaiq_gic_v2_param_selected_t; 127 128 enum { GIC_NORMAL = 0, GIC_HDR = 1, GIC_NIGHT = 2 }; 129 130 typedef enum rkaiq_gic_api_op_mode_e { 131 RKAIQ_GIC_API_OPMODE_OFF = 0, // run IQ agic 132 RKAIQ_GIC_API_OPMODE_AUTO = 1, // run api auto agic 133 RKAIQ_GIC_API_OPMODE_MANUAL = 2, // run api manual agic 134 } rkaiq_gic_api_op_mode_t; 135 136 #define RKAIQ_GIC_MAX_ISO_CNT 16 137 138 typedef struct rkaiq_gic_v1_api_attr_s { 139 rk_aiq_uapi_sync_t sync; 140 // M4_BOOL_DESC("enable", "0") 141 uint8_t gic_en; 142 // M4_BOOL_DESC("edge_open", "0") 143 uint8_t edge_open; 144 // M4_BOOL_DESC("noise_cut_en", "0") 145 uint8_t noise_cut_en; 146 // M4_ENUM_DESC("op_mode", "rkaiq_gic_api_op_mode_t", "RKAIQ_GIC_API_OPMODE_AUTO"); 147 rkaiq_gic_api_op_mode_t op_mode; 148 // M4_NUMBER_DESC("iso count", "u32", M4_RANGE(1, 16), "16", M4_DIGIT(0)) 149 uint32_t iso_cnt; 150 // M4_STRUCT_LIST_DESC("auto params", M4_SIZE(1, 16), "normal_ui_style") 151 rkaiq_gic_v1_param_selected_t auto_params[RKAIQ_GIC_MAX_ISO_CNT]; 152 // M4_STRUCT_DESC("manual params", "normal_ui_style") 153 rkaiq_gic_v1_param_selected_t manual_param; 154 } rkaiq_gic_v1_api_attr_t; 155 156 typedef struct rkaiq_gic_v2_api_attr_s { 157 rk_aiq_uapi_sync_t sync; 158 // M4_BOOL_DESC("enable", "0") 159 uint8_t gic_en; 160 // M4_ENUM_DESC("op_mode", "rkaiq_gic_api_op_mode_t", "RKAIQ_GIC_API_OPMODE_AUTO"); 161 rkaiq_gic_api_op_mode_t op_mode; 162 // M4_NUMBER_DESC("iso count", "u32", M4_RANGE(1, 16), "16", M4_DIGIT(0)) 163 uint32_t iso_cnt; 164 // M4_STRUCT_LIST_DESC("auto params", M4_SIZE(1, 16), "normal_ui_style") 165 rkaiq_gic_v2_param_selected_t auto_params[RKAIQ_GIC_MAX_ISO_CNT]; 166 // M4_STRUCT_DESC("manual params", "normal_ui_style") 167 rkaiq_gic_v2_param_selected_t manual_param; 168 } rkaiq_gic_v2_api_attr_t; 169 170 #endif /*__AGIC_UAPI_HEAD_H__*/ 171