2 // This file is part of the PicoDrive Megadrive Emulator
\r
4 // Copyright (c) 2011 FinalDave (emudave (at) gmail.com)
\r
6 // This code is licensed under the GNU General Public License version 2.0 and the MAME License.
\r
7 // You can choose the license that has the most advantages for you.
\r
9 // SVN repository can be found at http://code.google.com/p/cyclone68000/
\r
11 #include "PicoInt.h"
\r
15 // Quick low-quality conversion of 320 to 176:
\r
16 int PicuQuick(unsigned short *dest,unsigned short *src)
\r
18 unsigned short *end=NULL;
\r
20 src+=13; end=src+290;
\r
26 *dest++=*src; src+=2;
\r
27 *dest++=*src; src+=2;
\r
29 *dest++=*src; src+=2;
\r
30 *dest++=*src; src+=2;
\r
37 // Shrink the pixels in src/srcLen, to the screen line pointed to by dest/destLen
\r
38 int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen)
\r
40 unsigned short *end=NULL;
\r
41 int bias=0,pa=0,sub=0;
\r
48 pa=*src++; bias-=sub;
\r
49 if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }
\r
50 *dest++=(unsigned short)pa;
\r
52 pa=*src++; bias-=sub;
\r
53 if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }
\r
54 *dest++=(unsigned short)pa;
\r
61 int PicuMerge(unsigned short *dest,int destLen,unsigned short *src,int srcLen)
\r
63 unsigned short *end=NULL;
\r
64 int bias=0,pa=0,mask=PicuAnd,sub=0;
\r
71 pa=*src++; bias-=sub;
\r
72 if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }
\r
73 pa&=mask; pa+=(*dest)&mask; pa>>=1;
\r
74 *dest++=(unsigned short)pa;
\r
76 pa=*src++; bias-=sub;
\r
77 if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }
\r
78 pa&=mask; pa+=(*dest)&mask; pa>>=1;
\r
79 *dest++=(unsigned short)pa;
\r