Delete all Trailing spaces in code.

svn path=/trunk/; revision=29689
This commit is contained in:
Daniel Reimer 2007-10-19 23:05:02 +00:00
parent 622c29bffb
commit a7fddf9c07
293 changed files with 12346 additions and 12346 deletions

View file

@ -15,12 +15,12 @@ bool Fullscreen, Running;
bool Init (HWND hwnd) bool Init (HWND hwnd)
{ {
DDSURFACEDESC2 ddsd; DDSURFACEDESC2 ddsd;
HRESULT hResult; HRESULT hResult;
// Create the main object // Create the main object
OutputDebugString("=> DirectDrawCreateEx\n"); OutputDebugString("=> DirectDrawCreateEx\n");
hResult = DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL); hResult = DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL);
if (hResult != DD_OK) if (hResult != DD_OK)
{ {
@ -37,7 +37,7 @@ bool Init (HWND hwnd)
hResult = DirectDraw->SetCooperativeLevel (hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); hResult = DirectDraw->SetCooperativeLevel (hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
else else
hResult = DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL); hResult = DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL);
if (hResult != DD_OK) if (hResult != DD_OK)
{ {
MessageBox(0,DDErrorString(hResult), "DDraw->SetCooperativeLevel", 0); MessageBox(0,DDErrorString(hResult), "DDraw->SetCooperativeLevel", 0);
@ -49,7 +49,7 @@ bool Init (HWND hwnd)
{ {
OutputDebugString("=> DDraw->SetDisplayMode\n"); OutputDebugString("=> DDraw->SetDisplayMode\n");
hResult = DirectDraw->SetDisplayMode (800, 600, 32, 0, 0); hResult = DirectDraw->SetDisplayMode (800, 600, 32, 0, 0);
if (hResult != DD_OK) if (hResult != DD_OK)
{ {
MessageBox(0,DDErrorString(hResult), "DDraw->SetDisplayMode", 0); MessageBox(0,DDErrorString(hResult), "DDraw->SetDisplayMode", 0);
@ -90,7 +90,7 @@ bool Init (HWND hwnd)
{ {
MessageBox(0,DDErrorString(hResult), "Clipper->SetHWnd", 0); MessageBox(0,DDErrorString(hResult), "Clipper->SetHWnd", 0);
return 0; return 0;
} }
OutputDebugString("=> Suface->SetClipper\n"); OutputDebugString("=> Suface->SetClipper\n");
hResult = FrontBuffer->SetClipper(Clipper); hResult = FrontBuffer->SetClipper(Clipper);
@ -112,12 +112,12 @@ void Draw (HWND hwnd)
DDBLTFX ddbltfx; DDBLTFX ddbltfx;
ddbltfx.dwSize = sizeof(DDBLTFX); ddbltfx.dwSize = sizeof(DDBLTFX);
ddbltfx.dwFillColor = RGB(255, 0, 255); ddbltfx.dwFillColor = RGB(255, 0, 255);
OutputDebugString("=> Surface->Blt (DDBLT_COLORFILL)\n"); OutputDebugString("=> Surface->Blt (DDBLT_COLORFILL)\n");
FrontBuffer->Blt(&rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); FrontBuffer->Blt(&rect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
} }
void CleanUp (void) void CleanUp (void)
{ {
@ -142,47 +142,47 @@ void CleanUp (void)
} }
} }
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
LPSTR lpCmdLine, int nCmdShow) LPSTR lpCmdLine, int nCmdShow)
{ {
MSG msg; MSG msg;
WNDCLASS wndclass; WNDCLASS wndclass;
HWND hwnd; HWND hwnd;
Fullscreen = MessageBox(0, "Do you want to me to run in Fullscreen ?", 0, MB_YESNO) == IDYES; Fullscreen = MessageBox(0, "Do you want to me to run in Fullscreen ?", 0, MB_YESNO) == IDYES;
// Create windnow // Create windnow
wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc; wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0; wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0; wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst; wndclass.hInstance = hInst;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION); wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject (LTGRAY_BRUSH); wndclass.hbrBackground = (HBRUSH)GetStockObject (LTGRAY_BRUSH);
wndclass.lpszMenuName = NULL; wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "DDrawDemo"; wndclass.lpszClassName = "DDrawDemo";
RegisterClass(&wndclass); RegisterClass(&wndclass);
#ifdef USE_CLIPPER #ifdef USE_CLIPPER
hwnd = CreateWindow("DDrawDemo", hwnd = CreateWindow("DDrawDemo",
"ReactOS DirectDraw Demo", "ReactOS DirectDraw Demo",
Fullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW, Fullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
800, CW_USEDEFAULT,
600, 800,
NULL, NULL, 600,
NULL, NULL,
hInst, NULL); hInst, NULL);
#else #else
hwnd = CreateWindow("DDrawDemo", hwnd = CreateWindow("DDrawDemo",
"ReactOS DirectDraw Demo", "ReactOS DirectDraw Demo",
WS_POPUP, WS_POPUP,
CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
800, CW_USEDEFAULT,
600, 800,
NULL, NULL, 600,
NULL, NULL,
hInst, NULL); hInst, NULL);
#endif #endif
@ -191,10 +191,10 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
{ {
Running = true; Running = true;
ShowWindow(hwnd, nCmdShow); ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd); UpdateWindow(hwnd);
} }
// Main loop // Main loop
while (Running) while (Running)
{ {
@ -202,12 +202,12 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
Draw(hwnd); Draw(hwnd);
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{ {
if (msg.message == WM_QUIT) break; if (msg.message == WM_QUIT) break;
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
} }
CleanUp(); CleanUp();
@ -215,9 +215,9 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
} }
LONG WINAPI WndProc (HWND hwnd, UINT message, LONG WINAPI WndProc (HWND hwnd, UINT message,
UINT wParam, LONG lParam) UINT wParam, LONG lParam)
{ {
switch (message) switch (message)
{ {
case WM_PAINT: case WM_PAINT:
@ -238,13 +238,13 @@ LONG WINAPI WndProc (HWND hwnd, UINT message,
case WM_DESTROY: case WM_DESTROY:
{ {
PostQuitMessage (0); PostQuitMessage (0);
return 0; return 0;
} break; } break;
} }
return DefWindowProc (hwnd, message, wParam, lParam); return DefWindowProc (hwnd, message, wParam, lParam);
} }
PCHAR DDErrorString (HRESULT hResult) PCHAR DDErrorString (HRESULT hResult)
{ {

View file

@ -17,7 +17,7 @@
// String Table // String Table
// //
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
idsAppName "Screen Saver.Maze" idsAppName "Screen Saver.Maze"
END END
@ -28,17 +28,17 @@ END
// TEXTINCLUDE // TEXTINCLUDE
// //
1 TEXTINCLUDE DISCARDABLE 1 TEXTINCLUDE DISCARDABLE
BEGIN BEGIN
"resource.h\0" "resource.h\0"
END END
2 TEXTINCLUDE DISCARDABLE 2 TEXTINCLUDE DISCARDABLE
BEGIN BEGIN
"#include <scrnsave.h>\0" "#include <scrnsave.h>\0"
END END
3 TEXTINCLUDE DISCARDABLE 3 TEXTINCLUDE DISCARDABLE
BEGIN BEGIN
"\r\n" "\r\n"
"\0" "\0"

View file

@ -17,7 +17,7 @@
// String Table // String Table
// //
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
idsAppName "Screen Saver.Maze" idsAppName "Screen Saver.Maze"
END END
@ -28,17 +28,17 @@ END
// TEXTINCLUDE // TEXTINCLUDE
// //
1 TEXTINCLUDE DISCARDABLE 1 TEXTINCLUDE DISCARDABLE
BEGIN BEGIN
"resource.h\0" "resource.h\0"
END END
2 TEXTINCLUDE DISCARDABLE 2 TEXTINCLUDE DISCARDABLE
BEGIN BEGIN
"#include <scrnsave.h>\0" "#include <scrnsave.h>\0"
END END
3 TEXTINCLUDE DISCARDABLE 3 TEXTINCLUDE DISCARDABLE
BEGIN BEGIN
"\r\n" "\r\n"
"\0" "\0"

View file

@ -80,7 +80,7 @@ static void standardreg(CPU_INT *RegTableCount, CPU_INT reg, CPU_INT setup_ebp,
} }
CPU_INT ConvertToIA32Process( FILE *outfp, CPU_INT ConvertToIA32Process( FILE *outfp,
PMYBrainAnalys pMystart, PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits, PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse, CPU_INT HowManyRegInUse,
CPU_INT *RegTableCount) CPU_INT *RegTableCount)
@ -202,7 +202,7 @@ CPU_INT ConvertToIA32Process( FILE *outfp,
if ((pMystart->type & 2)== 2) if ((pMystart->type & 2)== 2)
{ {
/* dest [eax - 0x20], source reg */ /* dest [eax - 0x20], source reg */
fprintf(outfp,"mov dword ["); fprintf(outfp,"mov dword [");
standardreg( RegTableCount, standardreg( RegTableCount,
pMystart->dst, pMystart->dst,
@ -255,7 +255,7 @@ CPU_INT ConvertToIA32Process( FILE *outfp,
pMystart=NULL; pMystart=NULL;
else else
pMystart = (PMYBrainAnalys) pMystart->ptr_next; pMystart = (PMYBrainAnalys) pMystart->ptr_next;
} }
return 0; return 0;
} }

View file

@ -28,8 +28,8 @@ static void standardreg(CPU_INT *RegTableCount, CPU_UNINT reg,
} }
} }
CPU_INT ConvertToPPCProcess( FILE *outfp, CPU_INT ConvertToPPCProcess( FILE *outfp,
PMYBrainAnalys pMystart, PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits, PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse, CPU_INT HowManyRegInUse,
CPU_INT *RegTableCount) CPU_INT *RegTableCount)
@ -71,7 +71,7 @@ CPU_INT ConvertToPPCProcess( FILE *outfp,
} }
/* fixme gas compatible /* fixme gas compatible
fprintf(outfp,"BITS 32\n"); fprintf(outfp,"BITS 32\n");
fprintf(outfp,"GLOBAL _main\n"); fprintf(outfp,"GLOBAL _main\n");
fprintf(outfp,"SECTION .text\n\n"); fprintf(outfp,"SECTION .text\n\n");
@ -130,7 +130,7 @@ CPU_INT ConvertToPPCProcess( FILE *outfp,
} }
} }
} /* end pMyBrainAnalys->type & 8 */ } /* end pMyBrainAnalys->type & 8 */
if ((pMystart->type & 64)== 64) if ((pMystart->type & 64)== 64)
{ {
if ((pMystart->type & 2)== 2) if ((pMystart->type & 2)== 2)
@ -149,7 +149,7 @@ CPU_INT ConvertToPPCProcess( FILE *outfp,
pMystart->src, pMystart->src,
setup_ebp, outfp); setup_ebp, outfp);
fprintf(outfp,", %d(",pMystart->dst_extra); fprintf(outfp,", %d(",pMystart->dst_extra);
standardreg( RegTableCount, standardreg( RegTableCount,
pMystart->dst, pMystart->dst,
setup_ebp, outfp); setup_ebp, outfp);
@ -165,7 +165,7 @@ CPU_INT ConvertToPPCProcess( FILE *outfp,
{ {
if (setup_ebp == 1) if (setup_ebp == 1)
{ {
// FIXME end our own frame pointer // FIXME end our own frame pointer
fprintf(outfp,"\n; clean up after the frame \n"); fprintf(outfp,"\n; clean up after the frame \n");
} }
} }

View file

@ -68,7 +68,7 @@ CPU_INT ConvertProcess(FILE *outfp, CPU_INT FromCpuid, CPU_INT ToCpuid)
switch (ToCpuid) switch (ToCpuid)
{ {
case IMAGE_FILE_MACHINE_I386: case IMAGE_FILE_MACHINE_I386:
ret = ConvertToIA32Process( outfp, pMystart, ret = ConvertToIA32Process( outfp, pMystart,
pMyend, regbits, pMyend, regbits,
HowManyRegInUse, HowManyRegInUse,
RegTableCount); RegTableCount);
@ -80,7 +80,7 @@ CPU_INT ConvertProcess(FILE *outfp, CPU_INT FromCpuid, CPU_INT ToCpuid)
break; break;
case IMAGE_FILE_MACHINE_POWERPC: case IMAGE_FILE_MACHINE_POWERPC:
ret = ConvertToPPCProcess( outfp, pMystart, ret = ConvertToPPCProcess( outfp, pMystart,
pMyend, regbits, pMyend, regbits,
HowManyRegInUse, HowManyRegInUse,
RegTableCount); RegTableCount);

View file

@ -95,14 +95,14 @@ int main(int argc, char * argv[])
//} //}
// mode 0 disambler // mode 0 disambler
// mode 1 convert to intel // mode 1 convert to intel
// mode 2 convert to ppc // mode 2 convert to ppc
//return LoadPFileImage(infile,outfile,BaseAddress,cpuid,type, mode); //return LoadPFileImage(infile,outfile,BaseAddress,cpuid,type, mode);
//LoadPFileImage("e:\\testppc.exe","e:\\cputointel.asm",0,0,0,1); //LoadPFileImage("e:\\testppc.exe","e:\\cputointel.asm",0,0,0,1);
LoadPFileImage("e:\\testppc.exe","e:\\cputointel.asm",0,0,0,1); LoadPFileImage("e:\\testppc.exe","e:\\cputointel.asm",0,0,0,1);
//pMyBrainAnalys = NULL; //pMyBrainAnalys = NULL;
//pStartMyBrainAnalys = NULL; //pStartMyBrainAnalys = NULL;
//LoadPFileImage("e:\\testppc.exe","e:\\cputoppc.asm",0,0,0,2); //LoadPFileImage("e:\\testppc.exe","e:\\cputoppc.asm",0,0,0,2);
// return LoadPFileImage("e:\\testms.exe","e:\\cputointel.asm",0,0,0,1); // convert // return LoadPFileImage("e:\\testms.exe","e:\\cputointel.asm",0,0,0,1); // convert
return 0; return 0;

View file

@ -12,6 +12,6 @@ CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
CPU_INT ARM_(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch); CPU_INT ARM_(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
/* Export comment thing see m68k for example /* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu * in dummy we do not show it, for it is diffent for each cpu
*/ */

View file

@ -1,20 +1,20 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "ARMBrain.h" #include "ARMBrain.h"
#include "ARM.h" #include "ARM.h"
#include "../../misc.h" #include "../../misc.h"
/* /*
* DummyBrain is example how you create you own cpu brain to translate from * DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not * cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in * need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not * misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then. * need the brain you have writen so you do not need setup it there then.
* *
* input param: * input param:
* cpu_buffer : the memory buffer with loaded program we whant translate * cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer * cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer * cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use. * BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one * cpuarch : the sub arch for the brain, example if it exists more one
@ -24,16 +24,16 @@
* mode : if we should run disambler of this binary or * mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the * translate it, Disambler will not calc the
* the row name right so we simple give each * the row name right so we simple give each
row a name. In translations mode we run a row a name. In translations mode we run a
* analys so we getting better optimzing and * analys so we getting better optimzing and
* only row name there we need. * only row name there we need.
* value for mode are : * value for mode are :
* 0 = disambler mode * 0 = disambler mode
* 1 = translate mode intel * 1 = translate mode intel
* *
* return value * return value
* 0 : Ok * 0 : Ok
* 1 : unimplemt * 1 : unimplemt
* 2 : Unkonwn Opcode * 2 : Unkonwn Opcode
* 3 : unimplement cpu * 3 : unimplement cpu
* 4 : unknown machine * 4 : unknown machine
@ -52,13 +52,13 @@ CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
CPU_INT retsize; CPU_INT retsize;
/* now we start the process */ /* now we start the process */
while (cpu_pos<cpu_size) while (cpu_pos<cpu_size)
{ {
cpu_oldpos = cpu_pos; cpu_oldpos = cpu_pos;
cpuint = cpu_buffer[cpu_pos]; cpuint = cpu_buffer[cpu_pos];
/* Add */ /* Add */
if ((cpuint - (cpuint & GetMaskByte32(cpuARMInit_))) == ConvertBitToByte32(cpuARMInit_)) if ((cpuint - (cpuint & GetMaskByte32(cpuARMInit_))) == ConvertBitToByte32(cpuARMInit_))
{ {
@ -69,7 +69,7 @@ CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
else else
cpu_pos += retsize; cpu_pos += retsize;
} }
/* Found all Opcode and breakout and return no error found */ /* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size) if (cpu_pos >=cpu_size)
{ {
@ -78,11 +78,11 @@ CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
/* Check if we have found a cpu opcode */ /* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos) if (cpu_oldpos == cpu_pos)
{ {
if (retcode == 0) if (retcode == 0)
{ {
/* no unimplement error where found so we return a msg for unknown opcode */ /* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]); printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2; retcode = 2;
} }
} }
@ -94,5 +94,5 @@ CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
break; break;
} }
} }
return retcode; return retcode;
} }

View file

@ -2,10 +2,10 @@
#include "../../misc.h" #include "../../misc.h"
/* example how setup a opcode, this opcode is 16bit long (taken from M68K) /* example how setup a opcode, this opcode is 16bit long (taken from M68K)
* 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent * 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent
* thing in the opcode, example which reg so on, it can be etither 0 or 1 in * thing in the opcode, example which reg so on, it can be etither 0 or 1 in
* the opcode. but a opcode have also normal bit that is always been set to * the opcode. but a opcode have also normal bit that is always been set to
* same. thuse bit are always 0 or 1 * same. thuse bit are always 0 or 1
*/ */
CPU_BYTE cpuARMInit_[32] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}; CPU_BYTE cpuARMInit_[32] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};

View file

@ -1,45 +1,45 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "../../misc.h" #include "../../misc.h"
/* cpuDummyInit_Add /* cpuDummyInit_Add
* Input param : * Input param :
* out : The file pointer that we write to (the output file to intel asm) * out : The file pointer that we write to (the output file to intel asm)
* cpu_buffer : The memory buffer we have our binary code that we whant convert * cpu_buffer : The memory buffer we have our binary code that we whant convert
* cpu_pos : Current positions in the cpu_buffer * cpu_pos : Current positions in the cpu_buffer
* cpu_size : The memory size of the cpu_buffer * cpu_size : The memory size of the cpu_buffer
* BaseAddress : The base address you whant the binay file should run from * BaseAddress : The base address you whant the binay file should run from
* cpuarch : if it exists diffent cpu from a manufactor like pentium, * cpuarch : if it exists diffent cpu from a manufactor like pentium,
* pentinum-mmx so on, use this flag to specify which type * pentinum-mmx so on, use this flag to specify which type
* of cpu you whant or do not use it if it does not exists * of cpu you whant or do not use it if it does not exists
* other or any sub model. * other or any sub model.
* *
* mode : if we should run disambler of this binary or * mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the * translate it, Disambler will not calc the
* the row name right so we simple give each * the row name right so we simple give each
row a name. In translations mode we run a row a name. In translations mode we run a
* analys so we getting better optimzing and * analys so we getting better optimzing and
* only row name there we need. * only row name there we need.
* value for mode are : * value for mode are :
* 0 = disambler mode * 0 = disambler mode
* 1 = translate mode intel * 1 = translate mode intel
* *
* Return value : * Return value :
* value -1 : unimplement * value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode * value 0 : wrong opcode or not vaild opcode
* value +1 and higher : who many byte we should add to cpu_pos * value +1 and higher : who many byte we should add to cpu_pos
*/ */
CPU_INT ARM_( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_INT ARM_( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch) CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{ {
/* /*
* ConvertBitToByte() is perfect to use to get the bit being in use from a bit array * ConvertBitToByte() is perfect to use to get the bit being in use from a bit array
* GetMaskByte() is perfect if u whant known which bit have been mask out * GetMaskByte() is perfect if u whant known which bit have been mask out
* see M68kopcode.c and how it use the ConvertBitToByte() * see M68kopcode.c and how it use the ConvertBitToByte()
*/ */

View file

@ -12,6 +12,6 @@ CPU_INT IA32Brain( CPU_BYTE *cpu_buffer,
CPU_INT IA32_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch); CPU_INT IA32_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
/* Export comment thing see m68k for example /* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu * in dummy we do not show it, for it is diffent for each cpu
*/ */

View file

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "IA32Brain.h" #include "IA32Brain.h"
#include "IA32.h" #include "IA32.h"
#include "../../any_op.h" #include "../../any_op.h"
@ -9,16 +9,16 @@
/* /*
* DummyBrain is example how you create you own cpu brain to translate from * DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not * cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in * need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not * misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then. * need the brain you have writen so you do not need setup it there then.
* *
* input param: * input param:
* cpu_buffer : the memory buffer with loaded program we whant translate * cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer * cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer * cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use. * BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one * cpuarch : the sub arch for the brain, example if it exists more one
@ -28,16 +28,16 @@
* mode : if we should run disambler of this binary or * mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the * translate it, Disambler will not calc the
* the row name right so we simple give each * the row name right so we simple give each
row a name. In translations mode we run a row a name. In translations mode we run a
* analys so we getting better optimzing and * analys so we getting better optimzing and
* only row name there we need. * only row name there we need.
* value for mode are : * value for mode are :
* 0 = disambler mode * 0 = disambler mode
* 1 = translate mode intel * 1 = translate mode intel
* *
* return value * return value
* 0 : Ok * 0 : Ok
* 1 : unimplemt * 1 : unimplemt
* 2 : Unkonwn Opcode * 2 : Unkonwn Opcode
* 3 : unimplement cpu * 3 : unimplement cpu
* 4 : unknown machine * 4 : unknown machine
@ -64,10 +64,10 @@ CPU_INT IA32Brain( CPU_BYTE *cpu_buffer,
to read from the memory the to read from the memory the
Le is for small endian and the Le is for small endian and the
Be is for big endian Be is for big endian
the 32 is how many bits we should read the 32 is how many bits we should read
*/ */
cpuint = GetData32Be(&cpu_buffer[cpu_pos]); cpuint = GetData32Be(&cpu_buffer[cpu_pos]);
/* Add */ /* Add */
if ((cpuint - (cpuint & GetMaskByte(cpuIA32Init_Add))) == ConvertBitToByte(cpuIA32Init_Add)) if ((cpuint - (cpuint & GetMaskByte(cpuIA32Init_Add))) == ConvertBitToByte(cpuIA32Init_Add))
{ {
@ -78,7 +78,7 @@ CPU_INT IA32Brain( CPU_BYTE *cpu_buffer,
else else
cpu_pos += retsize; cpu_pos += retsize;
} }
/* Found all Opcode and breakout and return no error found */ /* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size) if (cpu_pos >=cpu_size)
{ {
@ -87,11 +87,11 @@ CPU_INT IA32Brain( CPU_BYTE *cpu_buffer,
/* Check if we have found a cpu opcode */ /* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos) if (cpu_oldpos == cpu_pos)
{ {
if (retcode == 0) if (retcode == 0)
{ {
/* no unimplement error where found so we return a msg for unknown opcode */ /* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]); printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2; retcode = 2;
} }
} }

View file

@ -3,10 +3,10 @@
#include "../../misc.h" #include "../../misc.h"
/* example how setup a opcode, this opcode is 16bit long (taken from M68K) /* example how setup a opcode, this opcode is 16bit long (taken from M68K)
* 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent * 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent
* thing in the opcode, example which reg so on, it can be etither 0 or 1 in * thing in the opcode, example which reg so on, it can be etither 0 or 1 in
* the opcode. but a opcode have also normal bit that is always been set to * the opcode. but a opcode have also normal bit that is always been set to
* same. thuse bit are always 0 or 1 * same. thuse bit are always 0 or 1
*/ */
CPU_BYTE cpuIA32Init_Add[16] = {1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2}; CPU_BYTE cpuIA32Init_Add[16] = {1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2};

View file

@ -1,45 +1,45 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "IA32.h" #include "IA32.h"
#include "../../misc.h" #include "../../misc.h"
/* cpuDummyInit_Add /* cpuDummyInit_Add
* Input param : * Input param :
* out : The file pointer that we write to (the output file to intel asm) * out : The file pointer that we write to (the output file to intel asm)
* cpu_buffer : The memory buffer we have our binary code that we whant convert * cpu_buffer : The memory buffer we have our binary code that we whant convert
* cpu_pos : Current positions in the cpu_buffer * cpu_pos : Current positions in the cpu_buffer
* cpu_size : The memory size of the cpu_buffer * cpu_size : The memory size of the cpu_buffer
* BaseAddress : The base address you whant the binay file should run from * BaseAddress : The base address you whant the binay file should run from
* cpuarch : if it exists diffent cpu from a manufactor like pentium, * cpuarch : if it exists diffent cpu from a manufactor like pentium,
* pentinum-mmx so on, use this flag to specify which type * pentinum-mmx so on, use this flag to specify which type
* of cpu you whant or do not use it if it does not exists * of cpu you whant or do not use it if it does not exists
* other or any sub model. * other or any sub model.
* *
* mode : if we should run disambler of this binary or * mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the * translate it, Disambler will not calc the
* the row name right so we simple give each * the row name right so we simple give each
row a name. In translations mode we run a row a name. In translations mode we run a
* analys so we getting better optimzing and * analys so we getting better optimzing and
* only row name there we need. * only row name there we need.
* value for mode are : * value for mode are :
* 0 = disambler mode * 0 = disambler mode
* 1 = translate mode intel * 1 = translate mode intel
* *
* Return value : * Return value :
* value -1 : unimplement * value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode * value 0 : wrong opcode or not vaild opcode
* value +1 and higher : who many byte we should add to cpu_pos * value +1 and higher : who many byte we should add to cpu_pos
*/ */
CPU_INT IA32_Add( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_INT IA32_Add( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch) CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{ {
/* /*
* ConvertBitToByte() is perfect to use to get the bit being in use from a bit array * ConvertBitToByte() is perfect to use to get the bit being in use from a bit array
* GetMaskByte() is perfect if u whant known which bit have been mask out * GetMaskByte() is perfect if u whant known which bit have been mask out
* see M68kopcode.c and how it use the ConvertBitToByte() * see M68kopcode.c and how it use the ConvertBitToByte()
*/ */

View file

@ -16,7 +16,7 @@ CPU_INT PPC_mr( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT c
CPU_INT PPC_Stw( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch); CPU_INT PPC_Stw( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
CPU_INT PPC_Stwu( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch); CPU_INT PPC_Stwu( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
/* Export comment thing see m68k for example /* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu * in dummy we do not show it, for it is diffent for each cpu
*/ */

View file

@ -1,20 +1,20 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "PPCBrain.h" #include "PPCBrain.h"
#include "PPC.h" #include "PPC.h"
#include "../../misc.h" #include "../../misc.h"
/* /*
* DummyBrain is example how you create you own cpu brain to translate from * DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not * cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in * need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not * misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then. * need the brain you have writen so you do not need setup it there then.
* *
* input param: * input param:
* cpu_buffer : the memory buffer with loaded program we whant translate * cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer * cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer * cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use. * BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one * cpuarch : the sub arch for the brain, example if it exists more one
@ -24,16 +24,16 @@
* mode : if we should run disambler of this binary or * mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the * translate it, Disambler will not calc the
* the row name right so we simple give each * the row name right so we simple give each
row a name. In translations mode we run a row a name. In translations mode we run a
* analys so we getting better optimzing and * analys so we getting better optimzing and
* only row name there we need. * only row name there we need.
* value for mode are : * value for mode are :
* 0 = disambler mode * 0 = disambler mode
* 1 = translate mode intel * 1 = translate mode intel
* *
* return value * return value
* 0 : Ok * 0 : Ok
* 1 : unimplemt * 1 : unimplemt
* 2 : Unkonwn Opcode * 2 : Unkonwn Opcode
* 3 : unimplement cpu * 3 : unimplement cpu
* 4 : unknown machine * 4 : unknown machine
@ -121,11 +121,11 @@ CPU_INT PPCBrain( CPU_BYTE *cpu_buffer,
/* Check if we have found a cpu opcode */ /* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos) if (cpu_oldpos == cpu_pos)
{ {
if (retcode == 0) if (retcode == 0)
{ {
/* no unimplement error where found so we return a msg for unknown opcode */ /* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]); printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2; retcode = 2;
} }
} }

View file

@ -2,10 +2,10 @@
#include "../../misc.h" #include "../../misc.h"
/* example how setup a opcode, this opcode is 16bit long (taken from M68K) /* example how setup a opcode, this opcode is 16bit long (taken from M68K)
* 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent * 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent
* thing in the opcode, example which reg so on, it can be etither 0 or 1 in * thing in the opcode, example which reg so on, it can be etither 0 or 1 in
* the opcode. but a opcode have also normal bit that is always been set to * the opcode. but a opcode have also normal bit that is always been set to
* same. thuse bit are always 0 or 1 * same. thuse bit are always 0 or 1
*/ */
@ -22,7 +22,7 @@ CPU_BYTE cpuPPCInit_lwz[32] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
/* mask */ /* mask */
/* /*
* no mask we implement function getting the reg right * no mask we implement function getting the reg right
*/ */
/* bit index /* bit index

View file

@ -1,28 +1,28 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "PPC.h" #include "PPC.h"
#include "../../misc.h" #include "../../misc.h"
#include "../../any_op.h" #include "../../any_op.h"
/* reg r0-r31 /* reg r0-r31
r3 = eax r3 = eax
*/ */
/* cpuDummyInit_Add /* cpuDummyInit_Add
* Input param : * Input param :
* out : The file pointer that we write to (the output file to intel asm) * out : The file pointer that we write to (the output file to intel asm)
* cpu_buffer : The memory buffer we have our binary code that we whant convert * cpu_buffer : The memory buffer we have our binary code that we whant convert
* cpu_pos : Current positions in the cpu_buffer * cpu_pos : Current positions in the cpu_buffer
* cpu_size : The memory size of the cpu_buffer * cpu_size : The memory size of the cpu_buffer
* BaseAddress : The base address you whant the binay file should run from * BaseAddress : The base address you whant the binay file should run from
* cpuarch : if it exists diffent cpu from a manufactor like pentium, * cpuarch : if it exists diffent cpu from a manufactor like pentium,
* pentinum-mmx so on, use this flag to specify which type * pentinum-mmx so on, use this flag to specify which type
* of cpu you whant or do not use it if it does not exists * of cpu you whant or do not use it if it does not exists
* other or any sub model. * other or any sub model.
* *
* Return value : * Return value :
* value -1 : unimplement * value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode * value 0 : wrong opcode or not vaild opcode
* value +1 and higher : who many byte we should add to cpu_pos * value +1 and higher : who many byte we should add to cpu_pos
*/ */

View file

@ -12,6 +12,6 @@ CPU_INT DummyBrain( CPU_BYTE *cpu_buffer,
CPU_INT DUMMY_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch); CPU_INT DUMMY_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch);
/* Export comment thing see m68k for example /* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu * in dummy we do not show it, for it is diffent for each cpu
*/ */

View file

@ -1,22 +1,22 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "DummyBrain.h" #include "DummyBrain.h"
#include "Dummy.h" #include "Dummy.h"
#include "../../misc.h" #include "../../misc.h"
/* /*
* DummyBrain is example how you create you own cpu brain to translate from * DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not * cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in * need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not * misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then. * need the brain you have writen so you do not need setup it there then.
* *
* input param: * input param:
* cpu_buffer : the memory buffer with loaded program we whant translate * cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer * cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer * cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use. * BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one * cpuarch : the sub arch for the brain, example if it exists more one
@ -24,8 +24,8 @@
* outfp : the output file pointer * outfp : the output file pointer
* *
* return value * return value
* 0 : Ok * 0 : Ok
* 1 : unimplemt * 1 : unimplemt
* 2 : Unkonwn Opcode * 2 : Unkonwn Opcode
* 3 : unimplement cpu * 3 : unimplement cpu
* 4 : unknown machine * 4 : unknown machine
@ -52,10 +52,10 @@ CPU_INT DummyBrain( CPU_BYTE *cpu_buffer,
to read from the memory the to read from the memory the
Le is for small endian and the Le is for small endian and the
Be is for big endian Be is for big endian
the 32 is how many bits we should read the 32 is how many bits we should read
*/ */
cpuint = GetData32Be(&cpu_buffer[cpu_pos]); cpuint = GetData32Be(&cpu_buffer[cpu_pos]);
/* Add */ /* Add */
if ((cpuint - (cpuint & GetMaskByte(cpuDummyInit_Add))) == ConvertBitToByte(cpuDummyInit_Add)) if ((cpuint - (cpuint & GetMaskByte(cpuDummyInit_Add))) == ConvertBitToByte(cpuDummyInit_Add))
{ {
@ -66,7 +66,7 @@ CPU_INT DummyBrain( CPU_BYTE *cpu_buffer,
else else
cpu_pos += retsize; cpu_pos += retsize;
} }
/* Found all Opcode and breakout and return no error found */ /* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size) if (cpu_pos >=cpu_size)
{ {
@ -75,11 +75,11 @@ CPU_INT DummyBrain( CPU_BYTE *cpu_buffer,
/* Check if we have found a cpu opcode */ /* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos) if (cpu_oldpos == cpu_pos)
{ {
if (retcode == 0) if (retcode == 0)
{ {
/* no unimplement error where found so we return a msg for unknown opcode */ /* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]); printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2; retcode = 2;
} }
} }

View file

@ -2,10 +2,10 @@
#include "../../misc.h" #include "../../misc.h"
/* example how setup a opcode, this opcode is 16bit long (taken from M68K) /* example how setup a opcode, this opcode is 16bit long (taken from M68K)
* 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent * 0 and 1 mean normal bit, 2 mean mask bit the bit that are determent diffent
* thing in the opcode, example which reg so on, it can be etither 0 or 1 in * thing in the opcode, example which reg so on, it can be etither 0 or 1 in
* the opcode. but a opcode have also normal bit that is always been set to * the opcode. but a opcode have also normal bit that is always been set to
* same. thuse bit are always 0 or 1 * same. thuse bit are always 0 or 1
*/ */
CPU_BYTE cpuDummyInit_Add[16] = {1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2}; CPU_BYTE cpuDummyInit_Add[16] = {1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2};

View file

@ -1,34 +1,34 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "Dummy.h" #include "Dummy.h"
#include "../../misc.h" #include "../../misc.h"
/* cpuDummyInit_Add /* cpuDummyInit_Add
* Input param : * Input param :
* out : The file pointer that we write to (the output file to intel asm) * out : The file pointer that we write to (the output file to intel asm)
* cpu_buffer : The memory buffer we have our binary code that we whant convert * cpu_buffer : The memory buffer we have our binary code that we whant convert
* cpu_pos : Current positions in the cpu_buffer * cpu_pos : Current positions in the cpu_buffer
* cpu_size : The memory size of the cpu_buffer * cpu_size : The memory size of the cpu_buffer
* BaseAddress : The base address you whant the binay file should run from * BaseAddress : The base address you whant the binay file should run from
* cpuarch : if it exists diffent cpu from a manufactor like pentium, * cpuarch : if it exists diffent cpu from a manufactor like pentium,
* pentinum-mmx so on, use this flag to specify which type * pentinum-mmx so on, use this flag to specify which type
* of cpu you whant or do not use it if it does not exists * of cpu you whant or do not use it if it does not exists
* other or any sub model. * other or any sub model.
* Return value : * Return value :
* value -1 : unimplement * value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode * value 0 : wrong opcode or not vaild opcode
* value +1 and higher : who many byte we should add to cpu_pos * value +1 and higher : who many byte we should add to cpu_pos
*/ */
CPU_INT DUMMY_Add( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_INT DUMMY_Add( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch) CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{ {
/* /*
* ConvertBitToByte() is perfect to use to get the bit being in use from a bit array * ConvertBitToByte() is perfect to use to get the bit being in use from a bit array
* GetMaskByte() is perfect if u whant known which bit have been mask out * GetMaskByte() is perfect if u whant known which bit have been mask out
* see M68kopcode.c and how it use the ConvertBitToByte() * see M68kopcode.c and how it use the ConvertBitToByte()
*/ */

View file

@ -1,20 +1,20 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "M68kBrain.h" #include "M68kBrain.h"
#include "m68k.h" #include "m68k.h"
#include "../../misc.h" #include "../../misc.h"
/* /*
* DummyBrain is example how you create you own cpu brain to translate from * DummyBrain is example how you create you own cpu brain to translate from
* cpu to intel assembler, I have not add DummyBrain to the loader it is not * cpu to intel assembler, I have not add DummyBrain to the loader it is not
* need it in our example. When you write you own brain, it must be setup in * need it in our example. When you write you own brain, it must be setup in
* misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not * misc.c function LoadPFileImage and PEFileStart, PEFileStart maybe does not
* need the brain you have writen so you do not need setup it there then. * need the brain you have writen so you do not need setup it there then.
* *
* input param: * input param:
* cpu_buffer : the memory buffer with loaded program we whant translate * cpu_buffer : the memory buffer with loaded program we whant translate
* cpu_pos : the positions in the cpu_buffer * cpu_pos : the positions in the cpu_buffer
* cpu_size : the alloced memory size of the cpu_buffer * cpu_size : the alloced memory size of the cpu_buffer
* BaseAddress : the virtual memory address we setup to use. * BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one * cpuarch : the sub arch for the brain, example if it exists more one
@ -22,8 +22,8 @@
* outfp : the output file pointer * outfp : the output file pointer
* *
* return value * return value
* 0 : Ok * 0 : Ok
* 1 : unimplemt * 1 : unimplemt
* 2 : Unkonwn Opcode * 2 : Unkonwn Opcode
* 3 : unimplement cpu * 3 : unimplement cpu
* 4 : unknown machine * 4 : unknown machine
@ -47,7 +47,7 @@ CPU_INT M68KBrain( CPU_BYTE *cpu_buffer,
cpu_oldpos = cpu_pos; cpu_oldpos = cpu_pos;
cpuint = cpu_buffer[cpu_pos]; cpuint = cpu_buffer[cpu_pos];
/* Abcd */ /* Abcd */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Abcd))) == ConvertBitToByte(cpuM68kInit_Abcd)) if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Abcd))) == ConvertBitToByte(cpuM68kInit_Abcd))
{ {
@ -120,7 +120,7 @@ CPU_INT M68KBrain( CPU_BYTE *cpu_buffer,
} }
/* AndToCCR */ /* AndToCCR */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_AndToCCRF))) == ConvertBitToByte(cpuM68kInit_AndToCCRF)) if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_AndToCCRF))) == ConvertBitToByte(cpuM68kInit_AndToCCRF))
{ {
cpuint = cpu_buffer[cpu_pos+1]; cpuint = cpu_buffer[cpu_pos+1];
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_AndToCCRS))) == ConvertBitToByte(cpuM68kInit_AndToCCRS)) if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_AndToCCRS))) == ConvertBitToByte(cpuM68kInit_AndToCCRS))
{ {
@ -300,11 +300,11 @@ CPU_INT M68KBrain( CPU_BYTE *cpu_buffer,
/* Check if we have found a cpu opcode */ /* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos) if (cpu_oldpos == cpu_pos)
{ {
if (retcode == 0) if (retcode == 0)
{ {
/* no unimplement error where found so we return a msg for unknown opcode */ /* no unimplement error where found so we return a msg for unknown opcode */
printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]); printf("Unkonwn Opcode found at 0x%8x opcode 0x%2x\n",cpu_oldpos+BaseAddress,(unsigned int)cpu_buffer[cpu_oldpos]);
retcode = 2; retcode = 2;
} }
} }
@ -316,5 +316,5 @@ CPU_INT M68KBrain( CPU_BYTE *cpu_buffer,
break; break;
} }
} }
return retcode; return retcode;
} }

