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 #ifndef IA_CSS_NO_DEBUG
19 /* FIXME: See BZ 4427 */
20 #include "ia_css_debug.h"
21 #endif
22 #include "csc/csc_1.0/ia_css_csc.host.h"
23 #include "vamem.h"
24 
25 #include "ia_css_gc2.host.h"
26 
27 const struct ia_css_cc_config default_yuv2rgb_cc_config = {
28 	12,
29 	{4096, -4096, 4096, 4096, 4096, 0, 4096, -4096, -4096}
30 };
31 
32 const struct ia_css_cc_config default_rgb2yuv_cc_config = {
33 	13,
34 	{2449, 4809, 934, -1382, -2714, 4096, 4096, -3430, -666}
35 };
36 
37 void
ia_css_yuv2rgb_encode(struct sh_css_isp_csc_params * to,const struct ia_css_cc_config * from,unsigned int size)38 ia_css_yuv2rgb_encode(
39     struct sh_css_isp_csc_params *to,
40     const struct ia_css_cc_config *from,
41     unsigned int size)
42 {
43 	ia_css_encode_cc(to, from, size);
44 }
45 
46 void
ia_css_rgb2yuv_encode(struct sh_css_isp_csc_params * to,const struct ia_css_cc_config * from,unsigned int size)47 ia_css_rgb2yuv_encode(
48     struct sh_css_isp_csc_params *to,
49     const struct ia_css_cc_config *from,
50     unsigned int size)
51 {
52 	ia_css_encode_cc(to, from, size);
53 }
54 
55 void
ia_css_r_gamma_vamem_encode(struct sh_css_isp_rgb_gamma_vamem_params * to,const struct ia_css_rgb_gamma_table * from,unsigned int size)56 ia_css_r_gamma_vamem_encode(
57     struct sh_css_isp_rgb_gamma_vamem_params *to,
58     const struct ia_css_rgb_gamma_table *from,
59     unsigned int size)
60 {
61 	(void)size;
62 	memcpy(&to->gc,  &from->data, sizeof(to->gc));
63 }
64 
65 void
ia_css_g_gamma_vamem_encode(struct sh_css_isp_rgb_gamma_vamem_params * to,const struct ia_css_rgb_gamma_table * from,unsigned int size)66 ia_css_g_gamma_vamem_encode(
67     struct sh_css_isp_rgb_gamma_vamem_params *to,
68     const struct ia_css_rgb_gamma_table *from,
69     unsigned int size)
70 {
71 	(void)size;
72 	memcpy(&to->gc,  &from->data, sizeof(to->gc));
73 }
74 
75 void
ia_css_b_gamma_vamem_encode(struct sh_css_isp_rgb_gamma_vamem_params * to,const struct ia_css_rgb_gamma_table * from,unsigned int size)76 ia_css_b_gamma_vamem_encode(
77     struct sh_css_isp_rgb_gamma_vamem_params *to,
78     const struct ia_css_rgb_gamma_table *from,
79     unsigned int size)
80 {
81 	(void)size;
82 	memcpy(&to->gc,  &from->data, sizeof(to->gc));
83 }
84 
85 #ifndef IA_CSS_NO_DEBUG
86 void
ia_css_yuv2rgb_dump(const struct sh_css_isp_csc_params * yuv2rgb,unsigned int level)87 ia_css_yuv2rgb_dump(
88     const struct sh_css_isp_csc_params *yuv2rgb,
89     unsigned int level)
90 {
91 	ia_css_cc_dump(yuv2rgb, level, "YUV to RGB Conversion");
92 }
93 
94 void
ia_css_rgb2yuv_dump(const struct sh_css_isp_csc_params * rgb2yuv,unsigned int level)95 ia_css_rgb2yuv_dump(
96     const struct sh_css_isp_csc_params *rgb2yuv,
97     unsigned int level)
98 {
99 	ia_css_cc_dump(rgb2yuv, level, "RGB to YUV Conversion");
100 }
101 
102 void
ia_css_rgb_gamma_table_debug_dtrace(const struct ia_css_rgb_gamma_table * config,unsigned int level)103 ia_css_rgb_gamma_table_debug_dtrace(
104     const struct ia_css_rgb_gamma_table *config,
105     unsigned int level)
106 {
107 	(void)config;
108 	(void)level;
109 }
110 #endif
111