]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr2.host.c
staging/atomisp: Add support for the Intel IPU v2
[mirror_ubuntu-hirsute-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / ynr / ynr_2 / ia_css_ynr2.host.c
1 /*
2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
4 *
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.
8 *
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
12 * more details.
13 */
14
15 #include "ia_css_types.h"
16 #include "sh_css_defs.h"
17 #include "ia_css_debug.h"
18 #include "assert_support.h"
19
20 #include "ia_css_ynr2.host.h"
21
22 const struct ia_css_ynr_config default_ynr_config = {
23 0,
24 0,
25 0,
26 0,
27 };
28
29 const struct ia_css_fc_config default_fc_config = {
30 1,
31 0, /* 0 -> ineffective */
32 0, /* 0 -> ineffective */
33 0, /* 0 -> ineffective */
34 0, /* 0 -> ineffective */
35 (1 << (ISP_VEC_ELEMBITS - 2)), /* 0.5 */
36 (1 << (ISP_VEC_ELEMBITS - 2)), /* 0.5 */
37 (1 << (ISP_VEC_ELEMBITS - 2)), /* 0.5 */
38 (1 << (ISP_VEC_ELEMBITS - 2)), /* 0.5 */
39 (1 << (ISP_VEC_ELEMBITS - 1)) - 1, /* 1 */
40 (1 << (ISP_VEC_ELEMBITS - 1)) - 1, /* 1 */
41 (int16_t)- (1 << (ISP_VEC_ELEMBITS - 1)), /* -1 */
42 (int16_t)- (1 << (ISP_VEC_ELEMBITS - 1)), /* -1 */
43 };
44
45 void
46 ia_css_ynr_encode(
47 struct sh_css_isp_yee2_params *to,
48 const struct ia_css_ynr_config *from,
49 unsigned size)
50 {
51 (void)size;
52 to->edge_sense_gain_0 = from->edge_sense_gain_0;
53 to->edge_sense_gain_1 = from->edge_sense_gain_1;
54 to->corner_sense_gain_0 = from->corner_sense_gain_0;
55 to->corner_sense_gain_1 = from->corner_sense_gain_1;
56 }
57
58 void
59 ia_css_fc_encode(
60 struct sh_css_isp_fc_params *to,
61 const struct ia_css_fc_config *from,
62 unsigned size)
63 {
64 (void)size;
65 to->gain_exp = from->gain_exp;
66
67 to->coring_pos_0 = from->coring_pos_0;
68 to->coring_pos_1 = from->coring_pos_1;
69 to->coring_neg_0 = from->coring_neg_0;
70 to->coring_neg_1 = from->coring_neg_1;
71
72 to->gain_pos_0 = from->gain_pos_0;
73 to->gain_pos_1 = from->gain_pos_1;
74 to->gain_neg_0 = from->gain_neg_0;
75 to->gain_neg_1 = from->gain_neg_1;
76
77 to->crop_pos_0 = from->crop_pos_0;
78 to->crop_pos_1 = from->crop_pos_1;
79 to->crop_neg_0 = from->crop_neg_0;
80 to->crop_neg_1 = from->crop_neg_1;
81 }
82
83 void
84 ia_css_ynr_dump(
85 const struct sh_css_isp_yee2_params *yee2,
86 unsigned level);
87
88 void
89 ia_css_fc_dump(
90 const struct sh_css_isp_fc_params *fc,
91 unsigned level);
92
93 void
94 ia_css_fc_debug_dtrace(
95 const struct ia_css_fc_config *config,
96 unsigned level)
97 {
98 ia_css_debug_dtrace(level,
99 "config.gain_exp=%d, "
100 "config.coring_pos_0=%d, config.coring_pos_1=%d, "
101 "config.coring_neg_0=%d, config.coring_neg_1=%d, "
102 "config.gain_pos_0=%d, config.gain_pos_1=%d, "
103 "config.gain_neg_0=%d, config.gain_neg_1=%d, "
104 "config.crop_pos_0=%d, config.crop_pos_1=%d, "
105 "config.crop_neg_0=%d, config.crop_neg_1=%d\n",
106 config->gain_exp,
107 config->coring_pos_0, config->coring_pos_1,
108 config->coring_neg_0, config->coring_neg_1,
109 config->gain_pos_0, config->gain_pos_1,
110 config->gain_neg_0, config->gain_neg_1,
111 config->crop_pos_0, config->crop_pos_1,
112 config->crop_neg_0, config->crop_neg_1);
113 }
114
115 void
116 ia_css_ynr_debug_dtrace(
117 const struct ia_css_ynr_config *config,
118 unsigned level)
119 {
120 ia_css_debug_dtrace(level,
121 "config.edge_sense_gain_0=%d, config.edge_sense_gain_1=%d, "
122 "config.corner_sense_gain_0=%d, config.corner_sense_gain_1=%d\n",
123 config->edge_sense_gain_0, config->edge_sense_gain_1,
124 config->corner_sense_gain_0, config->corner_sense_gain_1);
125 }