View file

@ -1,7 +1,7 @@
#include "../../misc.h" #include "../../misc.h"
CPU_BYTE cpuM68kInit_Abcd[16] = {1,1,1,1,2,2,2,1,0,0,0,0,2,2,2,2}; CPU_BYTE cpuM68kInit_Abcd[16] = {1,1,1,1,2,2,2,1,0,0,0,0,2,2,2,2};
CPU_BYTE cpuM68kInit_Add[16] = {1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2}; CPU_BYTE cpuM68kInit_Add[16] = {1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Addi[16] = {0,0,0,0,0,1,1,0,2,2,2,2,2,2,2,2}; CPU_BYTE cpuM68kInit_Addi[16] = {0,0,0,0,0,1,1,0,2,2,2,2,2,2,2,2};
CPU_BYTE cpuM68kInit_Addq[16] = {0,1,0,1,2,2,2,0,2,2,2,2,2,2,2,2}; CPU_BYTE cpuM68kInit_Addq[16] = {0,1,0,1,2,2,2,0,2,2,2,2,2,2,2,2};

View file

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "m68k.h" #include "m68k.h"
#include "misc.h" #include "misc.h"
@ -22,7 +22,7 @@ CPU_INT M68k_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_INT Rx; CPU_INT Rx;
CPU_INT Ry; CPU_INT Ry;
//CPU_INT cpuint; //CPU_INT cpuint;
opmode = ConvertBitToByte(M68k_Opmode); opmode = ConvertBitToByte(M68k_Opmode);
mode = ConvertBitToByte(M68k_Mode); mode = ConvertBitToByte(M68k_Mode);
Rx = ConvertBitToByte(M68k_Rx); Rx = ConvertBitToByte(M68k_Rx);
@ -32,9 +32,9 @@ CPU_INT M68k_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
if (opmode == 0x00) if (opmode == 0x00)
{ {
/* <ea> + Dn -> Dn */ /* <ea> + Dn -> Dn */
printf(";Add unimplement of \"<ea> + Dn -> Dn\" \n"); printf(";Add unimplement of \"<ea> + Dn -> Dn\" \n");
} }
if (opmode == 0x01) if (opmode == 0x01)
@ -54,7 +54,7 @@ CPU_INT M68k_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
/* <ea> + An -> An */ /* <ea> + An -> An */
printf(";Add unimplement of \"<ea> + An -> An\" \n"); printf(";Add unimplement of \"<ea> + An -> An\" \n");
} }
if (opmode == 0x04) if (opmode == 0x04)
{ {
/* Dn + <ea> -> <ea> */ /* Dn + <ea> -> <ea> */
@ -80,9 +80,9 @@ CPU_INT M68k_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
} }
return -1; return -1;
} }

View file

@ -13,7 +13,7 @@ static CPU_INT machine_type = 0;
//static CPU_INT ToMachine_type = IMAGE_FILE_MACHINE_I386; //static CPU_INT ToMachine_type = IMAGE_FILE_MACHINE_I386;
static CPU_INT ToMachine_type = IMAGE_FILE_MACHINE_POWERPC; static CPU_INT ToMachine_type = IMAGE_FILE_MACHINE_POWERPC;
/* /*
* infileName file name to convert or disambler * infileName file name to convert or disambler
* outputfileName file name to save to * outputfileName file name to save to
* BaseAddress the address we should emulate * BaseAddress the address we should emulate
* cpuid the cpu we choice not vaild for pe loader * cpuid the cpu we choice not vaild for pe loader
@ -21,7 +21,7 @@ static CPU_INT ToMachine_type = IMAGE_FILE_MACHINE_POWERPC;
* mode disambler mode : 0 the arch cpu. * mode disambler mode : 0 the arch cpu.
* translate mode : 1 intel * translate mode : 1 intel
* translate mode : 2 ppc * translate mode : 2 ppc
* *
*/ */
static void SetCPU(CPU_INT FromCpu, CPU_INT mode) static void SetCPU(CPU_INT FromCpu, CPU_INT mode)
@ -57,18 +57,18 @@ static void Convert(FILE *outfp, CPU_INT FromCpu, CPU_INT mode)
} }
CPU_INT LoadPFileImage( char *infileName, char *outputfileName, CPU_INT LoadPFileImage( char *infileName, char *outputfileName,
CPU_UNINT BaseAddress, char *cpuid, CPU_UNINT BaseAddress, char *cpuid,
CPU_UNINT type, CPU_INT mode) CPU_UNINT type, CPU_INT mode)
{ {
FILE *infp; FILE *infp;
FILE *outfp; FILE *outfp;
CPU_BYTE *cpu_buffer; CPU_BYTE *cpu_buffer;
CPU_UNINT cpu_pos = 0; CPU_UNINT cpu_pos = 0;
CPU_UNINT cpu_size=0; CPU_UNINT cpu_size=0;
CPU_INT ret; CPU_INT ret;
//fopen("testms.exe","RB"); //fopen("testms.exe","RB");
/* Open file for read */ /* Open file for read */
@ -94,7 +94,7 @@ CPU_INT LoadPFileImage( char *infileName, char *outputfileName,
fclose(outfp); fclose(outfp);
return 5; return 5;
} }
/* get the memory size buffer */ /* get the memory size buffer */
cpu_size = ftell(infp); cpu_size = ftell(infp);
if (ferror(infp)) if (ferror(infp))
@ -145,7 +145,7 @@ CPU_INT LoadPFileImage( char *infileName, char *outputfileName,
} }
fclose(infp); fclose(infp);
if (type==0) if (type==0)
{ {
if ( PEFileStart(cpu_buffer, 0, BaseAddress, cpu_size, outfp, mode) !=0) if ( PEFileStart(cpu_buffer, 0, BaseAddress, cpu_size, outfp, mode) !=0)
{ {
@ -238,7 +238,7 @@ CPU_INT LoadPFileImage( char *infileName, char *outputfileName,
} }
} }
if (type==2) if (type==2)
{ {
ret = PEFileStart(cpu_buffer, 0, BaseAddress, cpu_size, outfp, mode); ret = PEFileStart(cpu_buffer, 0, BaseAddress, cpu_size, outfp, mode);
@ -371,8 +371,8 @@ CPU_INT PEFileStart( CPU_BYTE *memory, CPU_UNINT pos,
SectionHeader[i].VirtualAddress + SectionHeader[i].SizeOfRawData > (ULONG)NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress) SectionHeader[i].VirtualAddress + SectionHeader[i].SizeOfRawData > (ULONG)NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress)
{ {
ExportEntry = (PIMAGE_NT_HEADERS) (((ULONG)memory) + ExportEntry = (PIMAGE_NT_HEADERS) (((ULONG)memory) +
(ULONG)(NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress - (ULONG)(NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress -
SectionHeader[i].VirtualAddress + SectionHeader[i].VirtualAddress +
SectionHeader[i].PointerToRawData)); SectionHeader[i].PointerToRawData));
} }
} }

View file

@ -5,7 +5,7 @@
#define OP_ANY_mov 0x00000000 #define OP_ANY_mov 0x00000000
#define OP_ANY_ret 0x00000001 #define OP_ANY_ret 0x00000001
/* We are using same abi as PPC /* We are using same abi as PPC
* eax = register 3 * eax = register 3
* edx = register 4 * edx = register 4
* esp = register 1 * esp = register 1
@ -46,8 +46,8 @@ typedef struct _BrainAnalys
CPU_UNINT memAdr; /* where are we in the current memory pos + baseaddress */ CPU_UNINT memAdr; /* where are we in the current memory pos + baseaddress */
CPU_INT row; /* 0 = no row, CPU_INT row; /* 0 = no row,
* 1 = row is bcc (conditions), * 1 = row is bcc (conditions),
* 2 = row is jsr (Call) * 2 = row is jsr (Call)
*/ */
@ -59,14 +59,14 @@ typedef struct _BrainAnalys
extern PMYBrainAnalys pMyBrainAnalys; /* current working address */ extern PMYBrainAnalys pMyBrainAnalys; /* current working address */
extern PMYBrainAnalys pStartMyBrainAnalys; /* start address */ extern PMYBrainAnalys pStartMyBrainAnalys; /* start address */
CPU_INT ConvertToIA32Process( FILE *outfp, CPU_INT ConvertToIA32Process( FILE *outfp,
PMYBrainAnalys pMystart, PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits, PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse, CPU_INT HowManyRegInUse,
CPU_INT *RegTableCount); CPU_INT *RegTableCount);
CPU_INT ConvertToPPCProcess( FILE *outfp, CPU_INT ConvertToPPCProcess( FILE *outfp,
PMYBrainAnalys pMystart, PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits, PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse, CPU_INT HowManyRegInUse,
CPU_INT *RegTableCount); CPU_INT *RegTableCount);

View file

@ -25,7 +25,7 @@
<file>From/dummycpu/Dummyopcode.c</file> <file>From/dummycpu/Dummyopcode.c</file>
<file>ImageLoader.c</file> <file>ImageLoader.c</file>
<file>AnyalsingProcess.c</file> <file>AnyalsingProcess.c</file>
<file>ConvertingProcess.c</file> <file>ConvertingProcess.c</file>
<file>ConvertToIA32Process.c</file> <file>ConvertToIA32Process.c</file>
<file>ConvertToPPCProcess.c</file> <file>ConvertToPPCProcess.c</file>

View file

@ -13,10 +13,10 @@
#include "From/PPC/PPC.h" #include "From/PPC/PPC.h"
/* retun /* retun
* 0 = Ok * 0 = Ok
* 1 = unimplemt * 1 = unimplemt
* 2 = Unkonwn Opcode * 2 = Unkonwn Opcode
* 3 = can not open read file * 3 = can not open read file
* 4 = can not open write file * 4 = can not open write file
* 5 = can not seek to end of read file * 5 = can not seek to end of read file
@ -41,7 +41,7 @@ CPU_UNINT ConvertBitToByte(CPU_BYTE *bit)
for(t=size;t>=0;t--) for(t=size;t>=0;t--)
{ {
if (bit[size-t] != 2) if (bit[size-t] != 2)
Byte = Byte + (bit[size-t]<<t); Byte = Byte + (bit[size-t]<<t);
} }
return Byte; return Byte;
@ -56,8 +56,8 @@ CPU_UNINT GetMaskByte(CPU_BYTE *bit)
for(t=size;t>=0;t--) for(t=size;t>=0;t--)
{ {
if (bit[size-t] == 2) if (bit[size-t] == 2)
{ {
MaskByte = MaskByte + ( (bit[size-t]-1) <<t); MaskByte = MaskByte + ( (bit[size-t]-1) <<t);
} }
} }
@ -73,7 +73,7 @@ CPU_UNINT ConvertBitToByte32(CPU_BYTE *bit)
for(t=size;t>=0;t--) for(t=size;t>=0;t--)
{ {
if (bit[size-t] != 2) if (bit[size-t] != 2)
Byte = Byte + (bit[size-t]<<t); Byte = Byte + (bit[size-t]<<t);
} }
return Byte; return Byte;
@ -88,8 +88,8 @@ CPU_UNINT GetMaskByte32(CPU_BYTE *bit)
for(t=size;t>=0;t--) for(t=size;t>=0;t--)
{ {
if (bit[size-t] == 2) if (bit[size-t] == 2)
{ {
MaskByte = MaskByte + ( (bit[size-t]-1) <<t); MaskByte = MaskByte + ( (bit[size-t]-1) <<t);
} }
} }
@ -154,7 +154,7 @@ CPU_INT AllocAny()
pMyBrainAnalys->ptr_next = (CPU_BYTE*)tmp; pMyBrainAnalys->ptr_next = (CPU_BYTE*)tmp;
tmp->ptr_prev= (CPU_BYTE*)pMyBrainAnalys; tmp->ptr_prev= (CPU_BYTE*)pMyBrainAnalys;
pMyBrainAnalys = tmp; pMyBrainAnalys = tmp;
} }
return 0; return 0;

View file

@ -46,18 +46,18 @@ int main(int argc, char* argv[])
HANDLE hThread; HANDLE hThread;
DWORD ThreadId; DWORD ThreadId;
SECURITY_ATTRIBUTES sa; SECURITY_ATTRIBUTES sa;
// Set up the security attributes struct. // Set up the security attributes struct.
sa.nLength= sizeof(SECURITY_ATTRIBUTES); sa.nLength= sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL; sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE; sa.bInheritHandle = TRUE;
// Create the child output pipe. // Create the child output pipe.
if (!CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0)) if (!CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0))
DisplayError("CreatePipe"); DisplayError("CreatePipe");
// Create a duplicate of the output write handle for the std error // Create a duplicate of the output write handle for the std error
// write handle. This is necessary in case the child application // write handle. This is necessary in case the child application
// closes one of its std output handles. // closes one of its std output handles.
@ -65,13 +65,13 @@ int main(int argc, char* argv[])
GetCurrentProcess(),&hErrorWrite,0, GetCurrentProcess(),&hErrorWrite,0,
TRUE,DUPLICATE_SAME_ACCESS)) TRUE,DUPLICATE_SAME_ACCESS))
DisplayError("DuplicateHandle"); DisplayError("DuplicateHandle");
// Create the child input pipe. // Create the child input pipe.
if (!CreatePipe(&hInputRead,&hInputWriteTmp,&sa,0)) if (!CreatePipe(&hInputRead,&hInputWriteTmp,&sa,0))
DisplayError("CreatePipe"); DisplayError("CreatePipe");
// Create new output read handle and the input write handles. Set // Create new output read handle and the input write handles. Set
// the Properties to FALSE. Otherwise, the child inherits the // the Properties to FALSE. Otherwise, the child inherits the
// properties and, as a result, non-closeable handles to the pipes // properties and, as a result, non-closeable handles to the pipes
@ -82,27 +82,27 @@ int main(int argc, char* argv[])
0,FALSE, // Make it uninheritable. 0,FALSE, // Make it uninheritable.
DUPLICATE_SAME_ACCESS)) DUPLICATE_SAME_ACCESS))
DisplayError("DupliateHandle"); DisplayError("DupliateHandle");
if (!DuplicateHandle(GetCurrentProcess(),hInputWriteTmp, if (!DuplicateHandle(GetCurrentProcess(),hInputWriteTmp,
GetCurrentProcess(), GetCurrentProcess(),
&hInputWrite, // Address of new handle. &hInputWrite, // Address of new handle.
0,FALSE, // Make it uninheritable. 0,FALSE, // Make it uninheritable.
DUPLICATE_SAME_ACCESS)) DUPLICATE_SAME_ACCESS))
DisplayError("DupliateHandle"); DisplayError("DupliateHandle");
// Close inheritable copies of the handles you do not want to be // Close inheritable copies of the handles you do not want to be
// inherited. // inherited.
if (!CloseHandle(hOutputReadTmp)) DisplayError("CloseHandle"); if (!CloseHandle(hOutputReadTmp)) DisplayError("CloseHandle");
if (!CloseHandle(hInputWriteTmp)) DisplayError("CloseHandle"); if (!CloseHandle(hInputWriteTmp)) DisplayError("CloseHandle");
// Get std input handle so you can close it and force the ReadFile to // Get std input handle so you can close it and force the ReadFile to
// fail when you want the input thread to exit. // fail when you want the input thread to exit.
if ( (hStdIn = GetStdHandle(STD_INPUT_HANDLE)) == if ( (hStdIn = GetStdHandle(STD_INPUT_HANDLE)) ==
INVALID_HANDLE_VALUE ) INVALID_HANDLE_VALUE )
DisplayError("GetStdHandle"); DisplayError("GetStdHandle");
SetConsoleTitle("gdb control console"); SetConsoleTitle("gdb control console");
size_t size = strlen(GDB_INITIAL_COMMAND)+PARAMS_SEPARATOR_LEN; size_t size = strlen(GDB_INITIAL_COMMAND)+PARAMS_SEPARATOR_LEN;
@ -128,8 +128,8 @@ int main(int argc, char* argv[])
} }
PrepAndLaunchRedirectedChild(hOutputWrite,hInputRead,hErrorWrite,pszCommandLine); PrepAndLaunchRedirectedChild(hOutputWrite,hInputRead,hErrorWrite,pszCommandLine);
// Close pipe handles (do not continue to modify the parent). // Close pipe handles (do not continue to modify the parent).
// You need to make sure that no handles to the write end of the // You need to make sure that no handles to the write end of the
// output pipe are maintained in this process or else the pipe will // output pipe are maintained in this process or else the pipe will
@ -137,39 +137,39 @@ int main(int argc, char* argv[])
if (!CloseHandle(hOutputWrite)) DisplayError("CloseHandle"); if (!CloseHandle(hOutputWrite)) DisplayError("CloseHandle");
if (!CloseHandle(hInputRead )) DisplayError("CloseHandle"); if (!CloseHandle(hInputRead )) DisplayError("CloseHandle");
if (!CloseHandle(hErrorWrite)) DisplayError("CloseHandle"); if (!CloseHandle(hErrorWrite)) DisplayError("CloseHandle");
// Launch the thread that gets the input and sends it to the child. // Launch the thread that gets the input and sends it to the child.
hThread = CreateThread(NULL,0,GetAndSendInputThread, hThread = CreateThread(NULL,0,GetAndSendInputThread,
(LPVOID)hInputWrite,0,&ThreadId); (LPVOID)hInputWrite,0,&ThreadId);
if (hThread == NULL) DisplayError("CreateThread"); if (hThread == NULL) DisplayError("CreateThread");
// Read the child's output. // Read the child's output.
ReadAndHandleOutput(hOutputRead); ReadAndHandleOutput(hOutputRead);
// Redirection is complete // Redirection is complete
// Force the read on the input to return by closing the stdin handle. // Force the read on the input to return by closing the stdin handle.
if (!CloseHandle(hStdIn)) DisplayError("CloseHandle"); if (!CloseHandle(hStdIn)) DisplayError("CloseHandle");
// Tell the thread to exit and wait for thread to die. // Tell the thread to exit and wait for thread to die.
bRunThread = FALSE; bRunThread = FALSE;
if (WaitForSingleObject(hThread,INFINITE) == WAIT_FAILED) if (WaitForSingleObject(hThread,INFINITE) == WAIT_FAILED)
DisplayError("WaitForSingleObject"); DisplayError("WaitForSingleObject");
if (!CloseHandle(hOutputRead)) DisplayError("CloseHandle"); if (!CloseHandle(hOutputRead)) DisplayError("CloseHandle");
if (!CloseHandle(hInputWrite)) DisplayError("CloseHandle"); if (!CloseHandle(hInputWrite)) DisplayError("CloseHandle");
return 0; return 0;
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// PrepAndLaunchRedirectedChild // PrepAndLaunchRedirectedChild
// Sets up STARTUPINFO structure, and launches redirected child. // Sets up STARTUPINFO structure, and launches redirected child.
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
void PrepAndLaunchRedirectedChild(HANDLE hChildStdOut, void PrepAndLaunchRedirectedChild(HANDLE hChildStdOut,
HANDLE hChildStdIn, HANDLE hChildStdIn,
HANDLE hChildStdErr, HANDLE hChildStdErr,
@ -177,7 +177,7 @@ void PrepAndLaunchRedirectedChild(HANDLE hChildStdOut,
{ {
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
STARTUPINFO si; STARTUPINFO si;
// Set up the start up info struct. // Set up the start up info struct.
ZeroMemory(&si,sizeof(STARTUPINFO)); ZeroMemory(&si,sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO); si.cb = sizeof(STARTUPINFO);
@ -190,8 +190,8 @@ void PrepAndLaunchRedirectedChild(HANDLE hChildStdOut,
// si.wShowWindow = SW_HIDE; // si.wShowWindow = SW_HIDE;
// Note that dwFlags must include STARTF_USESHOWWINDOW if you want to // Note that dwFlags must include STARTF_USESHOWWINDOW if you want to
// use the wShowWindow flags. // use the wShowWindow flags.
// Launch the process that you want to redirect (in this case, // Launch the process that you want to redirect (in this case,
// Child.exe). Make sure Child.exe is in the same directory as // Child.exe). Make sure Child.exe is in the same directory as
// redirect.c launch redirect from a command line to prevent location // redirect.c launch redirect from a command line to prevent location
@ -199,26 +199,26 @@ void PrepAndLaunchRedirectedChild(HANDLE hChildStdOut,
if (!CreateProcess(NULL,pchCommandLine,NULL,NULL,TRUE, if (!CreateProcess(NULL,pchCommandLine,NULL,NULL,TRUE,
CREATE_NEW_CONSOLE,NULL,NULL,&si,&pi)) CREATE_NEW_CONSOLE,NULL,NULL,&si,&pi))
DisplayError("CreateProcess"); DisplayError("CreateProcess");
// Set global child process handle to cause threads to exit. // Set global child process handle to cause threads to exit.
hChildProcess = pi.hProcess; hChildProcess = pi.hProcess;
// Close any unnecessary handles. // Close any unnecessary handles.
if (!CloseHandle(pi.hThread)) DisplayError("CloseHandle"); if (!CloseHandle(pi.hThread)) DisplayError("CloseHandle");
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// ReadAndHandleOutput // ReadAndHandleOutput
// Monitors handle for input. Exits when child exits or pipe breaks. // Monitors handle for input. Exits when child exits or pipe breaks.
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
void ReadAndHandleOutput(HANDLE hPipeRead) void ReadAndHandleOutput(HANDLE hPipeRead)
{ {
CHAR lpBuffer[256]; CHAR lpBuffer[256];
DWORD nBytesRead; DWORD nBytesRead;
DWORD nCharsWritten; DWORD nCharsWritten;
while(TRUE) while(TRUE)
{ {
if (!ReadFile(hPipeRead,lpBuffer,sizeof(lpBuffer), if (!ReadFile(hPipeRead,lpBuffer,sizeof(lpBuffer),
@ -229,7 +229,7 @@ void ReadAndHandleOutput(HANDLE hPipeRead)
else else
DisplayError("ReadFile"); // Something bad happened. DisplayError("ReadFile"); // Something bad happened.
} }
// Display the character read on the screen. // Display the character read on the screen.
if (!WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),lpBuffer, if (!WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),lpBuffer,
nBytesRead,&nCharsWritten,NULL)) nBytesRead,&nCharsWritten,NULL))
@ -238,26 +238,26 @@ void ReadAndHandleOutput(HANDLE hPipeRead)
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// GetAndSendInputThread // GetAndSendInputThread
// Thread procedure that monitors the console for input and sends input // Thread procedure that monitors the console for input and sends input
// to the child process through the input pipe. // to the child process through the input pipe.
// This thread ends when the child application exits. // This thread ends when the child application exits.
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
DWORD WINAPI GetAndSendInputThread(LPVOID lpvThreadParam) DWORD WINAPI GetAndSendInputThread(LPVOID lpvThreadParam)
{ {
CHAR read_buff[256]; CHAR read_buff[256];
DWORD nBytesRead,nBytesWrote; DWORD nBytesRead,nBytesWrote;
HANDLE hPipeWrite = (HANDLE)lpvThreadParam; HANDLE hPipeWrite = (HANDLE)lpvThreadParam;
// Get input from our console and send it to child through the pipe. // Get input from our console and send it to child through the pipe.
while (bRunThread) while (bRunThread)
{ {
if(!ReadConsole(hStdIn,read_buff,1,&nBytesRead,NULL)) if(!ReadConsole(hStdIn,read_buff,1,&nBytesRead,NULL))
DisplayError("ReadConsole"); DisplayError("ReadConsole");
read_buff[nBytesRead] = '\0'; // Follow input with a NULL. read_buff[nBytesRead] = '\0'; // Follow input with a NULL.
if (!WriteFile(hPipeWrite,read_buff,nBytesRead,&nBytesWrote,NULL)) if (!WriteFile(hPipeWrite,read_buff,nBytesRead,&nBytesWrote,NULL))
{ {
if (GetLastError() == ERROR_NO_DATA) if (GetLastError() == ERROR_NO_DATA)
@ -266,33 +266,33 @@ DWORD WINAPI GetAndSendInputThread(LPVOID lpvThreadParam)
DisplayError("WriteFile"); DisplayError("WriteFile");
} }
} }
return 1; return 1;
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// DisplayError // DisplayError
// Displays the error number and corresponding message. // Displays the error number and corresponding message.
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
void DisplayError(char *pszAPI) void DisplayError(char *pszAPI)
{ {
LPVOID lpvMessageBuffer; LPVOID lpvMessageBuffer;
CHAR szPrintBuffer[512]; CHAR szPrintBuffer[512];
DWORD nCharsWritten; DWORD nCharsWritten;
FormatMessage( FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(), NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpvMessageBuffer, 0, NULL); (LPTSTR)&lpvMessageBuffer, 0, NULL);
wsprintf(szPrintBuffer, wsprintf(szPrintBuffer,
"ERROR: API = %s.\n error code = %d.\n message = %s.\n", "ERROR: API = %s.\n error code = %d.\n message = %s.\n",
pszAPI, GetLastError(), (char *)lpvMessageBuffer); pszAPI, GetLastError(), (char *)lpvMessageBuffer);
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),szPrintBuffer, WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),szPrintBuffer,
lstrlen(szPrintBuffer),&nCharsWritten,NULL); lstrlen(szPrintBuffer),&nCharsWritten,NULL);
LocalFree(lpvMessageBuffer); LocalFree(lpvMessageBuffer);
ExitProcess(GetLastError()); ExitProcess(GetLastError());
} }

View file

@ -85,7 +85,7 @@ HandleList_Update(HWND hHandleListCtrl, HANDLE ProcessId)
if ( ((ProcessId != (HANDLE)1) && ((pEntry->Type & GDI_HANDLE_BASETYPE_MASK) != 0)) || if ( ((ProcessId != (HANDLE)1) && ((pEntry->Type & GDI_HANDLE_BASETYPE_MASK) != 0)) ||
((ProcessId == (HANDLE)1) && ((pEntry->Type & GDI_HANDLE_BASETYPE_MASK) == 0)) ) ((ProcessId == (HANDLE)1) && ((pEntry->Type & GDI_HANDLE_BASETYPE_MASK) == 0)) )
{ {
if (ProcessId == (HANDLE)1 || if (ProcessId == (HANDLE)1 ||
ProcessId == (HANDLE)((ULONG)pEntry->ProcessId & 0xfffc)) ProcessId == (HANDLE)((ULONG)pEntry->ProcessId & 0xfffc))
{ {
handle = GDI_HANDLE_CREATE(i, pEntry->Type); handle = GDI_HANDLE_CREATE(i, pEntry->Type);

View file

@ -1,4 +1,4 @@
/* $Id: genguid.rc,v 1.2 2004/10/16 22:30:17 gvg Exp $ */ /* $Id$ */
#define REACTOS_STR_FILE_DESCRIPTION "GUID Generator\0" #define REACTOS_STR_FILE_DESCRIPTION "GUID Generator\0"
#define REACTOS_STR_INTERNAL_NAME "genguid\0" #define REACTOS_STR_INTERNAL_NAME "genguid\0"

