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 #ifndef IA_CSS_NO_DEBUG
16 #include "ia_css_debug.h"
18 #include "ia_css_iefd2_6.host.h"
20 /* Copy parameters to VMEM
23 ia_css_iefd2_6_vmem_encode(
24 struct iefd2_6_vmem_params
*to
,
25 const struct ia_css_iefd2_6_config
*from
,
28 const unsigned total_blocks
= 4;
29 const unsigned shuffle_block
= 16;
33 /* For configurable units parameters are copied to vmem. Per CU 3 arrays are copied:
34 * x containing the x coordinates
35 * a containing the slopes
36 * b containing the intercept values.
38 * A 64 element vector is split up in 4 blocks of 16 element. Each array is copied to
39 * a vector 4 times, (starting at 0, 16, 32 and 48). All array elements are copied or
40 * initialised as described in the KFS. The remaining elements of a vector are set to 0.
42 /* first init the vectors */
43 for(i
= 0; i
< total_blocks
*shuffle_block
; i
++) {
44 to
->e_cued_x
[0][i
] = 0;
45 to
->e_cued_a
[0][i
] = 0;
46 to
->e_cued_b
[0][i
] = 0;
48 to
->e_cu_dir_x
[0][i
] = 0;
49 to
->e_cu_dir_a
[0][i
] = 0;
50 to
->e_cu_dir_b
[0][i
] = 0;
52 to
->e_cu_non_dir_x
[0][i
] = 0;
53 to
->e_cu_non_dir_a
[0][i
] = 0;
54 to
->e_cu_non_dir_b
[0][i
] = 0;
56 to
->e_curad_x
[0][i
] = 0;
57 to
->e_curad_a
[0][i
] = 0;
58 to
->e_curad_b
[0][i
] = 0;
62 for(i
= 0; i
< total_blocks
; i
++) {
63 base
= shuffle_block
*i
;
66 to
->e_cued_x
[0][base
] = 0;
67 to
->e_cued_a
[0][base
] = 0;
68 to
->e_cued_b
[0][base
] = from
->cu_ed_slopes_b
[0];
70 to
->e_cu_dir_x
[0][base
] = 0;
71 to
->e_cu_dir_a
[0][base
] = 0;
72 to
->e_cu_dir_b
[0][base
] = from
->cu_dir_sharp_slopes_b
[0];
74 to
->e_cu_non_dir_x
[0][base
] = 0;
75 to
->e_cu_non_dir_a
[0][base
] = 0;
76 to
->e_cu_non_dir_b
[0][base
] = from
->cu_non_dir_sharp_slopes_b
[0];
78 to
->e_curad_x
[0][base
] = 0;
79 to
->e_curad_a
[0][base
] = 0;
80 to
->e_curad_b
[0][base
] = from
->cu_radial_slopes_b
[0];
82 for (j
= 1; j
< 4; j
++) {
83 to
->e_cu_dir_a
[0][base
+j
] = from
->cu_dir_sharp_slopes_a
[j
-1];
84 to
->e_cu_dir_b
[0][base
+j
] = from
->cu_dir_sharp_slopes_b
[j
-1];
85 to
->e_cu_non_dir_a
[0][base
+j
] = from
->cu_non_dir_sharp_slopes_a
[j
-1];
86 to
->e_cu_non_dir_b
[0][base
+j
] = from
->cu_non_dir_sharp_slopes_b
[j
-1];
89 for (j
= 1; j
< 5; j
++) {
90 to
->e_cu_dir_x
[0][base
+j
] = from
->cu_dir_sharp_points_x
[j
-1];
91 to
->e_cu_non_dir_x
[0][base
+j
] = from
->cu_non_dir_sharp_points_x
[j
-1];
95 for (j
= 1; j
< 6; j
++) {
96 to
->e_cued_x
[0][base
+j
] = from
->cu_ed_points_x
[j
-1];
97 to
->e_cued_a
[0][base
+j
] = from
->cu_ed_slopes_a
[j
-1];
98 to
->e_cued_b
[0][base
+j
] = from
->cu_ed_slopes_b
[j
-1];
100 to
->e_cued_x
[0][base
+6] = from
->cu_ed_points_x
[5];
102 for (j
= 1; j
< 6; j
++) {
103 to
->e_curad_x
[0][base
+j
] = from
->cu_radial_points_x
[j
-1];
104 to
->e_curad_a
[0][base
+j
] = from
->cu_radial_slopes_a
[j
-1];
105 to
->e_curad_b
[0][base
+j
] = from
->cu_radial_slopes_b
[j
-1];
107 to
->e_curad_x
[0][base
+6] = from
->cu_radial_points_x
[5];
109 /* Init asrrnd_lut */
110 to
->asrrnd_lut
[0][base
] = 8192;
111 to
->asrrnd_lut
[0][base
+1] = 4096;
112 to
->asrrnd_lut
[0][base
+2] = 2048;
113 to
->asrrnd_lut
[0][base
+3] = 1024;
114 to
->asrrnd_lut
[0][base
+4] = 512;
115 to
->asrrnd_lut
[0][base
+5] = 256;
116 to
->asrrnd_lut
[0][base
+6] = 128;
117 to
->asrrnd_lut
[0][base
+7] = 64;
118 to
->asrrnd_lut
[0][base
+8] = 32;
124 ia_css_iefd2_6_encode(
125 struct iefd2_6_dmem_params
*to
,
126 const struct ia_css_iefd2_6_config
*from
,
131 /* Copy parameters to dmem, as described in the KFS
133 to
->horver_diag_coeff
= from
->horver_diag_coeff
;
134 to
->ed_horver_diag_coeff
= from
->ed_horver_diag_coeff
;
135 to
->dir_smooth_enable
= from
->dir_smooth_enable
;
136 to
->dir_metric_update
= from
->dir_metric_update
;
137 to
->unsharp_c00
= from
->unsharp_c00
;
138 to
->unsharp_c01
= from
->unsharp_c01
;
139 to
->unsharp_c02
= from
->unsharp_c02
;
140 to
->unsharp_c11
= from
->unsharp_c11
;
141 to
->unsharp_c12
= from
->unsharp_c12
;
142 to
->unsharp_c22
= from
->unsharp_c22
;
143 to
->unsharp_weight
= from
->unsharp_weight
;
144 to
->unsharp_amount
= from
->unsharp_amount
;
145 to
->cu_dir_sharp_pow
= from
->cu_dir_sharp_pow
;
146 to
->cu_dir_sharp_pow_bright
= from
->cu_dir_sharp_pow_bright
;
147 to
->cu_non_dir_sharp_pow
= from
->cu_non_dir_sharp_pow
;
148 to
->cu_non_dir_sharp_pow_bright
= from
->cu_non_dir_sharp_pow_bright
;
149 to
->dir_far_sharp_weight
= from
->dir_far_sharp_weight
;
150 to
->rad_cu_dir_sharp_x1
= from
->rad_cu_dir_sharp_x1
;
151 to
->rad_cu_non_dir_sharp_x1
= from
->rad_cu_non_dir_sharp_x1
;
152 to
->rad_dir_far_sharp_weight
= from
->rad_dir_far_sharp_weight
;
153 to
->sharp_nega_lmt_txt
= from
->sharp_nega_lmt_txt
;
154 to
->sharp_posi_lmt_txt
= from
->sharp_posi_lmt_txt
;
155 to
->sharp_nega_lmt_dir
= from
->sharp_nega_lmt_dir
;
156 to
->sharp_posi_lmt_dir
= from
->sharp_posi_lmt_dir
;
157 to
->clamp_stitch
= from
->clamp_stitch
;
158 to
->rad_enable
= from
->rad_enable
;
159 to
->rad_x_origin
= from
->rad_x_origin
;
160 to
->rad_y_origin
= from
->rad_y_origin
;
161 to
->rad_nf
= from
->rad_nf
;
162 to
->rad_inv_r2
= from
->rad_inv_r2
;
163 to
->vssnlm_enable
= from
->vssnlm_enable
;
164 to
->vssnlm_x0
= from
->vssnlm_x0
;
165 to
->vssnlm_x1
= from
->vssnlm_x1
;
166 to
->vssnlm_x2
= from
->vssnlm_x2
;
167 to
->vssnlm_y1
= from
->vssnlm_y1
;
168 to
->vssnlm_y2
= from
->vssnlm_y2
;
169 to
->vssnlm_y3
= from
->vssnlm_y3
;
171 /* Setup for configurable units */
172 to
->e_cued2_a
= from
->cu_ed2_slopes_a
;
173 to
->e_cu_vssnlm_a
= from
->cu_vssnlm_slopes_a
;
174 to
->e_cued2_x1
= from
->cu_ed2_points_x
[0];
175 to
->e_cued2_x_diff
= from
->cu_ed2_points_x
[1] - from
->cu_ed2_points_x
[0];
176 to
->e_cu_vssnlm_x1
= from
->cu_vssnlm_points_x
[0];
177 to
->e_cu_vssnlm_x_diff
= from
->cu_vssnlm_points_x
[1] - from
->cu_vssnlm_points_x
[0];
180 /* TODO: AM: This needs a proper implementation. */
182 ia_css_init_iefd2_6_state(
190 #ifndef IA_CSS_NO_DEBUG
191 /* TODO: AM: This needs a proper implementation. */
193 ia_css_iefd2_6_debug_dtrace(
194 const struct ia_css_iefd2_6_config
*config
,