diff options
Diffstat (limited to 'drivers/video/c2p.c')
-rw-r--r-- | drivers/video/c2p.c | 92 |
1 files changed, 1 insertions, 91 deletions
diff --git a/drivers/video/c2p.c b/drivers/video/c2p.c index c170fff0d35e..1238c8b912ea 100644 --- a/drivers/video/c2p.c +++ b/drivers/video/c2p.c | |||
@@ -3,10 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2003-2008 Geert Uytterhoeven | 4 | * Copyright (C) 2003-2008 Geert Uytterhoeven |
5 | * | 5 | * |
6 | * NOTES: | ||
7 | * - This code was inspired by Scout's C2P tutorial | ||
8 | * - It assumes to run on a big endian system | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | 6 | * This file is subject to the terms and conditions of the GNU General Public |
11 | * License. See the file COPYING in the main directory of this archive | 7 | * License. See the file COPYING in the main directory of this archive |
12 | * for more details. | 8 | * for more details. |
@@ -18,82 +14,7 @@ | |||
18 | #include <asm/unaligned.h> | 14 | #include <asm/unaligned.h> |
19 | 15 | ||
20 | #include "c2p.h" | 16 | #include "c2p.h" |
21 | 17 | #include "c2p_core.h" | |
22 | |||
23 | /* | ||
24 | * Basic transpose step | ||
25 | */ | ||
26 | |||
27 | static inline void _transp(u32 d[], unsigned int i1, unsigned int i2, | ||
28 | unsigned int shift, u32 mask) | ||
29 | { | ||
30 | u32 t = (d[i1] ^ (d[i2] >> shift)) & mask; | ||
31 | |||
32 | d[i1] ^= t; | ||
33 | d[i2] ^= t << shift; | ||
34 | } | ||
35 | |||
36 | extern void c2p_unsupported(void); | ||
37 | |||
38 | static inline u32 get_mask(unsigned int n) | ||
39 | { | ||
40 | switch (n) { | ||
41 | case 1: | ||
42 | return 0x55555555; | ||
43 | |||
44 | case 2: | ||
45 | return 0x33333333; | ||
46 | |||
47 | case 4: | ||
48 | return 0x0f0f0f0f; | ||
49 | |||
50 | case 8: | ||
51 | return 0x00ff00ff; | ||
52 | |||
53 | case 16: | ||
54 | return 0x0000ffff; | ||
55 | } | ||
56 | |||
57 | c2p_unsupported(); | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static inline void transp8(u32 d[], unsigned int n, unsigned int m) | ||
62 | { | ||
63 | u32 mask = get_mask(n); | ||
64 | |||
65 | switch (m) { | ||
66 | case 1: | ||
67 | /* First n x 1 block */ | ||
68 | _transp(d, 0, 1, n, mask); | ||
69 | /* Second n x 1 block */ | ||
70 | _transp(d, 2, 3, n, mask); | ||
71 | /* Third n x 1 block */ | ||
72 | _transp(d, 4, 5, n, mask); | ||
73 | /* Fourth n x 1 block */ | ||
74 | _transp(d, 6, 7, n, mask); | ||
75 | return; | ||
76 | |||
77 | case 2: | ||
78 | /* First n x 2 block */ | ||
79 | _transp(d, 0, 2, n, mask); | ||
80 | _transp(d, 1, 3, n, mask); | ||
81 | /* Second n x 2 block */ | ||
82 | _transp(d, 4, 6, n, mask); | ||
83 | _transp(d, 5, 7, n, mask); | ||
84 | return; | ||
85 | |||
86 | case 4: | ||
87 | /* Single n x 4 block */ | ||
88 | _transp(d, 0, 4, n, mask); | ||
89 | _transp(d, 1, 5, n, mask); | ||
90 | _transp(d, 2, 6, n, mask); | ||
91 | _transp(d, 3, 7, n, mask); | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | c2p_unsupported(); | ||
96 | } | ||
97 | 18 | ||
98 | 19 | ||
99 | /* | 20 | /* |
@@ -121,17 +42,6 @@ static const int perm_c2p_32x8[8] = { 7, 5, 3, 1, 6, 4, 2, 0 }; | |||
121 | 42 | ||
122 | 43 | ||
123 | /* | 44 | /* |
124 | * Compose two values, using a bitmask as decision value | ||
125 | * This is equivalent to (a & mask) | (b & ~mask) | ||
126 | */ | ||
127 | |||
128 | static inline u32 comp(u32 a, u32 b, u32 mask) | ||
129 | { | ||
130 | return ((a ^ b) & mask) ^ b; | ||
131 | } | ||
132 | |||
133 | |||
134 | /* | ||
135 | * Store a full block of planar data after c2p conversion | 45 | * Store a full block of planar data after c2p conversion |
136 | */ | 46 | */ |
137 | 47 | ||