2 // This file is part of the PicoDrive Megadrive Emulator
\r
4 // This code is licensed under the GNU General Public License version 2.0 and the MAME License.
\r
5 // You can choose the license that has the most advantages for you.
\r
7 // SVN repository can be found at http://code.google.com/p/cyclone68000/
\r
13 // Quick low-quality conversion of 320 to 176:
\r
14 int PicuQuick(unsigned short *dest,unsigned short *src)
\r
16 unsigned short *end=NULL;
\r
18 src+=13; end=src+290;
\r
24 *dest++=*src; src+=2;
\r
25 *dest++=*src; src+=2;
\r
27 *dest++=*src; src+=2;
\r
28 *dest++=*src; src+=2;
\r
35 // Shrink the pixels in src/srcLen, to the screen line pointed to by dest/destLen
\r
36 int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen)
\r
38 unsigned short *end=NULL;
\r
39 int bias=0,pa=0,sub=0;
\r
46 pa=*src++; bias-=sub;
\r
47 if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }
\r
48 *dest++=(unsigned short)pa;
\r
50 pa=*src++; bias-=sub;
\r
51 if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }
\r
52 *dest++=(unsigned short)pa;
\r
59 int PicuMerge(unsigned short *dest,int destLen,unsigned short *src,int srcLen)
\r
61 unsigned short *end=NULL;
\r
62 int bias=0,pa=0,mask=PicuAnd,sub=0;
\r
69 pa=*src++; bias-=sub;
\r
70 if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }
\r
71 pa&=mask; pa+=(*dest)&mask; pa>>=1;
\r
72 *dest++=(unsigned short)pa;
\r
74 pa=*src++; bias-=sub;
\r
75 if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }
\r
76 pa&=mask; pa+=(*dest)&mask; pa>>=1;
\r
77 *dest++=(unsigned short)pa;
\r