View file

@ -3,7 +3,7 @@
*/ */
unsigned short table_Windows28591[256] = unsigned short table_Windows28591[256] =
{ {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013,
0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D,

View file

@ -3,7 +3,7 @@
*/ */
unsigned short table_Windows28592[256] = unsigned short table_Windows28592[256] =
{ {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013,
0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D,
@ -23,11 +23,11 @@ unsigned short table_Windows28592[256] =
0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160,
0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, 0x00B0, 0x0105, 0x02DB, 0x0142, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, 0x00B0, 0x0105, 0x02DB, 0x0142,
0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD,
0x017E, 0x017C, 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x017E, 0x017C, 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, 0x0110, 0x0143, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, 0x0110, 0x0143,
0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170,
0x00DC, 0x00DD, 0x0162, 0x00DF, 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x00DC, 0x00DD, 0x0162, 0x00DF, 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A,
0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F,
0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9}; 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9};

View file

@ -4,7 +4,7 @@
unsigned short table_OEM437[256] = unsigned short table_OEM437[256] =
{ {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013,
0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D,
0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
@ -23,13 +23,13 @@ unsigned short table_OEM437[256] =
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310,
0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, 0x2591, 0x2592, 0x2593, 0x2502, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, 0x2591, 0x2592, 0x2593, 0x2502,
0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C,
0x255B, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255B, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, 0x2568, 0x2564, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, 0x2568, 0x2564,
0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588,
0x2584, 0x258C, 0x2590, 0x2580, 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x2584, 0x258C, 0x2590, 0x2580, 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3,
0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219,
0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0}; 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0};

View file

@ -28,5 +28,5 @@ unsigned short table_OEM850[256] =
0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588,
0x2584, 0x00A6, 0x00CC, 0x2580, 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x2584, 0x00A6, 0x00CC, 0x2580, 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5,
0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8,
0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0}; 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0};

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
<define name="_WIN32_WINNT">0x0501</define> <define name="_WIN32_WINNT">0x0501</define>
<define name="__USE_W32API" /> <define name="__USE_W32API" />
<library>kernel32</library> <library>kernel32</library>
<file>roswebparser.c</file> <file>roswebparser.c</file>
<file>utf8.c</file> <file>utf8.c</file>
</module> </module>

View file

@ -1,14 +1,14 @@
/* /*
* Convert ansi to utf-8 * Convert ansi to utf-8
* it does not support more that utf-16 * it does not support more that utf-16
* the table we are using is base on utf-16 then we convert the table to utf-8 * the table we are using is base on utf-16 then we convert the table to utf-8
* *
* All table lookup the ansi char to utf-16 then we calc the utf-8 format. * All table lookup the ansi char to utf-16 then we calc the utf-8 format.
*/ */
#include "oem437.h" /* windows oem 437 */ #include "oem437.h" /* windows oem 437 */
#include "oem850.h" /* windows oem 850 */ #include "oem850.h" /* windows oem 850 */
#include "Windows28591.h" /* windows 28591 aka ISO-2859-1 (Latin 1) */ #include "Windows28591.h" /* windows 28591 aka ISO-2859-1 (Latin 1) */
#include "Windows28592.h" /* windows 28592 aka ISO-2859-2 (Latin 2) */ #include "Windows28592.h" /* windows 28592 aka ISO-2859-2 (Latin 2) */
@ -23,24 +23,24 @@ int ansiCodePage(int codepage, unsigned char *inBuffer, unsigned char *outBuffer
ch=-1; ch=-1;
if (codepage == 437) if (codepage == 437)
{ {
ch = (int) table_OEM437[ ((unsigned char)inBuffer[t])]; ch = (int) table_OEM437[ ((unsigned char)inBuffer[t])];
} }
if (codepage == 850) if (codepage == 850)
{ {
ch = (int) table_OEM850[ ((unsigned char)inBuffer[t])]; ch = (int) table_OEM850[ ((unsigned char)inBuffer[t])];
} }
if (codepage == 28591) if (codepage == 28591)
{ {
ch = (int) table_Windows28591[ ((unsigned char)inBuffer[t])]; ch = (int) table_Windows28591[ ((unsigned char)inBuffer[t])];
} }
if (codepage == 28592) if (codepage == 28592)
{ {
ch = (int) table_Windows28592[ ((unsigned char)inBuffer[t])]; ch = (int) table_Windows28592[ ((unsigned char)inBuffer[t])];
} }
if (ch == -1) if (ch == -1)
@ -54,22 +54,22 @@ int ansiCodePage(int codepage, unsigned char *inBuffer, unsigned char *outBuffer
pos++; pos++;
} }
else if (ch <=0x07FF) // 1 1111 11 1111 else if (ch <=0x07FF) // 1 1111 11 1111
{ {
outBuffer[pos]= 0xC0 | (0x1F & (ch >> 6)); // 110x xxxx outBuffer[pos]= 0xC0 | (0x1F & (ch >> 6)); // 110x xxxx
outBuffer[pos+1]= 0x80 | (0x3f & ch); // 11xx xxxx outBuffer[pos+1]= 0x80 | (0x3f & ch); // 11xx xxxx
pos+=2; pos+=2;
} }
else if (ch <=0xFFFF) // 11 11 11 11 11 11 11 11 else if (ch <=0xFFFF) // 11 11 11 11 11 11 11 11
{ {
outBuffer[pos]= 0xC2 | (0xf & (ch >> 12)); // 1110xxxx outBuffer[pos]= 0xC2 | (0xf & (ch >> 12)); // 1110xxxx
outBuffer[pos+1]= 0x80 | (0x3f & (ch >> 6)); // 10xxxxxx outBuffer[pos+1]= 0x80 | (0x3f & (ch >> 6)); // 10xxxxxx
outBuffer[pos+1]= 0x80 | (0x3f & ch); // 10xxxxxx outBuffer[pos+1]= 0x80 | (0x3f & ch); // 10xxxxxx
pos+=3; pos+=3;
} }
} }
return pos; return pos;
} }

View file

@ -29,7 +29,7 @@ IDI_ZOOMIN ICON DISCARDABLE "zoomin.ico"
// Menu // Menu
// //
IDR_ZOOMIN_MENU MENU DISCARDABLE IDR_ZOOMIN_MENU MENU DISCARDABLE
BEGIN BEGIN
POPUP "&File" POPUP "&File"
BEGIN BEGIN
@ -74,7 +74,7 @@ END
// String Table // String Table
// //
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_APP_TITLE "ReactOS Zoomin" IDS_APP_TITLE "ReactOS Zoomin"
END END
@ -85,7 +85,7 @@ END
// Accelerator // Accelerator
// //
IDR_ZOOMIN ACCELERATORS DISCARDABLE IDR_ZOOMIN ACCELERATORS DISCARDABLE
BEGIN BEGIN
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
END END

View file

@ -5,7 +5,7 @@
<define name="_WIN32_IE">0x0501</define> <define name="_WIN32_IE">0x0501</define>
<define name="_WIN32_WINNT">0x0501</define> <define name="_WIN32_WINNT">0x0501</define>
<library>kernel32</library> <library>kernel32</library>
<library>gdi32</library> <library>gdi32</library>
<file>applicat.c</file> <file>applicat.c</file>
<file>barchart.c</file> <file>barchart.c</file>
<file>box.c</file> <file>box.c</file>

View file

@ -1,4 +1,4 @@
/* $Id: edit.rc,v 1.3 2004/10/16 22:30:17 gvg Exp $ */ /* $Id$ */
#define REACTOS_STR_FILE_DESCRIPTION "FreeDOS/ReactOS Text Editor\0" #define REACTOS_STR_FILE_DESCRIPTION "FreeDOS/ReactOS Text Editor\0"
#define REACTOS_STR_INTERNAL_NAME "edit\0" #define REACTOS_STR_INTERNAL_NAME "edit\0"

View file

@ -42,7 +42,7 @@
<directory name="imagesoft"> <directory name="imagesoft">
<xi:include href="imagesoft/imagesoft.rbuild" /> <xi:include href="imagesoft/imagesoft.rbuild" />
</directory> </directory>
<directory name="lib"> <directory name="lib">
<xi:include href="lib/directory.rbuild" /> <xi:include href="lib/directory.rbuild" />
</directory> </directory>
@ -84,7 +84,7 @@
<directory name="screenshot"> <directory name="screenshot">
<xi:include href="screenshot/screenshot.rbuild" /> <xi:include href="screenshot/screenshot.rbuild" />
</directory> </directory>
<!-- <!--
<directory name="smartpdf"> <directory name="smartpdf">
<xi:include href="smartpdf/fitz.rbuild" /> <xi:include href="smartpdf/fitz.rbuild" />
@ -92,7 +92,7 @@
<xi:include href="smartpdf/smartpdf.rbuild" /> <xi:include href="smartpdf/smartpdf.rbuild" />
</directory> </directory>
--> -->
<directory name="sysutils"> <directory name="sysutils">
<xi:include href="sysutils/sysutils.rbuild" /> <xi:include href="sysutils/sysutils.rbuild" />
</directory> </directory>

View file

@ -57,7 +57,7 @@ dlQueryInterface(IBindStatusCallback* This, REFIID riid, void** ppvObject)
{ {
return E_POINTER; return E_POINTER;
} }
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IBindStatusCallback)) if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IBindStatusCallback))
{ {
IBindStatusCallback_AddRef( This ); IBindStatusCallback_AddRef( This );
@ -72,7 +72,7 @@ static ULONG WINAPI
dlAddRef(IBindStatusCallback* iface) dlAddRef(IBindStatusCallback* iface)
{ {
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface; IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
@ -81,13 +81,13 @@ dlRelease(IBindStatusCallback* iface)
{ {
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface; IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
DWORD ref = InterlockedDecrement(&This->ref); DWORD ref = InterlockedDecrement(&This->ref);
if( !ref ) if( !ref )
{ {
DestroyWindow( This->hDialog ); DestroyWindow( This->hDialog );
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;
} }
@ -242,7 +242,7 @@ ThreadFunc(LPVOID Context)
{ {
goto end; goto end;
} }
DWORD dwSize = MAX_PATH; DWORD dwSize = MAX_PATH;
if (RegQueryValueEx(hKey, if (RegQueryValueEx(hKey,
L"DownloadFolder", L"DownloadFolder",
@ -253,7 +253,7 @@ ThreadFunc(LPVOID Context)
{ {
goto end; goto end;
} }
if (GetFileAttributes(path) == 0xFFFFFFFF) if (GetFileAttributes(path) == 0xFFFFFFFF)
if (!CreateDirectory((LPCTSTR)path,NULL)) if (!CreateDirectory((LPCTSTR)path,NULL))
{ {

View file

@ -25,7 +25,7 @@ BEGIN
PUSHBUTTON "&Abbrechen", IDCANCEL, 207, 90, 54, 15 PUSHBUTTON "&Abbrechen", IDCANCEL, 207, 90, 54, 15
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
IDS_WELCOME_TITLE "Willkommen im ReactOS Downloader" IDS_WELCOME_TITLE "Willkommen im ReactOS Downloader"

View file

@ -25,7 +25,7 @@ BEGIN
PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15 PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
IDS_WELCOME_TITLE "Welcome to the ReactOS Downloader" IDS_WELCOME_TITLE "Welcome to the ReactOS Downloader"

View file

@ -25,7 +25,7 @@ BEGIN
PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15 PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_WINDOW_TITLE "¡Descargar! - Descargador de ReactOS" IDS_WINDOW_TITLE "¡Descargar! - Descargador de ReactOS"
IDS_WELCOME_TITLE "Bienvenido al descargador de ReactOS" IDS_WELCOME_TITLE "Bienvenido al descargador de ReactOS"

View file

@ -25,7 +25,7 @@ BEGIN
PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15 PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_WINDOW_TITLE "Télécharger ! - Téléchargeur de ReactOS" IDS_WINDOW_TITLE "Télécharger ! - Téléchargeur de ReactOS"
IDS_WELCOME_TITLE "Bienvenue dans le Téléchargeur de ReactOS" IDS_WELCOME_TITLE "Bienvenue dans le Téléchargeur de ReactOS"

View file

@ -25,7 +25,7 @@ BEGIN
PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15 PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
IDS_WELCOME_TITLE "Selamat datang di ReactOS Downloader" IDS_WELCOME_TITLE "Selamat datang di ReactOS Downloader"

View file

@ -25,7 +25,7 @@ BEGIN
PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15 PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader" IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
IDS_WELCOME_TITLE "Benvenuto al ReactOS Downloader" IDS_WELCOME_TITLE "Benvenuto al ReactOS Downloader"

View file

@ -27,7 +27,7 @@ BEGIN
PUSHBUTTON "О&тмена", IDCANCEL, 207, 90, 54, 15 PUSHBUTTON "О&тмена", IDCANCEL, 207, 90, 54, 15
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_WINDOW_TITLE "Скачать! - Менеджер закачек ReactOS" IDS_WINDOW_TITLE "Скачать! - Менеджер закачек ReactOS"
IDS_WELCOME_TITLE "Добро пожаловать в Менеджер закачек ReactOS" IDS_WELCOME_TITLE "Добро пожаловать в Менеджер закачек ReactOS"

View file

@ -33,7 +33,7 @@ BEGIN
PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15 PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_WINDOW_TITLE "Çàâàíòàæèòè ! - Çàâàíòàæóâà÷ ReactOS" IDS_WINDOW_TITLE "Çàâàíòàæèòè ! - Çàâàíòàæóâà÷ ReactOS"
IDS_WELCOME_TITLE "Ëàñêàâî ïðîñèìî ó Çàâàíòàæóâà÷ ReactOS" IDS_WELCOME_TITLE "Ëàñêàâî ïðîñèìî ó Çàâàíòàæóâà÷ ReactOS"

View file

@ -75,19 +75,19 @@ ShowMessage (WCHAR* title, WCHAR* message)
{ {
DescriptionHeadline = title; DescriptionHeadline = title;
DescriptionText = message; DescriptionText = message;
InvalidateRect(hwnd,NULL,TRUE); InvalidateRect(hwnd,NULL,TRUE);
UpdateWindow(hwnd); UpdateWindow(hwnd);
} }
void void
AddItems(HWND hwnd, struct Category* Category, struct Category* Parent) AddItems(HWND hwnd, struct Category* Category, struct Category* Parent)
{ {
TV_INSERTSTRUCTW Insert; TV_INSERTSTRUCTW Insert;
Insert.item.lParam = (UINT)Category; Insert.item.lParam = (UINT)Category;
Insert.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;; Insert.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;;
Insert.item.pszText = Category->Name; Insert.item.pszText = Category->Name;
Insert.item.cchTextMax = lstrlenW(Category->Name); Insert.item.cchTextMax = lstrlenW(Category->Name);
Insert.item.iImage = Category->Icon; Insert.item.iImage = Category->Icon;
Insert.item.iSelectedImage = Category->Icon; Insert.item.iSelectedImage = Category->Icon;
Insert.hInsertAfter = TVI_LAST; Insert.hInsertAfter = TVI_LAST;
@ -108,7 +108,7 @@ CategoryChoosen(HWND hwnd, struct Category* Category)
struct Application* CurrentApplication; struct Application* CurrentApplication;
TV_INSERTSTRUCTW Insert; TV_INSERTSTRUCTW Insert;
SelectedApplication = NULL; SelectedApplication = NULL;
if(Category->Children && !Category->Apps) if(Category->Children && !Category->Apps)
ShowMessage(Category->Name, Strings[IDS_CHOOSE_SUB]); ShowMessage(Category->Name, Strings[IDS_CHOOSE_SUB]);
else if(!Category->Children && Category->Apps) else if(!Category->Children && Category->Apps)
@ -119,7 +119,7 @@ CategoryChoosen(HWND hwnd, struct Category* Category)
ShowMessage(Category->Name, Strings[IDS_NO_APPS]); ShowMessage(Category->Name, Strings[IDS_NO_APPS]);
(void)TreeView_DeleteItem(hwnd, TVI_ROOT); (void)TreeView_DeleteItem(hwnd, TVI_ROOT);
(void)TreeView_DeleteItem(hwnd, TVI_ROOT); // Delete twice to bypass bug in windows (void)TreeView_DeleteItem(hwnd, TVI_ROOT); // Delete twice to bypass bug in windows
Insert.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE; Insert.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE;
Insert.hInsertAfter = TVI_LAST; Insert.hInsertAfter = TVI_LAST;
@ -137,7 +137,7 @@ CategoryChoosen(HWND hwnd, struct Category* Category)
if(StrCmpW(CurrentApplication->RegName,L"")) { if(StrCmpW(CurrentApplication->RegName,L"")) {
if(getUninstaller(CurrentApplication->RegName, Uninstaller)) if(getUninstaller(CurrentApplication->RegName, Uninstaller))
Insert.item.iImage = 9; Insert.item.iImage = 9;
} }
SendMessage(hwnd, TVM_INSERTITEM, 0, (LPARAM)&Insert); SendMessage(hwnd, TVM_INSERTITEM, 0, (LPARAM)&Insert);
CurrentApplication = CurrentApplication->Next; CurrentApplication = CurrentApplication->Next;
} }
@ -158,7 +158,7 @@ SetupControls (HWND hwnd)
if(!GetSystemDirectory(Buf,sizeof(Buf)/sizeof(char))) return FALSE; if(!GetSystemDirectory(Buf,sizeof(Buf)/sizeof(char))) return FALSE;
lstrcat((LPTSTR)Buf, L"\\downloader.xml"); lstrcat((LPTSTR)Buf, L"\\downloader.xml");
for (i = 0; i < _tcslen(Buf) + 1; i++) Tmp[i] = Buf[i]; for (i = 0; i < _tcslen(Buf) + 1; i++) Tmp[i] = Buf[i];
// Parse the XML file // Parse the XML file
if (!ProcessXML(Tmp, &Root)) if (!ProcessXML(Tmp, &Root))
return FALSE; return FALSE;
@ -168,11 +168,11 @@ SetupControls (HWND hwnd)
// Set up the controls // Set up the controls
hCategories = CreateWindowExW(0, WC_TREEVIEWW, Cats, hCategories = CreateWindowExW(0, WC_TREEVIEWW, Cats,
WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS, WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS,
0, 0, 0, 0, hwnd, NULL, hInstance, NULL); 0, 0, 0, 0, hwnd, NULL, hInstance, NULL);
hApps = CreateWindowExW(0, WC_TREEVIEWW, Apps, hApps = CreateWindowExW(0, WC_TREEVIEWW, Apps,
WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS, WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS,
0, 0, 0, 0, hwnd, NULL, hInstance, NULL); 0, 0, 0, 0, hwnd, NULL, hInstance, NULL);
hLogo = LoadBitmap(GetModuleHandle(NULL), hLogo = LoadBitmap(GetModuleHandle(NULL),
@ -200,7 +200,7 @@ SetupControls (HWND hwnd)
WS_CHILD | WS_VISIBLE | BS_BITMAP, WS_CHILD | WS_VISIBLE | BS_BITMAP,
260, 505, 140, 33, 260, 505, 140, 33,
hwnd, 0, hInstance, NULL); hwnd, 0, hInstance, NULL);
SendMessageW(hProfButton, SendMessageW(hProfButton,
BM_SETIMAGE, BM_SETIMAGE,
(WPARAM)IMAGE_ICON, (WPARAM)IMAGE_ICON,
@ -226,9 +226,9 @@ SetupControls (HWND hwnd)
// Set deflaut entry for hApps // Set deflaut entry for hApps
Insert.item.mask = TVIF_TEXT|TVIF_IMAGE; Insert.item.mask = TVIF_TEXT|TVIF_IMAGE;
Insert.item.pszText = Strings[IDS_CHOOSE_CATEGORY]; Insert.item.pszText = Strings[IDS_CHOOSE_CATEGORY];
Insert.item.cchTextMax = lstrlenW(Strings[IDS_CHOOSE_CATEGORY]); Insert.item.cchTextMax = lstrlenW(Strings[IDS_CHOOSE_CATEGORY]);
Insert.item.iImage = 0; Insert.item.iImage = 0;
SendMessage(hApps, TVM_INSERTITEM, 0, (LPARAM)&Insert); SendMessage(hApps, TVM_INSERTITEM, 0, (LPARAM)&Insert);
// Create Tree Icons // Create Tree Icons
hImageList = ImageList_Create(16, 16, ILC_COLORDDB, 1, 1); hImageList = ImageList_Create(16, 16, ILC_COLORDDB, 1, 1);
@ -236,25 +236,25 @@ SetupControls (HWND hwnd)
SendMessageW(hApps, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)(HIMAGELIST)hImageList); SendMessageW(hApps, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)(HIMAGELIST)hImageList);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_0)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_0)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_1)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_1)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_2)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_2)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_3)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_3)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_4)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_4)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_5)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_5)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_6)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_6)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_7)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_7)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_8)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_8)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_9)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_9)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_10)), NULL); LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TREEVIEW_ICON_10)), NULL);
ImageList_Add(hImageList, ImageList_Add(hImageList,
@ -305,14 +305,14 @@ DrawDescription (HDC hdc, RECT DescriptionRect)
DrawBitmap(hdc, i, DescriptionRect.top+22, hUnderline); // less code then stretching ;) DrawBitmap(hdc, i, DescriptionRect.top+22, hUnderline); // less code then stretching ;)
// Headline // Headline
Font = CreateFont(-16 , 0, 0, 0, FW_EXTRABOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, Font = CreateFont(-16 , 0, 0, 0, FW_EXTRABOLD, FALSE, FALSE, FALSE, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, L"Arial"); OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, L"Arial");
SelectObject(hdc, Font); SelectObject(hdc, Font);
DrawTextW(hdc, DescriptionHeadline, lstrlenW(DescriptionHeadline), &Rect, DT_SINGLELINE|DT_NOPREFIX); DrawTextW(hdc, DescriptionHeadline, lstrlenW(DescriptionHeadline), &Rect, DT_SINGLELINE|DT_NOPREFIX);
DeleteObject(Font); DeleteObject(Font);
// Description // Description
Font = CreateFont(-13 , 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, Font = CreateFont(-13 , 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, L"Arial"); OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, L"Arial");
SelectObject(hdc, Font); SelectObject(hdc, Font);
Rect.top += 50; Rect.top += 50;
@ -346,7 +346,7 @@ void startUninstaller(WCHAR* Uninstaller) {
memset(&si, 0, sizeof(si)); memset(&si, 0, sizeof(si));
si.cb = sizeof(si); si.cb = sizeof(si);
CreateProcessW(NULL,Uninstaller,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi); CreateProcessW(NULL,Uninstaller,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
CloseHandle(pi.hThread); CloseHandle(pi.hThread);
// WaitForSingleObject(pi.hProcess, INFINITE); // If you want to wait for the Unistaller // WaitForSingleObject(pi.hProcess, INFINITE); // If you want to wait for the Unistaller
CloseHandle(pi.hProcess); CloseHandle(pi.hProcess);
@ -358,12 +358,12 @@ SaveSettings(HWND hwnd)
{ {
HKEY hKey; HKEY hKey;
TCHAR szBuf[MAX_PATH]; TCHAR szBuf[MAX_PATH];
if (RegOpenKey(HKEY_LOCAL_MACHINE, if (RegOpenKey(HKEY_LOCAL_MACHINE,
TEXT("Software\\ReactOS\\Download!"), TEXT("Software\\ReactOS\\Download!"),
&hKey) != ERROR_SUCCESS) &hKey) != ERROR_SUCCESS)
return FALSE; return FALSE;
SendMessage(GetDlgItem(hwnd, IDC_DOWNLOAD_FOLDER_EDIT), WM_GETTEXT, sizeof(szBuf)/sizeof(TCHAR), (LPARAM)szBuf); SendMessage(GetDlgItem(hwnd, IDC_DOWNLOAD_FOLDER_EDIT), WM_GETTEXT, sizeof(szBuf)/sizeof(TCHAR), (LPARAM)szBuf);
if (GetFileAttributes(szBuf) == 0xFFFFFFFF) if (GetFileAttributes(szBuf) == 0xFFFFFFFF)
if (!CreateDirectory((LPCTSTR)szBuf,NULL)) if (!CreateDirectory((LPCTSTR)szBuf,NULL))
@ -379,7 +379,7 @@ SaveSettings(HWND hwnd)
(LPBYTE)szBuf, (LPBYTE)szBuf,
(DWORD)(sizeof(szBuf) / sizeof(TCHAR)))) (DWORD)(sizeof(szBuf) / sizeof(TCHAR))))
return FALSE; return FALSE;
SendMessage(GetDlgItem(hwnd, IDC_UPDATE_SERVER_EDIT), WM_GETTEXT, sizeof(szBuf)/sizeof(TCHAR), (LPARAM)szBuf); SendMessage(GetDlgItem(hwnd, IDC_UPDATE_SERVER_EDIT), WM_GETTEXT, sizeof(szBuf)/sizeof(TCHAR), (LPARAM)szBuf);
if (RegSetValueEx(hKey, if (RegSetValueEx(hKey,
L"UpdateServer", L"UpdateServer",
@ -388,7 +388,7 @@ SaveSettings(HWND hwnd)
(LPBYTE)szBuf, (LPBYTE)szBuf,
(DWORD)(sizeof(szBuf) / sizeof(TCHAR)))) (DWORD)(sizeof(szBuf) / sizeof(TCHAR))))
return FALSE; return FALSE;
DWORD dwValue; DWORD dwValue;
if (SendMessage(GetDlgItem(hwnd, IDC_DELINST_FILES_CHECKBOX), BM_GETCHECK, 0, 0) == BST_CHECKED) if (SendMessage(GetDlgItem(hwnd, IDC_DELINST_FILES_CHECKBOX), BM_GETCHECK, 0, 0) == BST_CHECKED)
dwValue = 0x1; dwValue = 0x1;
@ -401,9 +401,9 @@ SaveSettings(HWND hwnd)
(LPBYTE)&dwValue, (LPBYTE)&dwValue,
sizeof(DWORD))) sizeof(DWORD)))
return FALSE; return FALSE;
RegCloseKey(hKey); RegCloseKey(hKey);
return TRUE; return TRUE;
} }
@ -413,12 +413,12 @@ InitProfDlg(HWND hwnd)
HKEY hKey; HKEY hKey;
TCHAR Buf[MAX_PATH]; TCHAR Buf[MAX_PATH];
DWORD dwDisp, dwSize; DWORD dwDisp, dwSize;
if (RegOpenKey(HKEY_LOCAL_MACHINE, if (RegOpenKey(HKEY_LOCAL_MACHINE,
TEXT("Software\\ReactOS\\Download!"), TEXT("Software\\ReactOS\\Download!"),
&hKey) != ERROR_SUCCESS) &hKey) != ERROR_SUCCESS)
{ {
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, L"Software\\ReactOS\\Download!", if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, L"Software\\ReactOS\\Download!",
0, NULL, REG_OPTION_NON_VOLATILE, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL, &hKey, &dwDisp)) KEY_WRITE, NULL, &hKey, &dwDisp))
{ {
@ -427,7 +427,7 @@ InitProfDlg(HWND hwnd)
return FALSE; return FALSE;
} }
} }
dwSize = MAX_PATH; dwSize = MAX_PATH;
if (RegQueryValueEx(hKey, if (RegQueryValueEx(hKey,
L"DownloadFolder", L"DownloadFolder",
@ -441,7 +441,7 @@ InitProfDlg(HWND hwnd)
else else
{ {
if (!GetWindowsDirectory(Buf, sizeof(Buf) / sizeof(TCHAR))) return FALSE; if (!GetWindowsDirectory(Buf, sizeof(Buf) / sizeof(TCHAR))) return FALSE;
TCHAR DPath[256]; TCHAR DPath[256];
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -469,7 +469,7 @@ InitProfDlg(HWND hwnd)
SendMessage(GetDlgItem(hwnd, IDC_DOWNLOAD_FOLDER_EDIT), WM_SETTEXT, -1, (LPARAM)DPath); SendMessage(GetDlgItem(hwnd, IDC_DOWNLOAD_FOLDER_EDIT), WM_SETTEXT, -1, (LPARAM)DPath);
} }
} }
dwSize = MAX_PATH; dwSize = MAX_PATH;
if (RegQueryValueEx(hKey, if (RegQueryValueEx(hKey,
L"UpdateServer", L"UpdateServer",
@ -495,7 +495,7 @@ InitProfDlg(HWND hwnd)
SendMessage(GetDlgItem(hwnd, IDC_UPDATE_SERVER_EDIT), WM_SETTEXT, -1, (LPARAM)Buf); SendMessage(GetDlgItem(hwnd, IDC_UPDATE_SERVER_EDIT), WM_SETTEXT, -1, (LPARAM)Buf);
} }
} }
DWORD dwValue, dwType = REG_DWORD; DWORD dwValue, dwType = REG_DWORD;
dwSize = sizeof(DWORD); dwSize = sizeof(DWORD);
if (RegQueryValueEx(hKey, if (RegQueryValueEx(hKey,
@ -519,9 +519,9 @@ InitProfDlg(HWND hwnd)
sizeof(DWORD))) sizeof(DWORD)))
return FALSE; return FALSE;
} }
RegCloseKey(hKey); RegCloseKey(hKey);
return TRUE; return TRUE;
} }
@ -531,7 +531,7 @@ ChooseFolder(HWND hwnd)
BROWSEINFO fi; BROWSEINFO fi;
LPCITEMIDLIST lpItemList; LPCITEMIDLIST lpItemList;
TCHAR szPath[MAX_PATH],Buf[256]; TCHAR szPath[MAX_PATH],Buf[256];
ZeroMemory(&fi, sizeof(BROWSEINFO)); ZeroMemory(&fi, sizeof(BROWSEINFO));
fi.hwndOwner = hwnd; fi.hwndOwner = hwnd;
LoadString(GetModuleHandle(NULL), IDS_CHOOSE_FOLDER, Buf, sizeof(Buf) / sizeof(TCHAR)); LoadString(GetModuleHandle(NULL), IDS_CHOOSE_FOLDER, Buf, sizeof(Buf) / sizeof(TCHAR));
@ -540,13 +540,13 @@ ChooseFolder(HWND hwnd)
fi.lpfn = NULL; fi.lpfn = NULL;
fi.lParam = -1; fi.lParam = -1;
fi.iImage = 0; fi.iImage = 0;
if(!(lpItemList = SHBrowseForFolder(&fi))) return FALSE; if(!(lpItemList = SHBrowseForFolder(&fi))) return FALSE;
SHGetPathFromIDList(lpItemList, szPath); SHGetPathFromIDList(lpItemList, szPath);
if (_tcslen(szPath) == 0) return FALSE; if (_tcslen(szPath) == 0) return FALSE;
SendMessage(GetDlgItem(hwnd, IDC_DOWNLOAD_FOLDER_EDIT), WM_SETTEXT, -1, (LPARAM)szPath); SendMessage(GetDlgItem(hwnd, IDC_DOWNLOAD_FOLDER_EDIT), WM_SETTEXT, -1, (LPARAM)szPath);
return TRUE; return TRUE;
} }
@ -611,7 +611,7 @@ WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
if(!SetupControls(hwnd)) if(!SetupControls(hwnd))
return -1; return -1;
ShowMessage(Strings[IDS_WELCOME_TITLE], Strings[IDS_WELCOME]); ShowMessage(Strings[IDS_WELCOME_TITLE], Strings[IDS_WELCOME]);
} }
break; break;
case WM_PAINT: case WM_PAINT:
@ -621,11 +621,11 @@ WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
HDC BackbufferHdc = CreateCompatibleDC(hdc); HDC BackbufferHdc = CreateCompatibleDC(hdc);
HBITMAP BackbufferBmp = CreateCompatibleBitmap(hdc, ps.rcPaint.right, ps.rcPaint.bottom); HBITMAP BackbufferBmp = CreateCompatibleBitmap(hdc, ps.rcPaint.right, ps.rcPaint.bottom);
SelectObject(BackbufferHdc, BackbufferBmp); SelectObject(BackbufferHdc, BackbufferBmp);
FillRect(BackbufferHdc, &ps.rcPaint, CreateSolidBrush(RGB(235,235,235))); FillRect(BackbufferHdc, &ps.rcPaint, CreateSolidBrush(RGB(235,235,235)));
DrawBitmap(BackbufferHdc, 10, 12, hLogo); DrawBitmap(BackbufferHdc, 10, 12, hLogo);
DrawDescription(BackbufferHdc, DescriptionRect); DrawDescription(BackbufferHdc, DescriptionRect);
BitBlt(hdc, 0, 0, ps.rcPaint.right, ps.rcPaint.bottom, BackbufferHdc, 0, 0, SRCCOPY); BitBlt(hdc, 0, 0, ps.rcPaint.right, ps.rcPaint.bottom, BackbufferHdc, 0, 0, SRCCOPY);
DeleteObject(BackbufferBmp); DeleteObject(BackbufferBmp);
DeleteDC(BackbufferHdc); DeleteDC(BackbufferHdc);
@ -680,12 +680,12 @@ WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
if(data->code == TVN_SELCHANGED) if(data->code == TVN_SELCHANGED)
{ {
BOOL bShowUninstaller = FALSE; BOOL bShowUninstaller = FALSE;
if(data->hwndFrom == hCategories) if(data->hwndFrom == hCategories)
{ {
struct Category* Category = (struct Category*) ((LPNMTREEVIEW)lParam)->itemNew.lParam; struct Category* Category = (struct Category*) ((LPNMTREEVIEW)lParam)->itemNew.lParam;
CategoryChoosen (hApps, Category); CategoryChoosen (hApps, Category);
} }
else if(data->hwndFrom == hApps) else if(data->hwndFrom == hApps)
{ {
SelectedApplication = (struct Application*) ((LPNMTREEVIEW)lParam)->itemNew.lParam; SelectedApplication = (struct Application*) ((LPNMTREEVIEW)lParam)->itemNew.lParam;
if(SelectedApplication) if(SelectedApplication)
@ -760,7 +760,7 @@ WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case WM_DESTROY: case WM_DESTROY:
{ {
DeleteObject(hLogo); DeleteObject(hLogo);
if(Root.Children) if(Root.Children)
FreeTree(Root.Children); FreeTree(Root.Children);
PostQuitMessage(0); PostQuitMessage(0);
@ -786,10 +786,10 @@ wWinMain (HINSTANCE hInstance,
// Load strings // Load strings
for(i=0; i<STRING_COUNT; i++) for(i=0; i<STRING_COUNT; i++)
LoadStringW(hInstance, i, Strings[i], MAX_STRING_LENGHT); // if you know a better method please tell me. LoadStringW(hInstance, i, Strings[i], MAX_STRING_LENGHT); // if you know a better method please tell me.
// Create the window // Create the window
WndClass.cbSize = sizeof(WNDCLASSEX); WndClass.cbSize = sizeof(WNDCLASSEX);
WndClass.lpszClassName = L"Downloader"; WndClass.lpszClassName = L"Downloader";
WndClass.lpfnWndProc = WndProc; WndClass.lpfnWndProc = WndProc;
WndClass.hInstance = hInstance; WndClass.hInstance = hInstance;
@ -799,14 +799,14 @@ wWinMain (HINSTANCE hInstance,
RegisterClassExW(&WndClass); RegisterClassExW(&WndClass);
hwnd = CreateWindowW(L"Downloader", hwnd = CreateWindowW(L"Downloader",
Strings[IDS_WINDOW_TITLE], Strings[IDS_WINDOW_TITLE],
WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN, WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
650, 550, 650, 550,
NULL, NULL, NULL, NULL,
hInstance, hInstance,
NULL); NULL);
// Show it // Show it

View file

@ -51,7 +51,7 @@ void tag_opened (void* usrdata, const char* tag, const char** arg)
} }
TagOpen = TRUE; TagOpen = TRUE;
for (i=0; arg[i]; i+=2) for (i=0; arg[i]; i+=2)
{ {
if(!strcmp(arg[i], "name")) if(!strcmp(arg[i], "name"))
{ {
@ -82,7 +82,7 @@ void tag_opened (void* usrdata, const char* tag, const char** arg)
CurrentApplication = Current->Apps; CurrentApplication = Current->Apps;
} }
for (i=0; arg[i]; i+=2) for (i=0; arg[i]; i+=2)
{ {
if(!strcmp(arg[i], "name")) if(!strcmp(arg[i], "name"))
{ {
@ -157,7 +157,7 @@ void tag_closed (void* tree, const char* tag)
} }
} }
BOOL ProcessXML (const char* filename, struct Category* Root) BOOL ProcessXML (const char* filename, struct Category* Root)
{ {
int done = 0; int done = 0;
char buffer[255]; char buffer[255];
@ -171,10 +171,10 @@ BOOL ProcessXML (const char* filename, struct Category* Root)
TagOpen = TRUE; TagOpen = TRUE;
file = fopen("downloader.xml", "r"); file = fopen("downloader.xml", "r");
if(!file) if(!file)
{ {
file = fopen(filename, "r"); file = fopen(filename, "r");
if(!file) if(!file)
{ {
MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0); MessageBoxW(0,Strings[IDS_XMLERROR_1],0,0);
return FALSE; return FALSE;
@ -190,7 +190,7 @@ BOOL ProcessXML (const char* filename, struct Category* Root)
size_t len = fread (buffer, 1, sizeof(buffer), file); size_t len = fread (buffer, 1, sizeof(buffer), file);
done = len < sizeof(buffer); done = len < sizeof(buffer);
if(!XML_Parse(parser, buffer, len, done)) if(!XML_Parse(parser, buffer, len, done))
{ {
MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0); MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0);
return FALSE; return FALSE;

View file

@ -194,7 +194,7 @@ Display_SetTypeFace(HWND hwnd, LPARAM lParam)
si.nPage = rect.bottom; si.nPage = rect.bottom;
si.nPos = 0; si.nPos = 0;
si.nTrackPos = 0; si.nTrackPos = 0;
SetScrollInfo(hwnd, SB_VERT, &si, TRUE); SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
return 0; return 0;
} }

View file

@ -82,7 +82,7 @@ ErrorMsgBox(HWND hParent, DWORD dwCaptionID, DWORD dwMessageId, ...)
LocalFree(hMemText); LocalFree(hMemText);
} }
int WINAPI int WINAPI
WinMain (HINSTANCE hThisInstance, WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, LPSTR lpCmdLine,

View file

@ -10,7 +10,7 @@ void UpdateDefragInfo (HWND Dlg)
char PercentText[100]; char PercentText[100];
Defrag = (Defragment *) GetWindowLongPtr (Dlg, GWLP_USERDATA); Defrag = (Defragment *) GetWindowLongPtr (Dlg, GWLP_USERDATA);
sprintf (PercentText, "%6.2f%%", Defrag->GetStatusPercent()); sprintf (PercentText, "%6.2f%%", Defrag->GetStatusPercent());
PercentItem = GetDlgItem (Dlg, IDC_PERCENT); PercentItem = GetDlgItem (Dlg, IDC_PERCENT);
SendMessage (GetDlgItem (Dlg, IDC_PERCENT), WM_SETTEXT, 0, (LPARAM) PercentText); SendMessage (GetDlgItem (Dlg, IDC_PERCENT), WM_SETTEXT, 0, (LPARAM) PercentText);

View file

@ -56,16 +56,16 @@ int FitName (wchar_t *destination, const wchar_t *path, const wchar_t *filename,
len4path = pathLen; len4path = pathLen;
len4fn = (totalWidth - len4path); len4fn = (totalWidth - len4path);
} }
/* /*
if halfTotLen was adjusted above to avoid a rounding error, give the if halfTotLen was adjusted above to avoid a rounding error, give the
extra wchar_t to the filename extra wchar_t to the filename
*/ */
if (halfTotLen < (totalWidth/2)) len4path++; if (halfTotLen < (totalWidth/2)) len4path++;
if (pathLen > len4path) swprintf (fmtStrPath, L"%%.%ds...\\", len4path-4); if (pathLen > len4path) swprintf (fmtStrPath, L"%%.%ds...\\", len4path-4);
else else
swprintf (fmtStrPath, L"%%s"); swprintf (fmtStrPath, L"%%s");
if (fnLen > len4fn) swprintf (fmtStrFile, L"%%.%ds...", len4fn-3); if (fnLen > len4fn) swprintf (fmtStrFile, L"%%.%ds...", len4fn-3);
else else
swprintf (fmtStrFile, L"%%s"); swprintf (fmtStrFile, L"%%s");
@ -74,8 +74,8 @@ int FitName (wchar_t *destination, const wchar_t *path, const wchar_t *filename,
wcscat (fmtString, fmtStrFile); wcscat (fmtString, fmtStrFile);
/*swprintf (fmtString, L"%s%s", fmtStrPath, fmtStrFile);*/ /*swprintf (fmtString, L"%s%s", fmtStrPath, fmtStrFile);*/
swprintf (destination, fmtString, path,filename); swprintf (destination, fmtString, path,filename);
return (1); return (1);
} }
@ -304,7 +304,7 @@ void Defragment::Start (void)
break; break;
} }
// //
Info = Volume.GetDBFile (i); Info = Volume.GetDBFile (i);
PreviousClusters = ClustersProgress; PreviousClusters = ClustersProgress;
@ -367,7 +367,7 @@ void Defragment::Start (void)
} }
} }
} }
// New: Only update bitmap if it's older than 15 seconds // New: Only update bitmap if it's older than 15 seconds
if ((GetTickCount() - LastBMPUpdate) < 15000) if ((GetTickCount() - LastBMPUpdate) < 15000)
Retry = 1; Retry = 1;

