xref: /linux/drivers/staging/media/atomisp/pci/isp/kernels/de/de_1.0/ia_css_de.host.c (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 
16 #include "ia_css_types.h"
17 #include "sh_css_defs.h"
18 #include "ia_css_debug.h"
19 #include "sh_css_frac.h"
20 #include "ia_css_de.host.h"
21 
22 const struct ia_css_de_config default_de_config = {
23 	0,
24 	0,
25 	0
26 };
27 
28 void
ia_css_de_encode(struct sh_css_isp_de_params * to,const struct ia_css_de_config * from,unsigned int size)29 ia_css_de_encode(
30     struct sh_css_isp_de_params *to,
31     const struct ia_css_de_config *from,
32     unsigned int size)
33 {
34 	(void)size;
35 	to->pixelnoise =
36 	    uDIGIT_FITTING(from->pixelnoise, 16, SH_CSS_BAYER_BITS);
37 	to->c1_coring_threshold =
38 	    uDIGIT_FITTING(from->c1_coring_threshold, 16,
39 			   SH_CSS_BAYER_BITS);
40 	to->c2_coring_threshold =
41 	    uDIGIT_FITTING(from->c2_coring_threshold, 16,
42 			   SH_CSS_BAYER_BITS);
43 }
44 
45 void
ia_css_de_dump(const struct sh_css_isp_de_params * de,unsigned int level)46 ia_css_de_dump(
47     const struct sh_css_isp_de_params *de,
48     unsigned int level)
49 {
50 	if (!de)
51 		return;
52 	ia_css_debug_dtrace(level, "Demosaic:\n");
53 	ia_css_debug_dtrace(level, "\t%-32s = %d\n",
54 			    "de_pixelnoise", de->pixelnoise);
55 	ia_css_debug_dtrace(level, "\t%-32s = %d\n",
56 			    "de_c1_coring_threshold",
57 			    de->c1_coring_threshold);
58 	ia_css_debug_dtrace(level, "\t%-32s = %d\n",
59 			    "de_c2_coring_threshold",
60 			    de->c2_coring_threshold);
61 }
62 
63 void
ia_css_de_debug_dtrace(const struct ia_css_de_config * config,unsigned int level)64 ia_css_de_debug_dtrace(
65     const struct ia_css_de_config *config,
66     unsigned int level)
67 {
68 	ia_css_debug_dtrace(level,
69 			    "config.pixelnoise=%d, config.c1_coring_threshold=%d, config.c2_coring_threshold=%d\n",
70 			    config->pixelnoise,
71 			    config->c1_coring_threshold, config->c2_coring_threshold);
72 }
73 
74 void
ia_css_init_de_state(void * state,size_t size)75 ia_css_init_de_state(
76     void/*struct sh_css_isp_de_vmem_state*/ * state,
77     size_t size)
78 {
79 	memset(state, 0, size);
80 }
81