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_debug.h"
17 #include "ia_css_tdf.host.h"
18 
19 static const s16 g_pyramid[8][8] = {
20 	{128, 384, 640, 896, 896, 640, 384, 128},
21 	{384, 1152, 1920, 2688, 2688, 1920, 1152, 384},
22 	{640, 1920, 3200, 4480, 4480, 3200, 1920, 640},
23 	{896, 2688, 4480, 6272, 6272, 4480, 2688, 896},
24 	{896, 2688, 4480, 6272, 6272, 4480, 2688, 896},
25 	{640, 1920, 3200, 4480, 4480, 3200, 1920, 640},
26 	{384, 1152, 1920, 2688, 2688, 1920, 1152, 384},
27 	{128, 384, 640, 896, 896, 640, 384, 128}
28 };
29 
30 void
31 ia_css_tdf_vmem_encode(
32     struct ia_css_isp_tdf_vmem_params *to,
33     const struct ia_css_tdf_config *from,
34     size_t size)
35 {
36 	unsigned int i;
37 	(void)size;
38 
39 	for (i = 0; i < ISP_VEC_NELEMS; i++) {
40 		to->pyramid[0][i]          = g_pyramid[i / 8][i % 8];
41 		to->threshold_flat[0][i]   = from->thres_flat_table[i];
42 		to->threshold_detail[0][i] = from->thres_detail_table[i];
43 	}
44 }
45 
46 void
47 ia_css_tdf_encode(
48     struct ia_css_isp_tdf_dmem_params *to,
49     const struct ia_css_tdf_config *from,
50     size_t size)
51 {
52 	(void)size;
53 	to->Epsilon_0        = from->epsilon_0;
54 	to->Epsilon_1        = from->epsilon_1;
55 	to->EpsScaleText     = from->eps_scale_text;
56 	to->EpsScaleEdge     = from->eps_scale_edge;
57 	to->Sepa_flat	     = from->sepa_flat;
58 	to->Sepa_Edge	     = from->sepa_edge;
59 	to->Blend_Flat	     = from->blend_flat;
60 	to->Blend_Text	     = from->blend_text;
61 	to->Blend_Edge	     = from->blend_edge;
62 	to->Shading_Gain     = from->shading_gain;
63 	to->Shading_baseGain = from->shading_base_gain;
64 	to->LocalY_Gain      = from->local_y_gain;
65 	to->LocalY_baseGain  = from->local_y_base_gain;
66 }
67 
68 void
69 ia_css_tdf_debug_dtrace(
70     const struct ia_css_tdf_config *config,
71     unsigned int level)
72 {
73 	(void)config;
74 	(void)level;
75 }
76