View file

@ -48,7 +48,7 @@ bool DriveVolume::Open (wstring Name)
RootPath = Name.c_str(); RootPath = Name.c_str();
RootPath += L"\\"; RootPath += L"\\";
Handle = CreateFile Handle = CreateFile
( (
FileName, FileName,
MAXIMUM_ALLOWED, // access MAXIMUM_ALLOWED, // access
@ -91,7 +91,7 @@ bool DriveVolume::Open (wstring Name)
VolInfo.MaxNameLen = VolMaxFileLen; VolInfo.MaxNameLen = VolMaxFileLen;
VolInfo.Name = VolName; VolInfo.Name = VolName;
swprintf (SerialText, L"%x-%x", (VolSN & 0xffff0000) >> 16, swprintf (SerialText, L"%x-%x", (VolSN & 0xffff0000) >> 16,
VolSN & 0x0000ffff); VolSN & 0x0000ffff);
wcsupr (SerialText); wcsupr (SerialText);
@ -153,7 +153,7 @@ bool DriveVolume::ObtainInfo (void)
if (!Result) if (!Result)
return (false); return (false);
VolInfo.ClusterSize = SectorsPerCluster * BytesPerSector; VolInfo.ClusterSize = SectorsPerCluster * BytesPerSector;
Result = GetDiskFreeSpaceEx Result = GetDiskFreeSpaceEx
( (
@ -324,7 +324,7 @@ bool BuildDBCallback (FileInfo &Info, HANDLE &FileHandle, void *UserData)
return (false); return (false);
DBInfo->ClusterProgress += (uint64)Info.Clusters; DBInfo->ClusterProgress += (uint64)Info.Clusters;
*(DBInfo->Percent) = *(DBInfo->Percent) =
((double)DBInfo->ClusterProgress / (double)DBInfo->ClusterCount) * 100.0f; ((double)DBInfo->ClusterProgress / (double)DBInfo->ClusterCount) * 100.0f;
return (true); return (true);
@ -511,12 +511,12 @@ bool DriveVolume::GetClusterInfo (FileInfo &Info, HANDLE &HandleResult)
if (Handle == INVALID_HANDLE_VALUE) if (Handle == INVALID_HANDLE_VALUE)
{ {
LPVOID lpMsgBuf; LPVOID lpMsgBuf;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(), NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL ); (LPTSTR) &lpMsgBuf, 0, NULL );
Info.Attributes.AccessDenied = 1; Info.Attributes.AccessDenied = 1;
LocalFree( lpMsgBuf ); LocalFree( lpMsgBuf );
@ -529,7 +529,7 @@ bool DriveVolume::GetClusterInfo (FileInfo &Info, HANDLE &HandleResult)
if (Result == FALSE) if (Result == FALSE)
{ {
Info.Attributes.AccessDenied = 1; Info.Attributes.AccessDenied = 1;
wprintf (L"GetFileInformationByHandle ('%s%s') failed\n", GetDBDir (Info.DirIndice).c_str(), wprintf (L"GetFileInformationByHandle ('%s%s') failed\n", GetDBDir (Info.DirIndice).c_str(),
Info.Name.c_str()); Info.Name.c_str());
CloseHandle (Handle); CloseHandle (Handle);
@ -705,10 +705,10 @@ bool DriveVolume::MoveFileDumb (uint32 FileIndice, uint64 NewLCN)
LPVOID lpMsgBuf; LPVOID lpMsgBuf;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(), NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL ); (LPTSTR) &lpMsgBuf, 0, NULL );
LocalFree (lpMsgBuf); LocalFree (lpMsgBuf);
// //
@ -762,12 +762,12 @@ bool DriveVolume::MoveFileDumb (uint32 FileIndice, uint64 NewLCN)
{ {
// //
LPVOID lpMsgBuf; LPVOID lpMsgBuf;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(), NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL ); (LPTSTR) &lpMsgBuf, 0, NULL );
LocalFree( lpMsgBuf ); LocalFree( lpMsgBuf );
// //
@ -778,7 +778,7 @@ bool DriveVolume::MoveFileDumb (uint32 FileIndice, uint64 NewLCN)
// Ok good. Now update our drive bitmap and file infos. // Ok good. Now update our drive bitmap and file infos.
uint64 j; uint64 j;
for (j = 0; for (j = 0;
j < Info.Fragments[i].Length; j < Info.Fragments[i].Length;
j++) j++)
{ {

View file

@ -99,8 +99,8 @@ public:
// builds list of files on drive // builds list of files on drive
// if QuitMonitor ever becomes true (ie from a separate thread) it will clean up and return // if QuitMonitor ever becomes true (ie from a separate thread) it will clean up and return
bool BuildFileList (bool &QuitMonitor, double &Progress); bool BuildFileList (bool &QuitMonitor, double &Progress);
// Functions for accessing the volume bitmap // Functions for accessing the volume bitmap
bool IsClusterUsed (uint64 Cluster); bool IsClusterUsed (uint64 Cluster);
void SetClusterUsed (uint64 Cluster, bool Used); void SetClusterUsed (uint64 Cluster, bool Used);

View file

@ -27,26 +27,26 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
IDD_MAIN DIALOGEX 0, 0, 346, 103 IDD_MAIN DIALOGEX 0, 0, 346, 103
STYLE DS_SETFONT | DS_CENTERMOUSE | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | STYLE DS_SETFONT | DS_CENTERMOUSE | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU WS_CAPTION | WS_SYSMENU
FONT 8, "MS Sans Serif", 0, 0, 0x1 FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN BEGIN
COMBOBOX IDC_DRIVES_LIST,78,52,29,111,CBS_DROPDOWNLIST | CBS_SORT | COMBOBOX IDC_DRIVES_LIST,78,52,29,111,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_METHODS_LIST,135,52,77,79,CBS_DROPDOWNLIST | COMBOBOX IDC_METHODS_LIST,135,52,77,79,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_PRIORITY_LIST,223,52,59,91,CBS_DROPDOWNLIST | COMBOBOX IDC_PRIORITY_LIST,223,52,59,91,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Start",IDC_STARTSTOP,294,7,45,15 PUSHBUTTON "Start",IDC_STARTSTOP,294,7,45,15
PUSHBUTTON "Help",ID_MAIN_HELP,294,28,45,15 PUSHBUTTON "Help",ID_MAIN_HELP,294,28,45,15
PUSHBUTTON "Exit",IDC_QUIT,294,49,45,15 PUSHBUTTON "Exit",IDC_QUIT,294,49,45,15
CONTROL 110,-1,"Static",SS_BITMAP | SS_SUNKEN | CONTROL 110,-1,"Static",SS_BITMAP | SS_SUNKEN |
WS_BORDER,7,7,63,58 WS_BORDER,7,7,63,58
LTEXT "Choose a drive:",-1,78,40,50,8 LTEXT "Choose a drive:",-1,78,40,50,8
LTEXT "Choose an action:",-1,135,40,58,8 LTEXT "Choose an action:",-1,135,40,58,8
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER | CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER |
0x1,7,71,299,10 0x1,7,71,299,10
CONTROL "Static",IDC_STATUS,"Static",SS_LEFTNOWORDWRAP | CONTROL "Static",IDC_STATUS,"Static",SS_LEFTNOWORDWRAP |
SS_SUNKEN | WS_GROUP,7,86,332,10 SS_SUNKEN | WS_GROUP,7,86,332,10
LTEXT "I am a monkey, hear me eeK",IDC_WISECRACKS,78,15,91,8 LTEXT "I am a monkey, hear me eeK",IDC_WISECRACKS,78,15,91,8
LTEXT "100.00%",IDC_PERCENT,311,71,28,8,0,WS_EX_RIGHT LTEXT "100.00%",IDC_PERCENT,311,71,28,8,0,WS_EX_RIGHT
@ -116,7 +116,7 @@ END
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO GUIDELINES DESIGNINFO
BEGIN BEGIN
IDD_MAIN, DIALOG IDD_MAIN, DIALOG
BEGIN BEGIN
@ -143,18 +143,18 @@ END
// TEXTINCLUDE // TEXTINCLUDE
// //
1 TEXTINCLUDE 1 TEXTINCLUDE
BEGIN BEGIN
"resource.h\0" "resource.h\0"
END END
2 TEXTINCLUDE 2 TEXTINCLUDE
BEGIN BEGIN
"#include ""windows.h""\r\n" "#include ""windows.h""\r\n"
"\0" "\0"
END END
3 TEXTINCLUDE 3 TEXTINCLUDE
BEGIN BEGIN
"\r\n" "\r\n"
"\0" "\0"

View file

@ -101,9 +101,9 @@ void UpdateDefragInfo (HWND Dlg)
if (Defrag == NULL) if (Defrag == NULL)
return; return;
NewPercent = Defrag->GetStatusPercent (); NewPercent = Defrag->GetStatusPercent ();
if (NewPercent > 100.0f) if (NewPercent > 100.0f)
NewPercent = 100.0f; NewPercent = 100.0f;
if (NewPercent < 0.0f) if (NewPercent < 0.0f)
NewPercent = 0.0f; NewPercent = 0.0f;
@ -111,7 +111,7 @@ void UpdateDefragInfo (HWND Dlg)
{ {
swprintf (PercentText, L"%6.2f%%", NewPercent); swprintf (PercentText, L"%6.2f%%", NewPercent);
SendDlgItemMessage (Dlg, IDC_PERCENT, WM_SETTEXT, 0, (LPARAM) PercentText); SendDlgItemMessage (Dlg, IDC_PERCENT, WM_SETTEXT, 0, (LPARAM) PercentText);
SendDlgItemMessage (Dlg, IDC_PROGRESS, PBM_SETPOS, SendDlgItemMessage (Dlg, IDC_PROGRESS, PBM_SETPOS,
(WPARAM) (int)(NewPercent * 100.0f), 0); (WPARAM) (int)(NewPercent * 100.0f), 0);
OldPercent = NewPercent; OldPercent = NewPercent;
} }
@ -135,7 +135,7 @@ void UpdateDefragInfo (HWND Dlg)
it++; it++;
} }
SendDlgItemMessage (Dlg, IDC_STATUS, WM_SETTEXT, 0, SendDlgItemMessage (Dlg, IDC_STATUS, WM_SETTEXT, 0,
(LPARAM) Status.c_str()); (LPARAM) Status.c_str());
OldStatus = NewStatus; OldStatus = NewStatus;
@ -166,7 +166,7 @@ wstring GetDefragTitle (void)
DefragText = GetDefaultTitle (); DefragText = GetDefaultTitle ();
if (Defrag != NULL) if (Defrag != NULL)
{ {
DefragText = wstring(Percent) + wstring (L" - ") + Defrag->GetVolume().GetRootPath() + DefragText = wstring(Percent) + wstring (L" - ") + Defrag->GetVolume().GetRootPath() +
wstring (L" - ") + DefragText; wstring (L" - ") + DefragText;
} }
@ -456,7 +456,7 @@ INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPara
if (Defrag->IsDoneYet() || Defrag->HasError()) if (Defrag->IsDoneYet() || Defrag->HasError())
{ // This is the code executed when defragging is finished (or stopped :) { // This is the code executed when defragging is finished (or stopped :)
if (Defrag->GetDefragType() == DefragAnalyze && if (Defrag->GetDefragType() == DefragAnalyze &&
!Defrag->HasError() && !Defrag->HasError() &&
!Stopping) !Stopping)
{ // Show report { // Show report
@ -533,7 +533,7 @@ INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPara
if (Defrag != NULL) if (Defrag != NULL)
return (1); return (1);
SendMessage (GetDlgItem (Dlg, IDC_DRIVES_LIST), WM_GETTEXT, SendMessage (GetDlgItem (Dlg, IDC_DRIVES_LIST), WM_GETTEXT,
sizeof (Drive) - 1, (LPARAM) Drive); sizeof (Drive) - 1, (LPARAM) Drive);
if (wcslen(Drive) != 2 || Drive[1] != L':') if (wcslen(Drive) != 2 || Drive[1] != L':')
@ -556,7 +556,7 @@ INT_PTR CALLBACK MainDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LPara
Defrag->SetDoLimitLength (false); Defrag->SetDoLimitLength (false);
SetWindowText (Dlg, GetDefragTitle().c_str()); SetWindowText (Dlg, GetDefragTitle().c_str());
SetDisables (Dlg); SetDisables (Dlg);
} }
} }
else else
{ // L"Stop" { // L"Stop"

View file

@ -29,7 +29,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
// DiskSizeBytes // DiskSizeBytes
if (Fractional) if (Fractional)
{ {
swprintf (Text, L"%.2f %s", (double)(signed)(Report.DiskSizeBytes / swprintf (Text, L"%.2f %s", (double)(signed)(Report.DiskSizeBytes /
(BytesDivisor / 1024)) / 1024.0, BytesUnits); (BytesDivisor / 1024)) / 1024.0, BytesUnits);
} }
else else
@ -44,7 +44,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
// DiskFreeBytes // DiskFreeBytes
if (Fractional) if (Fractional)
{ {
swprintf (Text, L"%.2f %s", (double)(signed)(Defrag->GetVolume().GetVolumeInfo().FreeBytes / swprintf (Text, L"%.2f %s", (double)(signed)(Defrag->GetVolume().GetVolumeInfo().FreeBytes /
(BytesDivisor / 1024)) / 1024.0, BytesUnits); (BytesDivisor / 1024)) / 1024.0, BytesUnits);
} }
else else
@ -85,7 +85,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
// FilesSizeBytes // FilesSizeBytes
if (Fractional) if (Fractional)
{ {
swprintf (Text, L"%.2f %s", (double)(signed)(Report.FilesSizeBytes / swprintf (Text, L"%.2f %s", (double)(signed)(Report.FilesSizeBytes /
(BytesDivisor / 1024)) / 1024.0, BytesUnits); (BytesDivisor / 1024)) / 1024.0, BytesUnits);
} }
else else
@ -99,7 +99,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
// Files SizeOnDisk // Files SizeOnDisk
if (Fractional) if (Fractional)
{ {
swprintf (Text, L"%.2f %s", (double)(signed)((Report.FilesSizeBytes + Report.FilesSlackBytes) / swprintf (Text, L"%.2f %s", (double)(signed)((Report.FilesSizeBytes + Report.FilesSlackBytes) /
(BytesDivisor / 1024)) / 1024.0, BytesUnits); (BytesDivisor / 1024)) / 1024.0, BytesUnits);
} }
else else
@ -107,14 +107,14 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
AddCommas (Text, (Report.FilesSizeBytes + Report.FilesSlackBytes) / (uint64)BytesDivisor); AddCommas (Text, (Report.FilesSizeBytes + Report.FilesSlackBytes) / (uint64)BytesDivisor);
wcscat (Text, L" "); wcscat (Text, L" ");
wcscat (Text, BytesUnits); wcscat (Text, BytesUnits);
} }
SetDlgItemText (Dlg, IDC_FILESSIZEONDISK, Text); SetDlgItemText (Dlg, IDC_FILESSIZEONDISK, Text);
// FilesSlackBytes // FilesSlackBytes
if (Fractional) if (Fractional)
{ {
swprintf (Text, L"%.2f %s", (double)(signed)(Report.FilesSlackBytes / swprintf (Text, L"%.2f %s", (double)(signed)(Report.FilesSlackBytes /
(BytesDivisor / 1024)) / 1024.0, BytesUnits); (BytesDivisor / 1024)) / 1024.0, BytesUnits);
} }
else else
@ -141,7 +141,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
if (PFRec) if (PFRec)
{ {
swprintf swprintf
( (
Text2, Text2,
L"%.2f%% of the files on this volume are fragmented. ", L"%.2f%% of the files on this volume are fragmented. ",
@ -174,9 +174,9 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
// Should we recommend a smaller cluster size? // Should we recommend a smaller cluster size?
if (Report.PercentSlack >= 10.0f) if (Report.PercentSlack >= 10.0f)
{ {
swprintf swprintf
( (
Text2, Text2,
L"\n* A large amount of disk space (%.2f%%) is being lost " L"\n* A large amount of disk space (%.2f%%) is being lost "
L"due to a large (%u bytes) cluster size. It is recommended " L"due to a large (%u bytes) cluster size. It is recommended "
L"that you use a disk utility such as Partition Magic to " L"that you use a disk utility such as Partition Magic to "

View file

@ -23,7 +23,7 @@ bool CheckWinVer (void)
ZeroMemory (&OSVersion, sizeof (OSVersion)); ZeroMemory (&OSVersion, sizeof (OSVersion));
OSVersion.dwOSVersionInfoSize = sizeof (OSVersion); OSVersion.dwOSVersionInfoSize = sizeof (OSVersion);
GetVersionEx (&OSVersion); GetVersionEx (&OSVersion);
// Need Windows 2000! // Need Windows 2000!
// Check for NT first // Check for NT first
@ -246,7 +246,7 @@ int wmain (int argc, wchar_t **argv)
for (size_t d = 0; d < Drives.size (); d++) for (size_t d = 0; d < Drives.size (); d++)
{ {
if (!Defrags[d]->IsDoneYet() && !Defrags[d]->HasError()) if (!Defrags[d]->IsDoneYet() && !Defrags[d]->HasError())
Continue = true; Continue = true;
} }
} }
@ -336,7 +336,7 @@ int wmain (int argc, wchar_t **argv)
if (Info.Attributes.Unmovable == 1) if (Info.Attributes.Unmovable == 1)
wprintf (L"unmovable, "); wprintf (L"unmovable, ");
wprintf (L"%I64u bytes, %I64u bytes on disk, %I64u bytes slack, %u fragments\n", wprintf (L"%I64u bytes, %I64u bytes on disk, %I64u bytes slack, %u fragments\n",
Info.Size, Used, Slack, Info.Fragments.size()); Info.Size, Used, Slack, Info.Fragments.size());
} }
} }

View file

@ -40,7 +40,7 @@
#define IDC_PRIORITY_LIST 1057 #define IDC_PRIORITY_LIST 1057
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 118 #define _APS_NEXT_RESOURCE_VALUE 118

View file

@ -30,7 +30,7 @@ enum
GETTYPE_BUILD = 0x080 GETTYPE_BUILD = 0x080
}; };
INT INT
GetVersionNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) GetVersionNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
{ {
INT VersionNumber = 255; INT VersionNumber = 255;
@ -40,7 +40,7 @@ GetVersionNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
VersionNumber += (pBuf102->sv102_version_minor * 100); VersionNumber += (pBuf102->sv102_version_minor * 100);
} }
else if(bLocal) else if(bLocal)
{ {
VersionNumber = osvi->dwMajorVersion * 1000; VersionNumber = osvi->dwMajorVersion * 1000;
VersionNumber += (osvi->dwMinorVersion * 100); VersionNumber += (osvi->dwMinorVersion * 100);
} }
@ -48,7 +48,7 @@ GetVersionNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
return VersionNumber; return VersionNumber;
} }
INT INT
GetMajValue(BOOL Major, BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) GetMajValue(BOOL Major, BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
{ {
INT VersionNumber = 255; INT VersionNumber = 255;
@ -69,7 +69,7 @@ GetMajValue(BOOL Major, BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 p
return VersionNumber; return VersionNumber;
} }
INT INT
GetSystemRole(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) GetSystemRole(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
{ {
@ -96,7 +96,7 @@ GetSystemRole(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
} }
INT INT
GetServicePack(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102, TCHAR * Server) GetServicePack(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102, TCHAR * Server)
{ {
INT SPNumber = 255; INT SPNumber = 255;
@ -111,7 +111,7 @@ GetServicePack(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102, T
return SPNumber; return SPNumber;
} }
INT INT
GetBuildNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) GetBuildNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
{ {
INT BuildNum = 255; INT BuildNum = 255;
@ -147,7 +147,7 @@ INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
return 5; return 5;
else if(osvi->wSuiteMask & VER_SUITE_ENTERPRISE) else if(osvi->wSuiteMask & VER_SUITE_ENTERPRISE)
return 4; return 4;
else else
return 3; return 3;
} }
} }
@ -159,7 +159,7 @@ INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
return 255; return 255;
} }
VOID VOID
GetBasicInfo(LPOSVERSIONINFOEX osvi, TCHAR * HostName, TCHAR * OSName, TCHAR * Version, TCHAR * Role, TCHAR * Components) GetBasicInfo(LPOSVERSIONINFOEX osvi, TCHAR * HostName, TCHAR * OSName, TCHAR * Version, TCHAR * Role, TCHAR * Components)
{ {
/* Host Name - COMPUTERNAME*/ /* Host Name - COMPUTERNAME*/
@ -191,7 +191,7 @@ GetBasicInfo(LPOSVERSIONINFOEX osvi, TCHAR * HostName, TCHAR * OSName, TCHAR * V
{ {
_tcscpy(OSName, _T("Microsoft Windows Vista ")); _tcscpy(OSName, _T("Microsoft Windows Vista "));
} }
else else
{ {
_tcscpy(OSName, _T("Microsoft Windows ")); _tcscpy(OSName, _T("Microsoft Windows "));
} }

View file

@ -144,7 +144,7 @@ ScreenAddDevice(
{ {
DPRINT("Attaching to old blue\n"); DPRINT("Attaching to old blue\n");
/* Suggested by hpoussin .. Hide previous blue device /* Suggested by hpoussin .. Hide previous blue device
* This makes us able to coexist with blue, and install * This makes us able to coexist with blue, and install
* when loaded */ * when loaded */
Status = IoCreateDevice( Status = IoCreateDevice(

View file

@ -438,7 +438,7 @@ DisplaySharpness(HWND hwnd,
/* Green */ /* Green */
c1 = g; c1 = g;
if ((Count < ((bitmap.bmHeight - 1)* bitmap.bmWidth * 4lu)) && if ((Count < ((bitmap.bmHeight - 1)* bitmap.bmWidth * 4lu)) &&
(Count > (bitmap.bmWidth * 4lu))) (Count > (bitmap.bmWidth * 4lu)))
{ {
CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4); CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4);
@ -458,7 +458,7 @@ DisplaySharpness(HWND hwnd,
/* Blue */ /* Blue */
c1 = b; c1 = b;
if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) && if ((Count < ((bitmap.bmHeight - 1) * bitmap.bmWidth * 4lu)) &&
(Count > (bitmap.bmWidth * 4lu))) (Count > (bitmap.bmWidth * 4lu)))
{ {
CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4); CopyMemory(&Val, &pBits[(Count - (bitmap.bmWidth * 4l))], 4);

View file

@ -4,32 +4,32 @@
LIBRARY DFLAT32.DLL LIBRARY DFLAT32.DLL
EXPORTS EXPORTS
DfCreateWindow DfCreateWindow
DfInitialize ;message.c DfInitialize ;message.c
DfPostMessage ;message.c DfPostMessage ;message.c
DfSendMessage ;message.c DfSendMessage ;message.c
DfDispatchMessage ;message.c DfDispatchMessage ;message.c
handshake ;message.c handshake ;message.c
TestCriticalError ;stubs.c TestCriticalError ;stubs.c
;DefaultWndProc ;DefaultWndProc
;BaseWndProc ;BaseWndProc
;WindowHeight ;WindowHeight
;WindowWidth ;WindowWidth
;ClientWidth ;ClientWidth
;ClientHeight ;ClientHeight
;GetTop ;GetTop
;GetBottom ;GetBottom
;GetLeft ;GetLeft
;GetRight ;GetRight
;GetClientTop ;GetClientTop
;GetClientBottom ;GetClientBottom
;GetClientLeft ;GetClientLeft
;GetClientRight ;GetClientRight
;GetParent ;GetParent
;FirstWindow ;FirstWindow
;LastWindow ;LastWindow
;NextWindow ;NextWindow
;PrevWindow ;PrevWindow
CharInView CharInView
;TopBorderAdj ;TopBorderAdj
;BorderAdj ;BorderAdj

View file

@ -1,4 +1,4 @@
/* $Id: dflat32.rc,v 1.3 2004/10/16 22:30:17 gvg Exp $ */ /* $Id$ */
#define REACTOS_VERSION_DLL #define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "dflat32 console windowing library\0" #define REACTOS_STR_FILE_DESCRIPTION "dflat32 console windowing library\0"

View file

@ -6,7 +6,7 @@
* conjunction with the documentation file libjpeg.doc. * conjunction with the documentation file libjpeg.doc.
* *
* This code will not do anything useful as-is, but it may be helpful as a * This code will not do anything useful as-is, but it may be helpful as a
* skeleton for constructing routines that call the JPEG library. * skeleton for constructing routines that call the JPEG library.
* *
* We present these routines in the same coding style used in the JPEG code * We present these routines in the same coding style used in the JPEG code
* (ANSI function definitions, etc); but you are of course free to code your * (ANSI function definitions, etc); but you are of course free to code your
@ -356,7 +356,7 @@ read_JPEG_file (char * filename)
* output image dimensions available, as well as the output colormap * output image dimensions available, as well as the output colormap
* if we asked for color quantization. * if we asked for color quantization.
* In this example, we need to make an output work buffer of the right size. * In this example, we need to make an output work buffer of the right size.
*/ */
/* JSAMPLEs per row in output buffer */ /* JSAMPLEs per row in output buffer */
row_stride = cinfo.output_width * cinfo.output_components; row_stride = cinfo.output_width * cinfo.output_components;
/* Make a one-row-high sample array that will go away when done with image */ /* Make a one-row-high sample array that will go away when done with image */

View file

@ -36,7 +36,7 @@ jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize)
if (version != JPEG_LIB_VERSION) if (version != JPEG_LIB_VERSION)
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
if (structsize != SIZEOF(struct jpeg_compress_struct)) if (structsize != SIZEOF(struct jpeg_compress_struct))
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
(int) SIZEOF(struct jpeg_compress_struct), (int) structsize); (int) SIZEOF(struct jpeg_compress_struct), (int) structsize);
/* For debugging purposes, we zero the whole master structure. /* For debugging purposes, we zero the whole master structure.

View file

@ -204,7 +204,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(c_derived_tbl)); SIZEOF(c_derived_tbl));
dtbl = *pdtbl; dtbl = *pdtbl;
/* Figure C.1: make table of Huffman code length for each symbol */ /* Figure C.1: make table of Huffman code length for each symbol */
p = 0; p = 0;
@ -217,7 +217,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
} }
huffsize[p] = 0; huffsize[p] = 0;
lastp = p; lastp = p;
/* Figure C.2: generate the codes themselves */ /* Figure C.2: generate the codes themselves */
/* We also validate that the counts represent a legal Huffman code tree. */ /* We also validate that the counts represent a legal Huffman code tree. */
@ -237,7 +237,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
code <<= 1; code <<= 1;
si++; si++;
} }
/* Figure C.3: generate encoding tables */ /* Figure C.3: generate encoding tables */
/* These are code and size indexed by symbol value */ /* These are code and size indexed by symbol value */
@ -311,16 +311,16 @@ emit_bits (working_state * state, unsigned int code, int size)
ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE);
put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */ put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */
put_bits += size; /* new number of bits in buffer */ put_bits += size; /* new number of bits in buffer */
put_buffer <<= 24 - put_bits; /* align incoming bits */ put_buffer <<= 24 - put_bits; /* align incoming bits */
put_buffer |= state->cur.put_buffer; /* and merge with old buffer contents */ put_buffer |= state->cur.put_buffer; /* and merge with old buffer contents */
while (put_bits >= 8) { while (put_bits >= 8) {
int c = (int) ((put_buffer >> 16) & 0xFF); int c = (int) ((put_buffer >> 16) & 0xFF);
emit_byte(state, c, return FALSE); emit_byte(state, c, return FALSE);
if (c == 0xFF) { /* need to stuff a zero byte? */ if (c == 0xFF) { /* need to stuff a zero byte? */
emit_byte(state, 0, return FALSE); emit_byte(state, 0, return FALSE);
@ -356,9 +356,9 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
register int temp, temp2; register int temp, temp2;
register int nbits; register int nbits;
register int k, r, i; register int k, r, i;
/* Encode the DC coefficient difference per section F.1.2.1 */ /* Encode the DC coefficient difference per section F.1.2.1 */
temp = temp2 = block[0] - last_dc_val; temp = temp2 = block[0] - last_dc_val;
if (temp < 0) { if (temp < 0) {
@ -367,7 +367,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
/* This code assumes we are on a two's complement machine */ /* This code assumes we are on a two's complement machine */
temp2--; temp2--;
} }
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0; nbits = 0;
while (temp) { while (temp) {
@ -379,7 +379,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
*/ */
if (nbits > MAX_COEF_BITS+1) if (nbits > MAX_COEF_BITS+1)
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
/* Emit the Huffman-coded symbol for the number of bits */ /* Emit the Huffman-coded symbol for the number of bits */
if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))
return FALSE; return FALSE;
@ -391,9 +391,9 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
return FALSE; return FALSE;
/* Encode the AC coefficients per section F.1.2.2 */ /* Encode the AC coefficients per section F.1.2.2 */
r = 0; /* r = run length of zeros */ r = 0; /* r = run length of zeros */
for (k = 1; k < DCTSIZE2; k++) { for (k = 1; k < DCTSIZE2; k++) {
if ((temp = block[jpeg_natural_order[k]]) == 0) { if ((temp = block[jpeg_natural_order[k]]) == 0) {
r++; r++;
@ -411,7 +411,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
/* This code assumes we are on a two's complement machine */ /* This code assumes we are on a two's complement machine */
temp2--; temp2--;
} }
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 1; /* there must be at least one 1 bit */ nbits = 1; /* there must be at least one 1 bit */
while ((temp >>= 1)) while ((temp >>= 1))
@ -419,7 +419,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
/* Check for out-of-range coefficient values */ /* Check for out-of-range coefficient values */
if (nbits > MAX_COEF_BITS) if (nbits > MAX_COEF_BITS)
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
/* Emit Huffman symbol for run length / number of bits */ /* Emit Huffman symbol for run length / number of bits */
i = (r << 4) + nbits; i = (r << 4) + nbits;
if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i])) if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i]))
@ -429,7 +429,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
/* or the complement of its magnitude, if negative. */ /* or the complement of its magnitude, if negative. */
if (! emit_bits(state, (unsigned int) temp2, nbits)) if (! emit_bits(state, (unsigned int) temp2, nbits))
return FALSE; return FALSE;
r = 0; r = 0;
} }
} }
@ -575,13 +575,13 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
register int temp; register int temp;
register int nbits; register int nbits;
register int k, r; register int k, r;
/* Encode the DC coefficient difference per section F.1.2.1 */ /* Encode the DC coefficient difference per section F.1.2.1 */
temp = block[0] - last_dc_val; temp = block[0] - last_dc_val;
if (temp < 0) if (temp < 0)
temp = -temp; temp = -temp;
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0; nbits = 0;
while (temp) { while (temp) {
@ -596,11 +596,11 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
/* Count the Huffman symbol for the number of bits */ /* Count the Huffman symbol for the number of bits */
dc_counts[nbits]++; dc_counts[nbits]++;
/* Encode the AC coefficients per section F.1.2.2 */ /* Encode the AC coefficients per section F.1.2.2 */
r = 0; /* r = run length of zeros */ r = 0; /* r = run length of zeros */
for (k = 1; k < DCTSIZE2; k++) { for (k = 1; k < DCTSIZE2; k++) {
if ((temp = block[jpeg_natural_order[k]]) == 0) { if ((temp = block[jpeg_natural_order[k]]) == 0) {
r++; r++;
@ -610,11 +610,11 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
ac_counts[0xF0]++; ac_counts[0xF0]++;
r -= 16; r -= 16;
} }
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
if (temp < 0) if (temp < 0)
temp = -temp; temp = -temp;
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 1; /* there must be at least one 1 bit */ nbits = 1; /* there must be at least one 1 bit */
while ((temp >>= 1)) while ((temp >>= 1))
@ -622,10 +622,10 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
/* Check for out-of-range coefficient values */ /* Check for out-of-range coefficient values */
if (nbits > MAX_COEF_BITS) if (nbits > MAX_COEF_BITS)
ERREXIT(cinfo, JERR_BAD_DCT_COEF); ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count Huffman symbol for run length / number of bits */ /* Count Huffman symbol for run length / number of bits */
ac_counts[(r << 4) + nbits]++; ac_counts[(r << 4) + nbits]++;
r = 0; r = 0;
} }
} }
@ -718,7 +718,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
MEMZERO(codesize, SIZEOF(codesize)); MEMZERO(codesize, SIZEOF(codesize));
for (i = 0; i < 257; i++) for (i = 0; i < 257; i++)
others[i] = -1; /* init links to empty */ others[i] = -1; /* init links to empty */
freq[256] = 1; /* make sure 256 has a nonzero count */ freq[256] = 1; /* make sure 256 has a nonzero count */
/* Including the pseudo-symbol 256 in the Huffman procedure guarantees /* Including the pseudo-symbol 256 in the Huffman procedure guarantees
* that no real symbol is given code-value of all ones, because 256 * that no real symbol is given code-value of all ones, because 256
@ -753,7 +753,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
/* Done if we've merged everything into one frequency */ /* Done if we've merged everything into one frequency */
if (c2 < 0) if (c2 < 0)
break; break;
/* Else merge the two counts/trees */ /* Else merge the two counts/trees */
freq[c1] += freq[c2]; freq[c1] += freq[c2];
freq[c2] = 0; freq[c2] = 0;
@ -764,9 +764,9 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
c1 = others[c1]; c1 = others[c1];
codesize[c1]++; codesize[c1]++;
} }
others[c1] = c2; /* chain c2 onto c1's tree branch */ others[c1] = c2; /* chain c2 onto c1's tree branch */
/* Increment the codesize of everything in c2's tree branch */ /* Increment the codesize of everything in c2's tree branch */
codesize[c2]++; codesize[c2]++;
while (others[c2] >= 0) { while (others[c2] >= 0) {
@ -797,13 +797,13 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
* shortest nonzero BITS entry is converted into a prefix for two code words * shortest nonzero BITS entry is converted into a prefix for two code words
* one bit longer. * one bit longer.
*/ */
for (i = MAX_CLEN; i > 16; i--) { for (i = MAX_CLEN; i > 16; i--) {
while (bits[i] > 0) { while (bits[i] > 0) {
j = i - 2; /* find length of new prefix to be used */ j = i - 2; /* find length of new prefix to be used */
while (bits[j] == 0) while (bits[j] == 0)
j--; j--;
bits[i] -= 2; /* remove two symbols */ bits[i] -= 2; /* remove two symbols */
bits[i-1]++; /* one goes in this length */ bits[i-1]++; /* one goes in this length */
bits[j+1] += 2; /* two new symbols in this length */ bits[j+1] += 2; /* two new symbols in this length */
@ -815,10 +815,10 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
while (bits[i] == 0) /* find largest codelength still in use */ while (bits[i] == 0) /* find largest codelength still in use */
i--; i--;
bits[i]--; bits[i]--;
/* Return final symbol counts (only for lengths 0..16) */ /* Return final symbol counts (only for lengths 0..16) */
MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits)); MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits));
/* Return a list of the symbols sorted by code length */ /* Return a list of the symbols sorted by code length */
/* It's not real clear to me why we don't need to consider the codelength /* It's not real clear to me why we don't need to consider the codelength
* changes made above, but the JPEG spec seems to think this works. * changes made above, but the JPEG spec seems to think this works.

View file

@ -18,24 +18,24 @@ typedef enum { /* JPEG marker codes */
M_SOF1 = 0xc1, M_SOF1 = 0xc1,
M_SOF2 = 0xc2, M_SOF2 = 0xc2,
M_SOF3 = 0xc3, M_SOF3 = 0xc3,
M_SOF5 = 0xc5, M_SOF5 = 0xc5,
M_SOF6 = 0xc6, M_SOF6 = 0xc6,
M_SOF7 = 0xc7, M_SOF7 = 0xc7,
M_JPG = 0xc8, M_JPG = 0xc8,
M_SOF9 = 0xc9, M_SOF9 = 0xc9,
M_SOF10 = 0xca, M_SOF10 = 0xca,
M_SOF11 = 0xcb, M_SOF11 = 0xcb,
M_SOF13 = 0xcd, M_SOF13 = 0xcd,
M_SOF14 = 0xce, M_SOF14 = 0xce,
M_SOF15 = 0xcf, M_SOF15 = 0xcf,
M_DHT = 0xc4, M_DHT = 0xc4,
M_DAC = 0xcc, M_DAC = 0xcc,
M_RST0 = 0xd0, M_RST0 = 0xd0,
M_RST1 = 0xd1, M_RST1 = 0xd1,
M_RST2 = 0xd2, M_RST2 = 0xd2,
@ -44,7 +44,7 @@ typedef enum { /* JPEG marker codes */
M_RST5 = 0xd5, M_RST5 = 0xd5,
M_RST6 = 0xd6, M_RST6 = 0xd6,
M_RST7 = 0xd7, M_RST7 = 0xd7,
M_SOI = 0xd8, M_SOI = 0xd8,
M_EOI = 0xd9, M_EOI = 0xd9,
M_SOS = 0xda, M_SOS = 0xda,
@ -53,7 +53,7 @@ typedef enum { /* JPEG marker codes */
M_DRI = 0xdd, M_DRI = 0xdd,
M_DHP = 0xde, M_DHP = 0xde,
M_EXP = 0xdf, M_EXP = 0xdf,
M_APP0 = 0xe0, M_APP0 = 0xe0,
M_APP1 = 0xe1, M_APP1 = 0xe1,
M_APP2 = 0xe2, M_APP2 = 0xe2,
@ -70,13 +70,13 @@ typedef enum { /* JPEG marker codes */
M_APP13 = 0xed, M_APP13 = 0xed,
M_APP14 = 0xee, M_APP14 = 0xee,
M_APP15 = 0xef, M_APP15 = 0xef,
M_JPG0 = 0xf0, M_JPG0 = 0xf0,
M_JPG13 = 0xfd, M_JPG13 = 0xfd,
M_COM = 0xfe, M_COM = 0xfe,
M_TEM = 0x01, M_TEM = 0x01,
M_ERROR = 0x100 M_ERROR = 0x100
} JPEG_MARKER; } JPEG_MARKER;
@ -186,7 +186,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
{ {
JHUFF_TBL * htbl; JHUFF_TBL * htbl;
int length, i; int length, i;
if (is_ac) { if (is_ac) {
htbl = cinfo->ac_huff_tbl_ptrs[index]; htbl = cinfo->ac_huff_tbl_ptrs[index];
index += 0x10; /* output index has AC bit set */ index += 0x10; /* output index has AC bit set */
@ -196,23 +196,23 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
if (htbl == NULL) if (htbl == NULL)
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index); ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
if (! htbl->sent_table) { if (! htbl->sent_table) {
emit_marker(cinfo, M_DHT); emit_marker(cinfo, M_DHT);
length = 0; length = 0;
for (i = 1; i <= 16; i++) for (i = 1; i <= 16; i++)
length += htbl->bits[i]; length += htbl->bits[i];
emit_2bytes(cinfo, length + 2 + 1 + 16); emit_2bytes(cinfo, length + 2 + 1 + 16);
emit_byte(cinfo, index); emit_byte(cinfo, index);
for (i = 1; i <= 16; i++) for (i = 1; i <= 16; i++)
emit_byte(cinfo, htbl->bits[i]); emit_byte(cinfo, htbl->bits[i]);
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
emit_byte(cinfo, htbl->huffval[i]); emit_byte(cinfo, htbl->huffval[i]);
htbl->sent_table = TRUE; htbl->sent_table = TRUE;
} }
} }
@ -229,24 +229,24 @@ emit_dac (j_compress_ptr cinfo)
char ac_in_use[NUM_ARITH_TBLS]; char ac_in_use[NUM_ARITH_TBLS];
int length, i; int length, i;
jpeg_component_info *compptr; jpeg_component_info *compptr;
for (i = 0; i < NUM_ARITH_TBLS; i++) for (i = 0; i < NUM_ARITH_TBLS; i++)
dc_in_use[i] = ac_in_use[i] = 0; dc_in_use[i] = ac_in_use[i] = 0;
for (i = 0; i < cinfo->comps_in_scan; i++) { for (i = 0; i < cinfo->comps_in_scan; i++) {
compptr = cinfo->cur_comp_info[i]; compptr = cinfo->cur_comp_info[i];
dc_in_use[compptr->dc_tbl_no] = 1; dc_in_use[compptr->dc_tbl_no] = 1;
ac_in_use[compptr->ac_tbl_no] = 1; ac_in_use[compptr->ac_tbl_no] = 1;
} }
length = 0; length = 0;
for (i = 0; i < NUM_ARITH_TBLS; i++) for (i = 0; i < NUM_ARITH_TBLS; i++)
length += dc_in_use[i] + ac_in_use[i]; length += dc_in_use[i] + ac_in_use[i];
emit_marker(cinfo, M_DAC); emit_marker(cinfo, M_DAC);
emit_2bytes(cinfo, length*2 + 2); emit_2bytes(cinfo, length*2 + 2);
for (i = 0; i < NUM_ARITH_TBLS; i++) { for (i = 0; i < NUM_ARITH_TBLS; i++) {
if (dc_in_use[i]) { if (dc_in_use[i]) {
emit_byte(cinfo, i); emit_byte(cinfo, i);
@ -266,7 +266,7 @@ emit_dri (j_compress_ptr cinfo)
/* Emit a DRI marker */ /* Emit a DRI marker */
{ {
emit_marker(cinfo, M_DRI); emit_marker(cinfo, M_DRI);
emit_2bytes(cinfo, 4); /* fixed length */ emit_2bytes(cinfo, 4); /* fixed length */
emit_2bytes(cinfo, (int) cinfo->restart_interval); emit_2bytes(cinfo, (int) cinfo->restart_interval);
@ -279,9 +279,9 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
{ {
int ci; int ci;
jpeg_component_info *compptr; jpeg_component_info *compptr;
emit_marker(cinfo, code); emit_marker(cinfo, code);
emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
/* Make sure image isn't bigger than SOF field can handle */ /* Make sure image isn't bigger than SOF field can handle */
@ -310,13 +310,13 @@ emit_sos (j_compress_ptr cinfo)
{ {
int i, td, ta; int i, td, ta;
jpeg_component_info *compptr; jpeg_component_info *compptr;
emit_marker(cinfo, M_SOS); emit_marker(cinfo, M_SOS);
emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */ emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
emit_byte(cinfo, cinfo->comps_in_scan); emit_byte(cinfo, cinfo->comps_in_scan);
for (i = 0; i < cinfo->comps_in_scan; i++) { for (i = 0; i < cinfo->comps_in_scan; i++) {
compptr = cinfo->cur_comp_info[i]; compptr = cinfo->cur_comp_info[i];
emit_byte(cinfo, compptr->component_id); emit_byte(cinfo, compptr->component_id);
@ -360,9 +360,9 @@ emit_jfif_app0 (j_compress_ptr cinfo)
* Thumbnail X size (1 byte) * Thumbnail X size (1 byte)
* Thumbnail Y size (1 byte) * Thumbnail Y size (1 byte)
*/ */
emit_marker(cinfo, M_APP0); emit_marker(cinfo, M_APP0);
emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */ emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */ emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */
@ -399,9 +399,9 @@ emit_adobe_app14 (j_compress_ptr cinfo)
* YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with
* whether the encoder performed a transformation, which is pretty useless. * whether the encoder performed a transformation, which is pretty useless.
*/ */
emit_marker(cinfo, M_APP14); emit_marker(cinfo, M_APP14);
emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */ emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */ emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */
@ -496,7 +496,7 @@ write_frame_header (j_compress_ptr cinfo)
int ci, prec; int ci, prec;
boolean is_baseline; boolean is_baseline;
jpeg_component_info *compptr; jpeg_component_info *compptr;
/* Emit DQT for each quantization table. /* Emit DQT for each quantization table.
* Note that emit_dqt() suppresses any duplicate tables. * Note that emit_dqt() suppresses any duplicate tables.
*/ */

View file

@ -7,7 +7,7 @@
* *
* This file contains master control logic for the JPEG compressor. * This file contains master control logic for the JPEG compressor.
* These routines are concerned with parameter validation, initial setup, * These routines are concerned with parameter validation, initial setup,
* and inter-pass control (determining the number of passes and the work * and inter-pass control (determining the number of passes and the work
* to be done in each pass). * to be done in each pass).
*/ */
@ -153,7 +153,7 @@ validate_script (j_compress_ptr cinfo)
#ifdef C_PROGRESSIVE_SUPPORTED #ifdef C_PROGRESSIVE_SUPPORTED
cinfo->progressive_mode = TRUE; cinfo->progressive_mode = TRUE;
last_bitpos_ptr = & last_bitpos[0][0]; last_bitpos_ptr = & last_bitpos[0][0];
for (ci = 0; ci < cinfo->num_components; ci++) for (ci = 0; ci < cinfo->num_components; ci++)
for (coefi = 0; coefi < DCTSIZE2; coefi++) for (coefi = 0; coefi < DCTSIZE2; coefi++)
*last_bitpos_ptr++ = -1; *last_bitpos_ptr++ = -1;
#else #else
@ -161,7 +161,7 @@ validate_script (j_compress_ptr cinfo)
#endif #endif
} else { } else {
cinfo->progressive_mode = FALSE; cinfo->progressive_mode = FALSE;
for (ci = 0; ci < cinfo->num_components; ci++) for (ci = 0; ci < cinfo->num_components; ci++)
component_sent[ci] = FALSE; component_sent[ci] = FALSE;
} }
@ -311,16 +311,16 @@ per_scan_setup (j_compress_ptr cinfo)
{ {
int ci, mcublks, tmp; int ci, mcublks, tmp;
jpeg_component_info *compptr; jpeg_component_info *compptr;
if (cinfo->comps_in_scan == 1) { if (cinfo->comps_in_scan == 1) {
/* Noninterleaved (single-component) scan */ /* Noninterleaved (single-component) scan */
compptr = cinfo->cur_comp_info[0]; compptr = cinfo->cur_comp_info[0];
/* Overall image size in MCUs */ /* Overall image size in MCUs */
cinfo->MCUs_per_row = compptr->width_in_blocks; cinfo->MCUs_per_row = compptr->width_in_blocks;
cinfo->MCU_rows_in_scan = compptr->height_in_blocks; cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
/* For noninterleaved scan, always one block per MCU */ /* For noninterleaved scan, always one block per MCU */
compptr->MCU_width = 1; compptr->MCU_width = 1;
compptr->MCU_height = 1; compptr->MCU_height = 1;
@ -333,18 +333,18 @@ per_scan_setup (j_compress_ptr cinfo)
tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
if (tmp == 0) tmp = compptr->v_samp_factor; if (tmp == 0) tmp = compptr->v_samp_factor;
compptr->last_row_height = tmp; compptr->last_row_height = tmp;
/* Prepare array describing MCU composition */ /* Prepare array describing MCU composition */
cinfo->blocks_in_MCU = 1; cinfo->blocks_in_MCU = 1;
cinfo->MCU_membership[0] = 0; cinfo->MCU_membership[0] = 0;
} else { } else {
/* Interleaved (multi-component) scan */ /* Interleaved (multi-component) scan */
if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
MAX_COMPS_IN_SCAN); MAX_COMPS_IN_SCAN);
/* Overall image size in MCUs */ /* Overall image size in MCUs */
cinfo->MCUs_per_row = (JDIMENSION) cinfo->MCUs_per_row = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width, jdiv_round_up((long) cinfo->image_width,
@ -352,9 +352,9 @@ per_scan_setup (j_compress_ptr cinfo)
cinfo->MCU_rows_in_scan = (JDIMENSION) cinfo->MCU_rows_in_scan = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height, jdiv_round_up((long) cinfo->image_height,
(long) (cinfo->max_v_samp_factor*DCTSIZE)); (long) (cinfo->max_v_samp_factor*DCTSIZE));
cinfo->blocks_in_MCU = 0; cinfo->blocks_in_MCU = 0;
for (ci = 0; ci < cinfo->comps_in_scan; ci++) { for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci]; compptr = cinfo->cur_comp_info[ci];
/* Sampling factors give # of blocks of component in each MCU */ /* Sampling factors give # of blocks of component in each MCU */
@ -377,7 +377,7 @@ per_scan_setup (j_compress_ptr cinfo)
cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
} }
} }
} }
/* Convert restart specified in rows to actual MCU count. */ /* Convert restart specified in rows to actual MCU count. */

View file

@ -187,12 +187,12 @@ std_huff_tables (j_compress_ptr cinfo)
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
static const UINT8 val_dc_luminance[] = static const UINT8 val_dc_luminance[] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
static const UINT8 bits_dc_chrominance[17] = static const UINT8 bits_dc_chrominance[17] =
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
static const UINT8 val_dc_chrominance[] = static const UINT8 val_dc_chrominance[] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
static const UINT8 bits_ac_luminance[17] = static const UINT8 bits_ac_luminance[17] =
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
static const UINT8 val_ac_luminance[] = static const UINT8 val_ac_luminance[] =
@ -217,7 +217,7 @@ std_huff_tables (j_compress_ptr cinfo)
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa }; 0xf9, 0xfa };
static const UINT8 bits_ac_chrominance[17] = static const UINT8 bits_ac_chrominance[17] =
{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
static const UINT8 val_ac_chrominance[] = static const UINT8 val_ac_chrominance[] =
@ -242,7 +242,7 @@ std_huff_tables (j_compress_ptr cinfo)
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa }; 0xf9, 0xfa };
add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0], add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
bits_dc_luminance, val_dc_luminance); bits_dc_luminance, val_dc_luminance);
add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0], add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0],

View file

@ -104,7 +104,7 @@ METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo));
METHODDEF(void) METHODDEF(void)
start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
boolean is_DC_band; boolean is_DC_band;
int ci, tbl; int ci, tbl;
@ -240,16 +240,16 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
return; /* do nothing if we're only getting stats */ return; /* do nothing if we're only getting stats */
put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */ put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */
put_bits += size; /* new number of bits in buffer */ put_bits += size; /* new number of bits in buffer */
put_buffer <<= 24 - put_bits; /* align incoming bits */ put_buffer <<= 24 - put_bits; /* align incoming bits */
put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */ put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */
while (put_bits >= 8) { while (put_bits >= 8) {
int c = (int) ((put_buffer >> 16) & 0xFF); int c = (int) ((put_buffer >> 16) & 0xFF);
emit_byte(entropy, c); emit_byte(entropy, c);
if (c == 0xFF) { /* need to stuff a zero byte? */ if (c == 0xFF) { /* need to stuff a zero byte? */
emit_byte(entropy, 0); emit_byte(entropy, 0);
@ -416,7 +416,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* This code assumes we are on a two's complement machine */ /* This code assumes we are on a two's complement machine */
temp2--; temp2--;
} }
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0; nbits = 0;
while (temp) { while (temp) {
@ -428,10 +428,10 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/ */
if (nbits > MAX_COEF_BITS+1) if (nbits > MAX_COEF_BITS+1)
ERREXIT(cinfo, JERR_BAD_DCT_COEF); ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count/emit the Huffman-coded symbol for the number of bits */ /* Count/emit the Huffman-coded symbol for the number of bits */
emit_symbol(entropy, compptr->dc_tbl_no, nbits); emit_symbol(entropy, compptr->dc_tbl_no, nbits);
/* Emit that number of bits of the value, if positive, */ /* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */ /* or the complement of its magnitude, if negative. */
if (nbits) /* emit_bits rejects calls with size 0 */ if (nbits) /* emit_bits rejects calls with size 0 */
@ -483,9 +483,9 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
block = MCU_data[0]; block = MCU_data[0];
/* Encode the AC coefficients per section G.1.2.2, fig. G.3 */ /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
r = 0; /* r = run length of zeros */ r = 0; /* r = run length of zeros */
for (k = cinfo->Ss; k <= Se; k++) { for (k = cinfo->Ss; k <= Se; k++) {
if ((temp = (*block)[jpeg_natural_order[k]]) == 0) { if ((temp = (*block)[jpeg_natural_order[k]]) == 0) {
r++; r++;
@ -658,7 +658,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
} }
/* Encode the AC coefficients per section G.1.2.3, fig. G.7 */ /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
r = 0; /* r = run length of zeros */ r = 0; /* r = run length of zeros */
BR = 0; /* BR = count of buffered bits added now */ BR = 0; /* BR = count of buffered bits added now */
BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */ BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
@ -744,7 +744,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
METHODDEF(void) METHODDEF(void)
finish_pass_phuff (j_compress_ptr cinfo) finish_pass_phuff (j_compress_ptr cinfo)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->next_output_byte = cinfo->dest->next_output_byte;

View file

@ -68,7 +68,7 @@ jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
if (version != JPEG_LIB_VERSION) if (version != JPEG_LIB_VERSION)
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
if (structsize != SIZEOF(struct jpeg_decompress_struct)) if (structsize != SIZEOF(struct jpeg_decompress_struct))
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
(int) SIZEOF(struct jpeg_decompress_struct), (int) structsize); (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize);
/* For debugging purposes, we zero the whole master structure. /* For debugging purposes, we zero the whole master structure.
@ -152,7 +152,7 @@ default_decompress_parms (j_decompress_ptr cinfo)
cinfo->jpeg_color_space = JCS_GRAYSCALE; cinfo->jpeg_color_space = JCS_GRAYSCALE;
cinfo->out_color_space = JCS_GRAYSCALE; cinfo->out_color_space = JCS_GRAYSCALE;
break; break;
case 3: case 3:
if (cinfo->saw_JFIF_marker) { if (cinfo->saw_JFIF_marker) {
cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */ cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
@ -187,7 +187,7 @@ default_decompress_parms (j_decompress_ptr cinfo)
/* Always guess RGB is proper output colorspace. */ /* Always guess RGB is proper output colorspace. */
cinfo->out_color_space = JCS_RGB; cinfo->out_color_space = JCS_RGB;
break; break;
case 4: case 4:
if (cinfo->saw_Adobe_marker) { if (cinfo->saw_Adobe_marker) {
switch (cinfo->Adobe_transform) { switch (cinfo->Adobe_transform) {
@ -208,7 +208,7 @@ default_decompress_parms (j_decompress_ptr cinfo)
} }
cinfo->out_color_space = JCS_CMYK; cinfo->out_color_space = JCS_CMYK;
break; break;
default: default:
cinfo->jpeg_color_space = JCS_UNKNOWN; cinfo->jpeg_color_space = JCS_UNKNOWN;
cinfo->out_color_space = JCS_UNKNOWN; cinfo->out_color_space = JCS_UNKNOWN;
@ -437,10 +437,10 @@ static int mmxsupport()
pushfd //Save Eflag to stack pushfd //Save Eflag to stack
pop eax //Get Eflag from stack into eax pop eax //Get Eflag from stack into eax
mov ecx, eax //Make another copy of Eflag in ecx mov ecx, eax //Make another copy of Eflag in ecx
xor eax, 0x200000 //Toggle ID bit in Eflag [i.e. bit(21)] xor eax, 0x200000 //Toggle ID bit in Eflag [i.e. bit(21)]
push eax //Save modified Eflag back to stack push eax //Save modified Eflag back to stack
popfd //Restored modified value back to Eflag reg popfd //Restored modified value back to Eflag reg
pushfd //Save Eflag to stack pushfd //Save Eflag to stack
pop eax //Get Eflag from stack pop eax //Get Eflag from stack
xor eax, ecx //Compare the new Eflag with the original Eflag xor eax, ecx //Compare the new Eflag with the original Eflag
@ -449,16 +449,16 @@ static int mmxsupport()
//NOT_SUPPORTED label //NOT_SUPPORTED label
xor eax, eax //Set eax to zero xor eax, eax //Set eax to zero
cpuid cpuid
cmp eax, 1 //make sure eax return non-zero value cmp eax, 1 //make sure eax return non-zero value
jl NOT_SUPPORTED //If eax is zero, mmx not supported jl NOT_SUPPORTED //If eax is zero, mmx not supported
xor eax, eax //set eax to zero xor eax, eax //set eax to zero
inc eax //Now increment eax to 1. This instruction is inc eax //Now increment eax to 1. This instruction is
//faster than the instruction "mov eax, 1" //faster than the instruction "mov eax, 1"
cpuid cpuid
and edx, 0x00800000 //mask out all bits but mmx bit(24) and edx, 0x00800000 //mask out all bits but mmx bit(24)
@ -468,11 +468,11 @@ static int mmxsupport()
mov mmx_supported, 1 //set return value to 1 mov mmx_supported, 1 //set return value to 1
NOT_SUPPORTED: NOT_SUPPORTED:
mov eax, mmx_supported //move return value to eax mov eax, mmx_supported //move return value to eax
} }
return mmx_supported; return mmx_supported;
} }
#endif #endif
@ -484,12 +484,12 @@ static int sse2support()
int my_edx; int my_edx;
_asm _asm
{ {
mov eax, 01 mov eax, 01
cpuid cpuid
mov my_edx, edx mov my_edx, edx
} }
if (my_edx & (0x1 << 26)) if (my_edx & (0x1 << 26))
sse2available = 1; sse2available = 1;
else sse2available = 2; else sse2available = 2;
return sse2available; return sse2available;

View file

@ -8,7 +8,7 @@
* This include file contains common declarations for the forward and * This include file contains common declarations for the forward and
* inverse DCT modules. These declarations are private to the DCT managers * inverse DCT modules. These declarations are private to the DCT managers
* (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms. * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.
* The individual DCT algorithms are kept in separate files to ease * The individual DCT algorithms are kept in separate files to ease
* machine-dependent tuning (e.g., assembly coding). * machine-dependent tuning (e.g., assembly coding).
*/ */

View file

@ -80,10 +80,10 @@ typedef union {
GLOBAL(void) GLOBAL(void)
jpeg_idct_islow_sse2 ( jpeg_idct_islow_sse2 (
j_decompress_ptr cinfo, j_decompress_ptr cinfo,
jpeg_component_info * compptr, jpeg_component_info * compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block,
JSAMPARRAY output_buf, JSAMPARRAY output_buf,
JDIMENSION output_col); JDIMENSION output_col);
@ -139,14 +139,14 @@ start_pass (j_decompress_ptr cinfo)
#else #else
method_ptr = jpeg_idct_islow; method_ptr = jpeg_idct_islow;
method = JDCT_ISLOW; method = JDCT_ISLOW;
#endif /* HAVE_SSE2_INTEL_MNEMONICS */ #endif /* HAVE_SSE2_INTEL_MNEMONICS */
break; break;
#endif #endif
#ifdef DCT_IFAST_SUPPORTED #ifdef DCT_IFAST_SUPPORTED
case JDCT_IFAST: case JDCT_IFAST:
#ifdef HAVE_SSE2_INTEL_MNEMONICS #ifdef HAVE_SSE2_INTEL_MNEMONICS
if (SSE2Available==1) if (SSE2Available==1)
{ {
method_ptr = jpeg_idct_islow_sse2; method_ptr = jpeg_idct_islow_sse2;
method = JDCT_ISLOW; method = JDCT_ISLOW;

View file

@ -176,7 +176,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
SIZEOF(d_derived_tbl)); SIZEOF(d_derived_tbl));
dtbl = *pdtbl; dtbl = *pdtbl;
dtbl->pub = htbl; /* fill in back link */ dtbl->pub = htbl; /* fill in back link */
/* Figure C.1: make table of Huffman code length for each symbol */ /* Figure C.1: make table of Huffman code length for each symbol */
p = 0; p = 0;
@ -189,10 +189,10 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
} }
huffsize[p] = 0; huffsize[p] = 0;
numsymbols = p; numsymbols = p;
/* Figure C.2: generate the codes themselves */ /* Figure C.2: generate the codes themselves */
/* We also validate that the counts represent a legal Huffman code tree. */ /* We also validate that the counts represent a legal Huffman code tree. */
code = 0; code = 0;
si = huffsize[0]; si = huffsize[0];
p = 0; p = 0;
@ -570,10 +570,10 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Since zeroes are skipped, output area must be cleared beforehand */ /* Since zeroes are skipped, output area must be cleared beforehand */
for (k = 1; k < DCTSIZE2; k++) { for (k = 1; k < DCTSIZE2; k++) {
HUFF_DECODE(s, br_state, actbl, return FALSE, label2); HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
r = s >> 4; r = s >> 4;
s &= 15; s &= 15;
if (s) { if (s) {
k += r; k += r;
CHECK_BIT_BUFFER(br_state, s, return FALSE); CHECK_BIT_BUFFER(br_state, s, return FALSE);
@ -597,10 +597,10 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* In this path we just discard the values */ /* In this path we just discard the values */
for (k = 1; k < DCTSIZE2; k++) { for (k = 1; k < DCTSIZE2; k++) {
HUFF_DECODE(s, br_state, actbl, return FALSE, label3); HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
r = s >> 4; r = s >> 4;
s &= 15; s &= 15;
if (s) { if (s) {
k += r; k += r;
CHECK_BIT_BUFFER(br_state, s, return FALSE); CHECK_BIT_BUFFER(br_state, s, return FALSE);

View file

@ -124,16 +124,16 @@ per_scan_setup (j_decompress_ptr cinfo)
{ {
int ci, mcublks, tmp; int ci, mcublks, tmp;
jpeg_component_info *compptr; jpeg_component_info *compptr;
if (cinfo->comps_in_scan == 1) { if (cinfo->comps_in_scan == 1) {
/* Noninterleaved (single-component) scan */ /* Noninterleaved (single-component) scan */
compptr = cinfo->cur_comp_info[0]; compptr = cinfo->cur_comp_info[0];
/* Overall image size in MCUs */ /* Overall image size in MCUs */
cinfo->MCUs_per_row = compptr->width_in_blocks; cinfo->MCUs_per_row = compptr->width_in_blocks;
cinfo->MCU_rows_in_scan = compptr->height_in_blocks; cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
/* For noninterleaved scan, always one block per MCU */ /* For noninterleaved scan, always one block per MCU */
compptr->MCU_width = 1; compptr->MCU_width = 1;
compptr->MCU_height = 1; compptr->MCU_height = 1;
@ -146,18 +146,18 @@ per_scan_setup (j_decompress_ptr cinfo)
tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
if (tmp == 0) tmp = compptr->v_samp_factor; if (tmp == 0) tmp = compptr->v_samp_factor;
compptr->last_row_height = tmp; compptr->last_row_height = tmp;
/* Prepare array describing MCU composition */ /* Prepare array describing MCU composition */
cinfo->blocks_in_MCU = 1; cinfo->blocks_in_MCU = 1;
cinfo->MCU_membership[0] = 0; cinfo->MCU_membership[0] = 0;
} else { } else {
/* Interleaved (multi-component) scan */ /* Interleaved (multi-component) scan */
if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
MAX_COMPS_IN_SCAN); MAX_COMPS_IN_SCAN);
/* Overall image size in MCUs */ /* Overall image size in MCUs */
cinfo->MCUs_per_row = (JDIMENSION) cinfo->MCUs_per_row = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width, jdiv_round_up((long) cinfo->image_width,
@ -165,9 +165,9 @@ per_scan_setup (j_decompress_ptr cinfo)
cinfo->MCU_rows_in_scan = (JDIMENSION) cinfo->MCU_rows_in_scan = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height, jdiv_round_up((long) cinfo->image_height,
(long) (cinfo->max_v_samp_factor*DCTSIZE)); (long) (cinfo->max_v_samp_factor*DCTSIZE));
cinfo->blocks_in_MCU = 0; cinfo->blocks_in_MCU = 0;
for (ci = 0; ci < cinfo->comps_in_scan; ci++) { for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci]; compptr = cinfo->cur_comp_info[ci];
/* Sampling factors give # of blocks of component in each MCU */ /* Sampling factors give # of blocks of component in each MCU */
@ -190,7 +190,7 @@ per_scan_setup (j_decompress_ptr cinfo)
cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
} }
} }
} }
} }

View file

@ -22,24 +22,24 @@ typedef enum { /* JPEG marker codes */
M_SOF1 = 0xc1, M_SOF1 = 0xc1,
M_SOF2 = 0xc2, M_SOF2 = 0xc2,
M_SOF3 = 0xc3, M_SOF3 = 0xc3,
M_SOF5 = 0xc5, M_SOF5 = 0xc5,
M_SOF6 = 0xc6, M_SOF6 = 0xc6,
M_SOF7 = 0xc7, M_SOF7 = 0xc7,
M_JPG = 0xc8, M_JPG = 0xc8,
M_SOF9 = 0xc9, M_SOF9 = 0xc9,
M_SOF10 = 0xca, M_SOF10 = 0xca,
M_SOF11 = 0xcb, M_SOF11 = 0xcb,
M_SOF13 = 0xcd, M_SOF13 = 0xcd,
M_SOF14 = 0xce, M_SOF14 = 0xce,
M_SOF15 = 0xcf, M_SOF15 = 0xcf,
M_DHT = 0xc4, M_DHT = 0xc4,
M_DAC = 0xcc, M_DAC = 0xcc,
M_RST0 = 0xd0, M_RST0 = 0xd0,
M_RST1 = 0xd1, M_RST1 = 0xd1,
M_RST2 = 0xd2, M_RST2 = 0xd2,
@ -48,7 +48,7 @@ typedef enum { /* JPEG marker codes */
M_RST5 = 0xd5, M_RST5 = 0xd5,
M_RST6 = 0xd6, M_RST6 = 0xd6,
M_RST7 = 0xd7, M_RST7 = 0xd7,
M_SOI = 0xd8, M_SOI = 0xd8,
M_EOI = 0xd9, M_EOI = 0xd9,
M_SOS = 0xda, M_SOS = 0xda,
@ -57,7 +57,7 @@ typedef enum { /* JPEG marker codes */
M_DRI = 0xdd, M_DRI = 0xdd,
M_DHP = 0xde, M_DHP = 0xde,
M_EXP = 0xdf, M_EXP = 0xdf,
M_APP0 = 0xe0, M_APP0 = 0xe0,
M_APP1 = 0xe1, M_APP1 = 0xe1,
M_APP2 = 0xe2, M_APP2 = 0xe2,
@ -74,13 +74,13 @@ typedef enum { /* JPEG marker codes */
M_APP13 = 0xed, M_APP13 = 0xed,
M_APP14 = 0xee, M_APP14 = 0xee,
M_APP15 = 0xef, M_APP15 = 0xef,
M_JPG0 = 0xf0, M_JPG0 = 0xf0,
M_JPG13 = 0xfd, M_JPG13 = 0xfd,
M_COM = 0xfe, M_COM = 0xfe,
M_TEM = 0x01, M_TEM = 0x01,
M_ERROR = 0x100 M_ERROR = 0x100
} JPEG_MARKER; } JPEG_MARKER;
@ -198,7 +198,7 @@ get_soi (j_decompress_ptr cinfo)
/* Process an SOI marker */ /* Process an SOI marker */
{ {
int i; int i;
TRACEMS(cinfo, 1, JTRC_SOI); TRACEMS(cinfo, 1, JTRC_SOI);
if (cinfo->marker->saw_SOI) if (cinfo->marker->saw_SOI)
@ -275,7 +275,7 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_IMAGE, ((j_common_ptr) cinfo, JPOOL_IMAGE,
cinfo->num_components * SIZEOF(jpeg_component_info)); cinfo->num_components * SIZEOF(jpeg_component_info));
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
compptr->component_index = ci; compptr->component_index = ci;
@ -325,7 +325,7 @@ get_sos (j_decompress_ptr cinfo)
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
INPUT_BYTE(cinfo, cc, return FALSE); INPUT_BYTE(cinfo, cc, return FALSE);
INPUT_BYTE(cinfo, c, return FALSE); INPUT_BYTE(cinfo, c, return FALSE);
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
if (cc == compptr->component_id) if (cc == compptr->component_id)
@ -339,7 +339,7 @@ get_sos (j_decompress_ptr cinfo)
cinfo->cur_comp_info[i] = compptr; cinfo->cur_comp_info[i] = compptr;
compptr->dc_tbl_no = (c >> 4) & 15; compptr->dc_tbl_no = (c >> 4) & 15;
compptr->ac_tbl_no = (c ) & 15; compptr->ac_tbl_no = (c ) & 15;
TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
compptr->dc_tbl_no, compptr->ac_tbl_no); compptr->dc_tbl_no, compptr->ac_tbl_no);
} }
@ -379,7 +379,7 @@ get_dac (j_decompress_ptr cinfo)
INPUT_2BYTES(cinfo, length, return FALSE); INPUT_2BYTES(cinfo, length, return FALSE);
length -= 2; length -= 2;
while (length > 0) { while (length > 0) {
INPUT_BYTE(cinfo, index, return FALSE); INPUT_BYTE(cinfo, index, return FALSE);
INPUT_BYTE(cinfo, val, return FALSE); INPUT_BYTE(cinfo, val, return FALSE);
@ -428,12 +428,12 @@ get_dht (j_decompress_ptr cinfo)
INPUT_2BYTES(cinfo, length, return FALSE); INPUT_2BYTES(cinfo, length, return FALSE);
length -= 2; length -= 2;
while (length > 16) { while (length > 16) {
INPUT_BYTE(cinfo, index, return FALSE); INPUT_BYTE(cinfo, index, return FALSE);
TRACEMS1(cinfo, 1, JTRC_DHT, index); TRACEMS1(cinfo, 1, JTRC_DHT, index);
bits[0] = 0; bits[0] = 0;
count = 0; count = 0;
for (i = 1; i <= 16; i++) { for (i = 1; i <= 16; i++) {
@ -473,7 +473,7 @@ get_dht (j_decompress_ptr cinfo)
if (*htblptr == NULL) if (*htblptr == NULL)
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval)); MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval));
} }
@ -508,7 +508,7 @@ get_dqt (j_decompress_ptr cinfo)
if (n >= NUM_QUANT_TBLS) if (n >= NUM_QUANT_TBLS)
ERREXIT1(cinfo, JERR_DQT_INDEX, n); ERREXIT1(cinfo, JERR_DQT_INDEX, n);
if (cinfo->quant_tbl_ptrs[n] == NULL) if (cinfo->quant_tbl_ptrs[n] == NULL)
cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo); cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo);
quant_ptr = cinfo->quant_tbl_ptrs[n]; quant_ptr = cinfo->quant_tbl_ptrs[n];
@ -553,7 +553,7 @@ get_dri (j_decompress_ptr cinfo)
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
INPUT_2BYTES(cinfo, length, return FALSE); INPUT_2BYTES(cinfo, length, return FALSE);
if (length != 4) if (length != 4)
ERREXIT(cinfo, JERR_BAD_LENGTH); ERREXIT(cinfo, JERR_BAD_LENGTH);
@ -850,7 +850,7 @@ skip_variable (j_decompress_ptr cinfo)
INPUT_2BYTES(cinfo, length, return FALSE); INPUT_2BYTES(cinfo, length, return FALSE);
length -= 2; length -= 2;
TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length); TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length);
INPUT_SYNC(cinfo); /* do before skip_input_data */ INPUT_SYNC(cinfo); /* do before skip_input_data */
@ -1013,32 +1013,32 @@ read_markers (j_decompress_ptr cinfo)
return JPEG_SUSPENDED; return JPEG_SUSPENDED;
cinfo->unread_marker = 0; /* processed the marker */ cinfo->unread_marker = 0; /* processed the marker */
return JPEG_REACHED_SOS; return JPEG_REACHED_SOS;
case M_EOI: case M_EOI:
TRACEMS(cinfo, 1, JTRC_EOI); TRACEMS(cinfo, 1, JTRC_EOI);
cinfo->unread_marker = 0; /* processed the marker */ cinfo->unread_marker = 0; /* processed the marker */
return JPEG_REACHED_EOI; return JPEG_REACHED_EOI;
case M_DAC: case M_DAC:
if (! get_dac(cinfo)) if (! get_dac(cinfo))
return JPEG_SUSPENDED; return JPEG_SUSPENDED;
break; break;
case M_DHT: case M_DHT:
if (! get_dht(cinfo)) if (! get_dht(cinfo))
return JPEG_SUSPENDED; return JPEG_SUSPENDED;
break; break;
case M_DQT: case M_DQT:
if (! get_dqt(cinfo)) if (! get_dqt(cinfo))
return JPEG_SUSPENDED; return JPEG_SUSPENDED;
break; break;
case M_DRI: case M_DRI:
if (! get_dri(cinfo)) if (! get_dri(cinfo))
return JPEG_SUSPENDED; return JPEG_SUSPENDED;
break; break;
case M_APP0: case M_APP0:
case M_APP1: case M_APP1:
case M_APP2: case M_APP2:
@ -1059,7 +1059,7 @@ read_markers (j_decompress_ptr cinfo)
cinfo->unread_marker - (int) M_APP0]) (cinfo)) cinfo->unread_marker - (int) M_APP0]) (cinfo))
return JPEG_SUSPENDED; return JPEG_SUSPENDED;
break; break;
case M_COM: case M_COM:
if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo)) if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo))
return JPEG_SUSPENDED; return JPEG_SUSPENDED;
@ -1193,10 +1193,10 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
{ {
int marker = cinfo->unread_marker; int marker = cinfo->unread_marker;
int action = 1; int action = 1;
/* Always put up a warning. */ /* Always put up a warning. */
WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired); WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
/* Outer loop handles repeated decision after scanning forward. */ /* Outer loop handles repeated decision after scanning forward. */
for (;;) { for (;;) {
if (marker < (int) M_SOF0) if (marker < (int) M_SOF0)

View file

@ -217,7 +217,7 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
* For most steps we can mathematically guarantee that the initial value * For most steps we can mathematically guarantee that the initial value
* of x is within MAXJSAMPLE+1 of the legal range, so a table running from * of x is within MAXJSAMPLE+1 of the legal range, so a table running from
* -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial
* limiting step (just after the IDCT), a wildly out-of-range value is * limiting step (just after the IDCT), a wildly out-of-range value is
* possible if the input data is corrupt. To avoid any chance of indexing * possible if the input data is corrupt. To avoid any chance of indexing
* off the end of memory and getting a bad-pointer trap, we perform the * off the end of memory and getting a bad-pointer trap, we perform the
* post-IDCT limiting thus: * post-IDCT limiting thus:

View file

@ -240,7 +240,7 @@ h2v1_merged_upsample (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
register int y, cred, cgreen, cblue; register int y, cred, cgreen, cblue;
@ -309,7 +309,7 @@ h2v2_merged_upsample_mmx (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf); JSAMPARRAY output_buf);
#endif #endif
METHODDEF(void) METHODDEF(void)
h2v2_merged_upsample (j_decompress_ptr cinfo, h2v2_merged_upsample (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
@ -429,9 +429,9 @@ h2v2_merged_upsample_mmx (j_decompress_ptr cinfo,
INT32 * Crgtab = upsample->Cr_g_tab; INT32 * Crgtab = upsample->Cr_g_tab;
INT32 * Cbgtab = upsample->Cb_g_tab; INT32 * Cbgtab = upsample->Cb_g_tab;
SHIFT_TEMPS SHIFT_TEMPS
// Added for MMX
// Added for MMX
register int width = cinfo->image_width; register int width = cinfo->image_width;
int cols = cinfo->output_width; int cols = cinfo->output_width;
int cols_asm = (cols >> 3); int cols_asm = (cols >> 3);
@ -448,13 +448,13 @@ h2v2_merged_upsample_mmx (j_decompress_ptr cinfo,
outptr1 = output_buf[1]; outptr1 = output_buf[1];
/* Loop for each group of output pixels */ /* Loop for each group of output pixels */
_asm _asm
{ {
mov esi, inptr00 mov esi, inptr00
mov eax, inptr01 mov eax, inptr01
mov ebx, inptr2 mov ebx, inptr2
mov ecx, inptr1 mov ecx, inptr1
@ -464,7 +464,7 @@ h2v2_merged_upsample_mmx (j_decompress_ptr cinfo,
mov edx, outptr1 mov edx, outptr1
do_next16: do_next16:
movd mm0, [ebx] ; Cr7 Cr6.....Cr1 Cr0 movd mm0, [ebx] ; Cr7 Cr6.....Cr1 Cr0
pxor mm6, mm6 pxor mm6, mm6
@ -480,20 +480,20 @@ do_next16:
punpcklbw mm0, mm6 ; Cr0 Cr0 Cr0 Cr0 punpcklbw mm0, mm6 ; Cr0 Cr0 Cr0 Cr0
psubsw mm0, mm7 ; Cr0 - 128:Cr0-128:Cr0-128:Cr0 -128 psubsw mm0, mm7 ; Cr0 - 128:Cr0-128:Cr0-128:Cr0 -128
movd mm1, [ecx] ; Cb7 Cb6...... Cb1 Cb0 movd mm1, [ecx] ; Cb7 Cb6...... Cb1 Cb0
psllw mm0, 2 ; left shift by 2 bits psllw mm0, 2 ; left shift by 2 bits
punpcklbw mm1, mm1 ; Cb3 Cb3 Cb2 Cb2 Cb1 Cb1 Cb0 Cb0 punpcklbw mm1, mm1 ; Cb3 Cb3 Cb2 Cb2 Cb1 Cb1 Cb0 Cb0
paddsw mm0, const05 ; add (one_half/fix(x)) << 2 paddsw mm0, const05 ; add (one_half/fix(x)) << 2
punpcklwd mm1, mm1 ; Cb1 Cb1 Cb1 Cb1 Cb0 Cb0 Cb0 Cb0 punpcklwd mm1, mm1 ; Cb1 Cb1 Cb1 Cb1 Cb0 Cb0 Cb0 Cb0
movq mm5, mm1 movq mm5, mm1
pmulhw mm0, const1 ; multiply by (fix(x) >> 1) pmulhw mm0, const1 ; multiply by (fix(x) >> 1)
punpcklbw mm1, mm6 ; Cb0 Cb0 Cb0 Cb0 punpcklbw mm1, mm6 ; Cb0 Cb0 Cb0 Cb0
@ -504,14 +504,14 @@ do_next16:
punpckhbw mm5, mm6 ; Cb1 Cb1 Cb1 Cb1 punpckhbw mm5, mm6 ; Cb1 Cb1 Cb1 Cb1
psllw mm1, 2 ; left shift by 2 bits psllw mm1, 2 ; left shift by 2 bits
paddsw mm1, const15 ; add (one_half/fix(x)) << 2 paddsw mm1, const15 ; add (one_half/fix(x)) << 2
psubsw mm4, mm7 ; Cr1 - 128:Cr1-128:Cr1-128:Cr1 -128 psubsw mm4, mm7 ; Cr1 - 128:Cr1-128:Cr1-128:Cr1 -128
psubsw mm5, mm7 ; Cb1 - 128:Cb1-128:Cb1-128:Cb1 -128 psubsw mm5, mm7 ; Cb1 - 128:Cb1-128:Cb1-128:Cb1 -128
pmulhw mm1, const2 ; multiply by (fix(x) >> 1) pmulhw mm1, const2 ; multiply by (fix(x) >> 1)
psllw mm4, 2 ; left shift by 2 bits psllw mm4, 2 ; left shift by 2 bits
@ -521,7 +521,7 @@ do_next16:
movd mm7, [esi] ; Y13 Y12 Y9 Y8 Y5 Y4 Y1 Y0 movd mm7, [esi] ; Y13 Y12 Y9 Y8 Y5 Y4 Y1 Y0
pmulhw mm4, const5 ; multiply by (fix(x) >> 1) pmulhw mm4, const5 ; multiply by (fix(x) >> 1)
movq mm6, mm7 movq mm6, mm7
@ -533,7 +533,7 @@ do_next16:
movq mm1, mm7 movq mm1, mm7
pmulhw mm5, const6 ; multiply by (fix(x) >> 1) pmulhw mm5, const6 ; multiply by (fix(x) >> 1)
movq mm2, mm0 ; cred0 cbl0 cgr0 cred0 movq mm2, mm0 ; cred0 cbl0 cgr0 cred0
@ -558,13 +558,13 @@ do_next16:
psllq mm3, 16 ; cgr1 cred1 0 0 psllq mm3, 16 ; cgr1 cred1 0 0
movq mm6, mm1 ; 0 0 Y5 Y5 Y4 Y4 Y1 Y1 movq mm6, mm1 ; 0 0 Y5 Y5 Y4 Y4 Y1 Y1
por mm2, mm3 ; cgr1 cred1 cbl0 cgr0 por mm2, mm3 ; cgr1 cred1 cbl0 cgr0
punpcklbw mm6, empty ; Y4 Y4 Y1 Y1 punpcklbw mm6, empty ; Y4 Y4 Y1 Y1
movd mm3, [eax] ; Y15 Y14 Y11 Y10 Y7 Y6 Y3 Y2 movd mm3, [eax] ; Y15 Y14 Y11 Y10 Y7 Y6 Y3 Y2
paddsw mm6, mm2 ; g4 r4 b1 g1 paddsw mm6, mm2 ; g4 r4 b1 g1
packuswb mm7, mm6 ; g4 r4 b1 g1 r1 b0 g0 r0 packuswb mm7, mm6 ; g4 r4 b1 g1 r1 b0 g0 r0
@ -594,7 +594,7 @@ do_next16:
punpcklbw mm6, empty ; Y6 Y6 Y3 Y3 punpcklbw mm6, empty ; Y6 Y6 Y3 Y3
psrlq mm1, 24 ; 0 0 0 0 0 Y5 Y5 Y4 psrlq mm1, 24 ; 0 0 0 0 0 Y5 Y5 Y4
paddsw mm6, mm2 ; g6 r6 b3 g3 paddsw mm6, mm2 ; g6 r6 b3 g3
packuswb mm3, mm6 ; g6 r6 b3 g3 r3 b2 g2 r2 packuswb mm3, mm6 ; g6 r6 b3 g3 r3 b2 g2 r2
@ -604,37 +604,37 @@ do_next16:
psrlq mm0, 32 ; 0 0 0 0 0 0 Y5 Y5 psrlq mm0, 32 ; 0 0 0 0 0 0 Y5 Y5
movq [edx], mm3 ; move to memory g6 r6 b3 g3 r3 b2 g2 r2 movq [edx], mm3 ; move to memory g6 r6 b3 g3 r3 b2 g2 r2
punpcklwd mm1, mm0 ; X X X X Y5 Y5 Y5 Y4 punpcklwd mm1, mm0 ; X X X X Y5 Y5 Y5 Y4
psrlq mm5, 24 ; 0 0 0 0 0 Y7 Y7 Y6 psrlq mm5, 24 ; 0 0 0 0 0 Y7 Y7 Y6
movd mm0, [ebx] ; Cr9 Cr8.....Cr3 Cr2 movd mm0, [ebx] ; Cr9 Cr8.....Cr3 Cr2
psrlq mm2, 32 ; 0 0 0 0 0 0 Y7 Y7 psrlq mm2, 32 ; 0 0 0 0 0 0 Y7 Y7
psrlq mm0, 16 psrlq mm0, 16
punpcklbw mm1, empty ; Y5 Y5 Y5 Y4 punpcklbw mm1, empty ; Y5 Y5 Y5 Y4
punpcklwd mm5, mm2 ; X X X X Y7 Y7 Y7 Y6 punpcklwd mm5, mm2 ; X X X X Y7 Y7 Y7 Y6
paddsw mm1, mm4 ; b5 g5 r5 b4 paddsw mm1, mm4 ; b5 g5 r5 b4
punpcklbw mm5, empty ; Y7 Y7 Y7 Y6 punpcklbw mm5, empty ; Y7 Y7 Y7 Y6
pxor mm6, mm6 ; clear mm6 registr pxor mm6, mm6 ; clear mm6 registr
punpcklbw mm0, mm0 ; X X X X Cr3 Cr3 Cr2 Cr2 punpcklbw mm0, mm0 ; X X X X Cr3 Cr3 Cr2 Cr2
paddsw mm5, mm4 ; b7 g7 r7 b6 paddsw mm5, mm4 ; b7 g7 r7 b6
punpcklwd mm0, mm0 ; Cr3 Cr3 Cr3 Cr3 Cr2 Cr2 Cr2 Cr2 punpcklwd mm0, mm0 ; Cr3 Cr3 Cr3 Cr3 Cr2 Cr2 Cr2 Cr2
movq mm4, mm0 movq mm4, mm0
movd mm3, [ecx] ; Cb9 Cb8...... Cb3 Cb2 movd mm3, [ecx] ; Cb9 Cb8...... Cb3 Cb2
punpcklbw mm0, mm6 ; Cr2 Cr2 Cr2 Cr2 punpcklbw mm0, mm6 ; Cr2 Cr2 Cr2 Cr2
psrlq mm3, 16 psrlq mm3, 16
@ -650,57 +650,57 @@ do_next16:
punpcklwd mm3, mm3 ; Cb3 Cb3 Cb3 Cb3 Cb2 Cb2 Cb2 Cb2 punpcklwd mm3, mm3 ; Cb3 Cb3 Cb3 Cb3 Cb2 Cb2 Cb2 Cb2
movq mm7, mm3 movq mm7, mm3
pmulhw mm0, const1 ; multiply by (fix(x) >> 1) pmulhw mm0, const1 ; multiply by (fix(x) >> 1)
punpcklbw mm3, mm6 ; Cb2 Cb2 Cb2 Cb2 punpcklbw mm3, mm6 ; Cb2 Cb2 Cb2 Cb2
psubsw mm3, const128 ; Cb0 - 128:Cb0-128:Cb0-128:Cb0 -128 psubsw mm3, const128 ; Cb0 - 128:Cb0-128:Cb0-128:Cb0 -128
punpckhbw mm4, mm6 ; Cr3 Cr3 Cr3 Cr3 punpckhbw mm4, mm6 ; Cr3 Cr3 Cr3 Cr3
psllw mm3, 2 ; left shift by 2 bits psllw mm3, 2 ; left shift by 2 bits
paddsw mm3, const15 ; add (one_half/fix(x)) << 2 paddsw mm3, const15 ; add (one_half/fix(x)) << 2
punpckhbw mm7, mm6 ; Cb3 Cb3 Cb3 Cb3 punpckhbw mm7, mm6 ; Cb3 Cb3 Cb3 Cb3
pmulhw mm3, const2 ; multiply by (fix(x) >> 1) pmulhw mm3, const2 ; multiply by (fix(x) >> 1)
psubsw mm7, const128 ; Cb3 - 128:Cb3-128:Cb3-128:Cb3 -128 psubsw mm7, const128 ; Cb3 - 128:Cb3-128:Cb3-128:Cb3 -128
paddsw mm0, mm3 ; cred2 cbl2 cgr2 cred2 paddsw mm0, mm3 ; cred2 cbl2 cgr2 cred2
psllw mm7, 2 ; left shift by 2 bits psllw mm7, 2 ; left shift by 2 bits
psubsw mm4, const128 ; Cr3 - 128:Cr3-128:Cr3-128:Cr3 -128 psubsw mm4, const128 ; Cr3 - 128:Cr3-128:Cr3-128:Cr3 -128
movd mm3, [esi+4] ; Y21 Y20 Y17 Y16 Y13 Y12 Y9 Y8 movd mm3, [esi+4] ; Y21 Y20 Y17 Y16 Y13 Y12 Y9 Y8
psllw mm4, 2 ; left shift by 2 bits psllw mm4, 2 ; left shift by 2 bits
paddsw mm7, const55 ; add (one_half/fix(x)) << 2 paddsw mm7, const55 ; add (one_half/fix(x)) << 2
movq mm6, mm3 ; Y21 Y20 Y17 Y16 Y13 Y12 Y9 Y8 movq mm6, mm3 ; Y21 Y20 Y17 Y16 Y13 Y12 Y9 Y8
movq mm2, mm0 movq mm2, mm0
pand mm2, davemask pand mm2, davemask
punpcklbw mm3, mm3 ; Y13 Y13 Y12 Y12 Y9 Y9 Y8 Y8 punpcklbw mm3, mm3 ; Y13 Y13 Y12 Y12 Y9 Y9 Y8 Y8
psrlq mm2, 16 psrlq mm2, 16
paddsw mm4, const45 ; add (one_half/fix(x)) << 2 paddsw mm4, const45 ; add (one_half/fix(x)) << 2
punpcklwd mm3, mm6 ; X X X X Y9 Y8 Y8 Y8 punpcklwd mm3, mm6 ; X X X X Y9 Y8 Y8 Y8
pmulhw mm4, const5 ; multiply by (fix(x) >> 1)
pmulhw mm7, const6 ; multiply by (fix(x) >> 1) pmulhw mm4, const5 ; multiply by (fix(x) >> 1)
pmulhw mm7, const6 ; multiply by (fix(x) >> 1)
punpcklbw mm3, empty ; Y9 Y8 Y8 Y8 punpcklbw mm3, empty ; Y9 Y8 Y8 Y8
paddsw mm4, mm7 ; cbl3 cgr3 cred3 cbl3 paddsw mm4, mm7 ; cbl3 cgr3 cred3 cbl3
paddsw mm3, mm0 ; r9 b8 g8 r8 paddsw mm3, mm0 ; r9 b8 g8 r8
@ -710,13 +710,13 @@ do_next16:
packuswb mm1, mm3 ; r9 b8 g8 r8 b5 g5 r5 b4 packuswb mm1, mm3 ; r9 b8 g8 r8 b5 g5 r5 b4
movd mm3, [eax+4] ; Y23 Y22 Y19 Y18 Y15 Y14 Y11 Y10 movd mm3, [eax+4] ; Y23 Y22 Y19 Y18 Y15 Y14 Y11 Y10
pand mm7, davemask pand mm7, davemask
psrlq mm6, 8 ; 0 Y21 Y20 Y17 Y16 Y13 Y12 Y9 psrlq mm6, 8 ; 0 Y21 Y20 Y17 Y16 Y13 Y12 Y9
psllq mm7, 16 psllq mm7, 16
movq [edi+8], mm1 ; move to memory r9 b8 g8 r8 b5 g5 r5 b4 movq [edi+8], mm1 ; move to memory r9 b8 g8 r8 b5 g5 r5 b4
por mm2, mm7 por mm2, mm7
@ -732,7 +732,7 @@ do_next16:
punpcklbw mm3, mm1 ; Y11 Y10 Y10 Y10 punpcklbw mm3, mm1 ; Y11 Y10 Y10 Y10
psrlq mm7, 8 ; 0 Y23 Y22 Y19 Y18 Y15 Y14 Y11 psrlq mm7, 8 ; 0 Y23 Y22 Y19 Y18 Y15 Y14 Y11
paddsw mm3, mm0 ; r11 b10 g10 r10 paddsw mm3, mm0 ; r11 b10 g10 r10
movq mm0, mm7 ; 0 Y23 Y22 Y19 Y18 Y15 Y14 Y11 movq mm0, mm7 ; 0 Y23 Y22 Y19 Y18 Y15 Y14 Y11
@ -769,11 +769,11 @@ do_next16:
add eax, 8 add eax, 8
psrlq mm0, 8 ; 0 0 Y23 Y22 Y19 Y18 Y15 Y14 psrlq mm0, 8 ; 0 0 Y23 Y22 Y19 Y18 Y15 Y14
punpcklbw mm1, empty ; Y13 Y13 Y13 Y12 punpcklbw mm1, empty ; Y13 Y13 Y13 Y12
movq mm5, mm0 ; 0 0 Y23 Y22 Y19 Y18 Y15 Y14 movq mm5, mm0 ; 0 0 Y23 Y22 Y19 Y18 Y15 Y14
punpcklbw mm0, mm0 ; X X X X Y15 Y15 Y14 Y14 punpcklbw mm0, mm0 ; X X X X Y15 Y15 Y14 Y14
@ -782,17 +782,17 @@ do_next16:
psrlq mm0, 16 ; X X X X X X Y15 Y15 psrlq mm0, 16 ; X X X X X X Y15 Y15
add edi, 24 add edi, 24
punpcklwd mm5, mm0 ; X X X X Y15 Y15 Y15 Y14 punpcklwd mm5, mm0 ; X X X X Y15 Y15 Y15 Y14
packuswb mm6, mm1 ; b13 g13 r13 b12 g12 r12 b9 g9 packuswb mm6, mm1 ; b13 g13 r13 b12 g12 r12 b9 g9
add edx, 24 add edx, 24
punpcklbw mm5, empty ; Y15 Y15 Y15 Y14 punpcklbw mm5, empty ; Y15 Y15 Y15 Y14
add ebx, 4 add ebx, 4
paddsw mm5, mm4 ; b15 g15 r15 b14 paddsw mm5, mm4 ; b15 g15 r15 b14
movq [edi-8], mm6 ; move to memory b13 g13 r13 b12 g12 r12 b9 g9 movq [edi-8], mm6 ; move to memory b13 g13 r13 b12 g12 r12 b9 g9
@ -800,18 +800,18 @@ do_next16:
packuswb mm7, mm5 ; b15 g15 r15 b14 g14 r14 b11 g11 packuswb mm7, mm5 ; b15 g15 r15 b14 g14 r14 b11 g11
add ecx, 4 add ecx, 4
movq [edx-8], mm7 ; move to memory b15 g15 r15 b14 g14 r14 b11 g11 movq [edx-8], mm7 ; move to memory b15 g15 r15 b14 g14 r14 b11 g11
dec cols_asm dec cols_asm
jnz do_next16 jnz do_next16
EMMS EMMS
} }
inptr1 += (cols_asm_copy<<2); inptr1 += (cols_asm_copy<<2);
inptr2 += (cols_asm_copy<<2); inptr2 += (cols_asm_copy<<2);
@ -823,7 +823,7 @@ do_next16:
outptr0 += cols_asm_copy*24; outptr0 += cols_asm_copy*24;
outptr1 += cols_asm_copy*24; outptr1 += cols_asm_copy*24;
//for (col = cinfo->output_width >> 1; col > 0; col--) { //for (col = cinfo->output_width >> 1; col > 0; col--) {
/* Do the chroma part of the calculation */ /* Do the chroma part of the calculation */
/*cb = GETJSAMPLE(*inptr1++); /*cb = GETJSAMPLE(*inptr1++);
@ -883,9 +883,9 @@ do_next16:
outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1[RGB_BLUE] = range_limit[y + cblue];
outptr1 += RGB_PIXELSIZE; outptr1 += RGB_PIXELSIZE;
} }
/* If image width is odd, do the last output column separately */ /* If image width is odd, do the last output column separately */
//if (cinfo->output_width & 1) { //if (cinfo->output_width & 1) {
if (diff & 1) { if (diff & 1) {
@ -902,7 +902,7 @@ do_next16:
outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_RED] = range_limit[y + cred];
outptr1[RGB_GREEN] = range_limit[y + cgreen]; outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1[RGB_BLUE] = range_limit[y + cblue];
} }
} }
#else #else

View file

@ -263,7 +263,7 @@ process_restart (j_decompress_ptr cinfo)
/* /*
* Huffman MCU decoding. * Huffman MCU decoding.
* Each of these routines decodes and returns one MCU's worth of * Each of these routines decodes and returns one MCU's worth of
* Huffman-compressed coefficients. * Huffman-compressed coefficients.
* The coefficients are reordered from zigzag order into natural array order, * The coefficients are reordered from zigzag order into natural array order,
* but are not dequantized. * but are not dequantized.
* *
@ -284,7 +284,7 @@ process_restart (j_decompress_ptr cinfo)
METHODDEF(boolean) METHODDEF(boolean)
decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int Al = cinfo->Al; int Al = cinfo->Al;
register int s, r; register int s, r;
@ -355,7 +355,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
METHODDEF(boolean) METHODDEF(boolean)
decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int Se = cinfo->Se; int Se = cinfo->Se;
int Al = cinfo->Al; int Al = cinfo->Al;
@ -440,7 +440,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
METHODDEF(boolean) METHODDEF(boolean)
decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
int blkn; int blkn;
@ -489,7 +489,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
METHODDEF(boolean) METHODDEF(boolean)
decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int Se = cinfo->Se; int Se = cinfo->Se;
int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
@ -660,7 +660,7 @@ jinit_phuff_decoder (j_decompress_ptr cinfo)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
cinfo->num_components*DCTSIZE2*SIZEOF(int)); cinfo->num_components*DCTSIZE2*SIZEOF(int));
coef_bit_ptr = & cinfo->coef_bits[0][0]; coef_bit_ptr = & cinfo->coef_bits[0][0];
for (ci = 0; ci < cinfo->num_components; ci++) for (ci = 0; ci < cinfo->num_components; ci++)
for (i = 0; i < DCTSIZE2; i++) for (i = 0; i < DCTSIZE2; i++)
*coef_bit_ptr++ = -1; *coef_bit_ptr++ = -1;
} }

View file

@ -118,7 +118,7 @@ sep_upsample (j_decompress_ptr cinfo,
/* Not more than the distance to the end of the image. Need this test /* Not more than the distance to the end of the image. Need this test
* in case the image height is not a multiple of max_v_samp_factor: * in case the image height is not a multiple of max_v_samp_factor:
*/ */
if (num_rows > upsample->rows_to_go) if (num_rows > upsample->rows_to_go)
num_rows = upsample->rows_to_go; num_rows = upsample->rows_to_go;
/* And not more than what the client can accept: */ /* And not more than what the client can accept: */
out_rows_avail -= *out_row_ctr; out_rows_avail -= *out_row_ctr;

View file

@ -76,21 +76,21 @@ jpeg_fdct_float (FAST_FLOAT * data)
tmp5 = dataptr[2] - dataptr[5]; tmp5 = dataptr[2] - dataptr[5];
tmp3 = dataptr[3] + dataptr[4]; tmp3 = dataptr[3] + dataptr[4];
tmp4 = dataptr[3] - dataptr[4]; tmp4 = dataptr[3] - dataptr[4];
/* Even part */ /* Even part */
tmp10 = tmp0 + tmp3; /* phase 2 */ tmp10 = tmp0 + tmp3; /* phase 2 */
tmp13 = tmp0 - tmp3; tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
dataptr[0] = tmp10 + tmp11; /* phase 3 */ dataptr[0] = tmp10 + tmp11; /* phase 3 */
dataptr[4] = tmp10 - tmp11; dataptr[4] = tmp10 - tmp11;
z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */
dataptr[2] = tmp13 + z1; /* phase 5 */ dataptr[2] = tmp13 + z1; /* phase 5 */
dataptr[6] = tmp13 - z1; dataptr[6] = tmp13 - z1;
/* Odd part */ /* Odd part */
tmp10 = tmp4 + tmp5; /* phase 2 */ tmp10 = tmp4 + tmp5; /* phase 2 */
@ -126,21 +126,21 @@ jpeg_fdct_float (FAST_FLOAT * data)
tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
/* Even part */ /* Even part */
tmp10 = tmp0 + tmp3; /* phase 2 */ tmp10 = tmp0 + tmp3; /* phase 2 */
tmp13 = tmp0 - tmp3; tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
dataptr[DCTSIZE*4] = tmp10 - tmp11; dataptr[DCTSIZE*4] = tmp10 - tmp11;
z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */
dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
dataptr[DCTSIZE*6] = tmp13 - z1; dataptr[DCTSIZE*6] = tmp13 - z1;
/* Odd part */ /* Odd part */
tmp10 = tmp4 + tmp5; /* phase 2 */ tmp10 = tmp4 + tmp5; /* phase 2 */

View file

@ -132,21 +132,21 @@ jpeg_fdct_ifast (DCTELEM * data)
tmp5 = dataptr[2] - dataptr[5]; tmp5 = dataptr[2] - dataptr[5];
tmp3 = dataptr[3] + dataptr[4]; tmp3 = dataptr[3] + dataptr[4];
tmp4 = dataptr[3] - dataptr[4]; tmp4 = dataptr[3] - dataptr[4];
/* Even part */ /* Even part */
tmp10 = tmp0 + tmp3; /* phase 2 */ tmp10 = tmp0 + tmp3; /* phase 2 */
tmp13 = tmp0 - tmp3; tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
dataptr[0] = tmp10 + tmp11; /* phase 3 */ dataptr[0] = tmp10 + tmp11; /* phase 3 */
dataptr[4] = tmp10 - tmp11; dataptr[4] = tmp10 - tmp11;
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
dataptr[2] = tmp13 + z1; /* phase 5 */ dataptr[2] = tmp13 + z1; /* phase 5 */
dataptr[6] = tmp13 - z1; dataptr[6] = tmp13 - z1;
/* Odd part */ /* Odd part */
tmp10 = tmp4 + tmp5; /* phase 2 */ tmp10 = tmp4 + tmp5; /* phase 2 */
@ -182,21 +182,21 @@ jpeg_fdct_ifast (DCTELEM * data)
tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
/* Even part */ /* Even part */
tmp10 = tmp0 + tmp3; /* phase 2 */ tmp10 = tmp0 + tmp3; /* phase 2 */
tmp13 = tmp0 - tmp3; tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
dataptr[DCTSIZE*4] = tmp10 - tmp11; dataptr[DCTSIZE*4] = tmp10 - tmp11;
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
dataptr[DCTSIZE*6] = tmp13 - z1; dataptr[DCTSIZE*6] = tmp13 - z1;
/* Odd part */ /* Odd part */
tmp10 = tmp4 + tmp5; /* phase 2 */ tmp10 = tmp4 + tmp5; /* phase 2 */

View file

@ -160,36 +160,36 @@ jpeg_fdct_islow (DCTELEM * data)
tmp5 = dataptr[2] - dataptr[5]; tmp5 = dataptr[2] - dataptr[5];
tmp3 = dataptr[3] + dataptr[4]; tmp3 = dataptr[3] + dataptr[4];
tmp4 = dataptr[3] - dataptr[4]; tmp4 = dataptr[3] - dataptr[4];
/* Even part per LL&M figure 1 --- note that published figure is faulty; /* Even part per LL&M figure 1 --- note that published figure is faulty;
* rotator "sqrt(2)*c1" should be "sqrt(2)*c6". * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
*/ */
tmp10 = tmp0 + tmp3; tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3; tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS); dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS);
dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS);
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
CONST_BITS-PASS1_BITS); CONST_BITS-PASS1_BITS);
dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
CONST_BITS-PASS1_BITS); CONST_BITS-PASS1_BITS);
/* Odd part per figure 8 --- note paper omits factor of sqrt(2). /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
* cK represents cos(K*pi/16). * cK represents cos(K*pi/16).
* i0..i3 in the paper are tmp4..tmp7 here. * i0..i3 in the paper are tmp4..tmp7 here.
*/ */
z1 = tmp4 + tmp7; z1 = tmp4 + tmp7;
z2 = tmp5 + tmp6; z2 = tmp5 + tmp6;
z3 = tmp4 + tmp6; z3 = tmp4 + tmp6;
z4 = tmp5 + tmp7; z4 = tmp5 + tmp7;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
@ -198,15 +198,15 @@ jpeg_fdct_islow (DCTELEM * data)
z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5; z3 += z5;
z4 += z5; z4 += z5;
dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS); dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS); dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS); dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS); dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */ dataptr += DCTSIZE; /* advance pointer to next row */
} }
@ -225,36 +225,36 @@ jpeg_fdct_islow (DCTELEM * data)
tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
/* Even part per LL&M figure 1 --- note that published figure is faulty; /* Even part per LL&M figure 1 --- note that published figure is faulty;
* rotator "sqrt(2)*c1" should be "sqrt(2)*c6". * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
*/ */
tmp10 = tmp0 + tmp3; tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3; tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS); dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS); dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
CONST_BITS+PASS1_BITS); CONST_BITS+PASS1_BITS);
dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
CONST_BITS+PASS1_BITS); CONST_BITS+PASS1_BITS);
/* Odd part per figure 8 --- note paper omits factor of sqrt(2). /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
* cK represents cos(K*pi/16). * cK represents cos(K*pi/16).
* i0..i3 in the paper are tmp4..tmp7 here. * i0..i3 in the paper are tmp4..tmp7 here.
*/ */
z1 = tmp4 + tmp7; z1 = tmp4 + tmp7;
z2 = tmp5 + tmp6; z2 = tmp5 + tmp6;
z3 = tmp4 + tmp6; z3 = tmp4 + tmp6;
z4 = tmp5 + tmp7; z4 = tmp5 + tmp7;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
@ -263,10 +263,10 @@ jpeg_fdct_islow (DCTELEM * data)
z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5; z3 += z5;
z4 += z5; z4 += z5;
dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,
CONST_BITS+PASS1_BITS); CONST_BITS+PASS1_BITS);
dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,
@ -275,7 +275,7 @@ jpeg_fdct_islow (DCTELEM * data)
CONST_BITS+PASS1_BITS); CONST_BITS+PASS1_BITS);
dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,
CONST_BITS+PASS1_BITS); CONST_BITS+PASS1_BITS);
dataptr++; /* advance pointer to next column */ dataptr++; /* advance pointer to next column */
} }
} }

