1 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
2 // Copyright (C) 1999-2003 Forgotten
3 // Copyright (C) 2004-2015 Forgotten and the VBA development team
4
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2, or(at your option)
8 // any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 #if (defined _MSC_VER)
20 #define C_CORE
21 #endif
22
23 #include "filters.h"
24
25 //
26 // Screen filters
27 //
28
29 extern int Init_2xSaI(u32);
30 extern void hq2x_init(unsigned);
31 extern bool sdlStretchInit(int colorDepth, int sizeMultiplier, int srcWidth);
32
33 extern void sdlStretch1x(u8*,u32,u8*,u8*,u32,int,int);
34 extern void sdlStretch2x(u8*,u32,u8*,u8*,u32,int,int);
35 extern void sdlStretch3x(u8*,u32,u8*,u8*,u32,int,int);
36 extern void sdlStretch4x(u8*,u32,u8*,u8*,u32,int,int);
37 extern void _2xSaI(u8*,u32,u8*,u8*,u32,int,int);
38 extern void _2xSaI32(u8*,u32,u8*,u8*,u32,int,int);
39 extern void Super2xSaI(u8*,u32,u8*,u8*,u32,int,int);
40 extern void Super2xSaI32(u8*,u32,u8*,u8*,u32,int,int);
41 extern void SuperEagle(u8*,u32,u8*,u8*,u32,int,int);
42 extern void SuperEagle32(u8*,u32,u8*,u8*,u32,int,int);
43 extern void Pixelate(u8*,u32,u8*,u8*,u32,int,int);
44 extern void Pixelate32(u8*,u32,u8*,u8*,u32,int,int);
45 extern void AdMame2x(u8*,u32,u8*,u8*,u32,int,int);
46 extern void AdMame2x32(u8*,u32,u8*,u8*,u32,int,int);
47 extern void Bilinear(u8*,u32,u8*,u8*,u32,int,int);
48 extern void Bilinear32(u8*,u32,u8*,u8*,u32,int,int);
49 extern void BilinearPlus(u8*,u32,u8*,u8*,u32,int,int);
50 extern void BilinearPlus32(u8*,u32,u8*,u8*,u32,int,int);
51 extern void Scanlines(u8*,u32,u8*,u8*,u32,int,int);
52 extern void Scanlines32(u8*,u32,u8*,u8*,u32,int,int);
53 extern void ScanlinesTV(u8*,u32,u8*,u8*,u32,int,int);
54 extern void ScanlinesTV32(u8*,u32,u8*,u8*,u32,int,int);
55 extern void hq2x(u8*,u32,u8*,u8*,u32,int,int);
56 extern void hq2x32(u8*,u32,u8*,u8*,u32,int,int);
57 extern void lq2x(u8*,u32,u8*,u8*,u32,int,int);
58 extern void lq2x32(u8*,u32,u8*,u8*,u32,int,int);
59 extern void hq3x16(u8*,u32,u8*,u8*,u32,int,int);
60 extern void hq4x16(u8*,u32,u8*,u8*,u32,int,int);
61 extern void hq3x32_32(u8*,u32,u8*,u8*,u32,int,int);
62 extern void hq4x32_32(u8*,u32,u8*,u8*,u32,int,int);
63 extern void xbrz2x32(u8*,u32,u8*,u8*,u32,int,int);
64 extern void xbrz3x32(u8*,u32,u8*,u8*,u32,int,int);
65 extern void xbrz4x32(u8*,u32,u8*,u8*,u32,int,int);
66 extern void xbrz5x32(u8*,u32,u8*,u8*,u32,int,int);
67 extern void xbrz6x32(u8*,u32,u8*,u8*,u32,int,int);
68
69 struct FilterDesc {
70 char name[30];
71 int enlargeFactor;
72 FilterFunc func16;
73 FilterFunc func24;
74 FilterFunc func32;
75 };
76
77 const FilterDesc Filters[] = {
78 { "Stretch 1x", 1, sdlStretch1x, sdlStretch1x, sdlStretch1x },
79 { "Stretch 2x", 2, sdlStretch2x, sdlStretch2x, sdlStretch2x },
80 { "2xSaI", 2, _2xSaI, 0, _2xSaI32 },
81 { "Super 2xSaI", 2, Super2xSaI, 0, Super2xSaI32 },
82 { "Super Eagle", 2, SuperEagle, 0, SuperEagle32 },
83 { "Pixelate", 2, Pixelate, 0, Pixelate32 },
84 { "AdvanceMAME Scale2x", 2, AdMame2x, 0, AdMame2x32 },
85 { "Bilinear", 2, Bilinear, 0, Bilinear32 },
86 { "Bilinear Plus", 2, BilinearPlus, 0, BilinearPlus32 },
87 { "Scanlines", 2, Scanlines, 0, Scanlines32 },
88 { "TV Mode", 2, ScanlinesTV, 0, ScanlinesTV32 },
89 { "lq2x", 2, lq2x, 0, lq2x32 },
90 { "hq2x", 2, hq2x, 0, hq2x32 },
91 { "xbrz2x", 2, 0, 0, xbrz2x32 },
92 { "Stretch 3x", 3, sdlStretch3x, sdlStretch3x, sdlStretch3x },
93 { "hq3x", 3, hq3x16, 0, hq3x32_32 },
94 { "xbrz3x", 3, 0, 0, xbrz3x32 },
95 { "Stretch 4x", 4, sdlStretch4x, sdlStretch4x, sdlStretch4x },
96 { "hq4x", 4, hq4x16, 0, hq4x32_32 },
97 { "xbrz4x", 4, 0, 0, xbrz4x32 },
98 { "xbrz5x", 5, 0, 0, xbrz5x32 },
99 { "xbrz6x", 6, 0, 0, xbrz6x32 }
100 };
101
getFilterEnlargeFactor(const int f)102 int getFilterEnlargeFactor(const int f)
103 {
104 return Filters[f].enlargeFactor;
105 }
106
getFilterName(const int f)107 char* getFilterName(const int f)
108 {
109 return (char*)Filters[f].name;
110 }
111
initFilter(const int f,const int colorDepth,const int srcWidth)112 FilterFunc initFilter(const int f, const int colorDepth, const int srcWidth)
113 {
114 FilterFunc func;
115
116 switch (colorDepth) {
117 case 15:
118 case 16:
119 func = Filters[f].func16;
120 break;
121 case 24:
122 func = Filters[f].func24;
123 break;
124 case 32:
125 func = Filters[f].func32;
126 break;
127 default:
128 func = 0;
129 break;
130 }
131
132 if (func)
133 switch (f) {
134 case kStretch1x:
135 sdlStretchInit(colorDepth, 0, srcWidth);
136 break;
137 case kStretch2x:
138 sdlStretchInit(colorDepth, 1, srcWidth);
139 break;
140 case kStretch3x:
141 sdlStretchInit(colorDepth, 2, srcWidth);
142 break;
143 case kStretch4x:
144 sdlStretchInit(colorDepth, 3, srcWidth);
145 break;
146 case k2xSaI:
147 case kSuper2xSaI:
148 case kSuperEagle:
149 if (colorDepth == 15) Init_2xSaI(555);
150 else if (colorDepth == 16) Init_2xSaI(565);
151 else Init_2xSaI(colorDepth);
152 break;
153 case khq2x:
154 case klq2x:
155 hq2x_init(colorDepth);
156 break;
157 default:
158 break;
159 }
160
161 return func;
162 }
163
164 //
165 // Interframe blending filters
166 //
167
168 extern void SmartIB(u8*,u32,int,int);
169 extern void SmartIB32(u8*,u32,int,int);
170 extern void MotionBlurIB(u8*,u32,int,int);
171 extern void MotionBlurIB32(u8*,u32,int,int);
172
173 struct IFBFilterDesc {
174 char name[30];
175 IFBFilterFunc func16;
176 IFBFilterFunc func32;
177 };
178
179 const IFBFilterDesc IFBFilters[] = {
180 { "No interframe blending", 0, 0 },
181 { "Interframe motion blur", MotionBlurIB, MotionBlurIB32 },
182 { "Smart interframe blending", SmartIB, SmartIB32 }
183 };
184
initIFBFilter(const int f,const int colorDepth)185 IFBFilterFunc initIFBFilter(const int f, const int colorDepth)
186 {
187 IFBFilterFunc func;
188
189 switch (colorDepth) {
190 case 15:
191 case 16:
192 func = IFBFilters[f].func16;
193 break;
194 case 32:
195 func = IFBFilters[f].func32;
196 break;
197 case 24:
198 default:
199 func = 0;
200 break;
201 }
202
203 return func;
204 }
205
getIFBFilterName(const IFBFilter f)206 char* getIFBFilterName(const IFBFilter f)
207 {
208 return (char*)IFBFilters[f].name;
209 }
210
211 //
212 // Optimized stretchers implementation
213 //
214
215 #ifndef C_CORE
216 u8 sdlStretcher[16384];
217
218 #ifdef _MSC_VER
219 #define SDL_CALL_STRETCHER \
220 {\
221 __asm mov eax, stretcher\
222 __asm mov edi, destPtr\
223 __asm mov esi, srcPtr\
224 __asm call eax\
225 }
226 #else
227 #define SDL_CALL_STRETCHER \
228 asm volatile("call *%%eax"::"a" (stretcher),"S" (srcPtr),"D" (dstPtr))
229 #endif
230
231 #define SDL_LONG(val) \
232 *((u32 *)&sdlStretcher[sdlStretcherPos]) = val;\
233 sdlStretcherPos+=4;
234
235 #define SDL_AND_EAX(val) \
236 sdlStretcher[sdlStretcherPos++] = 0x25;\
237 SDL_LONG(val);
238
239 #define SDL_AND_EBX(val) \
240 sdlStretcher[sdlStretcherPos++] = 0x81;\
241 sdlStretcher[sdlStretcherPos++] = 0xe3;\
242 SDL_LONG(val);
243
244 #define SDL_OR_EAX_EBX \
245 sdlStretcher[sdlStretcherPos++] = 0x09;\
246 sdlStretcher[sdlStretcherPos++] = 0xd8;
247
248 #define SDL_LOADL_EBX \
249 sdlStretcher[sdlStretcherPos++] = 0x8b;\
250 sdlStretcher[sdlStretcherPos++] = 0x1f;
251
252 #define SDL_LOADW \
253 sdlStretcher[sdlStretcherPos++] = 0x66;\
254 sdlStretcher[sdlStretcherPos++] = 0x8b;\
255 sdlStretcher[sdlStretcherPos++] = 0x06;\
256 sdlStretcher[sdlStretcherPos++] = 0x83;\
257 sdlStretcher[sdlStretcherPos++] = 0xc6;\
258 sdlStretcher[sdlStretcherPos++] = 0x02;
259
260 #define SDL_LOADL \
261 sdlStretcher[sdlStretcherPos++] = 0x8b;\
262 sdlStretcher[sdlStretcherPos++] = 0x06;\
263 sdlStretcher[sdlStretcherPos++] = 0x83;\
264 sdlStretcher[sdlStretcherPos++] = 0xc6;\
265 sdlStretcher[sdlStretcherPos++] = 0x04;
266
267 #define SDL_LOADL2 \
268 sdlStretcher[sdlStretcherPos++] = 0x8b;\
269 sdlStretcher[sdlStretcherPos++] = 0x06;\
270 sdlStretcher[sdlStretcherPos++] = 0x83;\
271 sdlStretcher[sdlStretcherPos++] = 0xc6;\
272 sdlStretcher[sdlStretcherPos++] = 0x03;
273
274 #define SDL_STOREW \
275 sdlStretcher[sdlStretcherPos++] = 0x66;\
276 sdlStretcher[sdlStretcherPos++] = 0x89;\
277 sdlStretcher[sdlStretcherPos++] = 0x07;\
278 sdlStretcher[sdlStretcherPos++] = 0x83;\
279 sdlStretcher[sdlStretcherPos++] = 0xc7;\
280 sdlStretcher[sdlStretcherPos++] = 0x02;
281
282 #define SDL_STOREL \
283 sdlStretcher[sdlStretcherPos++] = 0x89;\
284 sdlStretcher[sdlStretcherPos++] = 0x07;\
285 sdlStretcher[sdlStretcherPos++] = 0x83;\
286 sdlStretcher[sdlStretcherPos++] = 0xc7;\
287 sdlStretcher[sdlStretcherPos++] = 0x04;
288
289 #define SDL_STOREL2 \
290 sdlStretcher[sdlStretcherPos++] = 0x89;\
291 sdlStretcher[sdlStretcherPos++] = 0x07;\
292 sdlStretcher[sdlStretcherPos++] = 0x83;\
293 sdlStretcher[sdlStretcherPos++] = 0xc7;\
294 sdlStretcher[sdlStretcherPos++] = 0x03;
295
296 #define SDL_RET \
297 sdlStretcher[sdlStretcherPos++] = 0xc3;
298
299 #define SDL_PUSH_EAX \
300 sdlStretcher[sdlStretcherPos++] = 0x50;
301
302 #define SDL_PUSH_ECX \
303 sdlStretcher[sdlStretcherPos++] = 0x51;
304
305 #define SDL_PUSH_EBX \
306 sdlStretcher[sdlStretcherPos++] = 0x53;
307
308 #define SDL_PUSH_ESI \
309 sdlStretcher[sdlStretcherPos++] = 0x56;
310
311 #define SDL_PUSH_EDI \
312 sdlStretcher[sdlStretcherPos++] = 0x57;
313
314 #define SDL_POP_EAX \
315 sdlStretcher[sdlStretcherPos++] = 0x58;
316
317 #define SDL_POP_ECX \
318 sdlStretcher[sdlStretcherPos++] = 0x59;
319
320 #define SDL_POP_EBX \
321 sdlStretcher[sdlStretcherPos++] = 0x5b;
322
323 #define SDL_POP_ESI \
324 sdlStretcher[sdlStretcherPos++] = 0x5e;
325
326 #define SDL_POP_EDI \
327 sdlStretcher[sdlStretcherPos++] = 0x5f;
328
329 #define SDL_MOV_ECX(val) \
330 sdlStretcher[sdlStretcherPos++] = 0xb9;\
331 SDL_LONG(val);
332
333 #define SDL_REP_MOVSB \
334 sdlStretcher[sdlStretcherPos++] = 0xf3;\
335 sdlStretcher[sdlStretcherPos++] = 0xa4;
336
337 #define SDL_REP_MOVSW \
338 sdlStretcher[sdlStretcherPos++] = 0xf3;\
339 sdlStretcher[sdlStretcherPos++] = 0x66;\
340 sdlStretcher[sdlStretcherPos++] = 0xa5;
341
342 #define SDL_REP_MOVSL \
343 sdlStretcher[sdlStretcherPos++] = 0xf3;\
344 sdlStretcher[sdlStretcherPos++] = 0xa5;
345
sdlMakeStretcher(int width,int sizeOption)346 void sdlMakeStretcher(int width, int sizeOption)
347 {
348 int sdlStretcherPos;
349 sdlStretcherPos = 0;
350 switch(systemColorDepth) {
351 case 16:
352 if(sizeOption) {
353 SDL_PUSH_EAX;
354 SDL_PUSH_ESI;
355 SDL_PUSH_EDI;
356 for(int i = 0; i < width; i++) {
357 SDL_LOADW;
358 SDL_STOREW;
359 SDL_STOREW;
360 if(sizeOption > 1) {
361 SDL_STOREW;
362 }
363 if(sizeOption > 2) {
364 SDL_STOREW;
365 }
366 }
367 SDL_POP_EDI;
368 SDL_POP_ESI;
369 SDL_POP_EAX;
370 SDL_RET;
371 } else {
372 SDL_PUSH_ESI;
373 SDL_PUSH_EDI;
374 SDL_PUSH_ECX;
375 SDL_MOV_ECX(width);
376 SDL_REP_MOVSW;
377 SDL_POP_ECX;
378 SDL_POP_EDI;
379 SDL_POP_ESI;
380 SDL_RET;
381 }
382 break;
383 case 24:
384 if(sizeOption) {
385 SDL_PUSH_EAX;
386 SDL_PUSH_ESI;
387 SDL_PUSH_EDI;
388 int w = width - 1;
389 for(int i = 0; i < w; i++) {
390 SDL_LOADL2;
391 SDL_STOREL2;
392 SDL_STOREL2;
393 if(sizeOption > 1) {
394 SDL_STOREL2;
395 }
396 if(sizeOption > 2) {
397 SDL_STOREL2;
398 }
399 }
400 // need to write the last one
401 SDL_LOADL2;
402 SDL_STOREL2;
403 if(sizeOption > 1) {
404 SDL_STOREL2;
405 }
406 if(sizeOption > 2) {
407 SDL_STOREL2;
408 }
409 SDL_AND_EAX(0x00ffffff);
410 SDL_PUSH_EBX;
411 SDL_LOADL_EBX;
412 SDL_AND_EBX(0xff000000);
413 SDL_OR_EAX_EBX;
414 SDL_POP_EBX;
415 SDL_STOREL2;
416 SDL_POP_EDI;
417 SDL_POP_ESI;
418 SDL_POP_EAX;
419 SDL_RET;
420 } else {
421 SDL_PUSH_ESI;
422 SDL_PUSH_EDI;
423 SDL_PUSH_ECX;
424 SDL_MOV_ECX(3*width);
425 SDL_REP_MOVSB;
426 SDL_POP_ECX;
427 SDL_POP_EDI;
428 SDL_POP_ESI;
429 SDL_RET;
430 }
431 break;
432 case 32:
433 if(sizeOption) {
434 SDL_PUSH_EAX;
435 SDL_PUSH_ESI;
436 SDL_PUSH_EDI;
437 for(int i = 0; i < width; i++) {
438 SDL_LOADL;
439 SDL_STOREL;
440 SDL_STOREL;
441 if(sizeOption > 1) {
442 SDL_STOREL;
443 }
444 if(sizeOption > 2) {
445 SDL_STOREL;
446 }
447 }
448 SDL_POP_EDI;
449 SDL_POP_ESI;
450 SDL_POP_EAX;
451 SDL_RET;
452 } else {
453 SDL_PUSH_ESI;
454 SDL_PUSH_EDI;
455 SDL_PUSH_ECX;
456 SDL_MOV_ECX(width);
457 SDL_REP_MOVSL;
458 SDL_POP_ECX;
459 SDL_POP_EDI;
460 SDL_POP_ESI;
461 SDL_RET;
462 }
463 break;
464 }
465 }
466
467 #else // C_CORE
468
469 void (*sdlStretcher)(u8 *, u8*, int) = 0;
470
471 #define SDL_CALL_STRETCHER \
472 sdlStretcher(srcPtr, dstPtr, width)
473
474 template<typename T>
sdlStretchx1(u8 * src,u8 * dest,int width)475 void sdlStretchx1(u8 *src, u8 *dest, int width)
476 {
477 T *s = (T *)src;
478 T *d = (T *)dest;
479 for(int i = 0; i < width; i++)
480 *d++ = *s++;
481 }
482
483 template<typename T>
sdlStretchx2(u8 * src,u8 * dest,int width)484 void sdlStretchx2(u8 *src, u8 *dest, int width)
485 {
486 T *s = (T *)src;
487 T *d = (T *)dest;
488 for(int i = 0; i < width; i++) {
489 *d++ = *s;
490 *d++ = *s++;
491 }
492 }
493
494 template<typename T>
sdlStretchx3(u8 * src,u8 * dest,int width)495 void sdlStretchx3(u8 *src, u8 *dest, int width)
496 {
497 T *s = (T *)src;
498 T *d = (T *)dest;
499 for(int i = 0; i < width; i++) {
500 *d++ = *s;
501 *d++ = *s;
502 *d++ = *s++;
503 }
504 }
505
506 template<typename T>
sdlStretchx4(u8 * src,u8 * dest,int width)507 void sdlStretchx4(u8 *src, u8 *dest, int width)
508 {
509 T *s = (T *)src;
510 T *d = (T *)dest;
511 for(int i = 0; i < width; i++) {
512 *d++ = *s;
513 *d++ = *s;
514 *d++ = *s;
515 *d++ = *s++;
516 }
517 }
518
519 void (*sdlStretcher16[4])(u8 *, u8 *, int) = {
520 sdlStretchx1<u16>,
521 sdlStretchx2<u16>,
522 sdlStretchx3<u16>,
523 sdlStretchx4<u16>
524 };
525
526 void (*sdlStretcher32[4])(u8 *, u8 *, int) = {
527 sdlStretchx1<u32>,
528 sdlStretchx2<u32>,
529 sdlStretchx3<u32>,
530 sdlStretchx4<u32>
531 };
532
sdlStretch24x1(u8 * src,u8 * dest,int width)533 void sdlStretch24x1(u8 *src, u8 *dest, int width)
534 {
535 u8 *s = src;
536 u8 *d = dest;
537 for(int i = 0; i < width; i++) {
538 *d++ = *s++;
539 *d++ = *s++;
540 *d++ = *s++;
541 }
542 }
543
sdlStretch24x2(u8 * src,u8 * dest,int width)544 void sdlStretch24x2(u8 *src, u8 *dest, int width)
545 {
546 u8 *s = (u8 *)src;
547 u8 *d = (u8 *)dest;
548 for(int i = 0; i < width; i++) {
549 *d++ = *s;
550 *d++ = *(s+1);
551 *d++ = *(s+2);
552 s += 3;
553 *d++ = *s;
554 *d++ = *(s+1);
555 *d++ = *(s+2);
556 s += 3;
557 }
558 }
559
sdlStretch24x3(u8 * src,u8 * dest,int width)560 void sdlStretch24x3(u8 *src, u8 *dest, int width)
561 {
562 u8 *s = (u8 *)src;
563 u8 *d = (u8 *)dest;
564 for(int i = 0; i < width; i++) {
565 *d++ = *s;
566 *d++ = *(s+1);
567 *d++ = *(s+2);
568 s += 3;
569 *d++ = *s;
570 *d++ = *(s+1);
571 *d++ = *(s+2);
572 s += 3;
573 *d++ = *s;
574 *d++ = *(s+1);
575 *d++ = *(s+2);
576 s += 3;
577 }
578 }
579
sdlStretch24x4(u8 * src,u8 * dest,int width)580 void sdlStretch24x4(u8 *src, u8 *dest, int width)
581 {
582 u8 *s = (u8 *)src;
583 u8 *d = (u8 *)dest;
584 for(int i = 0; i < width; i++) {
585 *d++ = *s;
586 *d++ = *(s+1);
587 *d++ = *(s+2);
588 s += 3;
589 *d++ = *s;
590 *d++ = *(s+1);
591 *d++ = *(s+2);
592 s += 3;
593 *d++ = *s;
594 *d++ = *(s+1);
595 *d++ = *(s+2);
596 s += 3;
597 *d++ = *s;
598 *d++ = *(s+1);
599 *d++ = *(s+2);
600 s += 3;
601 }
602 }
603
604 void (*sdlStretcher24[4])(u8 *, u8 *, int) = {
605 sdlStretch24x1,
606 sdlStretch24x2,
607 sdlStretch24x3,
608 sdlStretch24x4
609 };
610
611 #endif // C_CORE
612
sdlStretchInit(int colorDepth,int sizeMultiplier,int srcWidth)613 bool sdlStretchInit(int colorDepth, int sizeMultiplier, int srcWidth)
614 {
615 #ifndef C_CORE
616 sdlMakeStretcher(srcWidth, sizeMultiplier);
617 #else
618 switch(colorDepth) {
619 case 16:
620 sdlStretcher = sdlStretcher16[sizeMultiplier];
621 break;
622 case 24:
623 sdlStretcher = sdlStretcher24[sizeMultiplier];
624 break;
625 case 32:
626 sdlStretcher = sdlStretcher32[sizeMultiplier];
627 break;
628 default:
629 return false;
630 }
631 #endif
632 return true;
633 }
634
sdlStretch1x(u8 * srcPtr,u32 srcPitch,u8 *,u8 * dstPtr,u32 dstPitch,int width,int height)635 void sdlStretch1x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) {
636 int i;
637 #ifndef C_CORE
638 u32 *stretcher = (u32 *)sdlStretcher;
639 #endif
640 for(i = 0; i < height; i++) {
641 SDL_CALL_STRETCHER;
642 srcPtr += srcPitch;
643 dstPtr += dstPitch;
644 }
645 }
sdlStretch2x(u8 * srcPtr,u32 srcPitch,u8 *,u8 * dstPtr,u32 dstPitch,int width,int height)646 void sdlStretch2x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) {
647 int i;
648 #ifndef C_CORE
649 u32 *stretcher = (u32 *)sdlStretcher;
650 #endif
651 for(i = 0; i < height; i++) {
652 SDL_CALL_STRETCHER;
653 dstPtr += dstPitch;
654 SDL_CALL_STRETCHER;
655 srcPtr += srcPitch;
656 dstPtr += dstPitch;
657 }
658 }
sdlStretch3x(u8 * srcPtr,u32 srcPitch,u8 *,u8 * dstPtr,u32 dstPitch,int width,int height)659 void sdlStretch3x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) {
660 int i;
661 #ifndef C_CORE
662 u32 *stretcher = (u32 *)sdlStretcher;
663 #endif
664 for(i = 0; i < height; i++) {
665 SDL_CALL_STRETCHER;
666 dstPtr += dstPitch;
667 SDL_CALL_STRETCHER;
668 dstPtr += dstPitch;
669 SDL_CALL_STRETCHER;
670 srcPtr += srcPitch;
671 dstPtr += dstPitch;
672 }
673 }
sdlStretch4x(u8 * srcPtr,u32 srcPitch,u8 *,u8 * dstPtr,u32 dstPitch,int width,int height)674 void sdlStretch4x(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, u8 *dstPtr, u32 dstPitch, int width, int height) {
675 int i;
676 #ifndef C_CORE
677 u32 *stretcher = (u32 *)sdlStretcher;
678 #endif
679 for(i = 0; i < height; i++) {
680 SDL_CALL_STRETCHER;
681 dstPtr += dstPitch;
682 SDL_CALL_STRETCHER;
683 dstPtr += dstPitch;
684 SDL_CALL_STRETCHER;
685 dstPtr += dstPitch;
686 SDL_CALL_STRETCHER;
687 srcPtr += srcPitch;
688 dstPtr += dstPitch;
689 }
690 }
691
692
693