2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #include "ia_css_types.h"
16 #include "sh_css_defs.h"
17 #include "ia_css_debug.h"
18 #include "assert_support.h"
20 #include "math_support.h" /* min() */
22 #define IA_CSS_INCLUDE_CONFIGURATIONS
23 #include "ia_css_isp_configs.h"
26 #include "ia_css_sc.host.h"
30 struct sh_css_isp_sc_params *to,
31 struct ia_css_shading_table **from,
35 to->gain_shift = (*from)->fraction_bits;
40 const struct sh_css_isp_sc_params *sc,
44 ia_css_debug_dtrace(level, "Shading Correction:\n");
45 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
46 "sc_gain_shift", sc->gain_shift);
52 struct sh_css_isp_sc_isp_config *to,
53 const struct ia_css_sc_configuration *from,
56 u32 internal_org_x_bqs = from->internal_frame_origin_x_bqs_on_sctbl;
57 u32 internal_org_y_bqs = from->internal_frame_origin_y_bqs_on_sctbl;
62 /* The internal_frame_origin_x_bqs_on_sctbl is separated to 8 times of slice_vec. */
63 rest = internal_org_x_bqs;
64 for (i = 0; i < SH_CSS_SC_INTERPED_GAIN_HOR_SLICE_TIMES; i++) {
65 slice = min(rest, ((uint32_t)ISP_SLICE_NELEMS));
67 to->interped_gain_hor_slice_bqs[i] = slice;
70 to->internal_frame_origin_y_bqs_on_sctbl = internal_org_y_bqs;
75 const struct ia_css_binary *binary,
76 u32 internal_frame_origin_x_bqs_on_sctbl,
77 uint32_t internal_frame_origin_y_bqs_on_sctbl)
79 const struct ia_css_sc_configuration config = {
80 internal_frame_origin_x_bqs_on_sctbl,
81 internal_frame_origin_y_bqs_on_sctbl
84 ia_css_configure_sc(binary, &config);
88 /* ------ deprecated(bz675) : from ------ */
89 /* It looks like @parameter{} (in *.pipe) is used to generate the process/get/set functions,
90 for parameters which should be used in the isp kernels.
91 However, the ia_css_shading_settings structure has a parameter which is used only in the css,
92 and does not have a parameter which is used in the isp kernels.
93 Then, I did not use @parameter{} to generate the get/set function
94 for the ia_css_shading_settings structure. (michie) */
96 sh_css_get_shading_settings(const struct ia_css_isp_parameters *params,
97 struct ia_css_shading_settings *settings)
103 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
104 "ia_css_get_shading_settings() enter: settings=%p\n", settings);
106 *settings = params->shading_settings;
108 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
109 "ia_css_get_shading_settings() leave: settings.enable_shading_table_conversion=%d\n",
110 settings->enable_shading_table_conversion);
114 sh_css_set_shading_settings(struct ia_css_isp_parameters *params,
115 const struct ia_css_shading_settings *settings)
121 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
122 "ia_css_set_shading_settings() enter: settings.enable_shading_table_conversion=%d\n",
123 settings->enable_shading_table_conversion);
125 params->shading_settings = *settings;
126 params->shading_settings_changed = true;
128 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
129 "ia_css_set_shading_settings() leave: return_void\n");
132 /* ------ deprecated(bz675) : to ------ */