View file

@ -95,14 +95,14 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* With typical images and quantization tables, half or more of the * With typical images and quantization tables, half or more of the
* column DCT calculations can be simplified this way. * column DCT calculations can be simplified this way.
*/ */
if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
inptr[DCTSIZE*7] == 0) { inptr[DCTSIZE*7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*0] = dcval;
wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*1] = dcval;
wsptr[DCTSIZE*2] = dcval; wsptr[DCTSIZE*2] = dcval;
@ -111,13 +111,13 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*5] = dcval;
wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*6] = dcval;
wsptr[DCTSIZE*7] = dcval; wsptr[DCTSIZE*7] = dcval;
inptr++; /* advance pointers to next column */ inptr++; /* advance pointers to next column */
quantptr++; quantptr++;
wsptr++; wsptr++;
continue; continue;
} }
/* Even part */ /* Even part */
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
@ -135,7 +135,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp3 = tmp10 - tmp13; tmp3 = tmp10 - tmp13;
tmp1 = tmp11 + tmp12; tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12; tmp2 = tmp11 - tmp12;
/* Odd part */ /* Odd part */
tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
@ -172,7 +172,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
quantptr++; quantptr++;
wsptr++; wsptr++;
} }
/* Pass 2: process rows from work array, store into output array. */ /* Pass 2: process rows from work array, store into output array. */
/* Note that we must descale the results by a factor of 8 == 2**3. */ /* Note that we must descale the results by a factor of 8 == 2**3. */
@ -184,7 +184,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* the simplification applies less often (typically 5% to 10% of the time). * the simplification applies less often (typically 5% to 10% of the time).
* And testing floats for zero is relatively expensive, so we don't bother. * And testing floats for zero is relatively expensive, so we don't bother.
*/ */
/* Even part */ /* Even part */
tmp10 = wsptr[0] + wsptr[4]; tmp10 = wsptr[0] + wsptr[4];
@ -234,7 +234,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
& RANGE_MASK]; & RANGE_MASK];
outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3) outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3)
& RANGE_MASK]; & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
} }

