#include "main.h"

BOOL WINAPI DLLEntryPoint(HINSTANCE hDll,DWORD dwReason,LPVOID Reserved)
{
switch (dwReason)
            {
               case  DLL_PROCESS_ATTACH :
                      break ; 
               case  DLL_PROCESS_DETACH :  
                      break ;
            }
            return  TRUE ;

}

int Port(unsigned char *pDest,unsigned char *pSrc)
{
//Input: 320*240 ,8880 32bit Output: 640*480 8880 32bit;
//TD: Add you code here;

/************************************/
/*          1:1 Scanlines           */
/************************************/

int Index =8*4;
	for(int i=0; i<(640*480*4-640 *4); i+=640*4 *2 )
	{
		for(int I =0;I<640*4;I+= 4*2)
		{
//Get Ready;
       unsigned char  b =pSrc[Index]/2;
	   unsigned char  g =pSrc[Index+1]/2;
	   unsigned char  r =pSrc[Index+2]/2;

       int Render_Base =I+i;

//Start Render;
              _asm
			 {
               mov esi,pDest;
			   mov ebx,Render_Base;
			   mov CL,b;             
			   add CL,b;
               mov [esi+ebx],CL;
			   mov CL,g;
			   add CL,g;
			   mov [esi+ebx+1],CL;
			   mov CL,r;
			   add CL,r;
			   mov [esi+ebx+2],CL;

               mov CL,b;             
			   add CL,b;
               mov [esi+ebx+4],CL;
			   mov CL,g;
			   add CL,g;
			   mov [esi+ebx+5],CL;
			   mov CL,r;
			   add CL,r;
			   mov [esi+ebx+6],CL;

               mov CL,b;             
               mov [esi+ebx+2560],CL;
			   mov CL,g;
			   mov [esi+ebx+2561],CL;
			   mov CL,r;
			   mov [esi+ebx+2562],CL;
 
               mov CL,b;             
               mov [esi+ebx+2564],CL;
			   mov CL,g;
			   mov [esi+ebx+2565],CL;
			   mov CL,r;
			   mov [esi+ebx+2566],CL;
			 }

        Index+=4;
		}
		Index +=16*4;
	}
	return 0;
}

long Version()
{
	return 20050122;
}
