aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/omap2/dss/Makefile4
-rw-r--r--drivers/video/omap2/dss/dispc.c137
-rw-r--r--drivers/video/omap2/dss/dispc.h11
-rw-r--r--drivers/video/omap2/dss/dispc_coefs.c326
4 files changed, 358 insertions, 120 deletions
diff --git a/drivers/video/omap2/dss/Makefile b/drivers/video/omap2/dss/Makefile
index 8594522184d9..5c450b0f94d0 100644
--- a/drivers/video/omap2/dss/Makefile
+++ b/drivers/video/omap2/dss/Makefile
@@ -1,6 +1,6 @@
1obj-$(CONFIG_OMAP2_DSS) += omapdss.o 1obj-$(CONFIG_OMAP2_DSS) += omapdss.o
2omapdss-y := core.o dss.o dss_features.o dispc.o display.o manager.o overlay.o \ 2omapdss-y := core.o dss.o dss_features.o dispc.o dispc_coefs.o display.o \
3 apply.o 3 manager.o overlay.o apply.o
4omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o 4omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
5omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o 5omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o
6omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o 6omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 4d684282b201..78e51d953629 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -64,22 +64,6 @@ struct omap_dispc_isr_data {
64 u32 mask; 64 u32 mask;
65}; 65};
66 66
67struct dispc_h_coef {
68 s8 hc4;
69 s8 hc3;
70 u8 hc2;
71 s8 hc1;
72 s8 hc0;
73};
74
75struct dispc_v_coef {
76 s8 vc22;
77 s8 vc2;
78 u8 vc1;
79 s8 vc0;
80 s8 vc00;
81};
82
83enum omap_burst_size { 67enum omap_burst_size {
84 BURST_SIZE_X2 = 0, 68 BURST_SIZE_X2 = 0,
85 BURST_SIZE_X4 = 1, 69 BURST_SIZE_X4 = 1,
@@ -561,105 +545,27 @@ static void dispc_ovl_write_firv2_reg(enum omap_plane plane, int reg, u32 value)
561 dispc_write_reg(DISPC_OVL_FIR_COEF_V2(plane, reg), value); 545 dispc_write_reg(DISPC_OVL_FIR_COEF_V2(plane, reg), value);
562} 546}
563 547
564static void dispc_ovl_set_scale_coef(enum omap_plane plane, int hscaleup, 548static void dispc_ovl_set_scale_coef(enum omap_plane plane, int fir_hinc,
565 int vscaleup, int five_taps, 549 int fir_vinc, int five_taps,
566 enum omap_color_component color_comp) 550 enum omap_color_component color_comp)
567{ 551{
568 /* Coefficients for horizontal up-sampling */ 552 const struct dispc_coef *h_coef, *v_coef;
569 static const struct dispc_h_coef coef_hup[8] = {
570 { 0, 0, 128, 0, 0 },
571 { -1, 13, 124, -8, 0 },
572 { -2, 30, 112, -11, -1 },
573 { -5, 51, 95, -11, -2 },
574 { 0, -9, 73, 73, -9 },
575 { -2, -11, 95, 51, -5 },
576 { -1, -11, 112, 30, -2 },
577 { 0, -8, 124, 13, -1 },
578 };
579
580 /* Coefficients for vertical up-sampling */
581 static const struct dispc_v_coef coef_vup_3tap[8] = {
582 { 0, 0, 128, 0, 0 },
583 { 0, 3, 123, 2, 0 },
584 { 0, 12, 111, 5, 0 },
585 { 0, 32, 89, 7, 0 },
586 { 0, 0, 64, 64, 0 },
587 { 0, 7, 89, 32, 0 },
588 { 0, 5, 111, 12, 0 },
589 { 0, 2, 123, 3, 0 },
590 };
591
592 static const struct dispc_v_coef coef_vup_5tap[8] = {
593 { 0, 0, 128, 0, 0 },
594 { -1, 13, 124, -8, 0 },
595 { -2, 30, 112, -11, -1 },
596 { -5, 51, 95, -11, -2 },
597 { 0, -9, 73, 73, -9 },
598 { -2, -11, 95, 51, -5 },
599 { -1, -11, 112, 30, -2 },
600 { 0, -8, 124, 13, -1 },
601 };
602
603 /* Coefficients for horizontal down-sampling */
604 static const struct dispc_h_coef coef_hdown[8] = {
605 { 0, 36, 56, 36, 0 },
606 { 4, 40, 55, 31, -2 },
607 { 8, 44, 54, 27, -5 },
608 { 12, 48, 53, 22, -7 },
609 { -9, 17, 52, 51, 17 },
610 { -7, 22, 53, 48, 12 },
611 { -5, 27, 54, 44, 8 },
612 { -2, 31, 55, 40, 4 },
613 };
614
615 /* Coefficients for vertical down-sampling */
616 static const struct dispc_v_coef coef_vdown_3tap[8] = {
617 { 0, 36, 56, 36, 0 },
618 { 0, 40, 57, 31, 0 },
619 { 0, 45, 56, 27, 0 },
620 { 0, 50, 55, 23, 0 },
621 { 0, 18, 55, 55, 0 },
622 { 0, 23, 55, 50, 0 },
623 { 0, 27, 56, 45, 0 },
624 { 0, 31, 57, 40, 0 },
625 };
626
627 static const struct dispc_v_coef coef_vdown_5tap[8] = {
628 { 0, 36, 56, 36, 0 },
629 { 4, 40, 55, 31, -2 },
630 { 8, 44, 54, 27, -5 },
631 { 12, 48, 53, 22, -7 },
632 { -9, 17, 52, 51, 17 },
633 { -7, 22, 53, 48, 12 },
634 { -5, 27, 54, 44, 8 },
635 { -2, 31, 55, 40, 4 },
636 };
637
638 const struct dispc_h_coef *h_coef;
639 const struct dispc_v_coef *v_coef;
640 int i; 553 int i;
641 554
642 if (hscaleup) 555 h_coef = dispc_ovl_get_scale_coef(fir_hinc, true);
643 h_coef = coef_hup; 556 v_coef = dispc_ovl_get_scale_coef(fir_vinc, five_taps);
644 else
645 h_coef = coef_hdown;
646
647 if (vscaleup)
648 v_coef = five_taps ? coef_vup_5tap : coef_vup_3tap;
649 else
650 v_coef = five_taps ? coef_vdown_5tap : coef_vdown_3tap;
651 557
652 for (i = 0; i < 8; i++) { 558 for (i = 0; i < 8; i++) {
653 u32 h, hv; 559 u32 h, hv;
654 560
655 h = FLD_VAL(h_coef[i].hc0, 7, 0) 561 h = FLD_VAL(h_coef[i].hc0_vc00, 7, 0)
656 | FLD_VAL(h_coef[i].hc1, 15, 8) 562 | FLD_VAL(h_coef[i].hc1_vc0, 15, 8)
657 | FLD_VAL(h_coef[i].hc2, 23, 16) 563 | FLD_VAL(h_coef[i].hc2_vc1, 23, 16)
658 | FLD_VAL(h_coef[i].hc3, 31, 24); 564 | FLD_VAL(h_coef[i].hc3_vc2, 31, 24);
659 hv = FLD_VAL(h_coef[i].hc4, 7, 0) 565 hv = FLD_VAL(h_coef[i].hc4_vc22, 7, 0)
660 | FLD_VAL(v_coef[i].vc0, 15, 8) 566 | FLD_VAL(v_coef[i].hc1_vc0, 15, 8)
661 | FLD_VAL(v_coef[i].vc1, 23, 16) 567 | FLD_VAL(v_coef[i].hc2_vc1, 23, 16)
662 | FLD_VAL(v_coef[i].vc2, 31, 24); 568 | FLD_VAL(v_coef[i].hc3_vc2, 31, 24);
663 569
664 if (color_comp == DISPC_COLOR_COMPONENT_RGB_Y) { 570 if (color_comp == DISPC_COLOR_COMPONENT_RGB_Y) {
665 dispc_ovl_write_firh_reg(plane, i, h); 571 dispc_ovl_write_firh_reg(plane, i, h);
@@ -674,8 +580,8 @@ static void dispc_ovl_set_scale_coef(enum omap_plane plane, int hscaleup,
674 if (five_taps) { 580 if (five_taps) {
675 for (i = 0; i < 8; i++) { 581 for (i = 0; i < 8; i++) {
676 u32 v; 582 u32 v;
677 v = FLD_VAL(v_coef[i].vc00, 7, 0) 583 v = FLD_VAL(v_coef[i].hc0_vc00, 7, 0)
678 | FLD_VAL(v_coef[i].vc22, 15, 8); 584 | FLD_VAL(v_coef[i].hc4_vc22, 15, 8);
679 if (color_comp == DISPC_COLOR_COMPONENT_RGB_Y) 585 if (color_comp == DISPC_COLOR_COMPONENT_RGB_Y)
680 dispc_ovl_write_firv_reg(plane, i, v); 586 dispc_ovl_write_firv_reg(plane, i, v);
681 else 587 else
@@ -1228,17 +1134,12 @@ static void dispc_ovl_set_scale_param(enum omap_plane plane,
1228 enum omap_color_component color_comp) 1134 enum omap_color_component color_comp)
1229{ 1135{
1230 int fir_hinc, fir_vinc; 1136 int fir_hinc, fir_vinc;
1231 int hscaleup, vscaleup;
1232
1233 hscaleup = orig_width <= out_width;
1234 vscaleup = orig_height <= out_height;
1235
1236 dispc_ovl_set_scale_coef(plane, hscaleup, vscaleup, five_taps,
1237 color_comp);
1238 1137
1239 fir_hinc = 1024 * orig_width / out_width; 1138 fir_hinc = 1024 * orig_width / out_width;
1240 fir_vinc = 1024 * orig_height / out_height; 1139 fir_vinc = 1024 * orig_height / out_height;
1241 1140
1141 dispc_ovl_set_scale_coef(plane, fir_hinc, fir_vinc, five_taps,
1142 color_comp);
1242 dispc_ovl_set_fir(plane, fir_hinc, fir_vinc, color_comp); 1143 dispc_ovl_set_fir(plane, fir_hinc, fir_vinc, color_comp);
1243} 1144}
1244 1145
diff --git a/drivers/video/omap2/dss/dispc.h b/drivers/video/omap2/dss/dispc.h
index c06efc38983e..5836bd1650f9 100644
--- a/drivers/video/omap2/dss/dispc.h
+++ b/drivers/video/omap2/dss/dispc.h
@@ -97,6 +97,17 @@
97#define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \ 97#define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \
98 DISPC_PRELOAD_OFFSET(n)) 98 DISPC_PRELOAD_OFFSET(n))
99 99
100/* DISPC up/downsampling FIR filter coefficient structure */
101struct dispc_coef {
102 s8 hc4_vc22;
103 s8 hc3_vc2;
104 u8 hc2_vc1;
105 s8 hc1_vc0;
106 s8 hc0_vc00;
107};
108
109const struct dispc_coef *dispc_ovl_get_scale_coef(int inc, int five_taps);
110
100/* DISPC manager/channel specific registers */ 111/* DISPC manager/channel specific registers */
101static inline u16 DISPC_DEFAULT_COLOR(enum omap_channel channel) 112static inline u16 DISPC_DEFAULT_COLOR(enum omap_channel channel)
102{ 113{
diff --git a/drivers/video/omap2/dss/dispc_coefs.c b/drivers/video/omap2/dss/dispc_coefs.c
new file mode 100644
index 000000000000..069bccbb3f12
--- /dev/null
+++ b/drivers/video/omap2/dss/dispc_coefs.c
@@ -0,0 +1,326 @@
1/*
2 * linux/drivers/video/omap2/dss/dispc_coefs.c
3 *
4 * Copyright (C) 2011 Texas Instruments
5 * Author: Chandrabhanu Mahapatra <cmahapatra@ti.com>
6 *
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.
10 *
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
14 * more details.
15 *
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/>.
18 */
19
20#include <linux/kernel.h>
21#include <video/omapdss.h>
22#include "dispc.h"
23
24#define ARRAY_LEN(array) (sizeof(array) / sizeof(array[0]))
25
26static const struct dispc_coef coef3_M8[8] = {
27 { 0, 0, 128, 0, 0 },
28 { 0, -4, 123, 9, 0 },
29 { 0, -4, 108, 87, 0 },
30 { 0, -2, 87, 43, 0 },
31 { 0, 64, 64, 0, 0 },
32 { 0, 43, 87, -2, 0 },
33 { 0, 24, 108, -4, 0 },
34 { 0, 9, 123, -4, 0 },
35};
36
37static const struct dispc_coef coef3_M9[8] = {
38 { 0, 6, 116, 6, 0 },
39 { 0, 0, 112, 16, 0 },
40 { 0, -2, 100, 30, 0 },
41 { 0, -2, 83, 47, 0 },
42 { 0, 64, 64, 0, 0 },
43 { 0, 47, 83, -2, 0 },
44 { 0, 30, 100, -2, 0 },
45 { 0, 16, 112, 0, 0 },
46};
47
48static const struct dispc_coef coef3_M10[8] = {
49 { 0, 10, 108, 10, 0 },
50 { 0, 3, 104, 21, 0 },
51 { 0, 0, 94, 34, 0 },
52 { 0, -1, 80, 49, 0 },
53 { 0, 64, 64, 0, 0 },
54 { 0, 49, 80, -1, 0 },
55 { 0, 34, 94, 0, 0 },
56 { 0, 21, 104, 3, 0 },
57};
58
59static const struct dispc_coef coef3_M11[8] = {
60 { 0, 14, 100, 14, 0 },
61 { 0, 6, 98, 24, 0 },
62 { 0, 2, 90, 36, 0 },
63 { 0, 0, 78, 50, 0 },
64 { 0, 64, 64, 0, 0 },
65 { 0, 50, 78, 0, 0 },
66 { 0, 36, 90, 2, 0 },
67 { 0, 24, 98, 6, 0 },
68};
69
70static const struct dispc_coef coef3_M12[8] = {
71 { 0, 16, 96, 16, 0 },
72 { 0, 9, 93, 26, 0 },
73 { 0, 4, 86, 38, 0 },
74 { 0, 1, 76, 51, 0 },
75 { 0, 64, 64, 0, 0 },
76 { 0, 51, 76, 1, 0 },
77 { 0, 38, 86, 4, 0 },
78 { 0, 26, 93, 9, 0 },
79};
80
81static const struct dispc_coef coef3_M13[8] = {
82 { 0, 18, 92, 18, 0 },
83 { 0, 10, 90, 28, 0 },
84 { 0, 5, 83, 40, 0 },
85 { 0, 1, 75, 52, 0 },
86 { 0, 64, 64, 0, 0 },
87 { 0, 52, 75, 1, 0 },
88 { 0, 40, 83, 5, 0 },
89 { 0, 28, 90, 10, 0 },
90};
91
92static const struct dispc_coef coef3_M14[8] = {
93 { 0, 20, 88, 20, 0 },
94 { 0, 12, 86, 30, 0 },
95 { 0, 6, 81, 41, 0 },
96 { 0, 2, 74, 52, 0 },
97 { 0, 64, 64, 0, 0 },
98 { 0, 52, 74, 2, 0 },
99 { 0, 41, 81, 6, 0 },
100 { 0, 30, 86, 12, 0 },
101};
102
103static const struct dispc_coef coef3_M16[8] = {
104 { 0, 22, 84, 22, 0 },
105 { 0, 14, 82, 32, 0 },
106 { 0, 8, 78, 42, 0 },
107 { 0, 3, 72, 53, 0 },
108 { 0, 64, 64, 0, 0 },
109 { 0, 53, 72, 3, 0 },
110 { 0, 42, 78, 8, 0 },
111 { 0, 32, 82, 14, 0 },
112};
113
114static const struct dispc_coef coef3_M19[8] = {
115 { 0, 24, 80, 24, 0 },
116 { 0, 16, 79, 33, 0 },
117 { 0, 9, 76, 43, 0 },
118 { 0, 4, 70, 54, 0 },
119 { 0, 64, 64, 0, 0 },
120 { 0, 54, 70, 4, 0 },
121 { 0, 43, 76, 9, 0 },
122 { 0, 33, 79, 16, 0 },
123};
124
125static const struct dispc_coef coef3_M22[8] = {
126 { 0, 25, 78, 25, 0 },
127 { 0, 17, 77, 34, 0 },
128 { 0, 10, 74, 44, 0 },
129 { 0, 5, 69, 54, 0 },
130 { 0, 64, 64, 0, 0 },
131 { 0, 54, 69, 5, 0 },
132 { 0, 44, 74, 10, 0 },
133 { 0, 34, 77, 17, 0 },
134};
135
136static const struct dispc_coef coef3_M26[8] = {
137 { 0, 26, 76, 26, 0 },
138 { 0, 19, 74, 35, 0 },
139 { 0, 11, 72, 45, 0 },
140 { 0, 5, 69, 54, 0 },
141 { 0, 64, 64, 0, 0 },
142 { 0, 54, 69, 5, 0 },
143 { 0, 45, 72, 11, 0 },
144 { 0, 35, 74, 19, 0 },
145};
146
147static const struct dispc_coef coef3_M32[8] = {
148 { 0, 27, 74, 27, 0 },
149 { 0, 19, 73, 36, 0 },
150 { 0, 12, 71, 45, 0 },
151 { 0, 6, 68, 54, 0 },
152 { 0, 64, 64, 0, 0 },
153 { 0, 54, 68, 6, 0 },
154 { 0, 45, 71, 12, 0 },
155 { 0, 36, 73, 19, 0 },
156};
157
158static const struct dispc_coef coef5_M8[8] = {
159 { 0, 0, 128, 0, 0 },
160 { -2, 14, 125, -10, 1 },
161 { -6, 33, 114, -15, 2 },
162 { -10, 55, 98, -16, 1 },
163 { 0, -14, 78, 78, -14 },
164 { 1, -16, 98, 55, -10 },
165 { 2, -15, 114, 33, -6 },
166 { 1, -10, 125, 14, -2 },
167};
168
169static const struct dispc_coef coef5_M9[8] = {
170 { -3, 10, 114, 10, -3 },
171 { -6, 24, 110, 0, -1 },
172 { -8, 40, 103, -7, 0 },
173 { -11, 58, 91, -11, 1 },
174 { 0, -12, 76, 76, -12 },
175 { 1, -11, 91, 58, -11 },
176 { 0, -7, 103, 40, -8 },
177 { -1, 0, 111, 24, -6 },
178};
179
180static const struct dispc_coef coef5_M10[8] = {
181 { -4, 18, 100, 18, -4 },
182 { -6, 30, 99, 8, -3 },
183 { -8, 44, 93, 0, -1 },
184 { -9, 58, 84, -5, 0 },
185 { 0, -8, 72, 72, -8 },
186 { 0, -5, 84, 58, -9 },
187 { -1, 0, 93, 44, -8 },
188 { -3, 8, 99, 30, -6 },
189};
190
191static const struct dispc_coef coef5_M11[8] = {
192 { -5, 23, 92, 23, -5 },
193 { -6, 34, 90, 13, -3 },
194 { -6, 45, 85, 6, -2 },
195 { -6, 57, 78, 0, -1 },
196 { 0, -4, 68, 68, -4 },
197 { -1, 0, 78, 57, -6 },
198 { -2, 6, 85, 45, -6 },
199 { -3, 13, 90, 34, -6 },
200};
201
202static const struct dispc_coef coef5_M12[8] = {
203 { -4, 26, 84, 26, -4 },
204 { -5, 36, 82, 18, -3 },
205 { -4, 46, 78, 10, -2 },
206 { -3, 55, 72, 5, -1 },
207 { 0, 0, 64, 64, 0 },
208 { -1, 5, 72, 55, -3 },
209 { -2, 10, 78, 46, -4 },
210 { -3, 18, 82, 36, -5 },
211};
212
213static const struct dispc_coef coef5_M13[8] = {
214 { -3, 28, 78, 28, -3 },
215 { -3, 37, 76, 21, -3 },
216 { -2, 45, 73, 14, -2 },
217 { 0, 53, 68, 8, -1 },
218 { 0, 3, 61, 61, 3 },
219 { -1, 8, 68, 53, 0 },
220 { -2, 14, 73, 45, -2 },
221 { -3, 21, 76, 37, -3 },
222};
223
224static const struct dispc_coef coef5_M14[8] = {
225 { -2, 30, 72, 30, -2 },
226 { -1, 37, 71, 23, -2 },
227 { 0, 45, 69, 16, -2 },
228 { 3, 52, 64, 10, -1 },
229 { 0, 6, 58, 58, 6 },
230 { -1, 10, 64, 52, 3 },
231 { -2, 16, 69, 45, 0 },
232 { -2, 23, 71, 37, -1 },
233};
234
235static const struct dispc_coef coef5_M16[8] = {
236 { 0, 31, 66, 31, 0 },
237 { 1, 38, 65, 25, -1 },
238 { 3, 44, 62, 20, -1 },
239 { 6, 49, 59, 14, 0 },
240 { 0, 10, 54, 54, 10 },
241 { 0, 14, 59, 49, 6 },
242 { -1, 20, 62, 44, 3 },
243 { -1, 25, 65, 38, 1 },
244};
245
246static const struct dispc_coef coef5_M19[8] = {
247 { 3, 32, 58, 32, 3 },
248 { 4, 38, 58, 27, 1 },
249 { 7, 42, 55, 23, 1 },
250 { 10, 46, 54, 18, 0 },
251 { 0, 14, 50, 50, 14 },
252 { 0, 18, 54, 46, 10 },
253 { 1, 23, 55, 42, 7 },
254 { 1, 27, 58, 38, 4 },
255};
256
257static const struct dispc_coef coef5_M22[8] = {
258 { 4, 33, 54, 33, 4 },
259 { 6, 37, 54, 28, 3 },
260 { 9, 41, 53, 24, 1 },
261 { 12, 45, 51, 20, 0 },
262 { 0, 16, 48, 48, 16 },
263 { 0, 20, 51, 45, 12 },
264 { 1, 24, 53, 41, 9 },
265 { 3, 28, 54, 37, 6 },
266};
267
268static const struct dispc_coef coef5_M26[8] = {
269 { 6, 33, 50, 33, 6 },
270 { 8, 36, 51, 29, 4 },
271 { 11, 40, 50, 25, 2 },
272 { 14, 43, 48, 22, 1 },
273 { 0, 18, 46, 46, 18 },
274 { 1, 22, 48, 43, 14 },
275 { 2, 25, 50, 40, 11 },
276 { 4, 29, 51, 36, 8 },
277};
278
279static const struct dispc_coef coef5_M32[8] = {
280 { 7, 33, 48, 33, 7 },
281 { 10, 36, 48, 29, 5 },
282 { 13, 39, 47, 26, 3 },
283 { 16, 42, 46, 23, 1 },
284 { 0, 19, 45, 45, 19 },
285 { 1, 23, 46, 42, 16 },
286 { 3, 26, 47, 39, 13 },
287 { 5, 29, 48, 36, 10 },
288};
289
290const struct dispc_coef *dispc_ovl_get_scale_coef(int inc, int five_taps)
291{
292 int i;
293 static const struct {
294 int Mmin;
295 int Mmax;
296 const struct dispc_coef *coef_3;
297 const struct dispc_coef *coef_5;
298 } coefs[] = {
299 { 27, 32, coef3_M32, coef5_M32 },
300 { 23, 26, coef3_M26, coef5_M26 },
301 { 20, 22, coef3_M22, coef5_M22 },
302 { 17, 19, coef3_M19, coef5_M19 },
303 { 15, 16, coef3_M16, coef5_M16 },
304 { 14, 14, coef3_M14, coef5_M14 },
305 { 13, 13, coef3_M13, coef5_M13 },
306 { 12, 12, coef3_M12, coef5_M12 },
307 { 11, 11, coef3_M11, coef5_M11 },
308 { 10, 10, coef3_M10, coef5_M10 },
309 { 9, 9, coef3_M9, coef5_M9 },
310 { 4, 8, coef3_M8, coef5_M8 },
311 /*
312 * When upscaling more than two times, blockiness and outlines
313 * around the image are observed when M8 tables are used. M11,
314 * M16 and M19 tables are used to prevent this.
315 */
316 { 3, 3, coef3_M11, coef5_M11 },
317 { 2, 2, coef3_M16, coef5_M16 },
318 { 0, 1, coef3_M19, coef5_M19 },
319 };
320
321 inc /= 128;
322 for (i = 0; i < ARRAY_LEN(coefs); ++i)
323 if (inc >= coefs[i].Mmin && inc <= coefs[i].Mmax)
324 return five_taps ? coefs[i].coef_5 : coefs[i].coef_3;
325 return NULL;
326}