View file

@ -226,7 +226,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* With typical images and quantization tables, half or more of the * With typical images and quantization tables, half or more of the
* column DCT calculations can be simplified this way. * column DCT calculations can be simplified this way.
*/ */
if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
@ -242,13 +242,13 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*5] = dcval;
wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*6] = dcval;
wsptr[DCTSIZE*7] = dcval; wsptr[DCTSIZE*7] = dcval;
inptr++; /* advance pointers to next column */ inptr++; /* advance pointers to next column */
quantptr++; quantptr++;
wsptr++; wsptr++;
continue; continue;
} }
/* Even part */ /* Even part */
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
@ -266,7 +266,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp3 = tmp10 - tmp13; tmp3 = tmp10 - tmp13;
tmp1 = tmp11 + tmp12; tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12; tmp2 = tmp11 - tmp12;
/* Odd part */ /* Odd part */
tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
@ -303,7 +303,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
quantptr++; quantptr++;
wsptr++; wsptr++;
} }
/* Pass 2: process rows from work array, store into output array. */ /* Pass 2: process rows from work array, store into output array. */
/* Note that we must descale the results by a factor of 8 == 2**3, */ /* Note that we must descale the results by a factor of 8 == 2**3, */
/* and also undo the PASS1_BITS scaling. */ /* and also undo the PASS1_BITS scaling. */
@ -318,14 +318,14 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* test takes more time than it's worth. In that case this section * test takes more time than it's worth. In that case this section
* may be commented out. * may be commented out.
*/ */
#ifndef NO_ZERO_ROW_TEST #ifndef NO_ZERO_ROW_TEST
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
outptr[2] = dcval; outptr[2] = dcval;
@ -339,7 +339,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
continue; continue;
} }
#endif #endif
/* Even part */ /* Even part */
tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]);
@ -432,7 +432,7 @@ jpeg_idct_ifast_orig (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* With typical images and quantization tables, half or more of the * With typical images and quantization tables, half or more of the
* column DCT calculations can be simplified this way. * column DCT calculations can be simplified this way.
*/ */
if ((inptr[DCTSIZE*1] | inptr[DCTSIZE*2] | inptr[DCTSIZE*3] | if ((inptr[DCTSIZE*1] | inptr[DCTSIZE*2] | inptr[DCTSIZE*3] |
inptr[DCTSIZE*4] | inptr[DCTSIZE*5] | inptr[DCTSIZE*6] | inptr[DCTSIZE*4] | inptr[DCTSIZE*5] | inptr[DCTSIZE*6] |
inptr[DCTSIZE*7]) == 0) { inptr[DCTSIZE*7]) == 0) {
@ -447,13 +447,13 @@ jpeg_idct_ifast_orig (j_decompress_ptr cinfo, jpeg_component_info * compptr,
wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*5] = dcval;
wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*6] = dcval;
wsptr[DCTSIZE*7] = dcval; wsptr[DCTSIZE*7] = dcval;
inptr++; /* advance pointers to next column */ inptr++; /* advance pointers to next column */
quantptr++; quantptr++;
wsptr++; wsptr++;
continue; continue;
} }
/* Even part */ /* Even part */
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
@ -471,7 +471,7 @@ jpeg_idct_ifast_orig (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp3 = tmp10 - tmp13; tmp3 = tmp10 - tmp13;
tmp1 = tmp11 + tmp12; tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12; tmp2 = tmp11 - tmp12;
/* Odd part */ /* Odd part */
tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
@ -508,7 +508,7 @@ jpeg_idct_ifast_orig (j_decompress_ptr cinfo, jpeg_component_info * compptr,
quantptr++; quantptr++;
wsptr++; wsptr++;
} }
/* Pass 2: process rows from work array, store into output array. */ /* Pass 2: process rows from work array, store into output array. */
/* Note that we must descale the results by a factor of 8 == 2**3, */ /* Note that we must descale the results by a factor of 8 == 2**3, */
/* and also undo the PASS1_BITS scaling. */ /* and also undo the PASS1_BITS scaling. */
@ -523,14 +523,14 @@ jpeg_idct_ifast_orig (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* test takes more time than it's worth. In that case this section * test takes more time than it's worth. In that case this section
* may be commented out. * may be commented out.
*/ */
#ifndef NO_ZERO_ROW_TEST #ifndef NO_ZERO_ROW_TEST
if ((wsptr[1] | wsptr[2] | wsptr[3] | wsptr[4] | wsptr[5] | wsptr[6] | if ((wsptr[1] | wsptr[2] | wsptr[3] | wsptr[4] | wsptr[5] | wsptr[6] |
wsptr[7]) == 0) { wsptr[7]) == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
outptr[2] = dcval; outptr[2] = dcval;
@ -544,7 +544,7 @@ jpeg_idct_ifast_orig (j_decompress_ptr cinfo, jpeg_component_info * compptr,
continue; continue;
} }
#endif #endif
/* Even part */ /* Even part */
tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]);
@ -619,8 +619,8 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
int16 *wsptr=workspace; int16 *wsptr=workspace;
int16 *quantptr=compptr->dct_table; int16 *quantptr=compptr->dct_table;
__asm{ __asm{
mov edi, quantptr mov edi, quantptr
mov ebx, inptr mov ebx, inptr
mov esi, wsptr mov esi, wsptr
@ -649,7 +649,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
paddw mm1, mm0 ;z13 = tmp6 + tmp5; paddw mm1, mm0 ;z13 = tmp6 + tmp5;
pmullw mm4, [edi + 8*14] ;tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); pmullw mm4, [edi + 8*14] ;tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
psubw mm2, mm0 ;z10 = tmp6 - tmp5 psubw mm2, mm0 ;z10 = tmp6 - tmp5
psllw mm2, 2 ;shift z10 psllw mm2, 2 ;shift z10
movq mm0, mm2 ;copy z10 movq mm0, mm2 ;copy z10
@ -670,7 +670,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm7, mm5 ;copy z12 movq mm7, mm5 ;copy z12
pmulhw mm5, fix_108n184 ;MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part pmulhw mm5, fix_108n184 ;MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part
paddw mm3, mm1 ;tmp7 = z11 + z13; paddw mm3, mm1 ;tmp7 = z11 + z13;
/* Even part */ /* Even part */
@ -696,7 +696,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq [esi+8*0], mm1 ;save tmp13 in workspace movq [esi+8*0], mm1 ;save tmp13 in workspace
psllw mm5, 2 ;shift tmp1-tmp3 psllw mm5, 2 ;shift tmp1-tmp3
movq mm7, [ebx + 8*0] ;load inptr[DCTSIZE*0] movq mm7, [ebx + 8*0] ;load inptr[DCTSIZE*0]
pmulhw mm5, fix_141 ;MULTIPLY(tmp1 - tmp3, FIX_1_414213562) pmulhw mm5, fix_141 ;MULTIPLY(tmp1 - tmp3, FIX_1_414213562)
@ -705,7 +705,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
pmullw mm7, [edi + 8*0] ;tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); pmullw mm7, [edi + 8*0] ;tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
movq mm4, [ebx + 8*8] ;load inptr[DCTSIZE*4] movq mm4, [ebx + 8*8] ;load inptr[DCTSIZE*4]
pmullw mm4, [edi + 8*8] ;tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); pmullw mm4, [edi + 8*8] ;tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
psubw mm5, mm1 ;tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */ psubw mm5, mm1 ;tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */
@ -713,22 +713,22 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm1, mm7 ;copy tmp0 /* phase 3 */ movq mm1, mm7 ;copy tmp0 /* phase 3 */
movq [esi+8*2], mm5 ;save tmp12 in workspace movq [esi+8*2], mm5 ;save tmp12 in workspace
psubw mm1, mm4 ;tmp11 = tmp0 - tmp2; psubw mm1, mm4 ;tmp11 = tmp0 - tmp2;
paddw mm7, mm4 ;tmp10 = tmp0 + tmp2; paddw mm7, mm4 ;tmp10 = tmp0 + tmp2;
movq mm5, mm1 ;copy tmp11 movq mm5, mm1 ;copy tmp11
paddw mm1, [esi+8*2] ;tmp1 = tmp11 + tmp12; paddw mm1, [esi+8*2] ;tmp1 = tmp11 + tmp12;
movq mm4, mm7 ;copy tmp10 /* phase 2 */ movq mm4, mm7 ;copy tmp10 /* phase 2 */
paddw mm7, [esi+8*0] ;tmp0 = tmp10 + tmp13; paddw mm7, [esi+8*0] ;tmp0 = tmp10 + tmp13;
psubw mm4, [esi+8*0] ;tmp3 = tmp10 - tmp13; psubw mm4, [esi+8*0] ;tmp3 = tmp10 - tmp13;
movq mm0, mm7 ;copy tmp0 movq mm0, mm7 ;copy tmp0
psubw mm5, [esi+8*2] ;tmp2 = tmp11 - tmp12; psubw mm5, [esi+8*2] ;tmp2 = tmp11 - tmp12;
paddw mm7, mm3 ;wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); paddw mm7, mm3 ;wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
psubw mm0, mm3 ;wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); psubw mm0, mm3 ;wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
movq [esi + 8*0], mm7 ;wsptr[DCTSIZE*0] movq [esi + 8*0], mm7 ;wsptr[DCTSIZE*0]
@ -789,7 +789,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
paddw mm1, mm0 ;z13 = tmp6 + tmp5; paddw mm1, mm0 ;z13 = tmp6 + tmp5;
pmullw mm4, [edi + 8*14] ;tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); pmullw mm4, [edi + 8*14] ;tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
psubw mm2, mm0 ;z10 = tmp6 - tmp5 psubw mm2, mm0 ;z10 = tmp6 - tmp5
psllw mm2, 2 ;shift z10 psllw mm2, 2 ;shift z10
movq mm0, mm2 ;copy z10 movq mm0, mm2 ;copy z10
@ -810,7 +810,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm7, mm5 ;copy z12 movq mm7, mm5 ;copy z12
pmulhw mm5, fix_108n184 ;MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part pmulhw mm5, fix_108n184 ;MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part
paddw mm3, mm1 ;tmp7 = z11 + z13; paddw mm3, mm1 ;tmp7 = z11 + z13;
/* Even part */ /* Even part */
@ -836,7 +836,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq [esi+8*0], mm1 ;save tmp13 in workspace movq [esi+8*0], mm1 ;save tmp13 in workspace
psllw mm5, 2 ;shift tmp1-tmp3 psllw mm5, 2 ;shift tmp1-tmp3
movq mm7, [ebx + 8*0] ;load inptr[DCTSIZE*0] movq mm7, [ebx + 8*0] ;load inptr[DCTSIZE*0]
paddw mm0, mm6 ;tmp4 = tmp10 + tmp5; paddw mm0, mm6 ;tmp4 = tmp10 + tmp5;
@ -845,7 +845,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
pmullw mm7, [edi + 8*0] ;tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); pmullw mm7, [edi + 8*0] ;tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
movq mm4, [ebx + 8*8] ;load inptr[DCTSIZE*4] movq mm4, [ebx + 8*8] ;load inptr[DCTSIZE*4]
pmullw mm4, [edi + 8*8] ;tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); pmullw mm4, [edi + 8*8] ;tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
psubw mm5, mm1 ;tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */ psubw mm5, mm1 ;tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */
@ -853,22 +853,22 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm1, mm7 ;copy tmp0 /* phase 3 */ movq mm1, mm7 ;copy tmp0 /* phase 3 */
movq [esi+8*2], mm5 ;save tmp12 in workspace movq [esi+8*2], mm5 ;save tmp12 in workspace
psubw mm1, mm4 ;tmp11 = tmp0 - tmp2; psubw mm1, mm4 ;tmp11 = tmp0 - tmp2;
paddw mm7, mm4 ;tmp10 = tmp0 + tmp2; paddw mm7, mm4 ;tmp10 = tmp0 + tmp2;
movq mm5, mm1 ;copy tmp11 movq mm5, mm1 ;copy tmp11
paddw mm1, [esi+8*2] ;tmp1 = tmp11 + tmp12; paddw mm1, [esi+8*2] ;tmp1 = tmp11 + tmp12;
movq mm4, mm7 ;copy tmp10 /* phase 2 */ movq mm4, mm7 ;copy tmp10 /* phase 2 */
paddw mm7, [esi+8*0] ;tmp0 = tmp10 + tmp13; paddw mm7, [esi+8*0] ;tmp0 = tmp10 + tmp13;
psubw mm4, [esi+8*0] ;tmp3 = tmp10 - tmp13; psubw mm4, [esi+8*0] ;tmp3 = tmp10 - tmp13;
movq mm0, mm7 ;copy tmp0 movq mm0, mm7 ;copy tmp0
psubw mm5, [esi+8*2] ;tmp2 = tmp11 - tmp12; psubw mm5, [esi+8*2] ;tmp2 = tmp11 - tmp12;
paddw mm7, mm3 ;wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); paddw mm7, mm3 ;wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
psubw mm0, mm3 ;wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); psubw mm0, mm3 ;wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
movq [esi + 8*0], mm7 ;wsptr[DCTSIZE*0] movq [esi + 8*0], mm7 ;wsptr[DCTSIZE*0]
@ -923,7 +923,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm1, [esi+8*1] ;wsptr[0,4],[0,5],[0,6],[0,7] movq mm1, [esi+8*1] ;wsptr[0,4],[0,5],[0,6],[0,7]
movq mm2, mm0 movq mm2, mm0
movq mm3, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3] movq mm3, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3]
paddw mm0, mm1 ;wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] paddw mm0, mm1 ;wsptr[0,tmp10],[xxx],[0,tmp13],[xxx]
@ -932,7 +932,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm6, mm0 movq mm6, mm0
movq mm5, mm3 movq mm5, mm3
paddw mm3, mm4 ;wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] paddw mm3, mm4 ;wsptr[1,tmp10],[xxx],[1,tmp13],[xxx]
movq mm1, mm2 movq mm1, mm2
@ -954,7 +954,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm5, [esi+8*5] ;wsptr[2,4],[2,5],[2,6],[2,7] movq mm5, [esi+8*5] ;wsptr[2,4],[2,5],[2,6],[2,7]
punpckldq mm1, mm2 ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] punpckldq mm1, mm2 ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14]
paddw mm3, mm5 ;wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] paddw mm3, mm5 ;wsptr[2,tmp10],[xxx],[2,tmp13],[xxx]
movq mm2, mm6 movq mm2, mm6
@ -963,7 +963,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm5, mm3 movq mm5, mm3
punpcklwd mm3, mm6 ;wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] punpcklwd mm3, mm6 ;wsptr[2,tmp10],[3,tmp10],[xxx],[xxx]
psubw mm2, mm7 ;wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] psubw mm2, mm7 ;wsptr[3,tmp11],[xxx],[3,tmp14],[xxx]
punpckhwd mm5, mm6 ;wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] punpckhwd mm5, mm6 ;wsptr[2,tmp13],[3,tmp13],[xxx],[xxx]
@ -1028,7 +1028,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq [esi+8*0], mm0 ;save tmp0 movq [esi+8*0], mm0 ;save tmp0
paddw mm2, mm4 ;wsptr[xxx],[0,z11],[xxx],[0,z13] paddw mm2, mm4 ;wsptr[xxx],[0,z11],[xxx],[0,z13]
//Continue with z10 --- z13 //Continue with z10 --- z13
movq mm6, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3] movq mm6, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3]
psubw mm3, mm4 ;wsptr[xxx],[0,z12],[xxx],[0,z10] psubw mm3, mm4 ;wsptr[xxx],[0,z12],[xxx],[0,z10]
@ -1041,11 +1041,11 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
punpckhdq mm0, mm4 ;wsptr[1,6],[1,7],[1,2],[1,3] punpckhdq mm0, mm4 ;wsptr[1,6],[1,7],[1,2],[1,3]
movq mm1, mm6 movq mm1, mm6
//Save tmp2 and tmp3 in wsptr //Save tmp2 and tmp3 in wsptr
paddw mm6, mm0 ;wsptr[xxx],[1,z11],[xxx],[1,z13] paddw mm6, mm0 ;wsptr[xxx],[1,z11],[xxx],[1,z13]
movq mm4, mm2 movq mm4, mm2
//Continue with z10 --- z13 //Continue with z10 --- z13
movq [esi+8*2], mm5 ;save tmp2 movq [esi+8*2], mm5 ;save tmp2
punpcklwd mm2, mm6 ;wsptr[xxx],[xxx],[0,z11],[1,z11] punpcklwd mm2, mm6 ;wsptr[xxx],[xxx],[0,z11],[1,z11]
@ -1073,7 +1073,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
punpckhdq mm7, mm4 ;wsptr[2,6],[2,7],[2,2],[2,3] punpckhdq mm7, mm4 ;wsptr[2,6],[2,7],[2,2],[2,3]
movq mm2, mm6 movq mm2, mm6
movq mm4, [esi+8*7] ;wsptr[3,4],[3,5],[3,6],[3,7] movq mm4, [esi+8*7] ;wsptr[3,4],[3,5],[3,6],[3,7]
paddw mm6, mm7 ;wsptr[xxx],[2,z11],[xxx],[2,z13] paddw mm6, mm7 ;wsptr[xxx],[2,z11],[xxx],[2,z13]
@ -1135,7 +1135,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
// tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */ // tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */
// + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */ // + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */
movq mm4, mm2 ;final1 movq mm4, mm2 ;final1
pmulhw mm0, fix_184n261 pmulhw mm0, fix_184n261
paddw mm2, mm5 ;tmp0+tmp7,final1 paddw mm2, mm5 ;tmp0+tmp7,final1
@ -1180,10 +1180,10 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
paddsw mm0, const_0x0080 paddsw mm0, const_0x0080
psraw mm6, 5 ;outptr[0,6],[1,6],[2,6],[3,6] psraw mm6, 5 ;outptr[0,6],[1,6],[2,6],[3,6]
paddsw mm6, const_0x0080 ;need to check this value paddsw mm6, const_0x0080 ;need to check this value
packuswb mm0, mm4 ;out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] packuswb mm0, mm4 ;out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7]
movq mm5, [esi+8*2] ;tmp2,final3 movq mm5, [esi+8*2] ;tmp2,final3
packuswb mm2, mm6 ;out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] packuswb mm2, mm6 ;out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6]
@ -1252,9 +1252,9 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
add eax, 4 add eax, 4
movq mm3, mm1 movq mm3, mm1
add ebx, output_col add ebx, output_col
punpckhwd mm7, mm4 ;out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] punpckhwd mm7, mm4 ;out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7]
movq [ecx], mm2 movq [ecx], mm2
punpckhdq mm0, mm6 ;out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] punpckhdq mm0, mm6 ;out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7]
@ -1275,9 +1275,9 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq [ebx], mm3 movq [ebx], mm3
/*******************************************************************/ /*******************************************************************/
add esi, 64 add esi, 64
add eax, 4 add eax, 4
@ -1292,7 +1292,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm1, [esi+8*1] ;wsptr[0,4],[0,5],[0,6],[0,7] movq mm1, [esi+8*1] ;wsptr[0,4],[0,5],[0,6],[0,7]
movq mm2, mm0 movq mm2, mm0
movq mm3, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3] movq mm3, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3]
paddw mm0, mm1 ;wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] paddw mm0, mm1 ;wsptr[0,tmp10],[xxx],[0,tmp13],[xxx]
@ -1301,7 +1301,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm6, mm0 movq mm6, mm0
movq mm5, mm3 movq mm5, mm3
paddw mm3, mm4 ;wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] paddw mm3, mm4 ;wsptr[1,tmp10],[xxx],[1,tmp13],[xxx]
movq mm1, mm2 movq mm1, mm2
@ -1323,7 +1323,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm5, [esi+8*5] ;wsptr[2,4],[2,5],[2,6],[2,7] movq mm5, [esi+8*5] ;wsptr[2,4],[2,5],[2,6],[2,7]
punpckldq mm1, mm2 ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] punpckldq mm1, mm2 ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14]
paddw mm3, mm5 ;wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] paddw mm3, mm5 ;wsptr[2,tmp10],[xxx],[2,tmp13],[xxx]
movq mm2, mm6 movq mm2, mm6
@ -1332,7 +1332,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm5, mm3 movq mm5, mm3
punpcklwd mm3, mm6 ;wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] punpcklwd mm3, mm6 ;wsptr[2,tmp10],[3,tmp10],[xxx],[xxx]
psubw mm2, mm7 ;wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] psubw mm2, mm7 ;wsptr[3,tmp11],[xxx],[3,tmp14],[xxx]
punpckhwd mm5, mm6 ;wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] punpckhwd mm5, mm6 ;wsptr[2,tmp13],[3,tmp13],[xxx],[xxx]
@ -1397,7 +1397,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq [esi+8*0], mm0 ;save tmp0 movq [esi+8*0], mm0 ;save tmp0
paddw mm2, mm4 ;wsptr[xxx],[0,z11],[xxx],[0,z13] paddw mm2, mm4 ;wsptr[xxx],[0,z11],[xxx],[0,z13]
//Continue with z10 --- z13 //Continue with z10 --- z13
movq mm6, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3] movq mm6, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3]
psubw mm3, mm4 ;wsptr[xxx],[0,z12],[xxx],[0,z10] psubw mm3, mm4 ;wsptr[xxx],[0,z12],[xxx],[0,z10]
@ -1410,11 +1410,11 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
punpckhdq mm0, mm4 ;wsptr[1,6],[1,7],[1,2],[1,3] punpckhdq mm0, mm4 ;wsptr[1,6],[1,7],[1,2],[1,3]
movq mm1, mm6 movq mm1, mm6
//Save tmp2 and tmp3 in wsptr //Save tmp2 and tmp3 in wsptr
paddw mm6, mm0 ;wsptr[xxx],[1,z11],[xxx],[1,z13] paddw mm6, mm0 ;wsptr[xxx],[1,z11],[xxx],[1,z13]
movq mm4, mm2 movq mm4, mm2
//Continue with z10 --- z13 //Continue with z10 --- z13
movq [esi+8*2], mm5 ;save tmp2 movq [esi+8*2], mm5 ;save tmp2
punpcklwd mm2, mm6 ;wsptr[xxx],[xxx],[0,z11],[1,z11] punpcklwd mm2, mm6 ;wsptr[xxx],[xxx],[0,z11],[1,z11]
@ -1442,7 +1442,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
punpckhdq mm7, mm4 ;wsptr[2,6],[2,7],[2,2],[2,3] punpckhdq mm7, mm4 ;wsptr[2,6],[2,7],[2,2],[2,3]
movq mm2, mm6 movq mm2, mm6
movq mm4, [esi+8*7] ;wsptr[3,4],[3,5],[3,6],[3,7] movq mm4, [esi+8*7] ;wsptr[3,4],[3,5],[3,6],[3,7]
paddw mm6, mm7 ;wsptr[xxx],[2,z11],[xxx],[2,z13] paddw mm6, mm7 ;wsptr[xxx],[2,z11],[xxx],[2,z13]
@ -1504,7 +1504,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
// tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */ // tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */
// + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */ // + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */
movq mm4, mm2 ;final1 movq mm4, mm2 ;final1
pmulhw mm0, fix_184n261 pmulhw mm0, fix_184n261
paddw mm2, mm5 ;tmp0+tmp7,final1 paddw mm2, mm5 ;tmp0+tmp7,final1
@ -1549,10 +1549,10 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
paddsw mm0, const_0x0080 paddsw mm0, const_0x0080
psraw mm6, 5 ;outptr[0,6],[1,6],[2,6],[3,6] psraw mm6, 5 ;outptr[0,6],[1,6],[2,6],[3,6]
paddsw mm6, const_0x0080 ;need to check this value paddsw mm6, const_0x0080 ;need to check this value
packuswb mm0, mm4 ;out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] packuswb mm0, mm4 ;out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7]
movq mm5, [esi+8*2] ;tmp2,final3 movq mm5, [esi+8*2] ;tmp2,final3
packuswb mm2, mm6 ;out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] packuswb mm2, mm6 ;out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6]
@ -1621,9 +1621,9 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
add eax, 4 add eax, 4
movq mm3, mm1 movq mm3, mm1
add ebx, output_col add ebx, output_col
punpckhwd mm7, mm4 ;out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] punpckhwd mm7, mm4 ;out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7]
movq [ecx], mm2 movq [ecx], mm2
punpckhdq mm0, mm6 ;out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] punpckhdq mm0, mm6 ;out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7]

