GNU Linux-libre 4.14.262-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / tdf / tdf_1.0 / ia_css_tdf.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_debug.h"
16 #include "ia_css_tdf.host.h"
17
18 const int16_t g_pyramid[8][8] = {
19 {128, 384, 640, 896, 896, 640, 384, 128},
20 {384, 1152, 1920, 2688, 2688, 1920, 1152, 384},
21 {640, 1920, 3200, 4480, 4480, 3200, 1920, 640},
22 {896, 2688, 4480, 6272, 6272, 4480, 2688, 896},
23 {896, 2688, 4480, 6272, 6272, 4480, 2688, 896},
24 {640, 1920, 3200, 4480, 4480, 3200, 1920, 640},
25 {384, 1152, 1920, 2688, 2688, 1920, 1152, 384},
26 {128, 384, 640, 896, 896, 640, 384, 128}
27 };
28
29 void
30 ia_css_tdf_vmem_encode(
31         struct ia_css_isp_tdf_vmem_params *to,
32         const struct ia_css_tdf_config *from,
33         size_t size)
34 {
35         unsigned i;
36         (void)size;
37
38         for (i = 0; i < ISP_VEC_NELEMS; i++) {
39                 to->pyramid[0][i]          = g_pyramid[i/8][i%8];
40                 to->threshold_flat[0][i]   = from->thres_flat_table[i];
41                 to->threshold_detail[0][i] = from->thres_detail_table[i];
42         }
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 level)
72 {
73         (void)config;
74         (void)level;
75 }
76