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

View file

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

View file

@ -17,7 +17,7 @@
// String Table
//
STRINGTABLE DISCARDABLE
STRINGTABLE DISCARDABLE
BEGIN
idsAppName "Screen Saver.Maze"
END
@ -28,17 +28,17 @@ END
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <scrnsave.h>\0"
END
3 TEXTINCLUDE DISCARDABLE
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\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,
PMYBrainAnalys pMystart,
PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse,
CPU_INT *RegTableCount)
@ -202,7 +202,7 @@ CPU_INT ConvertToIA32Process( FILE *outfp,
if ((pMystart->type & 2)== 2)
{
/* dest [eax - 0x20], source reg */
fprintf(outfp,"mov dword [");
standardreg( RegTableCount,
pMystart->dst,
@ -255,7 +255,7 @@ CPU_INT ConvertToIA32Process( FILE *outfp,
pMystart=NULL;
else
pMystart = (PMYBrainAnalys) pMystart->ptr_next;
}
return 0;
}

View file

@ -28,8 +28,8 @@ static void standardreg(CPU_INT *RegTableCount, CPU_UNINT reg,
}
}
CPU_INT ConvertToPPCProcess( FILE *outfp,
PMYBrainAnalys pMystart,
CPU_INT ConvertToPPCProcess( FILE *outfp,
PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits,
CPU_INT HowManyRegInUse,
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,"GLOBAL _main\n");
fprintf(outfp,"SECTION .text\n\n");
@ -130,7 +130,7 @@ CPU_INT ConvertToPPCProcess( FILE *outfp,
}
}
} /* end pMyBrainAnalys->type & 8 */
if ((pMystart->type & 64)== 64)
{
if ((pMystart->type & 2)== 2)
@ -149,7 +149,7 @@ CPU_INT ConvertToPPCProcess( FILE *outfp,
pMystart->src,
setup_ebp, outfp);
fprintf(outfp,", %d(",pMystart->dst_extra);
standardreg( RegTableCount,
pMystart->dst,
setup_ebp, outfp);
@ -165,7 +165,7 @@ CPU_INT ConvertToPPCProcess( FILE *outfp,
{
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");
}
}

View file

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

View file

@ -95,14 +95,14 @@ int main(int argc, char * argv[])
//}
// mode 0 disambler
// mode 1 convert to intel
// mode 1 convert to intel
// mode 2 convert to ppc
//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;
//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 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);
/* 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
*/

View file

@ -1,20 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "ARMBrain.h"
#include "ARM.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
* 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
* 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_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
* BaseAddress : the virtual memory address we setup to use.
* 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
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* return value
* 0 : Ok
* 1 : unimplemt
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
@ -52,13 +52,13 @@ CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
CPU_INT retsize;
/* now we start the process */
/* now we start the process */
while (cpu_pos<cpu_size)
{
cpu_oldpos = cpu_pos;
cpuint = cpu_buffer[cpu_pos];
/* Add */
if ((cpuint - (cpuint & GetMaskByte32(cpuARMInit_))) == ConvertBitToByte32(cpuARMInit_))
{
@ -69,7 +69,7 @@ CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
else
cpu_pos += retsize;
}
/* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size)
{
@ -78,11 +78,11 @@ CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
/* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos)
{
{
if (retcode == 0)
{
{
/* 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;
}
}
@ -94,5 +94,5 @@ CPU_INT ARMBrain( CPU_BYTE *cpu_buffer,
break;
}
}
return retcode;
return retcode;
}

View file

@ -2,10 +2,10 @@
#include "../../misc.h"
/* 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
* 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
/* 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
* 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
* 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};

View file

@ -1,45 +1,45 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "../../misc.h"
/* cpuDummyInit_Add
* Input param :
* out : The file pointer that we write to (the output file to intel asm)
* Input param :
* 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_pos : Current positions in the cpu_buffer
* cpu_pos : Current positions in 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,
* 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
* other or any sub model.
*
* mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* Return value :
* value -1 : unimplement
* value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode
* 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_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
* 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()
*/

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);
/* 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
*/

View file

@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "IA32Brain.h"
#include "IA32.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
* 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
* 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_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
* BaseAddress : the virtual memory address we setup to use.
* 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
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* return value
* 0 : Ok
* 1 : unimplemt
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
@ -64,10 +64,10 @@ CPU_INT IA32Brain( CPU_BYTE *cpu_buffer,
to read from the memory the
Le is for small endian and the
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]);
/* Add */
if ((cpuint - (cpuint & GetMaskByte(cpuIA32Init_Add))) == ConvertBitToByte(cpuIA32Init_Add))
{
@ -78,7 +78,7 @@ CPU_INT IA32Brain( CPU_BYTE *cpu_buffer,
else
cpu_pos += retsize;
}
/* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size)
{
@ -87,11 +87,11 @@ CPU_INT IA32Brain( CPU_BYTE *cpu_buffer,
/* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos)
{
{
if (retcode == 0)
{
{
/* 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;
}
}

View file

@ -3,10 +3,10 @@
#include "../../misc.h"
/* 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
* 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
/* 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
* 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
* 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};

View file

@ -1,45 +1,45 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "IA32.h"
#include "../../misc.h"
/* cpuDummyInit_Add
* Input param :
* out : The file pointer that we write to (the output file to intel asm)
* Input param :
* 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_pos : Current positions in the cpu_buffer
* cpu_pos : Current positions in 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,
* 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
* other or any sub model.
*
* mode : if we should run disambler of this binary or
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* Return value :
* value -1 : unimplement
* value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode
* 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_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
* 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()
*/

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_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
*/

View file

@ -1,20 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "PPCBrain.h"
#include "PPC.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
* 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
* 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_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
* BaseAddress : the virtual memory address we setup to use.
* 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
* translate it, Disambler will not calc the
* the row name right so we simple give each
row a name. In translations mode we run a
* analys so we getting better optimzing and
row a name. In translations mode we run a
* analys so we getting better optimzing and
* only row name there we need.
* value for mode are :
* 0 = disambler mode
* 1 = translate mode intel
*
* return value
* 0 : Ok
* 1 : unimplemt
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
@ -121,11 +121,11 @@ CPU_INT PPCBrain( CPU_BYTE *cpu_buffer,
/* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos)
{
{
if (retcode == 0)
{
{
/* 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;
}
}

View file

@ -2,10 +2,10 @@
#include "../../misc.h"
/* 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
* 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
/* 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
* 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
* 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 */
/*
* no mask we implement function getting the reg right
* no mask we implement function getting the reg right
*/
/* bit index

View file

@ -1,28 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "PPC.h"
#include "../../misc.h"
#include "../../any_op.h"
/* reg r0-r31
/* reg r0-r31
r3 = eax
*/
/* cpuDummyInit_Add
* Input param :
* out : The file pointer that we write to (the output file to intel asm)
* Input param :
* 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_pos : Current positions in the cpu_buffer
* cpu_pos : Current positions in 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,
* 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
* other or any sub model.
*
* Return value :
* value -1 : unimplement
* value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode
* 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);
/* 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
*/

View file

@ -1,22 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "DummyBrain.h"
#include "Dummy.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
* 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
* 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_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
* BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one
@ -24,8 +24,8 @@
* outfp : the output file pointer
*
* return value
* 0 : Ok
* 1 : unimplemt
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
@ -52,10 +52,10 @@ CPU_INT DummyBrain( CPU_BYTE *cpu_buffer,
to read from the memory the
Le is for small endian and the
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]);
/* Add */
if ((cpuint - (cpuint & GetMaskByte(cpuDummyInit_Add))) == ConvertBitToByte(cpuDummyInit_Add))
{
@ -66,7 +66,7 @@ CPU_INT DummyBrain( CPU_BYTE *cpu_buffer,
else
cpu_pos += retsize;
}
/* Found all Opcode and breakout and return no error found */
if (cpu_pos >=cpu_size)
{
@ -75,11 +75,11 @@ CPU_INT DummyBrain( CPU_BYTE *cpu_buffer,
/* Check if we have found a cpu opcode */
if (cpu_oldpos == cpu_pos)
{
{
if (retcode == 0)
{
{
/* 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;
}
}

View file

@ -2,10 +2,10 @@
#include "../../misc.h"
/* 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
* 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
/* 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
* 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
* 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};

View file

@ -1,34 +1,34 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "Dummy.h"
#include "../../misc.h"
/* cpuDummyInit_Add
* Input param :
* out : The file pointer that we write to (the output file to intel asm)
* Input param :
* 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_pos : Current positions in the cpu_buffer
* cpu_pos : Current positions in 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,
* 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
* other or any sub model.
* Return value :
* value -1 : unimplement
* value -1 : unimplement
* value 0 : wrong opcode or not vaild opcode
* 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_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
* 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()
*/

View file

@ -1,20 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "M68kBrain.h"
#include "m68k.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
* 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
* 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_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
* BaseAddress : the virtual memory address we setup to use.
* cpuarch : the sub arch for the brain, example if it exists more one
@ -22,8 +22,8 @@
* outfp : the output file pointer
*
* return value
* 0 : Ok
* 1 : unimplemt
* 0 : Ok
* 1 : unimplemt
* 2 : Unkonwn Opcode
* 3 : unimplement cpu
* 4 : unknown machine
@ -47,7 +47,7 @@ CPU_INT M68KBrain( CPU_BYTE *cpu_buffer,
cpu_oldpos = cpu_pos;
cpuint = cpu_buffer[cpu_pos];
/* Abcd */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_Abcd))) == ConvertBitToByte(cpuM68kInit_Abcd))
{
@ -120,7 +120,7 @@ CPU_INT M68KBrain( CPU_BYTE *cpu_buffer,
}
/* AndToCCR */
if ((cpuint - (cpuint & GetMaskByte(cpuM68kInit_AndToCCRF))) == ConvertBitToByte(cpuM68kInit_AndToCCRF))
{
{
cpuint = cpu_buffer[cpu_pos+1];
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 */
if (cpu_oldpos == cpu_pos)
{
{
if (retcode == 0)
{
{
/* 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;
}
}
@ -316,5 +316,5 @@ CPU_INT M68KBrain( CPU_BYTE *cpu_buffer,
break;
}
}
return retcode;
return retcode;
}

View file

@ -1,7 +1,7 @@
#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_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};

View file

@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "m68k.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 Ry;
//CPU_INT cpuint;
opmode = ConvertBitToByte(M68k_Opmode);
mode = ConvertBitToByte(M68k_Mode);
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)
{
/* <ea> + Dn -> Dn */
/* <ea> + Dn -> Dn */
printf(";Add unimplement of \"<ea> + Dn -> Dn\" \n");
}
if (opmode == 0x01)
@ -54,7 +54,7 @@ CPU_INT M68k_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
/* <ea> + An -> An */
printf(";Add unimplement of \"<ea> + An -> An\" \n");
}
if (opmode == 0x04)
{
/* Dn + <ea> -> <ea> */
@ -80,9 +80,9 @@ CPU_INT M68k_Add(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
}
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_POWERPC;
/*
* infileName file name to convert or disambler
* infileName file name to convert or disambler
* outputfileName file name to save to
* BaseAddress the address we should emulate
* 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.
* translate mode : 1 intel
* translate mode : 2 ppc
*
*
*/
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 type, CPU_INT mode)
{
FILE *infp;
FILE *outfp;
CPU_BYTE *cpu_buffer;
CPU_BYTE *cpu_buffer;
CPU_UNINT cpu_pos = 0;
CPU_UNINT cpu_size=0;
CPU_INT ret;
//fopen("testms.exe","RB");
/* Open file for read */
@ -94,7 +94,7 @@ CPU_INT LoadPFileImage( char *infileName, char *outputfileName,
fclose(outfp);
return 5;
}
/* get the memory size buffer */
cpu_size = ftell(infp);
if (ferror(infp))
@ -145,7 +145,7 @@ CPU_INT LoadPFileImage( char *infileName, char *outputfileName,
}
fclose(infp);
if (type==0)
if (type==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);
@ -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)
{
ExportEntry = (PIMAGE_NT_HEADERS) (((ULONG)memory) +
(ULONG)(NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress -
SectionHeader[i].VirtualAddress +
(ULONG)(NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress -
SectionHeader[i].VirtualAddress +
SectionHeader[i].PointerToRawData));
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@
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,
0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D,
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,
0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB, 0x2591, 0x2592, 0x2593, 0x2502,
0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C,
0x255B, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, 0x2568, 0x2564,
0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588,
0x2584, 0x258C, 0x2590, 0x2580, 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3,
0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219,
0x255B, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, 0x2568, 0x2564,
0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588,
0x2584, 0x258C, 0x2590, 0x2580, 0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3,
0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219,
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,
0x2584, 0x00A6, 0x00CC, 0x2580, 0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5,
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};

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
<define name="_WIN32_IE">0x0501</define>
<define name="_WIN32_WINNT">0x0501</define>
<library>kernel32</library>
<library>gdi32</library>
<library>gdi32</library>
<file>applicat.c</file>
<file>barchart.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_INTERNAL_NAME "edit\0"

View file

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

View file

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

View file

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

View file

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

View file

@ -25,7 +25,7 @@ BEGIN
PUSHBUTTON "&Cancel", IDCANCEL, 207, 90, 54, 15
END
STRINGTABLE DISCARDABLE
STRINGTABLE DISCARDABLE
BEGIN
IDS_WINDOW_TITLE "¡Descargar! - 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
END
STRINGTABLE DISCARDABLE
STRINGTABLE DISCARDABLE
BEGIN
IDS_WINDOW_TITLE "Télécharger ! - 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
END
STRINGTABLE DISCARDABLE
STRINGTABLE DISCARDABLE
BEGIN
IDS_WINDOW_TITLE "Download ! - ReactOS Downloader"
IDS_WELCOME_TITLE "Selamat datang di ReactOS Downloader"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,7 +10,7 @@ void UpdateDefragInfo (HWND Dlg)
char PercentText[100];
Defrag = (Defragment *) GetWindowLongPtr (Dlg, GWLP_USERDATA);
sprintf (PercentText, "%6.2f%%", Defrag->GetStatusPercent());
PercentItem = GetDlgItem (Dlg, IDC_PERCENT);
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;
len4fn = (totalWidth - len4path);
}
/*
if halfTotLen was adjusted above to avoid a rounding error, give the
extra wchar_t to the filename
/*
if halfTotLen was adjusted above to avoid a rounding error, give the
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);
else
swprintf (fmtStrPath, L"%%s");
if (fnLen > len4fn) swprintf (fmtStrFile, L"%%.%ds...", len4fn-3);
else
swprintf (fmtStrFile, L"%%s");
@ -74,8 +74,8 @@ int FitName (wchar_t *destination, const wchar_t *path, const wchar_t *filename,
wcscat (fmtString, fmtStrFile);
/*swprintf (fmtString, L"%s%s", fmtStrPath, fmtStrFile);*/
swprintf (destination, fmtString, path,filename);
return (1);
return (1);
}
@ -304,7 +304,7 @@ void Defragment::Start (void)
break;
}
//
//
Info = Volume.GetDBFile (i);
PreviousClusters = ClustersProgress;
@ -367,7 +367,7 @@ void Defragment::Start (void)
}
}
}
// New: Only update bitmap if it's older than 15 seconds
if ((GetTickCount() - LastBMPUpdate) < 15000)
Retry = 1;

View file

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

View file

@ -99,8 +99,8 @@ public:
// builds list of files on drive
// 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
bool IsClusterUsed (uint64 Cluster);
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
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
FONT 8, "MS Sans Serif", 0, 0, 0x1
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
COMBOBOX IDC_METHODS_LIST,135,52,77,79,CBS_DROPDOWNLIST |
COMBOBOX IDC_METHODS_LIST,135,52,77,79,CBS_DROPDOWNLIST |
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
PUSHBUTTON "Start",IDC_STARTSTOP,294,7,45,15
PUSHBUTTON "Help",ID_MAIN_HELP,294,28,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
LTEXT "Choose a drive:",-1,78,40,50,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
CONTROL "Static",IDC_STATUS,"Static",SS_LEFTNOWORDWRAP |
CONTROL "Static",IDC_STATUS,"Static",SS_LEFTNOWORDWRAP |
SS_SUNKEN | WS_GROUP,7,86,332,10
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
@ -116,7 +116,7 @@ END
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
GUIDELINES DESIGNINFO
BEGIN
IDD_MAIN, DIALOG
BEGIN
@ -143,18 +143,18 @@ END
// TEXTINCLUDE
//
1 TEXTINCLUDE
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
2 TEXTINCLUDE
BEGIN
"#include ""windows.h""\r\n"
"\0"
END
3 TEXTINCLUDE
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"

View file

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

View file

@ -29,7 +29,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
// DiskSizeBytes
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);
}
else
@ -44,7 +44,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
// DiskFreeBytes
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);
}
else
@ -85,7 +85,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
// FilesSizeBytes
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);
}
else
@ -99,7 +99,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
// Files SizeOnDisk
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);
}
else
@ -107,14 +107,14 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
AddCommas (Text, (Report.FilesSizeBytes + Report.FilesSlackBytes) / (uint64)BytesDivisor);
wcscat (Text, L" ");
wcscat (Text, BytesUnits);
}
SetDlgItemText (Dlg, IDC_FILESSIZEONDISK, Text);
// FilesSlackBytes
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);
}
else
@ -141,7 +141,7 @@ void SetReportInfo (HWND Dlg, DefragReport &Report, uint32 BytesDivisor, wchar_t
if (PFRec)
{
swprintf
swprintf
(
Text2,
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?
if (Report.PercentSlack >= 10.0f)
{
swprintf
swprintf
(
Text2,
Text2,
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"that you use a disk utility such as Partition Magic to "

View file

@ -23,7 +23,7 @@ bool CheckWinVer (void)
ZeroMemory (&OSVersion, sizeof (OSVersion));
OSVersion.dwOSVersionInfoSize = sizeof (OSVersion);
GetVersionEx (&OSVersion);
// Need Windows 2000!
// Check for NT first
@ -246,7 +246,7 @@ int wmain (int argc, wchar_t **argv)
for (size_t d = 0; d < Drives.size (); d++)
{
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)
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());
}
}

View file

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

View file

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

View file

@ -144,7 +144,7 @@ ScreenAddDevice(
{
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
* when loaded */
Status = IoCreateDevice(

View file

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

View file

@ -4,32 +4,32 @@
LIBRARY DFLAT32.DLL
EXPORTS
DfCreateWindow
DfInitialize ;message.c
DfCreateWindow
DfInitialize ;message.c
DfPostMessage ;message.c
DfSendMessage ;message.c
DfDispatchMessage ;message.c
handshake ;message.c
TestCriticalError ;stubs.c
;DefaultWndProc
;BaseWndProc
;WindowHeight
;WindowWidth
;ClientWidth
;ClientHeight
;GetTop
;GetBottom
;GetLeft
;GetRight
;GetClientTop
;GetClientBottom
;GetClientLeft
;GetClientRight
;GetParent
;DefaultWndProc
;BaseWndProc
;WindowHeight
;WindowWidth
;ClientWidth
;ClientHeight
;GetTop
;GetBottom
;GetLeft
;GetRight
;GetClientTop
;GetClientBottom
;GetClientLeft
;GetClientRight
;GetParent
;FirstWindow
;LastWindow
;LastWindow
;NextWindow
;PrevWindow
;PrevWindow
CharInView
;TopBorderAdj
;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_STR_FILE_DESCRIPTION "dflat32 console windowing library\0"

View file

@ -6,7 +6,7 @@
* conjunction with the documentation file libjpeg.doc.
*
* 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
* (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
* if we asked for color quantization.
* In this example, we need to make an output work buffer of the right size.
*/
*/
/* JSAMPLEs per row in output buffer */
row_stride = cinfo.output_width * cinfo.output_components;
/* 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)
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
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);
/* 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,
SIZEOF(c_derived_tbl));
dtbl = *pdtbl;
/* Figure C.1: make table of Huffman code length for each symbol */
p = 0;
@ -217,7 +217,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
}
huffsize[p] = 0;
lastp = p;
/* Figure C.2: generate the codes themselves */
/* 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;
si++;
}
/* Figure C.3: generate encoding tables */
/* 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);
put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */
put_bits += size; /* new number of bits in buffer */
put_buffer <<= 24 - put_bits; /* align incoming bits */
put_buffer |= state->cur.put_buffer; /* and merge with old buffer contents */
while (put_bits >= 8) {
int c = (int) ((put_buffer >> 16) & 0xFF);
emit_byte(state, c, return FALSE);
if (c == 0xFF) { /* need to stuff a zero byte? */
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 nbits;
register int k, r, i;
/* Encode the DC coefficient difference per section F.1.2.1 */
temp = temp2 = block[0] - last_dc_val;
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 */
temp2--;
}
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0;
while (temp) {
@ -379,7 +379,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
*/
if (nbits > MAX_COEF_BITS+1)
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
/* Emit the Huffman-coded symbol for the number of bits */
if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))
return FALSE;
@ -391,9 +391,9 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
return FALSE;
/* Encode the AC coefficients per section F.1.2.2 */
r = 0; /* r = run length of zeros */
for (k = 1; k < DCTSIZE2; k++) {
if ((temp = block[jpeg_natural_order[k]]) == 0) {
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 */
temp2--;
}
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 1; /* there must be at least one 1 bit */
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 */
if (nbits > MAX_COEF_BITS)
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
/* Emit Huffman symbol for run length / number of bits */
i = (r << 4) + nbits;
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. */
if (! emit_bits(state, (unsigned int) temp2, nbits))
return FALSE;
r = 0;
}
}
@ -575,13 +575,13 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
register int temp;
register int nbits;
register int k, r;
/* Encode the DC coefficient difference per section F.1.2.1 */
temp = block[0] - last_dc_val;
if (temp < 0)
temp = -temp;
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0;
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 */
dc_counts[nbits]++;
/* Encode the AC coefficients per section F.1.2.2 */
r = 0; /* r = run length of zeros */
for (k = 1; k < DCTSIZE2; k++) {
if ((temp = block[jpeg_natural_order[k]]) == 0) {
r++;
@ -610,11 +610,11 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
ac_counts[0xF0]++;
r -= 16;
}
/* Find the number of bits needed for the magnitude of the coefficient */
if (temp < 0)
temp = -temp;
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 1; /* there must be at least one 1 bit */
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 */
if (nbits > MAX_COEF_BITS)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count Huffman symbol for run length / number of bits */
ac_counts[(r << 4) + nbits]++;
r = 0;
}
}
@ -718,7 +718,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
MEMZERO(codesize, SIZEOF(codesize));
for (i = 0; i < 257; i++)
others[i] = -1; /* init links to empty */
freq[256] = 1; /* make sure 256 has a nonzero count */
/* Including the pseudo-symbol 256 in the Huffman procedure guarantees
* 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 */
if (c2 < 0)
break;
/* Else merge the two counts/trees */
freq[c1] += freq[c2];
freq[c2] = 0;
@ -764,9 +764,9 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
c1 = others[c1];
codesize[c1]++;
}
others[c1] = c2; /* chain c2 onto c1's tree branch */
/* Increment the codesize of everything in c2's tree branch */
codesize[c2]++;
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
* one bit longer.
*/
for (i = MAX_CLEN; i > 16; i--) {
while (bits[i] > 0) {
j = i - 2; /* find length of new prefix to be used */
while (bits[j] == 0)
j--;
bits[i] -= 2; /* remove two symbols */
bits[i-1]++; /* one goes 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 */
i--;
bits[i]--;
/* Return final symbol counts (only for lengths 0..16) */
MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits));
/* 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
* 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_SOF2 = 0xc2,
M_SOF3 = 0xc3,
M_SOF5 = 0xc5,
M_SOF6 = 0xc6,
M_SOF7 = 0xc7,
M_JPG = 0xc8,
M_SOF9 = 0xc9,
M_SOF10 = 0xca,
M_SOF11 = 0xcb,
M_SOF13 = 0xcd,
M_SOF14 = 0xce,
M_SOF15 = 0xcf,
M_DHT = 0xc4,
M_DAC = 0xcc,
M_RST0 = 0xd0,
M_RST1 = 0xd1,
M_RST2 = 0xd2,
@ -44,7 +44,7 @@ typedef enum { /* JPEG marker codes */
M_RST5 = 0xd5,
M_RST6 = 0xd6,
M_RST7 = 0xd7,
M_SOI = 0xd8,
M_EOI = 0xd9,
M_SOS = 0xda,
@ -53,7 +53,7 @@ typedef enum { /* JPEG marker codes */
M_DRI = 0xdd,
M_DHP = 0xde,
M_EXP = 0xdf,
M_APP0 = 0xe0,
M_APP1 = 0xe1,
M_APP2 = 0xe2,
@ -70,13 +70,13 @@ typedef enum { /* JPEG marker codes */
M_APP13 = 0xed,
M_APP14 = 0xee,
M_APP15 = 0xef,
M_JPG0 = 0xf0,
M_JPG13 = 0xfd,
M_COM = 0xfe,
M_TEM = 0x01,
M_ERROR = 0x100
} JPEG_MARKER;
@ -186,7 +186,7 @@ emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
{
JHUFF_TBL * htbl;
int length, i;
if (is_ac) {
htbl = cinfo->ac_huff_tbl_ptrs[index];
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)
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
if (! htbl->sent_table) {
emit_marker(cinfo, M_DHT);
length = 0;
for (i = 1; i <= 16; i++)
length += htbl->bits[i];
emit_2bytes(cinfo, length + 2 + 1 + 16);
emit_byte(cinfo, index);
for (i = 1; i <= 16; i++)
emit_byte(cinfo, htbl->bits[i]);
for (i = 0; i < length; i++)
emit_byte(cinfo, htbl->huffval[i]);
htbl->sent_table = TRUE;
}
}
@ -229,24 +229,24 @@ emit_dac (j_compress_ptr cinfo)
char ac_in_use[NUM_ARITH_TBLS];
int length, i;
jpeg_component_info *compptr;
for (i = 0; i < NUM_ARITH_TBLS; i++)
dc_in_use[i] = ac_in_use[i] = 0;
for (i = 0; i < cinfo->comps_in_scan; i++) {
compptr = cinfo->cur_comp_info[i];
dc_in_use[compptr->dc_tbl_no] = 1;
ac_in_use[compptr->ac_tbl_no] = 1;
}
length = 0;
for (i = 0; i < NUM_ARITH_TBLS; i++)
length += dc_in_use[i] + ac_in_use[i];
emit_marker(cinfo, M_DAC);
emit_2bytes(cinfo, length*2 + 2);
for (i = 0; i < NUM_ARITH_TBLS; i++) {
if (dc_in_use[i]) {
emit_byte(cinfo, i);
@ -266,7 +266,7 @@ emit_dri (j_compress_ptr cinfo)
/* Emit a DRI marker */
{
emit_marker(cinfo, M_DRI);
emit_2bytes(cinfo, 4); /* fixed length */
emit_2bytes(cinfo, (int) cinfo->restart_interval);
@ -279,9 +279,9 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
{
int ci;
jpeg_component_info *compptr;
emit_marker(cinfo, code);
emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
/* 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;
jpeg_component_info *compptr;
emit_marker(cinfo, M_SOS);
emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
emit_byte(cinfo, cinfo->comps_in_scan);
for (i = 0; i < cinfo->comps_in_scan; i++) {
compptr = cinfo->cur_comp_info[i];
emit_byte(cinfo, compptr->component_id);
@ -360,9 +360,9 @@ emit_jfif_app0 (j_compress_ptr cinfo)
* Thumbnail X size (1 byte)
* Thumbnail Y size (1 byte)
*/
emit_marker(cinfo, M_APP0);
emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
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
* whether the encoder performed a transformation, which is pretty useless.
*/
emit_marker(cinfo, M_APP14);
emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */
@ -496,7 +496,7 @@ write_frame_header (j_compress_ptr cinfo)
int ci, prec;
boolean is_baseline;
jpeg_component_info *compptr;
/* Emit DQT for each quantization table.
* Note that emit_dqt() suppresses any duplicate tables.
*/

View file

@ -7,7 +7,7 @@
*
* This file contains master control logic for the JPEG compressor.
* 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).
*/
@ -153,7 +153,7 @@ validate_script (j_compress_ptr cinfo)
#ifdef C_PROGRESSIVE_SUPPORTED
cinfo->progressive_mode = TRUE;
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++)
*last_bitpos_ptr++ = -1;
#else
@ -161,7 +161,7 @@ validate_script (j_compress_ptr cinfo)
#endif
} else {
cinfo->progressive_mode = FALSE;
for (ci = 0; ci < cinfo->num_components; ci++)
for (ci = 0; ci < cinfo->num_components; ci++)
component_sent[ci] = FALSE;
}
@ -311,16 +311,16 @@ per_scan_setup (j_compress_ptr cinfo)
{
int ci, mcublks, tmp;
jpeg_component_info *compptr;
if (cinfo->comps_in_scan == 1) {
/* Noninterleaved (single-component) scan */
compptr = cinfo->cur_comp_info[0];
/* Overall image size in MCUs */
cinfo->MCUs_per_row = compptr->width_in_blocks;
cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
/* For noninterleaved scan, always one block per MCU */
compptr->MCU_width = 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);
if (tmp == 0) tmp = compptr->v_samp_factor;
compptr->last_row_height = tmp;
/* Prepare array describing MCU composition */
cinfo->blocks_in_MCU = 1;
cinfo->MCU_membership[0] = 0;
} else {
/* Interleaved (multi-component) scan */
if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
MAX_COMPS_IN_SCAN);
/* Overall image size in MCUs */
cinfo->MCUs_per_row = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width,
@ -352,9 +352,9 @@ per_scan_setup (j_compress_ptr cinfo)
cinfo->MCU_rows_in_scan = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height,
(long) (cinfo->max_v_samp_factor*DCTSIZE));
cinfo->blocks_in_MCU = 0;
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
/* 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;
}
}
}
/* 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 };
static const UINT8 val_dc_luminance[] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
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 };
static const UINT8 val_dc_chrominance[] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
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 };
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,
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa };
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 };
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,
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa };
add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
bits_dc_luminance, val_dc_luminance);
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)
start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
{
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
boolean is_DC_band;
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 */
put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */
put_bits += size; /* new number of bits in buffer */
put_buffer <<= 24 - put_bits; /* align incoming bits */
put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */
while (put_bits >= 8) {
int c = (int) ((put_buffer >> 16) & 0xFF);
emit_byte(entropy, c);
if (c == 0xFF) { /* need to stuff a zero byte? */
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 */
temp2--;
}
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0;
while (temp) {
@ -428,10 +428,10 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
*/
if (nbits > MAX_COEF_BITS+1)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count/emit the Huffman-coded symbol for the number of bits */
emit_symbol(entropy, compptr->dc_tbl_no, nbits);
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
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];
/* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
r = 0; /* r = run length of zeros */
for (k = cinfo->Ss; k <= Se; k++) {
if ((temp = (*block)[jpeg_natural_order[k]]) == 0) {
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 */
r = 0; /* r = run length of zeros */
BR = 0; /* BR = count of buffered bits added now */
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)
finish_pass_phuff (j_compress_ptr cinfo)
{
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
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)
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
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);
/* 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->out_color_space = JCS_GRAYSCALE;
break;
case 3:
if (cinfo->saw_JFIF_marker) {
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. */
cinfo->out_color_space = JCS_RGB;
break;
case 4:
if (cinfo->saw_Adobe_marker) {
switch (cinfo->Adobe_transform) {
@ -208,7 +208,7 @@ default_decompress_parms (j_decompress_ptr cinfo)
}
cinfo->out_color_space = JCS_CMYK;
break;
default:
cinfo->jpeg_color_space = JCS_UNKNOWN;
cinfo->out_color_space = JCS_UNKNOWN;
@ -437,10 +437,10 @@ static int mmxsupport()
pushfd //Save Eflag to stack
pop eax //Get Eflag from stack into eax
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
popfd //Restored modified value back to Eflag reg
popfd //Restored modified value back to Eflag reg
pushfd //Save Eflag to stack
pop eax //Get Eflag from stack
xor eax, ecx //Compare the new Eflag with the original Eflag
@ -449,16 +449,16 @@ static int mmxsupport()
//NOT_SUPPORTED label
xor eax, eax //Set eax to zero
cpuid
cmp eax, 1 //make sure eax return non-zero value
jl NOT_SUPPORTED //If eax is zero, mmx not supported
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"
cpuid
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
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
@ -484,12 +484,12 @@ static int sse2support()
int my_edx;
_asm
{
mov eax, 01
cpuid
mov my_edx, edx
mov eax, 01
cpuid
mov my_edx, edx
}
if (my_edx & (0x1 << 26))
sse2available = 1;
if (my_edx & (0x1 << 26))
sse2available = 1;
else sse2available = 2;
return sse2available;

View file

@ -8,7 +8,7 @@
* This include file contains common declarations for the forward and
* inverse DCT modules. These declarations are private to the DCT managers
* (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).
*/

View file

@ -80,10 +80,10 @@ typedef union {
GLOBAL(void)
jpeg_idct_islow_sse2 (
j_decompress_ptr cinfo,
j_decompress_ptr cinfo,
jpeg_component_info * compptr,
JCOEFPTR coef_block,
JSAMPARRAY output_buf,
JSAMPARRAY output_buf,
JDIMENSION output_col);
@ -139,14 +139,14 @@ start_pass (j_decompress_ptr cinfo)
#else
method_ptr = jpeg_idct_islow;
method = JDCT_ISLOW;
#endif /* HAVE_SSE2_INTEL_MNEMONICS */
break;
#endif
#ifdef DCT_IFAST_SUPPORTED
case JDCT_IFAST:
#ifdef HAVE_SSE2_INTEL_MNEMONICS
if (SSE2Available==1)
if (SSE2Available==1)
{
method_ptr = jpeg_idct_islow_sse2;
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));
dtbl = *pdtbl;
dtbl->pub = htbl; /* fill in back link */
/* Figure C.1: make table of Huffman code length for each symbol */
p = 0;
@ -189,10 +189,10 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
}
huffsize[p] = 0;
numsymbols = p;
/* Figure C.2: generate the codes themselves */
/* We also validate that the counts represent a legal Huffman code tree. */
code = 0;
si = huffsize[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 */
for (k = 1; k < DCTSIZE2; k++) {
HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
r = s >> 4;
s &= 15;
if (s) {
k += r;
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 */
for (k = 1; k < DCTSIZE2; k++) {
HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
r = s >> 4;
s &= 15;
if (s) {
k += r;
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;
jpeg_component_info *compptr;
if (cinfo->comps_in_scan == 1) {
/* Noninterleaved (single-component) scan */
compptr = cinfo->cur_comp_info[0];
/* Overall image size in MCUs */
cinfo->MCUs_per_row = compptr->width_in_blocks;
cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
/* For noninterleaved scan, always one block per MCU */
compptr->MCU_width = 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);
if (tmp == 0) tmp = compptr->v_samp_factor;
compptr->last_row_height = tmp;
/* Prepare array describing MCU composition */
cinfo->blocks_in_MCU = 1;
cinfo->MCU_membership[0] = 0;
} else {
/* Interleaved (multi-component) scan */
if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
MAX_COMPS_IN_SCAN);
/* Overall image size in MCUs */
cinfo->MCUs_per_row = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width,
@ -165,9 +165,9 @@ per_scan_setup (j_decompress_ptr cinfo)
cinfo->MCU_rows_in_scan = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height,
(long) (cinfo->max_v_samp_factor*DCTSIZE));
cinfo->blocks_in_MCU = 0;
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
/* 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;
}
}
}
}

View file

@ -22,24 +22,24 @@ typedef enum { /* JPEG marker codes */
M_SOF1 = 0xc1,
M_SOF2 = 0xc2,
M_SOF3 = 0xc3,
M_SOF5 = 0xc5,
M_SOF6 = 0xc6,
M_SOF7 = 0xc7,
M_JPG = 0xc8,
M_SOF9 = 0xc9,
M_SOF10 = 0xca,
M_SOF11 = 0xcb,
M_SOF13 = 0xcd,
M_SOF14 = 0xce,
M_SOF15 = 0xcf,
M_DHT = 0xc4,
M_DAC = 0xcc,
M_RST0 = 0xd0,
M_RST1 = 0xd1,
M_RST2 = 0xd2,
@ -48,7 +48,7 @@ typedef enum { /* JPEG marker codes */
M_RST5 = 0xd5,
M_RST6 = 0xd6,
M_RST7 = 0xd7,
M_SOI = 0xd8,
M_EOI = 0xd9,
M_SOS = 0xda,
@ -57,7 +57,7 @@ typedef enum { /* JPEG marker codes */
M_DRI = 0xdd,
M_DHP = 0xde,
M_EXP = 0xdf,
M_APP0 = 0xe0,
M_APP1 = 0xe1,
M_APP2 = 0xe2,
@ -74,13 +74,13 @@ typedef enum { /* JPEG marker codes */
M_APP13 = 0xed,
M_APP14 = 0xee,
M_APP15 = 0xef,
M_JPG0 = 0xf0,
M_JPG13 = 0xfd,
M_COM = 0xfe,
M_TEM = 0x01,
M_ERROR = 0x100
} JPEG_MARKER;
@ -198,7 +198,7 @@ get_soi (j_decompress_ptr cinfo)
/* Process an SOI marker */
{
int i;
TRACEMS(cinfo, 1, JTRC_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)
((j_common_ptr) cinfo, JPOOL_IMAGE,
cinfo->num_components * SIZEOF(jpeg_component_info));
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
compptr->component_index = ci;
@ -325,7 +325,7 @@ get_sos (j_decompress_ptr cinfo)
for (i = 0; i < n; i++) {
INPUT_BYTE(cinfo, cc, return FALSE);
INPUT_BYTE(cinfo, c, return FALSE);
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
if (cc == compptr->component_id)
@ -339,7 +339,7 @@ get_sos (j_decompress_ptr cinfo)
cinfo->cur_comp_info[i] = compptr;
compptr->dc_tbl_no = (c >> 4) & 15;
compptr->ac_tbl_no = (c ) & 15;
TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
compptr->dc_tbl_no, compptr->ac_tbl_no);
}
@ -379,7 +379,7 @@ get_dac (j_decompress_ptr cinfo)
INPUT_2BYTES(cinfo, length, return FALSE);
length -= 2;
while (length > 0) {
INPUT_BYTE(cinfo, index, return FALSE);
INPUT_BYTE(cinfo, val, return FALSE);
@ -428,12 +428,12 @@ get_dht (j_decompress_ptr cinfo)
INPUT_2BYTES(cinfo, length, return FALSE);
length -= 2;
while (length > 16) {
INPUT_BYTE(cinfo, index, return FALSE);
TRACEMS1(cinfo, 1, JTRC_DHT, index);
bits[0] = 0;
count = 0;
for (i = 1; i <= 16; i++) {
@ -473,7 +473,7 @@ get_dht (j_decompress_ptr cinfo)
if (*htblptr == NULL)
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval));
}
@ -508,7 +508,7 @@ get_dqt (j_decompress_ptr cinfo)
if (n >= NUM_QUANT_TBLS)
ERREXIT1(cinfo, JERR_DQT_INDEX, n);
if (cinfo->quant_tbl_ptrs[n] == NULL)
cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo);
quant_ptr = cinfo->quant_tbl_ptrs[n];
@ -553,7 +553,7 @@ get_dri (j_decompress_ptr cinfo)
INPUT_VARS(cinfo);
INPUT_2BYTES(cinfo, length, return FALSE);
if (length != 4)
ERREXIT(cinfo, JERR_BAD_LENGTH);
@ -850,7 +850,7 @@ skip_variable (j_decompress_ptr cinfo)
INPUT_2BYTES(cinfo, length, return FALSE);
length -= 2;
TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length);
INPUT_SYNC(cinfo); /* do before skip_input_data */
@ -1013,32 +1013,32 @@ read_markers (j_decompress_ptr cinfo)
return JPEG_SUSPENDED;
cinfo->unread_marker = 0; /* processed the marker */
return JPEG_REACHED_SOS;
case M_EOI:
TRACEMS(cinfo, 1, JTRC_EOI);
cinfo->unread_marker = 0; /* processed the marker */
return JPEG_REACHED_EOI;
case M_DAC:
if (! get_dac(cinfo))
return JPEG_SUSPENDED;
break;
case M_DHT:
if (! get_dht(cinfo))
return JPEG_SUSPENDED;
break;
case M_DQT:
if (! get_dqt(cinfo))
return JPEG_SUSPENDED;
break;
case M_DRI:
if (! get_dri(cinfo))
return JPEG_SUSPENDED;
break;
case M_APP0:
case M_APP1:
case M_APP2:
@ -1059,7 +1059,7 @@ read_markers (j_decompress_ptr cinfo)
cinfo->unread_marker - (int) M_APP0]) (cinfo))
return JPEG_SUSPENDED;
break;
case M_COM:
if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo))
return JPEG_SUSPENDED;
@ -1193,10 +1193,10 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
{
int marker = cinfo->unread_marker;
int action = 1;
/* Always put up a warning. */
WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
/* Outer loop handles repeated decision after scanning forward. */
for (;;) {
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
* 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
* 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
* off the end of memory and getting a bad-pointer trap, we perform the
* 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,
JSAMPARRAY output_buf)
{
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
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,
JSAMPARRAY output_buf);
#endif
METHODDEF(void)
h2v2_merged_upsample (j_decompress_ptr cinfo,
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 * Cbgtab = upsample->Cb_g_tab;
SHIFT_TEMPS
// Added for MMX
// Added for MMX
register int width = cinfo->image_width;
int cols = cinfo->output_width;
int cols_asm = (cols >> 3);
@ -448,13 +448,13 @@ h2v2_merged_upsample_mmx (j_decompress_ptr cinfo,
outptr1 = output_buf[1];
/* Loop for each group of output pixels */
_asm
{
mov esi, inptr00
mov eax, inptr01
mov ebx, inptr2
mov ecx, inptr1
@ -464,7 +464,7 @@ h2v2_merged_upsample_mmx (j_decompress_ptr cinfo,
mov edx, outptr1
do_next16:
movd mm0, [ebx] ; Cr7 Cr6.....Cr1 Cr0
pxor mm6, mm6
@ -480,20 +480,20 @@ do_next16:
punpcklbw mm0, mm6 ; Cr0 Cr0 Cr0 Cr0
psubsw mm0, mm7 ; Cr0 - 128:Cr0-128:Cr0-128:Cr0 -128
movd mm1, [ecx] ; Cb7 Cb6...... Cb1 Cb0
psllw mm0, 2 ; left shift by 2 bits
punpcklbw mm1, mm1 ; Cb3 Cb3 Cb2 Cb2 Cb1 Cb1 Cb0 Cb0
paddsw mm0, const05 ; add (one_half/fix(x)) << 2
punpcklwd mm1, mm1 ; Cb1 Cb1 Cb1 Cb1 Cb0 Cb0 Cb0 Cb0
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
@ -504,14 +504,14 @@ do_next16:
punpckhbw mm5, mm6 ; Cb1 Cb1 Cb1 Cb1
psllw mm1, 2 ; left shift by 2 bits
paddsw mm1, const15 ; add (one_half/fix(x)) << 2
psubsw mm4, mm7 ; Cr1 - 128:Cr1-128:Cr1-128:Cr1 -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
@ -521,7 +521,7 @@ do_next16:
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
@ -533,7 +533,7 @@ do_next16:
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
@ -558,13 +558,13 @@ do_next16:
psllq mm3, 16 ; cgr1 cred1 0 0
movq mm6, mm1 ; 0 0 Y5 Y5 Y4 Y4 Y1 Y1
por mm2, mm3 ; cgr1 cred1 cbl0 cgr0
punpcklbw mm6, empty ; Y4 Y4 Y1 Y1
movd mm3, [eax] ; Y15 Y14 Y11 Y10 Y7 Y6 Y3 Y2
paddsw mm6, mm2 ; g4 r4 b1 g1
packuswb mm7, mm6 ; g4 r4 b1 g1 r1 b0 g0 r0
@ -594,7 +594,7 @@ do_next16:
punpcklbw mm6, empty ; Y6 Y6 Y3 Y3
psrlq mm1, 24 ; 0 0 0 0 0 Y5 Y5 Y4
paddsw mm6, mm2 ; g6 r6 b3 g3
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
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
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
psrlq mm2, 32 ; 0 0 0 0 0 0 Y7 Y7
psrlq mm0, 16
psrlq mm2, 32 ; 0 0 0 0 0 0 Y7 Y7
psrlq mm0, 16
punpcklbw mm1, empty ; Y5 Y5 Y5 Y4
punpcklwd mm5, mm2 ; X X X X Y7 Y7 Y7 Y6
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
punpcklbw mm0, mm0 ; X X X X Cr3 Cr3 Cr2 Cr2
paddsw mm5, mm4 ; b7 g7 r7 b6
punpcklwd mm0, mm0 ; Cr3 Cr3 Cr3 Cr3 Cr2 Cr2 Cr2 Cr2
movq mm4, mm0
movd mm3, [ecx] ; Cb9 Cb8...... Cb3 Cb2
punpcklbw mm0, mm6 ; Cr2 Cr2 Cr2 Cr2
psrlq mm3, 16
@ -650,57 +650,57 @@ do_next16:
punpcklwd mm3, mm3 ; Cb3 Cb3 Cb3 Cb3 Cb2 Cb2 Cb2 Cb2
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
psubsw mm3, const128 ; Cb0 - 128:Cb0-128:Cb0-128:Cb0 -128
punpckhbw mm4, mm6 ; Cr3 Cr3 Cr3 Cr3
psllw mm3, 2 ; left shift by 2 bits
paddsw mm3, const15 ; add (one_half/fix(x)) << 2
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
paddsw mm0, mm3 ; cred2 cbl2 cgr2 cred2
psllw mm7, 2 ; left shift by 2 bits
psubsw mm4, const128 ; Cr3 - 128:Cr3-128:Cr3-128:Cr3 -128
movd mm3, [esi+4] ; Y21 Y20 Y17 Y16 Y13 Y12 Y9 Y8
psllw mm4, 2 ; left shift by 2 bits
paddsw mm7, const55 ; add (one_half/fix(x)) << 2
movq mm6, mm3 ; Y21 Y20 Y17 Y16 Y13 Y12 Y9 Y8
movq mm2, mm0
pand mm2, davemask
punpcklbw mm3, mm3 ; Y13 Y13 Y12 Y12 Y9 Y9 Y8 Y8
psrlq mm2, 16
paddsw mm4, const45 ; add (one_half/fix(x)) << 2
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
paddsw mm4, mm7 ; cbl3 cgr3 cred3 cbl3
paddsw mm3, mm0 ; r9 b8 g8 r8
@ -710,13 +710,13 @@ do_next16:
packuswb mm1, mm3 ; r9 b8 g8 r8 b5 g5 r5 b4
movd mm3, [eax+4] ; Y23 Y22 Y19 Y18 Y15 Y14 Y11 Y10
pand mm7, davemask
psrlq mm6, 8 ; 0 Y21 Y20 Y17 Y16 Y13 Y12 Y9
psllq mm7, 16
movq [edi+8], mm1 ; move to memory r9 b8 g8 r8 b5 g5 r5 b4
por mm2, mm7
@ -732,7 +732,7 @@ do_next16:
punpcklbw mm3, mm1 ; Y11 Y10 Y10 Y10
psrlq mm7, 8 ; 0 Y23 Y22 Y19 Y18 Y15 Y14 Y11
paddsw mm3, mm0 ; r11 b10 g10 r10
movq mm0, mm7 ; 0 Y23 Y22 Y19 Y18 Y15 Y14 Y11
@ -769,11 +769,11 @@ do_next16:
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
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
@ -782,17 +782,17 @@ do_next16:
psrlq mm0, 16 ; X X X X X X Y15 Y15
add edi, 24
punpcklwd mm5, mm0 ; X X X X Y15 Y15 Y15 Y14
packuswb mm6, mm1 ; b13 g13 r13 b12 g12 r12 b9 g9
add edx, 24
punpcklbw mm5, empty ; Y15 Y15 Y15 Y14
add ebx, 4
paddsw mm5, mm4 ; b15 g15 r15 b14
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
add ecx, 4
movq [edx-8], mm7 ; move to memory b15 g15 r15 b14 g14 r14 b11 g11
dec cols_asm
jnz do_next16
EMMS
}
inptr1 += (cols_asm_copy<<2);
inptr2 += (cols_asm_copy<<2);
@ -823,7 +823,7 @@ do_next16:
outptr0 += cols_asm_copy*24;
outptr1 += cols_asm_copy*24;
//for (col = cinfo->output_width >> 1; col > 0; col--) {
/* Do the chroma part of the calculation */
/*cb = GETJSAMPLE(*inptr1++);
@ -883,9 +883,9 @@ do_next16:
outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue];
outptr1 += RGB_PIXELSIZE;
}
}
/* If image width is odd, do the last output column separately */
//if (cinfo->output_width & 1) {
if (diff & 1) {
@ -902,7 +902,7 @@ do_next16:
outptr1[RGB_RED] = range_limit[y + cred];
outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue];
}
}
}
#else

View file

@ -263,7 +263,7 @@ process_restart (j_decompress_ptr cinfo)
/*
* Huffman MCU decoding.
* 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,
* but are not dequantized.
*
@ -284,7 +284,7 @@ process_restart (j_decompress_ptr cinfo)
METHODDEF(boolean)
decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int Al = cinfo->Al;
register int s, r;
@ -355,7 +355,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
METHODDEF(boolean)
decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int Se = cinfo->Se;
int Al = cinfo->Al;
@ -440,7 +440,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
METHODDEF(boolean)
decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
int blkn;
@ -489,7 +489,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
METHODDEF(boolean)
decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int Se = cinfo->Se;
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->num_components*DCTSIZE2*SIZEOF(int));
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++)
*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
* 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;
/* And not more than what the client can accept: */
out_rows_avail -= *out_row_ctr;

View file

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

View file

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

View file

@ -160,36 +160,36 @@ jpeg_fdct_islow (DCTELEM * data)
tmp5 = dataptr[2] - dataptr[5];
tmp3 = dataptr[3] + dataptr[4];
tmp4 = dataptr[3] - dataptr[4];
/* Even part per LL&M figure 1 --- note that published figure is faulty;
* rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
*/
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS);
dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS);
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
CONST_BITS-PASS1_BITS);
dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
CONST_BITS-PASS1_BITS);
/* Odd part per figure 8 --- note paper omits factor of sqrt(2).
* cK represents cos(K*pi/16).
* i0..i3 in the paper are tmp4..tmp7 here.
*/
z1 = tmp4 + tmp7;
z2 = tmp5 + tmp6;
z3 = tmp4 + tmp6;
z4 = tmp5 + tmp7;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* 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) */
@ -198,15 +198,15 @@ jpeg_fdct_islow (DCTELEM * data)
z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5;
z4 += z5;
dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, 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[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */
}
@ -225,36 +225,36 @@ jpeg_fdct_islow (DCTELEM * data)
tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
tmp3 = 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;
* rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
*/
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
CONST_BITS+PASS1_BITS);
dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
CONST_BITS+PASS1_BITS);
/* Odd part per figure 8 --- note paper omits factor of sqrt(2).
* cK represents cos(K*pi/16).
* i0..i3 in the paper are tmp4..tmp7 here.
*/
z1 = tmp4 + tmp7;
z2 = tmp5 + tmp6;
z3 = tmp4 + tmp6;
z4 = tmp5 + tmp7;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* 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) */
@ -263,10 +263,10 @@ jpeg_fdct_islow (DCTELEM * data)
z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5;
z4 += z5;
dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,
CONST_BITS+PASS1_BITS);
dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,
@ -275,7 +275,7 @@ jpeg_fdct_islow (DCTELEM * data)
CONST_BITS+PASS1_BITS);
dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,
CONST_BITS+PASS1_BITS);
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
* column DCT calculations can be simplified this way.
*/
if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
inptr[DCTSIZE*7] == 0) {
/* AC terms all zero */
FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
wsptr[DCTSIZE*0] = dcval;
wsptr[DCTSIZE*1] = 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*6] = dcval;
wsptr[DCTSIZE*7] = dcval;
inptr++; /* advance pointers to next column */
quantptr++;
wsptr++;
continue;
}
/* Even part */
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;
tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12;
/* Odd part */
tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
@ -172,7 +172,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
quantptr++;
wsptr++;
}
/* 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. */
@ -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).
* And testing floats for zero is relatively expensive, so we don't bother.
*/
/* Even part */
tmp10 = wsptr[0] + wsptr[4];
@ -234,7 +234,7 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
& RANGE_MASK];
outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3)
& RANGE_MASK];
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
* column DCT calculations can be simplified this way.
*/
if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 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*6] = dcval;
wsptr[DCTSIZE*7] = dcval;
inptr++; /* advance pointers to next column */
quantptr++;
wsptr++;
continue;
}
/* Even part */
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;
tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12;
/* Odd part */
tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
@ -303,7 +303,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
quantptr++;
wsptr++;
}
/* 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, */
/* 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
* may be commented out.
*/
#ifndef NO_ZERO_ROW_TEST
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */
JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3)
& RANGE_MASK];
outptr[0] = dcval;
outptr[1] = dcval;
outptr[2] = dcval;
@ -339,7 +339,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
continue;
}
#endif
/* Even part */
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
* column DCT calculations can be simplified this way.
*/
if ((inptr[DCTSIZE*1] | inptr[DCTSIZE*2] | inptr[DCTSIZE*3] |
inptr[DCTSIZE*4] | inptr[DCTSIZE*5] | inptr[DCTSIZE*6] |
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*6] = dcval;
wsptr[DCTSIZE*7] = dcval;
inptr++; /* advance pointers to next column */
quantptr++;
wsptr++;
continue;
}
/* Even part */
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;
tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12;
/* Odd part */
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++;
wsptr++;
}
/* 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, */
/* 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
* may be commented out.
*/
#ifndef NO_ZERO_ROW_TEST
if ((wsptr[1] | wsptr[2] | wsptr[3] | wsptr[4] | wsptr[5] | wsptr[6] |
wsptr[7]) == 0) {
/* AC terms all zero */
JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3)
& RANGE_MASK];
outptr[0] = dcval;
outptr[1] = dcval;
outptr[2] = dcval;
@ -544,7 +544,7 @@ jpeg_idct_ifast_orig (j_decompress_ptr cinfo, jpeg_component_info * compptr,
continue;
}
#endif
/* Even part */
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 *quantptr=compptr->dct_table;
__asm{
__asm{
mov edi, quantptr
mov ebx, inptr
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;
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
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
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 */
@ -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
psllw mm5, 2 ;shift tmp1-tmp3
movq mm7, [ebx + 8*0] ;load inptr[DCTSIZE*0]
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]);
movq mm4, [ebx + 8*8] ;load inptr[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 */
@ -713,22 +713,22 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm1, mm7 ;copy tmp0 /* phase 3 */
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;
movq mm5, mm1 ;copy tmp11
paddw mm1, [esi+8*2] ;tmp1 = tmp11 + tmp12;
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;
movq mm0, mm7 ;copy tmp0
psubw mm5, [esi+8*2] ;tmp2 = tmp11 - tmp12;
paddw mm7, mm3 ;wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
psubw mm0, mm3 ;wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
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;
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
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
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 */
@ -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
psllw mm5, 2 ;shift tmp1-tmp3
movq mm7, [ebx + 8*0] ;load inptr[DCTSIZE*0]
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]);
movq mm4, [ebx + 8*8] ;load inptr[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 */
@ -853,22 +853,22 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm1, mm7 ;copy tmp0 /* phase 3 */
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;
movq mm5, mm1 ;copy tmp11
paddw mm1, [esi+8*2] ;tmp1 = tmp11 + tmp12;
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;
movq mm0, mm7 ;copy tmp0
psubw mm5, [esi+8*2] ;tmp2 = tmp11 - tmp12;
paddw mm7, mm3 ;wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7);
psubw mm0, mm3 ;wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7);
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 mm2, mm0
movq mm3, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3]
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 mm5, mm3
paddw mm3, mm4 ;wsptr[1,tmp10],[xxx],[1,tmp13],[xxx]
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]
punpckldq mm1, mm2 ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14]
paddw mm3, mm5 ;wsptr[2,tmp10],[xxx],[2,tmp13],[xxx]
movq mm2, mm6
@ -963,7 +963,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm5, mm3
punpcklwd mm3, mm6 ;wsptr[2,tmp10],[3,tmp10],[xxx],[xxx]
psubw mm2, mm7 ;wsptr[3,tmp11],[xxx],[3,tmp14],[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
paddw mm2, mm4 ;wsptr[xxx],[0,z11],[xxx],[0,z13]
//Continue with z10 --- z13
movq mm6, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3]
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]
movq mm1, mm6
//Save tmp2 and tmp3 in wsptr
paddw mm6, mm0 ;wsptr[xxx],[1,z11],[xxx],[1,z13]
movq mm4, mm2
//Continue with z10 --- z13
movq [esi+8*2], mm5 ;save tmp2
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]
movq mm2, mm6
movq mm4, [esi+8*7] ;wsptr[3,4],[3,5],[3,6],[3,7]
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) */
// + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */
movq mm4, mm2 ;final1
pmulhw mm0, fix_184n261
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
psraw mm6, 5 ;outptr[0,6],[1,6],[2,6],[3,6]
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]
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]
@ -1252,9 +1252,9 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
add eax, 4
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]
movq [ecx], mm2
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
/*******************************************************************/
add esi, 64
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 mm2, mm0
movq mm3, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3]
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 mm5, mm3
paddw mm3, mm4 ;wsptr[1,tmp10],[xxx],[1,tmp13],[xxx]
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]
punpckldq mm1, mm2 ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14]
paddw mm3, mm5 ;wsptr[2,tmp10],[xxx],[2,tmp13],[xxx]
movq mm2, mm6
@ -1332,7 +1332,7 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
movq mm5, mm3
punpcklwd mm3, mm6 ;wsptr[2,tmp10],[3,tmp10],[xxx],[xxx]
psubw mm2, mm7 ;wsptr[3,tmp11],[xxx],[3,tmp14],[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
paddw mm2, mm4 ;wsptr[xxx],[0,z11],[xxx],[0,z13]
//Continue with z10 --- z13
movq mm6, [esi+8*2] ;wsptr[1,0],[1,1],[1,2],[1,3]
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]
movq mm1, mm6
//Save tmp2 and tmp3 in wsptr
paddw mm6, mm0 ;wsptr[xxx],[1,z11],[xxx],[1,z13]
movq mm4, mm2
//Continue with z10 --- z13
movq [esi+8*2], mm5 ;save tmp2
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]
movq mm2, mm6
movq mm4, [esi+8*7] ;wsptr[3,4],[3,5],[3,6],[3,7]
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) */
// + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */
movq mm4, mm2 ;final1
pmulhw mm0, fix_184n261
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
psraw mm6, 5 ;outptr[0,6],[1,6],[2,6],[3,6]
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]
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]
@ -1621,9 +1621,9 @@ jpeg_idct_ifast_mmx (j_decompress_ptr cinfo, jpeg_component_info * compptr,
add eax, 4
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]
movq [ecx], mm2
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
* column DCT calculations can be simplified this way.
*/
if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
inptr[DCTSIZE*7] == 0) {
/* AC terms all zero */
int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
wsptr[DCTSIZE*0] = dcval;
wsptr[DCTSIZE*1] = 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*6] = dcval;
wsptr[DCTSIZE*7] = dcval;
inptr++; /* advance pointers to next column */
quantptr++;
wsptr++;
continue;
}
/* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
tmp0 = (z2 + z3) << CONST_BITS;
tmp1 = (z2 - z3) << CONST_BITS;
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
/* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* 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) */
@ -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) */
z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
tmp3 += z1 + z4;
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
wsptr[DCTSIZE*0] = (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);
@ -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*3] = (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 */
quantptr++;
wsptr++;
}
/* 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, */
/* 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
* may be commented out.
*/
#ifndef NO_ZERO_ROW_TEST
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
& RANGE_MASK];
outptr[0] = dcval;
outptr[1] = dcval;
outptr[2] = dcval;
@ -304,40 +304,40 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
continue;
}
#endif
/* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */
z2 = (INT32) wsptr[2];
z3 = (INT32) wsptr[6];
z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS;
tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS;
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
/* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
tmp0 = (INT32) wsptr[7];
tmp1 = (INT32) wsptr[5];
tmp2 = (INT32) wsptr[3];
tmp3 = (INT32) wsptr[1];
z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* 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) */
@ -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) */
z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
tmp3 += z1 + z4;
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3,
CONST_BITS+PASS1_BITS+3)
& 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,
CONST_BITS+PASS1_BITS+3)
& RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */
}
}
@ -422,7 +422,7 @@ typedef signed char Ipp8s;
typedef signed short Ipp16s;
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_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 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_2 1236 * (6 - BITS_INV_ACC) /* 0.6035 */
#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_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_6 -512 * (6 - BITS_INV_ACC) /* -0.25 */
#define c_inv_corr_7 -651 * (6 - BITS_INV_ACC) /* -0.3176 */
#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 RND_INV_ROW_0 RND_INV_ROW + c_inv_corr_0
#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 */
__declspec(align(16)) short tab_i_04[] = {
16384, 21407, 16384, 8867,
-16384, 21407, 16384, -8867,
16384, -8867, 16384, -21407,
16384, 8867, -16384, -21407,
22725, 19266, 19266, -4520,
4520, 19266, 19266, -22725,
12873, -22725, 4520, -12873,
12873, 4520, -22725, -12873};
__declspec(align(16)) short tab_i_04[] = {
16384, 21407, 16384, 8867,
-16384, 21407, 16384, -8867,
16384, -8867, 16384, -21407,
16384, 8867, -16384, -21407,
22725, 19266, 19266, -4520,
4520, 19266, 19266, -22725,
12873, -22725, 4520, -12873,
12873, 4520, -22725, -12873};
/* Table for rows 1,7 - constants are multiplied on cos_1_16 */
__declspec(align(16)) short tab_i_17[] = {
22725, 29692, 22725, 12299,
-22725, 29692, 22725, -12299,
22725, -12299, 22725, -29692,
22725, 12299, -22725, -29692,
31521, 26722, 26722, -6270,
6270, 26722, 26722, -31521,
17855, -31521, 6270, -17855,
17855, 6270, -31521, -17855};
22725, 29692, 22725, 12299,
-22725, 29692, 22725, -12299,
22725, -12299, 22725, -29692,
22725, 12299, -22725, -29692,
31521, 26722, 26722, -6270,
6270, 26722, 26722, -31521,
17855, -31521, 6270, -17855,
17855, 6270, -31521, -17855};
/* Table for rows 2,6 - constants are multiplied on cos_2_16 */
__declspec(align(16)) short tab_i_26[] = {
21407, 27969, 21407, 11585,
-21407, 27969, 21407, -11585,
21407, -11585, 21407, -27969,
21407, 11585, -21407, -27969,
29692, 25172, 25172, -5906,
5906, 25172, 25172, -29692,
16819, -29692, 5906, -16819,
16819, 5906, -29692, -16819};
21407, 27969, 21407, 11585,
-21407, 27969, 21407, -11585,
21407, -11585, 21407, -27969,
21407, 11585, -21407, -27969,
29692, 25172, 25172, -5906,
5906, 25172, 25172, -29692,
16819, -29692, 5906, -16819,
16819, 5906, -29692, -16819};
/* Table for rows 3,5 - constants are multiplied on cos_3_16 */
__declspec(align(16)) short tab_i_35[] = {
19266, 25172, 19266, 10426,
-19266, 25172, 19266, -10426,
19266, -10426, 19266, -25172,
19266, 10426, -19266, -25172,
26722, 22654, 22654, -5315,
5315, 22654, 22654, -26722,
15137, -26722, 5315, -15137,
15137, 5315, -26722, -15137};
19266, 25172, 19266, 10426,
-19266, 25172, 19266, -10426,
19266, -10426, 19266, -25172,
19266, 10426, -19266, -25172,
26722, 22654, 22654, -5315,
5315, 22654, 22654, -26722,
15137, -26722, 5315, -15137,
15137, 5315, -26722, -15137};
__declspec(align(16)) long round_i_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,
@ -545,7 +545,7 @@ __declspec(align(16)) short cos_4_16[] = {
*
*-----------------------------------------------------------------------------
*/
#define DCT_8_INV_ROW_2R(TABLE, ROUND1, ROUND2) __asm { \
__asm pshuflw xmm1, xmm0, 10001000b \
__asm pshuflw xmm0, xmm0, 11011101b \
@ -707,7 +707,7 @@ __declspec(align(16)) short cos_4_16[] = {
GLOBAL(void)
dct_8x8_inv_16s ( short *src, short *dst ) {
__asm {
mov ecx, src
@ -716,26 +716,26 @@ dct_8x8_inv_16s ( short *src, short *dst ) {
movdqa xmm0, [ecx+0*16]
movdqa xmm4, [ecx+4*16]
DCT_8_INV_ROW_2R(tab_i_04, round_i_0, round_i_4)
movdqa [edx+0*16], xmm1
movdqa [edx+4*16], xmm5
movdqa [edx+0*16], xmm1
movdqa [edx+4*16], xmm5
movdqa xmm0, [ecx+1*16]
movdqa xmm4, [ecx+7*16]
DCT_8_INV_ROW_2R(tab_i_17, round_i_1, round_i_7)
movdqa [edx+1*16], xmm1
movdqa [edx+7*16], xmm5
movdqa [edx+1*16], xmm1
movdqa [edx+7*16], xmm5
movdqa xmm0, [ecx+3*16]
movdqa xmm4, [ecx+5*16]
DCT_8_INV_ROW_2R(tab_i_35, round_i_3, round_i_5);
movdqa [edx+3*16], xmm1
movdqa [edx+5*16], xmm5
movdqa [edx+3*16], xmm1
movdqa [edx+5*16], xmm5
movdqa xmm0, [ecx+2*16]
movdqa xmm4, [ecx+6*16]
DCT_8_INV_ROW_2R(tab_i_26, round_i_2, round_i_6);
movdqa [edx+2*16], xmm1
movdqa [edx+6*16], xmm5
movdqa [edx+6*16], xmm5
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:
* ippiDCTQuantInv8x8LS_JPEG_16s8u_C1R
*
@ -913,33 +913,33 @@ ippiDCTQuantInv8x8LS_JPEG_16s8u_C1R(
{
__declspec(align(16)) Ipp8u buf[DCTSIZE2*sizeof(Ipp16s)];
Ipp16s * workbuf = (Ipp16s *)buf;
Ipp16s * workbuf = (Ipp16s *)buf;
ownpj_QuantInv_8x8_16s(pSrc,workbuf,pQuantInvTable);
dct_8x8_inv_16s(workbuf,workbuf);
ownpj_Add128_8x8_16s8u(workbuf,pDst,DstStep);
}
}
GLOBAL(void)
jpeg_idct_islow_sse2 (
j_decompress_ptr cinfo,
j_decompress_ptr cinfo,
jpeg_component_info * compptr,
JCOEFPTR coef_block,
JSAMPARRAY output_buf,
JSAMPARRAY output_buf,
JDIMENSION output_col)
{
int ctr;
JCOEFPTR inptr;
Ipp16u* quantptr;
Ipp8u* wsptr;
__declspec(align(16)) Ipp8u workspace[DCTSIZE2];
__declspec(align(16)) Ipp8u workspace[DCTSIZE2];
JSAMPROW outptr;
inptr = coef_block;
quantptr = (Ipp16u*)compptr->dct_table;
wsptr = workspace;
ippiDCTQuantInv8x8LS_JPEG_16s8u_C1R(inptr, workspace, 8, quantptr);
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) {
/* AC terms all zero; we need not examine term 4 for 4x4 output */
int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS;
wsptr[DCTSIZE*0] = dcval;
wsptr[DCTSIZE*1] = dcval;
wsptr[DCTSIZE*2] = dcval;
wsptr[DCTSIZE*3] = dcval;
continue;
}
/* Even part */
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
tmp0 <<= (CONST_BITS+1);
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865);
tmp10 = tmp0 + tmp2;
tmp12 = tmp0 - tmp2;
/* Odd part */
z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
+ MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */
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*1] = (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. */
wsptr = workspace;
@ -204,46 +204,46 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
/* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
& RANGE_MASK];
outptr[0] = dcval;
outptr[1] = dcval;
outptr[2] = dcval;
outptr[3] = dcval;
wsptr += DCTSIZE; /* advance pointer to next row */
continue;
}
#endif
/* Even part */
tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1);
tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065)
+ MULTIPLY((INT32) wsptr[6], - FIX_0_765366865);
tmp10 = tmp0 + tmp2;
tmp12 = tmp0 - tmp2;
/* Odd part */
z1 = (INT32) wsptr[7];
z2 = (INT32) wsptr[5];
z3 = (INT32) wsptr[3];
z4 = (INT32) wsptr[1];
tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
+ MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */
tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */
outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2,
CONST_BITS+PASS1_BITS+3+1)
& 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,
CONST_BITS+PASS1_BITS+3+1)
& RANGE_MASK];
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) {
/* 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;
wsptr[DCTSIZE*0] = dcval;
wsptr[DCTSIZE*1] = dcval;
continue;
}
/* Even part */
z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
tmp10 = z1 << (CONST_BITS+2);
/* Odd part */
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) */
/* Final output stage */
wsptr[DCTSIZE*0] = (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. */
wsptr = workspace;
@ -336,19 +336,19 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
/* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3)
& RANGE_MASK];
outptr[0] = dcval;
outptr[1] = dcval;
wsptr += DCTSIZE; /* advance pointer to next row */
continue;
}
#endif
/* Even part */
tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2);
/* Odd part */
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) */
/* Final output stage */
outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3+2)
& RANGE_MASK];
outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3+2)
& RANGE_MASK];
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.
* 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.
* 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
* 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.dst_handle = 0;
spec.dst.ptr = buffer_address;
ctx.ds_si = (void far *) & spec;
ctx.ax = 0x0b00; /* EMB move */
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_HANDLE(spec) = 0;
DST_PTR(spec) = buffer_address;
ctx.ds_si = (void far *) & spec;
ctx.ax = 0x5700; /* move memory region */
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_PAGE(spec) = (unsigned short) (file_offset / EMSPAGESIZE);
DST_OFFSET(spec) = (unsigned short) (file_offset % EMSPAGESIZE);
ctx.ds_si = (void far *) & spec;
ctx.ax = 0x5700; /* move memory region */
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.
*/
static const size_t first_pool_slop[JPOOL_NUMPOOLS] =
static const size_t first_pool_slop[JPOOL_NUMPOOLS] =
{
1600, /* first PERMANENT 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 */
5000 /* additional IMAGE pools */

View file

@ -11,7 +11,7 @@
*/
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning (disable : 4142) /* benign redefinition of type */
#endif
@ -104,8 +104,8 @@ typedef short JCOEF;
/* Defines for MMX/SSE2 support. */
/* Disabled for AT&T and VC++ 6.0 */
#if defined(_M_IX86) && !defined(__GNUC__) && !(defined(_MSC_VER) && (_MSC_VER<1300))
#define HAVE_MMX_INTEL_MNEMONICS
#if defined(_M_IX86) && !defined(__GNUC__) && !(defined(_MSC_VER) && (_MSC_VER<1300))
#define HAVE_MMX_INTEL_MNEMONICS
/* SSE2 code appears broken for some cpus (bug 247437)
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;
int file_index;
/* 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;

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