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 
19 #include "ia_css_cnr2.host.h"
20 
21 const struct ia_css_cnr_config default_cnr_config = {
22 	0,
23 	0,
24 	100,
25 	100,
26 	100,
27 	50,
28 	50,
29 	50
30 };
31 
32 void
33 ia_css_cnr_encode(
34     struct sh_css_isp_cnr_params *to,
35     const struct ia_css_cnr_config *from,
36     unsigned int size)
37 {
38 	(void)size;
39 	to->coring_u = from->coring_u;
40 	to->coring_v = from->coring_v;
41 	to->sense_gain_vy = from->sense_gain_vy;
42 	to->sense_gain_vu = from->sense_gain_vu;
43 	to->sense_gain_vv = from->sense_gain_vv;
44 	to->sense_gain_hy = from->sense_gain_hy;
45 	to->sense_gain_hu = from->sense_gain_hu;
46 	to->sense_gain_hv = from->sense_gain_hv;
47 }
48 
49 void
50 ia_css_cnr_dump(
51     const struct sh_css_isp_cnr_params *cnr,
52     unsigned int level);
53 
54 void
55 ia_css_cnr_debug_dtrace(
56     const struct ia_css_cnr_config *config,
57     unsigned int level)
58 {
59 	ia_css_debug_dtrace(level,
60 			    "config.coring_u=%d, config.coring_v=%d, config.sense_gain_vy=%d, config.sense_gain_hy=%d, config.sense_gain_vu=%d, config.sense_gain_hu=%d, config.sense_gain_vv=%d, config.sense_gain_hv=%d\n",
61 			    config->coring_u, config->coring_v,
62 			    config->sense_gain_vy, config->sense_gain_hy,
63 			    config->sense_gain_vu, config->sense_gain_hu,
64 			    config->sense_gain_vv, config->sense_gain_hv);
65 }
66 
67 void
68 ia_css_init_cnr2_state(
69     void/*struct sh_css_isp_cnr_vmem_state*/ * state,
70     size_t size)
71 {
72 	memset(state, 0, size);
73 }
74