View file

@ -177,14 +177,14 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* With typical images and quantization tables, half or more of the * With typical images and quantization tables, half or more of the
* column DCT calculations can be simplified this way. * column DCT calculations can be simplified this way.
*/ */
if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
inptr[DCTSIZE*7] == 0) { inptr[DCTSIZE*7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*0] = dcval;
wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*1] = dcval;
wsptr[DCTSIZE*2] = dcval; wsptr[DCTSIZE*2] = dcval;
@ -193,49 +193,49 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*5] = dcval;
wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*6] = dcval;
wsptr[DCTSIZE*7] = dcval; wsptr[DCTSIZE*7] = dcval;
inptr++; /* advance pointers to next column */ inptr++; /* advance pointers to next column */
quantptr++; quantptr++;
wsptr++; wsptr++;
continue; continue;
} }
/* Even part: reverse the even part of the forward DCT. */ /* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */ /* The rotator is sqrt(2)*c(-6). */
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
tmp0 = (z2 + z3) << CONST_BITS; tmp0 = (z2 + z3) << CONST_BITS;
tmp1 = (z2 - z3) << CONST_BITS; tmp1 = (z2 - z3) << CONST_BITS;
tmp10 = tmp0 + tmp3; tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3; tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
/* Odd part per figure 8; the matrix is unitary and hence its /* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/ */
tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
z1 = tmp0 + tmp3; z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2; z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2; z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3; z4 = tmp1 + tmp3;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
@ -244,17 +244,17 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5; z3 += z5;
z4 += z5; z4 += z5;
tmp0 += z1 + z3; tmp0 += z1 + z3;
tmp1 += z2 + z4; tmp1 += z2 + z4;
tmp2 += z2 + z3; tmp2 += z2 + z3;
tmp3 += z1 + z4; tmp3 += z1 + z4;
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
@ -263,12 +263,12 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
inptr++; /* advance pointers to next column */ inptr++; /* advance pointers to next column */
quantptr++; quantptr++;
wsptr++; wsptr++;
} }
/* Pass 2: process rows from work array, store into output array. */ /* Pass 2: process rows from work array, store into output array. */
/* Note that we must descale the results by a factor of 8 == 2**3, */ /* Note that we must descale the results by a factor of 8 == 2**3, */
/* and also undo the PASS1_BITS scaling. */ /* and also undo the PASS1_BITS scaling. */
@ -283,14 +283,14 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* test takes more time than it's worth. In that case this section * test takes more time than it's worth. In that case this section
* may be commented out. * may be commented out.
*/ */
#ifndef NO_ZERO_ROW_TEST #ifndef NO_ZERO_ROW_TEST
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
outptr[2] = dcval; outptr[2] = dcval;
@ -304,40 +304,40 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
continue; continue;
} }
#endif #endif
/* Even part: reverse the even part of the forward DCT. */ /* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */ /* The rotator is sqrt(2)*c(-6). */
z2 = (INT32) wsptr[2]; z2 = (INT32) wsptr[2];
z3 = (INT32) wsptr[6]; z3 = (INT32) wsptr[6];
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS; tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS;
tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS; tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS;
tmp10 = tmp0 + tmp3; tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3; tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2; tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2; tmp12 = tmp1 - tmp2;
/* Odd part per figure 8; the matrix is unitary and hence its /* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/ */
tmp0 = (INT32) wsptr[7]; tmp0 = (INT32) wsptr[7];
tmp1 = (INT32) wsptr[5]; tmp1 = (INT32) wsptr[5];
tmp2 = (INT32) wsptr[3]; tmp2 = (INT32) wsptr[3];
tmp3 = (INT32) wsptr[1]; tmp3 = (INT32) wsptr[1];
z1 = tmp0 + tmp3; z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2; z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2; z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3; z4 = tmp1 + tmp3;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
@ -346,17 +346,17 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5; z3 += z5;
z4 += z5; z4 += z5;
tmp0 += z1 + z3; tmp0 += z1 + z3;
tmp1 += z2 + z4; tmp1 += z2 + z4;
tmp2 += z2 + z3; tmp2 += z2 + z3;
tmp3 += z1 + z4; tmp3 += z1 + z4;
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3, outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS+PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
@ -381,7 +381,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0, outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS+PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
} }
@ -422,7 +422,7 @@ typedef signed char Ipp8s;
typedef signed short Ipp16s; typedef signed short Ipp16s;
typedef signed int Ipp32s; typedef signed int Ipp32s;
#define BITS_INV_ACC 4 #define BITS_INV_ACC 4
#define SHIFT_INV_ROW 16 - BITS_INV_ACC #define SHIFT_INV_ROW 16 - BITS_INV_ACC
#define SHIFT_INV_COL 1 + BITS_INV_ACC #define SHIFT_INV_COL 1 + BITS_INV_ACC
@ -431,13 +431,13 @@ typedef signed int Ipp32s;
#define RND_INV_CORR = RND_INV_COL - 1 /* correction -1.0 and round */ #define RND_INV_CORR = RND_INV_COL - 1 /* correction -1.0 and round */
#define c_inv_corr_0 -1024 * (6 - BITS_INV_ACC) + 65536 /* -0.5 + (16.0 or 32.0) */ #define c_inv_corr_0 -1024 * (6 - BITS_INV_ACC) + 65536 /* -0.5 + (16.0 or 32.0) */
#define c_inv_corr_1 1877 * (6 - BITS_INV_ACC) /* 0.9167 */ #define c_inv_corr_1 1877 * (6 - BITS_INV_ACC) /* 0.9167 */
#define c_inv_corr_2 1236 * (6 - BITS_INV_ACC) /* 0.6035 */ #define c_inv_corr_2 1236 * (6 - BITS_INV_ACC) /* 0.6035 */
#define c_inv_corr_3 680 * (6 - BITS_INV_ACC) /* 0.3322 */ #define c_inv_corr_3 680 * (6 - BITS_INV_ACC) /* 0.3322 */
#define c_inv_corr_4 0 * (6 - BITS_INV_ACC) /* 0.0 */ #define c_inv_corr_4 0 * (6 - BITS_INV_ACC) /* 0.0 */
#define c_inv_corr_5 -569 * (6 - BITS_INV_ACC) /* -0.278 */ #define c_inv_corr_5 -569 * (6 - BITS_INV_ACC) /* -0.278 */
#define c_inv_corr_6 -512 * (6 - BITS_INV_ACC) /* -0.25 */ #define c_inv_corr_6 -512 * (6 - BITS_INV_ACC) /* -0.25 */
#define c_inv_corr_7 -651 * (6 - BITS_INV_ACC) /* -0.3176 */ #define c_inv_corr_7 -651 * (6 - BITS_INV_ACC) /* -0.3176 */
#define RND_INV_ROW_0 RND_INV_ROW + c_inv_corr_0 #define RND_INV_ROW_0 RND_INV_ROW + c_inv_corr_0
#define RND_INV_ROW_1 RND_INV_ROW + c_inv_corr_1 #define RND_INV_ROW_1 RND_INV_ROW + c_inv_corr_1
@ -450,52 +450,52 @@ typedef signed int Ipp32s;
/* Table for rows 0,4 - constants are multiplied on cos_4_16 */ /* Table for rows 0,4 - constants are multiplied on cos_4_16 */
__declspec(align(16)) short tab_i_04[] = { __declspec(align(16)) short tab_i_04[] = {
16384, 21407, 16384, 8867, 16384, 21407, 16384, 8867,
-16384, 21407, 16384, -8867, -16384, 21407, 16384, -8867,
16384, -8867, 16384, -21407, 16384, -8867, 16384, -21407,
16384, 8867, -16384, -21407, 16384, 8867, -16384, -21407,
22725, 19266, 19266, -4520, 22725, 19266, 19266, -4520,
4520, 19266, 19266, -22725, 4520, 19266, 19266, -22725,
12873, -22725, 4520, -12873, 12873, -22725, 4520, -12873,
12873, 4520, -22725, -12873}; 12873, 4520, -22725, -12873};
/* Table for rows 1,7 - constants are multiplied on cos_1_16 */ /* Table for rows 1,7 - constants are multiplied on cos_1_16 */
__declspec(align(16)) short tab_i_17[] = { __declspec(align(16)) short tab_i_17[] = {
22725, 29692, 22725, 12299, 22725, 29692, 22725, 12299,
-22725, 29692, 22725, -12299, -22725, 29692, 22725, -12299,
22725, -12299, 22725, -29692, 22725, -12299, 22725, -29692,
22725, 12299, -22725, -29692, 22725, 12299, -22725, -29692,
31521, 26722, 26722, -6270, 31521, 26722, 26722, -6270,
6270, 26722, 26722, -31521, 6270, 26722, 26722, -31521,
17855, -31521, 6270, -17855, 17855, -31521, 6270, -17855,
17855, 6270, -31521, -17855}; 17855, 6270, -31521, -17855};
/* Table for rows 2,6 - constants are multiplied on cos_2_16 */ /* Table for rows 2,6 - constants are multiplied on cos_2_16 */
__declspec(align(16)) short tab_i_26[] = { __declspec(align(16)) short tab_i_26[] = {
21407, 27969, 21407, 11585, 21407, 27969, 21407, 11585,
-21407, 27969, 21407, -11585, -21407, 27969, 21407, -11585,
21407, -11585, 21407, -27969, 21407, -11585, 21407, -27969,
21407, 11585, -21407, -27969, 21407, 11585, -21407, -27969,
29692, 25172, 25172, -5906, 29692, 25172, 25172, -5906,
5906, 25172, 25172, -29692, 5906, 25172, 25172, -29692,
16819, -29692, 5906, -16819, 16819, -29692, 5906, -16819,
16819, 5906, -29692, -16819}; 16819, 5906, -29692, -16819};
/* Table for rows 3,5 - constants are multiplied on cos_3_16 */ /* Table for rows 3,5 - constants are multiplied on cos_3_16 */
__declspec(align(16)) short tab_i_35[] = { __declspec(align(16)) short tab_i_35[] = {
19266, 25172, 19266, 10426, 19266, 25172, 19266, 10426,
-19266, 25172, 19266, -10426, -19266, 25172, 19266, -10426,
19266, -10426, 19266, -25172, 19266, -10426, 19266, -25172,
19266, 10426, -19266, -25172, 19266, 10426, -19266, -25172,
26722, 22654, 22654, -5315, 26722, 22654, 22654, -5315,
5315, 22654, 22654, -26722, 5315, 22654, 22654, -26722,
15137, -26722, 5315, -15137, 15137, -26722, 5315, -15137,
15137, 5315, -26722, -15137}; 15137, 5315, -26722, -15137};
__declspec(align(16)) long round_i_0[] = {RND_INV_ROW_0,RND_INV_ROW_0, __declspec(align(16)) long round_i_0[] = {RND_INV_ROW_0,RND_INV_ROW_0,
RND_INV_ROW_0,RND_INV_ROW_0}; RND_INV_ROW_0,RND_INV_ROW_0};
__declspec(align(16)) long round_i_1[] = {RND_INV_ROW_1,RND_INV_ROW_1, __declspec(align(16)) long round_i_1[] = {RND_INV_ROW_1,RND_INV_ROW_1,
@ -545,7 +545,7 @@ __declspec(align(16)) short cos_4_16[] = {
* *
*----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
*/ */
#define DCT_8_INV_ROW_2R(TABLE, ROUND1, ROUND2) __asm { \ #define DCT_8_INV_ROW_2R(TABLE, ROUND1, ROUND2) __asm { \
__asm pshuflw xmm1, xmm0, 10001000b \ __asm pshuflw xmm1, xmm0, 10001000b \
__asm pshuflw xmm0, xmm0, 11011101b \ __asm pshuflw xmm0, xmm0, 11011101b \
@ -707,7 +707,7 @@ __declspec(align(16)) short cos_4_16[] = {
GLOBAL(void) GLOBAL(void)
dct_8x8_inv_16s ( short *src, short *dst ) { dct_8x8_inv_16s ( short *src, short *dst ) {
__asm { __asm {
mov ecx, src mov ecx, src
@ -716,26 +716,26 @@ dct_8x8_inv_16s ( short *src, short *dst ) {
movdqa xmm0, [ecx+0*16] movdqa xmm0, [ecx+0*16]
movdqa xmm4, [ecx+4*16] movdqa xmm4, [ecx+4*16]
DCT_8_INV_ROW_2R(tab_i_04, round_i_0, round_i_4) DCT_8_INV_ROW_2R(tab_i_04, round_i_0, round_i_4)
movdqa [edx+0*16], xmm1 movdqa [edx+0*16], xmm1
movdqa [edx+4*16], xmm5 movdqa [edx+4*16], xmm5
movdqa xmm0, [ecx+1*16] movdqa xmm0, [ecx+1*16]
movdqa xmm4, [ecx+7*16] movdqa xmm4, [ecx+7*16]
DCT_8_INV_ROW_2R(tab_i_17, round_i_1, round_i_7) DCT_8_INV_ROW_2R(tab_i_17, round_i_1, round_i_7)
movdqa [edx+1*16], xmm1 movdqa [edx+1*16], xmm1
movdqa [edx+7*16], xmm5 movdqa [edx+7*16], xmm5
movdqa xmm0, [ecx+3*16] movdqa xmm0, [ecx+3*16]
movdqa xmm4, [ecx+5*16] movdqa xmm4, [ecx+5*16]
DCT_8_INV_ROW_2R(tab_i_35, round_i_3, round_i_5); DCT_8_INV_ROW_2R(tab_i_35, round_i_3, round_i_5);
movdqa [edx+3*16], xmm1 movdqa [edx+3*16], xmm1
movdqa [edx+5*16], xmm5 movdqa [edx+5*16], xmm5
movdqa xmm0, [ecx+2*16] movdqa xmm0, [ecx+2*16]
movdqa xmm4, [ecx+6*16] movdqa xmm4, [ecx+6*16]
DCT_8_INV_ROW_2R(tab_i_26, round_i_2, round_i_6); DCT_8_INV_ROW_2R(tab_i_26, round_i_2, round_i_6);
movdqa [edx+2*16], xmm1 movdqa [edx+2*16], xmm1
movdqa [edx+6*16], xmm5 movdqa [edx+6*16], xmm5
DCT_8_INV_COL_8R(edx+0, edx+0); DCT_8_INV_COL_8R(edx+0, edx+0);
} }
@ -889,7 +889,7 @@ ownpj_Add128_8x8_16s8u(const short * pSrc, unsigned char * pDst, int DstStep)
} }
/* /*
* Name: * Name:
* ippiDCTQuantInv8x8LS_JPEG_16s8u_C1R * ippiDCTQuantInv8x8LS_JPEG_16s8u_C1R
* *
@ -913,33 +913,33 @@ ippiDCTQuantInv8x8LS_JPEG_16s8u_C1R(
{ {
__declspec(align(16)) Ipp8u buf[DCTSIZE2*sizeof(Ipp16s)]; __declspec(align(16)) Ipp8u buf[DCTSIZE2*sizeof(Ipp16s)];
Ipp16s * workbuf = (Ipp16s *)buf; Ipp16s * workbuf = (Ipp16s *)buf;
ownpj_QuantInv_8x8_16s(pSrc,workbuf,pQuantInvTable); ownpj_QuantInv_8x8_16s(pSrc,workbuf,pQuantInvTable);
dct_8x8_inv_16s(workbuf,workbuf); dct_8x8_inv_16s(workbuf,workbuf);
ownpj_Add128_8x8_16s8u(workbuf,pDst,DstStep); ownpj_Add128_8x8_16s8u(workbuf,pDst,DstStep);
} }
GLOBAL(void) GLOBAL(void)
jpeg_idct_islow_sse2 ( jpeg_idct_islow_sse2 (
j_decompress_ptr cinfo, j_decompress_ptr cinfo,
jpeg_component_info * compptr, jpeg_component_info * compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block,
JSAMPARRAY output_buf, JSAMPARRAY output_buf,
JDIMENSION output_col) JDIMENSION output_col)
{ {
int ctr; int ctr;
JCOEFPTR inptr; JCOEFPTR inptr;
Ipp16u* quantptr; Ipp16u* quantptr;
Ipp8u* wsptr; Ipp8u* wsptr;
__declspec(align(16)) Ipp8u workspace[DCTSIZE2]; __declspec(align(16)) Ipp8u workspace[DCTSIZE2];
JSAMPROW outptr; JSAMPROW outptr;
inptr = coef_block; inptr = coef_block;
quantptr = (Ipp16u*)compptr->dct_table; quantptr = (Ipp16u*)compptr->dct_table;
wsptr = workspace; wsptr = workspace;
ippiDCTQuantInv8x8LS_JPEG_16s8u_C1R(inptr, workspace, 8, quantptr); ippiDCTQuantInv8x8LS_JPEG_16s8u_C1R(inptr, workspace, 8, quantptr);
for(ctr = 0; ctr < DCTSIZE; ctr++) for(ctr = 0; ctr < DCTSIZE; ctr++)

View file

@ -144,53 +144,53 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) {
/* AC terms all zero; we need not examine term 4 for 4x4 output */ /* AC terms all zero; we need not examine term 4 for 4x4 output */
int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*0] = dcval;
wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*1] = dcval;
wsptr[DCTSIZE*2] = dcval; wsptr[DCTSIZE*2] = dcval;
wsptr[DCTSIZE*3] = dcval; wsptr[DCTSIZE*3] = dcval;
continue; continue;
} }
/* Even part */ /* Even part */
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
tmp0 <<= (CONST_BITS+1); tmp0 <<= (CONST_BITS+1);
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865); tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865);
tmp10 = tmp0 + tmp2; tmp10 = tmp0 + tmp2;
tmp12 = tmp0 - tmp2; tmp12 = tmp0 - tmp2;
/* Odd part */ /* Odd part */
z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
+ MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */ /* Final output stage */
wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1);
wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1);
wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1);
wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1);
} }
/* Pass 2: process 4 rows from work array, store into output array. */ /* Pass 2: process 4 rows from work array, store into output array. */
wsptr = workspace; wsptr = workspace;
@ -204,46 +204,46 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
outptr[2] = dcval; outptr[2] = dcval;
outptr[3] = dcval; outptr[3] = dcval;
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
continue; continue;
} }
#endif #endif
/* Even part */ /* Even part */
tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1); tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1);
tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065) tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065)
+ MULTIPLY((INT32) wsptr[6], - FIX_0_765366865); + MULTIPLY((INT32) wsptr[6], - FIX_0_765366865);
tmp10 = tmp0 + tmp2; tmp10 = tmp0 + tmp2;
tmp12 = tmp0 - tmp2; tmp12 = tmp0 - tmp2;
/* Odd part */ /* Odd part */
z1 = (INT32) wsptr[7]; z1 = (INT32) wsptr[7];
z2 = (INT32) wsptr[5]; z2 = (INT32) wsptr[5];
z3 = (INT32) wsptr[3]; z3 = (INT32) wsptr[3];
z4 = (INT32) wsptr[1]; z4 = (INT32) wsptr[1];
tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
+ MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2, outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS+PASS1_BITS+3+1)
& RANGE_MASK]; & RANGE_MASK];
@ -256,7 +256,7 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0, outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS+PASS1_BITS+3+1)
& RANGE_MASK]; & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
} }
@ -295,18 +295,18 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) { inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) {
/* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */ /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */
int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*0] = dcval;
wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*1] = dcval;
continue; continue;
} }
/* Even part */ /* Even part */
z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
tmp10 = z1 << (CONST_BITS+2); tmp10 = z1 << (CONST_BITS+2);
/* Odd part */ /* Odd part */
z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
@ -319,11 +319,11 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
/* Final output stage */ /* Final output stage */
wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2); wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2);
wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2); wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2);
} }
/* Pass 2: process 2 rows from work array, store into output array. */ /* Pass 2: process 2 rows from work array, store into output array. */
wsptr = workspace; wsptr = workspace;
@ -336,19 +336,19 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
continue; continue;
} }
#endif #endif
/* Even part */ /* Even part */
tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2); tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2);
/* Odd part */ /* Odd part */
tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */
@ -357,14 +357,14 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+ MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ + MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0, outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3+2) CONST_BITS+PASS1_BITS+3+2)
& RANGE_MASK]; & RANGE_MASK];
outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0, outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3+2) CONST_BITS+PASS1_BITS+3+2)
& RANGE_MASK]; & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
} }

