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 uint32_t internal_org_x_bqs = from->internal_frame_origin_x_bqs_on_sctbl;
57 uint32_t internal_org_y_bqs = from->internal_frame_origin_y_bqs_on_sctbl;
58 uint32_t slice, rest, i;
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 uint32_t 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 };
83 ia_css_configure_sc(binary, &config);
87 /* ------ deprecated(bz675) : from ------ */
88 /* It looks like @parameter{} (in *.pipe) is used to generate the process/get/set functions,
89 for parameters which should be used in the isp kernels.
90 However, the ia_css_shading_settings structure has a parameter which is used only in the css,
91 and does not have a parameter which is used in the isp kernels.
92 Then, I did not use @parameter{} to generate the get/set function
93 for the ia_css_shading_settings structure. (michie) */
95 sh_css_get_shading_settings(const struct ia_css_isp_parameters *params,
96 struct ia_css_shading_settings *settings)
100 assert(params != NULL);
102 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
103 "ia_css_get_shading_settings() enter: settings=%p\n", settings);
105 *settings = params->shading_settings;
107 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
108 "ia_css_get_shading_settings() leave: settings.enable_shading_table_conversion=%d\n",
109 settings->enable_shading_table_conversion);
113 sh_css_set_shading_settings(struct ia_css_isp_parameters *params,
114 const struct ia_css_shading_settings *settings)
116 if (settings == NULL)
118 assert(params != NULL);
120 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
121 "ia_css_set_shading_settings() enter: settings.enable_shading_table_conversion=%d\n",
122 settings->enable_shading_table_conversion);
124 params->shading_settings = *settings;
125 params->shading_settings_changed = true;
127 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
128 "ia_css_set_shading_settings() leave: return_void\n");
130 /* ------ deprecated(bz675) : to ------ */