Mercurial > mplayer.hg
comparison libmpcodecs/vf_2xsai.c @ 25004:98ca15113cc6
Replace stupid "unsigned long" by the correct uint32_t.
Makes 2xsai work on 64 bit architectures (displayed video doubled horizontally
before).
author | reimar |
---|---|
date | Mon, 12 Nov 2007 20:44:06 +0000 |
parents | c79fa5c75d4e |
children | 00fff9a3b735 |
comparison
equal
deleted
inserted
replaced
25003:c79fa5c75d4e | 25004:98ca15113cc6 |
---|---|
86 void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, | 86 void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, |
87 uint8_t *dst, uint32_t dst_pitch, | 87 uint8_t *dst, uint32_t dst_pitch, |
88 uint32_t width, uint32_t height, int sbpp) { | 88 uint32_t width, uint32_t height, int sbpp) { |
89 | 89 |
90 unsigned int x, y; | 90 unsigned int x, y; |
91 unsigned long color[16]; | 91 uint32_t color[16]; |
92 | 92 |
93 /* Point to the first 3 lines. */ | 93 /* Point to the first 3 lines. */ |
94 src_line[0] = src; | 94 src_line[0] = src; |
95 src_line[1] = src; | 95 src_line[1] = src; |
96 src_line[2] = src + src_pitch; | 96 src_line[2] = src + src_pitch; |
107 color[8] = *sbp; color[9] = color[8]; color[10] = *(sbp + 1); color[11] = *(sbp + 2); | 107 color[8] = *sbp; color[9] = color[8]; color[10] = *(sbp + 1); color[11] = *(sbp + 2); |
108 sbp = (unsigned short*)src_line[3]; | 108 sbp = (unsigned short*)src_line[3]; |
109 color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2); | 109 color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2); |
110 } | 110 } |
111 else { | 111 else { |
112 unsigned long *lbp; | 112 uint32_t *lbp; |
113 lbp = (unsigned long*)src_line[0]; | 113 lbp = (uint32_t*)src_line[0]; |
114 color[0] = *lbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0]; | 114 color[0] = *lbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0]; |
115 color[4] = color[0]; color[5] = color[0]; color[6] = *(lbp + 1); color[7] = *(lbp + 2); | 115 color[4] = color[0]; color[5] = color[0]; color[6] = *(lbp + 1); color[7] = *(lbp + 2); |
116 lbp = (unsigned long*)src_line[2]; | 116 lbp = (uint32_t*)src_line[2]; |
117 color[8] = *lbp; color[9] = color[8]; color[10] = *(lbp + 1); color[11] = *(lbp + 2); | 117 color[8] = *lbp; color[9] = color[8]; color[10] = *(lbp + 1); color[11] = *(lbp + 2); |
118 lbp = (unsigned long*)src_line[3]; | 118 lbp = (uint32_t*)src_line[3]; |
119 color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); | 119 color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); |
120 } | 120 } |
121 | 121 |
122 for (y = 0; y < height; y++) { | 122 for (y = 0; y < height; y++) { |
123 | 123 |
125 dst_line[1] = dst + dst_pitch*(2*y+1); | 125 dst_line[1] = dst + dst_pitch*(2*y+1); |
126 | 126 |
127 /* Todo: x = width - 2, x = width - 1 */ | 127 /* Todo: x = width - 2, x = width - 1 */ |
128 | 128 |
129 for (x = 0; x < width; x++) { | 129 for (x = 0; x < width; x++) { |
130 unsigned long product1a, product1b, product2a, product2b; | 130 uint32_t product1a, product1b, product2a, product2b; |
131 | 131 |
132 //--------------------------------------- B0 B1 B2 B3 0 1 2 3 | 132 //--------------------------------------- B0 B1 B2 B3 0 1 2 3 |
133 // 4 5* 6 S2 -> 4 5* 6 7 | 133 // 4 5* 6 S2 -> 4 5* 6 7 |
134 // 1 2 3 S1 8 9 10 11 | 134 // 1 2 3 S1 8 9 10 11 |
135 // A0 A1 A2 A3 12 13 14 15 | 135 // A0 A1 A2 A3 12 13 14 15 |
189 product1a = INTERPOLATE(color[9], color[5]); | 189 product1a = INTERPOLATE(color[9], color[5]); |
190 else | 190 else |
191 product1a = color[5]; | 191 product1a = color[5]; |
192 | 192 |
193 if (PixelsPerMask == 2) { | 193 if (PixelsPerMask == 2) { |
194 *((unsigned long *) (&dst_line[0][x * 4])) = product1a | (product1b << 16); | 194 *((uint32_t *) (&dst_line[0][x * 4])) = product1a | (product1b << 16); |
195 *((unsigned long *) (&dst_line[1][x * 4])) = product2a | (product2b << 16); | 195 *((uint32_t *) (&dst_line[1][x * 4])) = product2a | (product2b << 16); |
196 } | 196 } |
197 else { | 197 else { |
198 *((unsigned long *) (&dst_line[0][x * 8])) = product1a; | 198 *((uint32_t *) (&dst_line[0][x * 8])) = product1a; |
199 *((unsigned long *) (&dst_line[0][x * 8 + 4])) = product1b; | 199 *((uint32_t *) (&dst_line[0][x * 8 + 4])) = product1b; |
200 *((unsigned long *) (&dst_line[1][x * 8])) = product2a; | 200 *((uint32_t *) (&dst_line[1][x * 8])) = product2a; |
201 *((unsigned long *) (&dst_line[1][x * 8 + 4])) = product2b; | 201 *((uint32_t *) (&dst_line[1][x * 8 + 4])) = product2b; |
202 } | 202 } |
203 | 203 |
204 /* Move color matrix forward */ | 204 /* Move color matrix forward */ |
205 color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13]; | 205 color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13]; |
206 color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14]; | 206 color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14]; |
213 color[7] = *(((unsigned short*)src_line[1]) + x); | 213 color[7] = *(((unsigned short*)src_line[1]) + x); |
214 color[11] = *(((unsigned short*)src_line[2]) + x); | 214 color[11] = *(((unsigned short*)src_line[2]) + x); |
215 color[15] = *(((unsigned short*)src_line[3]) + x); | 215 color[15] = *(((unsigned short*)src_line[3]) + x); |
216 } | 216 } |
217 else { | 217 else { |
218 color[3] = *(((unsigned long*)src_line[0]) + x); | 218 color[3] = *(((uint32_t*)src_line[0]) + x); |
219 color[7] = *(((unsigned long*)src_line[1]) + x); | 219 color[7] = *(((uint32_t*)src_line[1]) + x); |
220 color[11] = *(((unsigned long*)src_line[2]) + x); | 220 color[11] = *(((uint32_t*)src_line[2]) + x); |
221 color[15] = *(((unsigned long*)src_line[3]) + x); | 221 color[15] = *(((uint32_t*)src_line[3]) + x); |
222 } | 222 } |
223 x -= 3; | 223 x -= 3; |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
246 color[8] = *sbp; color[9] = color[9]; color[10] = *(sbp + 1); color[11] = *(sbp + 2); | 246 color[8] = *sbp; color[9] = color[9]; color[10] = *(sbp + 1); color[11] = *(sbp + 2); |
247 sbp = (unsigned short*)src_line[3]; | 247 sbp = (unsigned short*)src_line[3]; |
248 color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2); | 248 color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2); |
249 } | 249 } |
250 else { | 250 else { |
251 unsigned long *lbp; | 251 uint32_t *lbp; |
252 lbp = (unsigned long*)src_line[0]; | 252 lbp = (uint32_t*)src_line[0]; |
253 color[0] = *lbp; color[1] = color[0]; color[2] = *(lbp + 1); color[3] = *(lbp + 2); | 253 color[0] = *lbp; color[1] = color[0]; color[2] = *(lbp + 1); color[3] = *(lbp + 2); |
254 lbp = (unsigned long*)src_line[1]; | 254 lbp = (uint32_t*)src_line[1]; |
255 color[4] = *lbp; color[5] = color[4]; color[6] = *(lbp + 1); color[7] = *(lbp + 2); | 255 color[4] = *lbp; color[5] = color[4]; color[6] = *(lbp + 1); color[7] = *(lbp + 2); |
256 lbp = (unsigned long*)src_line[2]; | 256 lbp = (uint32_t*)src_line[2]; |
257 color[8] = *lbp; color[9] = color[9]; color[10] = *(lbp + 1); color[11] = *(lbp + 2); | 257 color[8] = *lbp; color[9] = color[9]; color[10] = *(lbp + 1); color[11] = *(lbp + 2); |
258 lbp = (unsigned long*)src_line[3]; | 258 lbp = (uint32_t*)src_line[3]; |
259 color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); | 259 color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); |
260 } | 260 } |
261 | 261 |
262 } // y loop | 262 } // y loop |
263 | 263 |