xref: /linux/drivers/staging/media/atomisp/pci/isp/kernels/de/de_1.0/ia_css_de.host.c (revision 3fd6c59042dbba50391e30862beac979491145fe)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  */
6 
7 #include "ia_css_types.h"
8 #include "sh_css_defs.h"
9 #include "ia_css_debug.h"
10 #include "sh_css_frac.h"
11 #include "ia_css_de.host.h"
12 
13 const struct ia_css_de_config default_de_config = {
14 	0,
15 	0,
16 	0
17 };
18 
19 void
ia_css_de_encode(struct sh_css_isp_de_params * to,const struct ia_css_de_config * from,unsigned int size)20 ia_css_de_encode(
21     struct sh_css_isp_de_params *to,
22     const struct ia_css_de_config *from,
23     unsigned int size)
24 {
25 	(void)size;
26 	to->pixelnoise =
27 	    uDIGIT_FITTING(from->pixelnoise, 16, SH_CSS_BAYER_BITS);
28 	to->c1_coring_threshold =
29 	    uDIGIT_FITTING(from->c1_coring_threshold, 16,
30 			   SH_CSS_BAYER_BITS);
31 	to->c2_coring_threshold =
32 	    uDIGIT_FITTING(from->c2_coring_threshold, 16,
33 			   SH_CSS_BAYER_BITS);
34 }
35 
36 void
ia_css_de_dump(const struct sh_css_isp_de_params * de,unsigned int level)37 ia_css_de_dump(
38     const struct sh_css_isp_de_params *de,
39     unsigned int level)
40 {
41 	if (!de)
42 		return;
43 	ia_css_debug_dtrace(level, "Demosaic:\n");
44 	ia_css_debug_dtrace(level, "\t%-32s = %d\n",
45 			    "de_pixelnoise", de->pixelnoise);
46 	ia_css_debug_dtrace(level, "\t%-32s = %d\n",
47 			    "de_c1_coring_threshold",
48 			    de->c1_coring_threshold);
49 	ia_css_debug_dtrace(level, "\t%-32s = %d\n",
50 			    "de_c2_coring_threshold",
51 			    de->c2_coring_threshold);
52 }
53 
54 void
ia_css_de_debug_dtrace(const struct ia_css_de_config * config,unsigned int level)55 ia_css_de_debug_dtrace(
56     const struct ia_css_de_config *config,
57     unsigned int level)
58 {
59 	ia_css_debug_dtrace(level,
60 			    "config.pixelnoise=%d, config.c1_coring_threshold=%d, config.c2_coring_threshold=%d\n",
61 			    config->pixelnoise,
62 			    config->c1_coring_threshold, config->c2_coring_threshold);
63 }
64 
65 void
ia_css_init_de_state(void * state,size_t size)66 ia_css_init_de_state(
67     void/*struct sh_css_isp_de_vmem_state*/ * state,
68     size_t size)
69 {
70 	memset(state, 0, size);
71 }
72