View file

@ -228,7 +228,7 @@ jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
* 2. Extended memory, accessed per the XMS V2.0 specification. * 2. Extended memory, accessed per the XMS V2.0 specification.
* 3. Expanded memory, accessed per the LIM/EMS 4.0 specification. * 3. Expanded memory, accessed per the LIM/EMS 4.0 specification.
* You'll need copies of those specs to make sense of the related code. * You'll need copies of those specs to make sense of the related code.
* The specs are available by Internet FTP from the SIMTEL archives * The specs are available by Internet FTP from the SIMTEL archives
* (oak.oakland.edu and its various mirror sites). See files * (oak.oakland.edu and its various mirror sites). See files
* pub/msdos/microsoft/xms20.arc and pub/msdos/info/limems41.zip. * pub/msdos/microsoft/xms20.arc and pub/msdos/info/limems41.zip.
*/ */
@ -347,7 +347,7 @@ read_xms_store (j_common_ptr cinfo, backing_store_ptr info,
spec.src.offset = file_offset; spec.src.offset = file_offset;
spec.dst_handle = 0; spec.dst_handle = 0;
spec.dst.ptr = buffer_address; spec.dst.ptr = buffer_address;
ctx.ds_si = (void far *) & spec; ctx.ds_si = (void far *) & spec;
ctx.ax = 0x0b00; /* EMB move */ ctx.ax = 0x0b00; /* EMB move */
jxms_calldriver(xms_driver, (XMScontext far *) & ctx); jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
@ -503,7 +503,7 @@ read_ems_store (j_common_ptr cinfo, backing_store_ptr info,
DST_TYPE(spec) = 0; DST_TYPE(spec) = 0;
DST_HANDLE(spec) = 0; DST_HANDLE(spec) = 0;
DST_PTR(spec) = buffer_address; DST_PTR(spec) = buffer_address;
ctx.ds_si = (void far *) & spec; ctx.ds_si = (void far *) & spec;
ctx.ax = 0x5700; /* move memory region */ ctx.ax = 0x5700; /* move memory region */
jems_calldriver((EMScontext far *) & ctx); jems_calldriver((EMScontext far *) & ctx);
@ -528,7 +528,7 @@ write_ems_store (j_common_ptr cinfo, backing_store_ptr info,
DST_HANDLE(spec) = info->handle.ems_handle; DST_HANDLE(spec) = info->handle.ems_handle;
DST_PAGE(spec) = (unsigned short) (file_offset / EMSPAGESIZE); DST_PAGE(spec) = (unsigned short) (file_offset / EMSPAGESIZE);
DST_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE); DST_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE);
ctx.ds_si = (void far *) & spec; ctx.ds_si = (void far *) & spec;
ctx.ax = 0x5700; /* move memory region */ ctx.ax = 0x5700; /* move memory region */
jems_calldriver((EMScontext far *) & ctx); jems_calldriver((EMScontext far *) & ctx);

View file

@ -238,13 +238,13 @@ out_of_memory (j_common_ptr cinfo, int which)
* machines, but may be too small if longs are 64 bits or more. * machines, but may be too small if longs are 64 bits or more.
*/ */
static const size_t first_pool_slop[JPOOL_NUMPOOLS] = static const size_t first_pool_slop[JPOOL_NUMPOOLS] =
{ {
1600, /* first PERMANENT pool */ 1600, /* first PERMANENT pool */
16000 /* first IMAGE pool */ 16000 /* first IMAGE pool */
}; };
static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = static const size_t extra_pool_slop[JPOOL_NUMPOOLS] =
{ {
0, /* additional PERMANENT pools */ 0, /* additional PERMANENT pools */
5000 /* additional IMAGE pools */ 5000 /* additional IMAGE pools */

View file

@ -11,7 +11,7 @@
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning (disable : 4142) /* benign redefinition of type */ #pragma warning (disable : 4142) /* benign redefinition of type */
#endif #endif
@ -104,8 +104,8 @@ typedef short JCOEF;
/* Defines for MMX/SSE2 support. */ /* Defines for MMX/SSE2 support. */
/* Disabled for AT&T and VC++ 6.0 */ /* Disabled for AT&T and VC++ 6.0 */
#if defined(_M_IX86) && !defined(__GNUC__) && !(defined(_MSC_VER) && (_MSC_VER<1300)) #if defined(_M_IX86) && !defined(__GNUC__) && !(defined(_MSC_VER) && (_MSC_VER<1300))
#define HAVE_MMX_INTEL_MNEMONICS #define HAVE_MMX_INTEL_MNEMONICS
/* SSE2 code appears broken for some cpus (bug 247437) /* SSE2 code appears broken for some cpus (bug 247437)
my comment: I read the discussion about that bug and it was disabled my comment: I read the discussion about that bug and it was disabled

File diff suppressed because it is too large Load diff

View file

@ -366,7 +366,7 @@ main (int argc, char **argv)
jvirt_barray_ptr * dst_coef_arrays; jvirt_barray_ptr * dst_coef_arrays;
int file_index; int file_index;
/* We assume all-in-memory processing and can therefore use only a /* We assume all-in-memory processing and can therefore use only a
* single file pointer for sequential input and output operation. * single file pointer for sequential input and output operation.
*/ */
FILE * fp; FILE * fp;

Some files were not shown because too many files have changed in this diff Show more