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 "assert_support.h"
20
21 #include "ia_css_ctc.host.h"
22
23 const struct ia_css_ctc_config default_ctc_config = {
24 ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2, /* 0.5 */
25 ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2, /* 0.5 */
26 ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2, /* 0.5 */
27 ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2, /* 0.5 */
28 ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2, /* 0.5 */
29 ((1 << IA_CSS_CTC_COEF_SHIFT) + 1) / 2, /* 0.5 */
30 1,
31 SH_CSS_BAYER_MAXVAL / 5, /* To be implemented */
32 SH_CSS_BAYER_MAXVAL * 2 / 5, /* To be implemented */
33 SH_CSS_BAYER_MAXVAL * 3 / 5, /* To be implemented */
34 SH_CSS_BAYER_MAXVAL * 4 / 5, /* To be implemented */
35 };
36
37 void
ia_css_ctc_vamem_encode(struct sh_css_isp_ctc_vamem_params * to,const struct ia_css_ctc_table * from,unsigned int size)38 ia_css_ctc_vamem_encode(
39 struct sh_css_isp_ctc_vamem_params *to,
40 const struct ia_css_ctc_table *from,
41 unsigned int size)
42 {
43 (void)size;
44 memcpy(&to->ctc, &from->data, sizeof(to->ctc));
45 }
46
47 void
ia_css_ctc_debug_dtrace(const struct ia_css_ctc_config * config,unsigned int level)48 ia_css_ctc_debug_dtrace(
49 const struct ia_css_ctc_config *config,
50 unsigned int level)
51 {
52 ia_css_debug_dtrace(level,
53 "config.ce_gain_exp=%d, config.y0=%d, config.x1=%d, config.y1=%d, config.x2=%d, config.y2=%d, config.x3=%d, config.y3=%d, config.x4=%d, config.y4=%d\n",
54 config->ce_gain_exp, config->y0,
55 config->x1, config->y1,
56 config->x2, config->y2,
57 config->x3, config->y3,
58 config->x4, config->y4);
59 }
60