2 * linux/drivers/video/omap2/dss/dispc_coefs.c
4 * Copyright (C) 2011 Texas Instruments
5 * Author: Chandrabhanu Mahapatra <cmahapatra@ti.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <linux/kernel.h>
21 #include <video/omapfb_dss.h>
25 static const struct dispc_coef coef3_M8
[8] = {
28 { 0, -4, 108, 24, 0 },
32 { 0, 24, 108, -4, 0 },
36 static const struct dispc_coef coef3_M9
[8] = {
39 { 0, -2, 100, 30, 0 },
43 { 0, 30, 100, -2, 0 },
47 static const struct dispc_coef coef3_M10
[8] = {
48 { 0, 10, 108, 10, 0 },
58 static const struct dispc_coef coef3_M11
[8] = {
59 { 0, 14, 100, 14, 0 },
69 static const struct dispc_coef coef3_M12
[8] = {
80 static const struct dispc_coef coef3_M13
[8] = {
91 static const struct dispc_coef coef3_M14
[8] = {
102 static const struct dispc_coef coef3_M16
[8] = {
103 { 0, 22, 84, 22, 0 },
104 { 0, 14, 82, 32, 0 },
110 { 0, 32, 82, 14, 0 },
113 static const struct dispc_coef coef3_M19
[8] = {
114 { 0, 24, 80, 24, 0 },
115 { 0, 16, 79, 33, 0 },
121 { 0, 33, 79, 16, 0 },
124 static const struct dispc_coef coef3_M22
[8] = {
125 { 0, 25, 78, 25, 0 },
126 { 0, 17, 77, 34, 0 },
127 { 0, 10, 74, 44, 0 },
131 { 0, 44, 74, 10, 0 },
132 { 0, 34, 77, 17, 0 },
135 static const struct dispc_coef coef3_M26
[8] = {
136 { 0, 26, 76, 26, 0 },
137 { 0, 19, 74, 35, 0 },
138 { 0, 11, 72, 45, 0 },
142 { 0, 45, 72, 11, 0 },
143 { 0, 35, 74, 19, 0 },
146 static const struct dispc_coef coef3_M32
[8] = {
147 { 0, 27, 74, 27, 0 },
148 { 0, 19, 73, 36, 0 },
149 { 0, 12, 71, 45, 0 },
153 { 0, 45, 71, 12, 0 },
154 { 0, 36, 73, 19, 0 },
157 static const struct dispc_coef coef5_M8
[8] = {
159 { -2, 14, 125, -10, 1 },
160 { -6, 33, 114, -15, 2 },
161 { -10, 55, 98, -16, 1 },
162 { 0, -14, 78, 78, -14 },
163 { 1, -16, 98, 55, -10 },
164 { 2, -15, 114, 33, -6 },
165 { 1, -10, 125, 14, -2 },
168 static const struct dispc_coef coef5_M9
[8] = {
169 { -3, 10, 114, 10, -3 },
170 { -6, 24, 111, 0, -1 },
171 { -8, 40, 103, -7, 0 },
172 { -11, 58, 91, -11, 1 },
173 { 0, -12, 76, 76, -12 },
174 { 1, -11, 91, 58, -11 },
175 { 0, -7, 103, 40, -8 },
176 { -1, 0, 111, 24, -6 },
179 static const struct dispc_coef coef5_M10
[8] = {
180 { -4, 18, 100, 18, -4 },
181 { -6, 30, 99, 8, -3 },
182 { -8, 44, 93, 0, -1 },
183 { -9, 58, 84, -5, 0 },
184 { 0, -8, 72, 72, -8 },
185 { 0, -5, 84, 58, -9 },
186 { -1, 0, 93, 44, -8 },
187 { -3, 8, 99, 30, -6 },
190 static const struct dispc_coef coef5_M11
[8] = {
191 { -5, 23, 92, 23, -5 },
192 { -6, 34, 90, 13, -3 },
193 { -6, 45, 85, 6, -2 },
194 { -6, 57, 78, 0, -1 },
195 { 0, -4, 68, 68, -4 },
196 { -1, 0, 78, 57, -6 },
197 { -2, 6, 85, 45, -6 },
198 { -3, 13, 90, 34, -6 },
201 static const struct dispc_coef coef5_M12
[8] = {
202 { -4, 26, 84, 26, -4 },
203 { -5, 36, 82, 18, -3 },
204 { -4, 46, 78, 10, -2 },
205 { -3, 55, 72, 5, -1 },
207 { -1, 5, 72, 55, -3 },
208 { -2, 10, 78, 46, -4 },
209 { -3, 18, 82, 36, -5 },
212 static const struct dispc_coef coef5_M13
[8] = {
213 { -3, 28, 78, 28, -3 },
214 { -3, 37, 76, 21, -3 },
215 { -2, 45, 73, 14, -2 },
216 { 0, 53, 68, 8, -1 },
218 { -1, 8, 68, 53, 0 },
219 { -2, 14, 73, 45, -2 },
220 { -3, 21, 76, 37, -3 },
223 static const struct dispc_coef coef5_M14
[8] = {
224 { -2, 30, 72, 30, -2 },
225 { -1, 37, 71, 23, -2 },
226 { 0, 45, 69, 16, -2 },
227 { 3, 52, 64, 10, -1 },
229 { -1, 10, 64, 52, 3 },
230 { -2, 16, 69, 45, 0 },
231 { -2, 23, 71, 37, -1 },
234 static const struct dispc_coef coef5_M16
[8] = {
235 { 0, 31, 66, 31, 0 },
236 { 1, 38, 65, 25, -1 },
237 { 3, 44, 62, 20, -1 },
238 { 6, 49, 59, 14, 0 },
239 { 0, 10, 54, 54, 10 },
240 { 0, 14, 59, 49, 6 },
241 { -1, 20, 62, 44, 3 },
242 { -1, 25, 65, 38, 1 },
245 static const struct dispc_coef coef5_M19
[8] = {
246 { 3, 32, 58, 32, 3 },
247 { 4, 38, 58, 27, 1 },
248 { 7, 42, 55, 23, 1 },
249 { 10, 46, 54, 18, 0 },
250 { 0, 14, 50, 50, 14 },
251 { 0, 18, 54, 46, 10 },
252 { 1, 23, 55, 42, 7 },
253 { 1, 27, 58, 38, 4 },
256 static const struct dispc_coef coef5_M22
[8] = {
257 { 4, 33, 54, 33, 4 },
258 { 6, 37, 54, 28, 3 },
259 { 9, 41, 53, 24, 1 },
260 { 12, 45, 51, 20, 0 },
261 { 0, 16, 48, 48, 16 },
262 { 0, 20, 51, 45, 12 },
263 { 1, 24, 53, 41, 9 },
264 { 3, 28, 54, 37, 6 },
267 static const struct dispc_coef coef5_M26
[8] = {
268 { 6, 33, 50, 33, 6 },
269 { 8, 36, 51, 29, 4 },
270 { 11, 40, 50, 25, 2 },
271 { 14, 43, 48, 22, 1 },
272 { 0, 18, 46, 46, 18 },
273 { 1, 22, 48, 43, 14 },
274 { 2, 25, 50, 40, 11 },
275 { 4, 29, 51, 36, 8 },
278 static const struct dispc_coef coef5_M32
[8] = {
279 { 7, 33, 48, 33, 7 },
280 { 10, 36, 48, 29, 5 },
281 { 13, 39, 47, 26, 3 },
282 { 16, 42, 46, 23, 1 },
283 { 0, 19, 45, 45, 19 },
284 { 1, 23, 46, 42, 16 },
285 { 3, 26, 47, 39, 13 },
286 { 5, 29, 48, 36, 10 },
289 const struct dispc_coef
*dispc_ovl_get_scale_coef(int inc
, int five_taps
)
292 static const struct {
295 const struct dispc_coef
*coef_3
;
296 const struct dispc_coef
*coef_5
;
298 { 27, 32, coef3_M32
, coef5_M32
},
299 { 23, 26, coef3_M26
, coef5_M26
},
300 { 20, 22, coef3_M22
, coef5_M22
},
301 { 17, 19, coef3_M19
, coef5_M19
},
302 { 15, 16, coef3_M16
, coef5_M16
},
303 { 14, 14, coef3_M14
, coef5_M14
},
304 { 13, 13, coef3_M13
, coef5_M13
},
305 { 12, 12, coef3_M12
, coef5_M12
},
306 { 11, 11, coef3_M11
, coef5_M11
},
307 { 10, 10, coef3_M10
, coef5_M10
},
308 { 9, 9, coef3_M9
, coef5_M9
},
309 { 4, 8, coef3_M8
, coef5_M8
},
311 * When upscaling more than two times, blockiness and outlines
312 * around the image are observed when M8 tables are used. M11,
313 * M16 and M19 tables are used to prevent this.
315 { 3, 3, coef3_M11
, coef5_M11
},
316 { 2, 2, coef3_M16
, coef5_M16
},
317 { 0, 1, coef3_M19
, coef5_M19
},
321 for (i
= 0; i
< ARRAY_SIZE(coefs
); ++i
)
322 if (inc
>= coefs
[i
].Mmin
&& inc
<= coefs
[i
].Mmax
)
323 return five_taps
? coefs
[i
].coef_5
: coefs
[i
].coef_3
;