GNU Linux-libre 4.14.332-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / de / de_1.0 / ia_css_de.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 "sh_css_frac.h"
19 #include "ia_css_de.host.h"
20
21 const struct ia_css_de_config default_de_config = {
22         0,
23         0,
24         0
25 };
26
27 void
28 ia_css_de_encode(
29         struct sh_css_isp_de_params *to,
30         const struct ia_css_de_config *from,
31         unsigned size)
32 {
33         (void)size;
34         to->pixelnoise =
35             uDIGIT_FITTING(from->pixelnoise, 16, SH_CSS_BAYER_BITS);
36         to->c1_coring_threshold =
37             uDIGIT_FITTING(from->c1_coring_threshold, 16,
38                            SH_CSS_BAYER_BITS);
39         to->c2_coring_threshold =
40             uDIGIT_FITTING(from->c2_coring_threshold, 16,
41                            SH_CSS_BAYER_BITS);
42 }
43
44 void
45 ia_css_de_dump(
46         const struct sh_css_isp_de_params *de,
47         unsigned level)
48 {
49         if (!de) return;
50         ia_css_debug_dtrace(level, "Demosaic:\n");
51         ia_css_debug_dtrace(level, "\t%-32s = %d\n",
52                         "de_pixelnoise", de->pixelnoise);
53         ia_css_debug_dtrace(level, "\t%-32s = %d\n",
54                         "de_c1_coring_threshold",
55                         de->c1_coring_threshold);
56         ia_css_debug_dtrace(level, "\t%-32s = %d\n",
57                         "de_c2_coring_threshold",
58                         de->c2_coring_threshold);
59 }
60
61 void
62 ia_css_de_debug_dtrace(
63         const struct ia_css_de_config *config,
64         unsigned level)
65 {
66         ia_css_debug_dtrace(level,
67                 "config.pixelnoise=%d, "
68                 "config.c1_coring_threshold=%d, config.c2_coring_threshold=%d\n",
69                 config->pixelnoise,
70                 config->c1_coring_threshold, config->c2_coring_threshold);
71 }
72
73 void
74 ia_css_init_de_state(
75         void/*struct sh_css_isp_de_vmem_state*/ *state,
76         size_t size)
77 {
78         memset(state, 0, size);
79 }