forked from organicmaps/organicmaps
lineending fix
This commit is contained in:
parent
e66f95c539
commit
f2f0f6e308
8 changed files with 1674 additions and 1674 deletions
|
@ -1,58 +1,58 @@
|
|||
This directory contains a .Net wrapper class library for the ZLib1.dll
|
||||
|
||||
The wrapper includes support for inflating/deflating memory buffers,
|
||||
.Net streaming wrappers for the gz streams part of zlib, and wrappers
|
||||
for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples.
|
||||
|
||||
Directory structure:
|
||||
--------------------
|
||||
|
||||
LICENSE_1_0.txt - License file.
|
||||
readme.txt - This file.
|
||||
DotZLib.chm - Class library documentation
|
||||
DotZLib.build - NAnt build file
|
||||
DotZLib.sln - Microsoft Visual Studio 2003 solution file
|
||||
|
||||
DotZLib\*.cs - Source files for the class library
|
||||
|
||||
Unit tests:
|
||||
-----------
|
||||
The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher.
|
||||
To include unit tests in the build, define nunit before building.
|
||||
|
||||
|
||||
Build instructions:
|
||||
-------------------
|
||||
|
||||
1. Using Visual Studio.Net 2003:
|
||||
Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll)
|
||||
will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on
|
||||
you are building the release or debug version of the library. Check
|
||||
DotZLib/UnitTests.cs for instructions on how to include unit tests in the
|
||||
build.
|
||||
|
||||
2. Using NAnt:
|
||||
Open a command prompt with access to the build environment and run nant
|
||||
in the same directory as the DotZLib.build file.
|
||||
You can define 2 properties on the nant command-line to control the build:
|
||||
debug={true|false} to toggle between release/debug builds (default=true).
|
||||
nunit={true|false} to include or esclude unit tests (default=true).
|
||||
Also the target clean will remove binaries.
|
||||
Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
|
||||
or ./DotZLib/bin/debug, depending on whether you are building the release
|
||||
or debug version of the library.
|
||||
|
||||
Examples:
|
||||
nant -D:debug=false -D:nunit=false
|
||||
will build a release mode version of the library without unit tests.
|
||||
nant
|
||||
will build a debug version of the library with unit tests
|
||||
nant clean
|
||||
will remove all previously built files.
|
||||
|
||||
|
||||
---------------------------------
|
||||
Copyright (c) Henrik Ravn 2004
|
||||
|
||||
Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
This directory contains a .Net wrapper class library for the ZLib1.dll
|
||||
|
||||
The wrapper includes support for inflating/deflating memory buffers,
|
||||
.Net streaming wrappers for the gz streams part of zlib, and wrappers
|
||||
for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples.
|
||||
|
||||
Directory structure:
|
||||
--------------------
|
||||
|
||||
LICENSE_1_0.txt - License file.
|
||||
readme.txt - This file.
|
||||
DotZLib.chm - Class library documentation
|
||||
DotZLib.build - NAnt build file
|
||||
DotZLib.sln - Microsoft Visual Studio 2003 solution file
|
||||
|
||||
DotZLib\*.cs - Source files for the class library
|
||||
|
||||
Unit tests:
|
||||
-----------
|
||||
The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher.
|
||||
To include unit tests in the build, define nunit before building.
|
||||
|
||||
|
||||
Build instructions:
|
||||
-------------------
|
||||
|
||||
1. Using Visual Studio.Net 2003:
|
||||
Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll)
|
||||
will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on
|
||||
you are building the release or debug version of the library. Check
|
||||
DotZLib/UnitTests.cs for instructions on how to include unit tests in the
|
||||
build.
|
||||
|
||||
2. Using NAnt:
|
||||
Open a command prompt with access to the build environment and run nant
|
||||
in the same directory as the DotZLib.build file.
|
||||
You can define 2 properties on the nant command-line to control the build:
|
||||
debug={true|false} to toggle between release/debug builds (default=true).
|
||||
nunit={true|false} to include or esclude unit tests (default=true).
|
||||
Also the target clean will remove binaries.
|
||||
Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
|
||||
or ./DotZLib/bin/debug, depending on whether you are building the release
|
||||
or debug version of the library.
|
||||
|
||||
Examples:
|
||||
nant -D:debug=false -D:nunit=false
|
||||
will build a release mode version of the library without unit tests.
|
||||
nant
|
||||
will build a debug version of the library with unit tests
|
||||
nant clean
|
||||
will remove all previously built files.
|
||||
|
||||
|
||||
---------------------------------
|
||||
Copyright (c) Henrik Ravn 2004
|
||||
|
||||
Use, modification and distribution are subject to the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
|
|
@ -1,186 +1,186 @@
|
|||
/* inffas8664.c is a hand tuned assembler version of inffast.c - fast decoding
|
||||
* version for AMD64 on Windows using Microsoft C compiler
|
||||
*
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*
|
||||
* Copyright (C) 2003 Chris Anderson <christop@charm.net>
|
||||
* Please use the copyright conditions above.
|
||||
*
|
||||
* 2005 - Adaptation to Microsoft C Compiler for AMD64 by Gilles Vollant
|
||||
*
|
||||
* inffas8664.c call function inffas8664fnc in inffasx64.asm
|
||||
* inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
|
||||
*
|
||||
* Dec-29-2003 -- I added AMD64 inflate asm support. This version is also
|
||||
* slightly quicker on x86 systems because, instead of using rep movsb to copy
|
||||
* data, it uses rep movsw, which moves data in 2-byte chunks instead of single
|
||||
* bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates
|
||||
* from http://fedora.linux.duke.edu/fc1_x86_64
|
||||
* which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with
|
||||
* 1GB ram. The 64-bit version is about 4% faster than the 32-bit version,
|
||||
* when decompressing mozilla-source-1.3.tar.gz.
|
||||
*
|
||||
* Mar-13-2003 -- Most of this is derived from inffast.S which is derived from
|
||||
* the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at
|
||||
* the moment. I have successfully compiled and tested this code with gcc2.96,
|
||||
* gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S
|
||||
* compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX
|
||||
* enabled. I will attempt to merge the MMX code into this version. Newer
|
||||
* versions of this and inffast.S can be found at
|
||||
* http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "zutil.h"
|
||||
#include "inftrees.h"
|
||||
#include "inflate.h"
|
||||
#include "inffast.h"
|
||||
|
||||
/* Mark Adler's comments from inffast.c: */
|
||||
|
||||
/*
|
||||
Decode literal, length, and distance codes and write out the resulting
|
||||
literal and match bytes until either not enough input or output is
|
||||
available, an end-of-block is encountered, or a data error is encountered.
|
||||
When large enough input and output buffers are supplied to inflate(), for
|
||||
example, a 16K input buffer and a 64K output buffer, more than 95% of the
|
||||
inflate execution time is spent in this routine.
|
||||
|
||||
Entry assumptions:
|
||||
|
||||
state->mode == LEN
|
||||
strm->avail_in >= 6
|
||||
strm->avail_out >= 258
|
||||
start >= strm->avail_out
|
||||
state->bits < 8
|
||||
|
||||
On return, state->mode is one of:
|
||||
|
||||
LEN -- ran out of enough output space or enough available input
|
||||
TYPE -- reached end of block code, inflate() to interpret next block
|
||||
BAD -- error in block data
|
||||
|
||||
Notes:
|
||||
|
||||
- The maximum input bits used by a length/distance pair is 15 bits for the
|
||||
length code, 5 bits for the length extra, 15 bits for the distance code,
|
||||
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
||||
Therefore if strm->avail_in >= 6, then there is enough input to avoid
|
||||
checking for available input while decoding.
|
||||
|
||||
- The maximum bytes that a single length/distance pair can output is 258
|
||||
bytes, which is the maximum length that can be coded. inflate_fast()
|
||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
||||
output space.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
typedef struct inffast_ar {
|
||||
/* 64 32 x86 x86_64 */
|
||||
/* ar offset register */
|
||||
/* 0 0 */ void *esp; /* esp save */
|
||||
/* 8 4 */ void *ebp; /* ebp save */
|
||||
/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */
|
||||
/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */
|
||||
/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */
|
||||
/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */
|
||||
/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */
|
||||
/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */
|
||||
/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */
|
||||
/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */
|
||||
/* 80 40 */ size_t /*unsigned long */hold; /* edx rdx local strm->hold */
|
||||
/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */
|
||||
/* 92 48 */ unsigned wsize; /* window size */
|
||||
/* 96 52 */ unsigned write; /* window write index */
|
||||
/*100 56 */ unsigned lmask; /* r12 mask for lcode */
|
||||
/*104 60 */ unsigned dmask; /* r13 mask for dcode */
|
||||
/*108 64 */ unsigned len; /* r14 match length */
|
||||
/*112 68 */ unsigned dist; /* r15 match distance */
|
||||
/*116 72 */ unsigned status; /* set when state chng*/
|
||||
} type_ar;
|
||||
#ifdef ASMINF
|
||||
|
||||
void inflate_fast(strm, start)
|
||||
z_streamp strm;
|
||||
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
type_ar ar;
|
||||
void inffas8664fnc(struct inffast_ar * par);
|
||||
|
||||
|
||||
|
||||
#if (defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )) || (defined(_MSC_VER) && defined(_M_AMD64))
|
||||
#define PAD_AVAIL_IN 6
|
||||
#define PAD_AVAIL_OUT 258
|
||||
#else
|
||||
#define PAD_AVAIL_IN 5
|
||||
#define PAD_AVAIL_OUT 257
|
||||
#endif
|
||||
|
||||
/* copy state to local variables */
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
|
||||
ar.in = strm->next_in;
|
||||
ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN);
|
||||
ar.out = strm->next_out;
|
||||
ar.beg = ar.out - (start - strm->avail_out);
|
||||
ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT);
|
||||
ar.wsize = state->wsize;
|
||||
ar.write = state->wnext;
|
||||
ar.window = state->window;
|
||||
ar.hold = state->hold;
|
||||
ar.bits = state->bits;
|
||||
ar.lcode = state->lencode;
|
||||
ar.dcode = state->distcode;
|
||||
ar.lmask = (1U << state->lenbits) - 1;
|
||||
ar.dmask = (1U << state->distbits) - 1;
|
||||
|
||||
/* decode literals and length/distances until end-of-block or not enough
|
||||
input data or output space */
|
||||
|
||||
/* align in on 1/2 hold size boundary */
|
||||
while (((size_t)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) {
|
||||
ar.hold += (unsigned long)*ar.in++ << ar.bits;
|
||||
ar.bits += 8;
|
||||
}
|
||||
|
||||
inffas8664fnc(&ar);
|
||||
|
||||
if (ar.status > 1) {
|
||||
if (ar.status == 2)
|
||||
strm->msg = "invalid literal/length code";
|
||||
else if (ar.status == 3)
|
||||
strm->msg = "invalid distance code";
|
||||
else
|
||||
strm->msg = "invalid distance too far back";
|
||||
state->mode = BAD;
|
||||
}
|
||||
else if ( ar.status == 1 ) {
|
||||
state->mode = TYPE;
|
||||
}
|
||||
|
||||
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
|
||||
ar.len = ar.bits >> 3;
|
||||
ar.in -= ar.len;
|
||||
ar.bits -= ar.len << 3;
|
||||
ar.hold &= (1U << ar.bits) - 1;
|
||||
|
||||
/* update state and return */
|
||||
strm->next_in = ar.in;
|
||||
strm->next_out = ar.out;
|
||||
strm->avail_in = (unsigned)(ar.in < ar.last ?
|
||||
PAD_AVAIL_IN + (ar.last - ar.in) :
|
||||
PAD_AVAIL_IN - (ar.in - ar.last));
|
||||
strm->avail_out = (unsigned)(ar.out < ar.end ?
|
||||
PAD_AVAIL_OUT + (ar.end - ar.out) :
|
||||
PAD_AVAIL_OUT - (ar.out - ar.end));
|
||||
state->hold = (unsigned long)ar.hold;
|
||||
state->bits = ar.bits;
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* inffas8664.c is a hand tuned assembler version of inffast.c - fast decoding
|
||||
* version for AMD64 on Windows using Microsoft C compiler
|
||||
*
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*
|
||||
* Copyright (C) 2003 Chris Anderson <christop@charm.net>
|
||||
* Please use the copyright conditions above.
|
||||
*
|
||||
* 2005 - Adaptation to Microsoft C Compiler for AMD64 by Gilles Vollant
|
||||
*
|
||||
* inffas8664.c call function inffas8664fnc in inffasx64.asm
|
||||
* inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
|
||||
*
|
||||
* Dec-29-2003 -- I added AMD64 inflate asm support. This version is also
|
||||
* slightly quicker on x86 systems because, instead of using rep movsb to copy
|
||||
* data, it uses rep movsw, which moves data in 2-byte chunks instead of single
|
||||
* bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates
|
||||
* from http://fedora.linux.duke.edu/fc1_x86_64
|
||||
* which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with
|
||||
* 1GB ram. The 64-bit version is about 4% faster than the 32-bit version,
|
||||
* when decompressing mozilla-source-1.3.tar.gz.
|
||||
*
|
||||
* Mar-13-2003 -- Most of this is derived from inffast.S which is derived from
|
||||
* the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at
|
||||
* the moment. I have successfully compiled and tested this code with gcc2.96,
|
||||
* gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S
|
||||
* compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX
|
||||
* enabled. I will attempt to merge the MMX code into this version. Newer
|
||||
* versions of this and inffast.S can be found at
|
||||
* http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "zutil.h"
|
||||
#include "inftrees.h"
|
||||
#include "inflate.h"
|
||||
#include "inffast.h"
|
||||
|
||||
/* Mark Adler's comments from inffast.c: */
|
||||
|
||||
/*
|
||||
Decode literal, length, and distance codes and write out the resulting
|
||||
literal and match bytes until either not enough input or output is
|
||||
available, an end-of-block is encountered, or a data error is encountered.
|
||||
When large enough input and output buffers are supplied to inflate(), for
|
||||
example, a 16K input buffer and a 64K output buffer, more than 95% of the
|
||||
inflate execution time is spent in this routine.
|
||||
|
||||
Entry assumptions:
|
||||
|
||||
state->mode == LEN
|
||||
strm->avail_in >= 6
|
||||
strm->avail_out >= 258
|
||||
start >= strm->avail_out
|
||||
state->bits < 8
|
||||
|
||||
On return, state->mode is one of:
|
||||
|
||||
LEN -- ran out of enough output space or enough available input
|
||||
TYPE -- reached end of block code, inflate() to interpret next block
|
||||
BAD -- error in block data
|
||||
|
||||
Notes:
|
||||
|
||||
- The maximum input bits used by a length/distance pair is 15 bits for the
|
||||
length code, 5 bits for the length extra, 15 bits for the distance code,
|
||||
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
||||
Therefore if strm->avail_in >= 6, then there is enough input to avoid
|
||||
checking for available input while decoding.
|
||||
|
||||
- The maximum bytes that a single length/distance pair can output is 258
|
||||
bytes, which is the maximum length that can be coded. inflate_fast()
|
||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
||||
output space.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
typedef struct inffast_ar {
|
||||
/* 64 32 x86 x86_64 */
|
||||
/* ar offset register */
|
||||
/* 0 0 */ void *esp; /* esp save */
|
||||
/* 8 4 */ void *ebp; /* ebp save */
|
||||
/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */
|
||||
/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */
|
||||
/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */
|
||||
/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */
|
||||
/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */
|
||||
/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */
|
||||
/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */
|
||||
/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */
|
||||
/* 80 40 */ size_t /*unsigned long */hold; /* edx rdx local strm->hold */
|
||||
/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */
|
||||
/* 92 48 */ unsigned wsize; /* window size */
|
||||
/* 96 52 */ unsigned write; /* window write index */
|
||||
/*100 56 */ unsigned lmask; /* r12 mask for lcode */
|
||||
/*104 60 */ unsigned dmask; /* r13 mask for dcode */
|
||||
/*108 64 */ unsigned len; /* r14 match length */
|
||||
/*112 68 */ unsigned dist; /* r15 match distance */
|
||||
/*116 72 */ unsigned status; /* set when state chng*/
|
||||
} type_ar;
|
||||
#ifdef ASMINF
|
||||
|
||||
void inflate_fast(strm, start)
|
||||
z_streamp strm;
|
||||
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
type_ar ar;
|
||||
void inffas8664fnc(struct inffast_ar * par);
|
||||
|
||||
|
||||
|
||||
#if (defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )) || (defined(_MSC_VER) && defined(_M_AMD64))
|
||||
#define PAD_AVAIL_IN 6
|
||||
#define PAD_AVAIL_OUT 258
|
||||
#else
|
||||
#define PAD_AVAIL_IN 5
|
||||
#define PAD_AVAIL_OUT 257
|
||||
#endif
|
||||
|
||||
/* copy state to local variables */
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
|
||||
ar.in = strm->next_in;
|
||||
ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN);
|
||||
ar.out = strm->next_out;
|
||||
ar.beg = ar.out - (start - strm->avail_out);
|
||||
ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT);
|
||||
ar.wsize = state->wsize;
|
||||
ar.write = state->wnext;
|
||||
ar.window = state->window;
|
||||
ar.hold = state->hold;
|
||||
ar.bits = state->bits;
|
||||
ar.lcode = state->lencode;
|
||||
ar.dcode = state->distcode;
|
||||
ar.lmask = (1U << state->lenbits) - 1;
|
||||
ar.dmask = (1U << state->distbits) - 1;
|
||||
|
||||
/* decode literals and length/distances until end-of-block or not enough
|
||||
input data or output space */
|
||||
|
||||
/* align in on 1/2 hold size boundary */
|
||||
while (((size_t)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) {
|
||||
ar.hold += (unsigned long)*ar.in++ << ar.bits;
|
||||
ar.bits += 8;
|
||||
}
|
||||
|
||||
inffas8664fnc(&ar);
|
||||
|
||||
if (ar.status > 1) {
|
||||
if (ar.status == 2)
|
||||
strm->msg = "invalid literal/length code";
|
||||
else if (ar.status == 3)
|
||||
strm->msg = "invalid distance code";
|
||||
else
|
||||
strm->msg = "invalid distance too far back";
|
||||
state->mode = BAD;
|
||||
}
|
||||
else if ( ar.status == 1 ) {
|
||||
state->mode = TYPE;
|
||||
}
|
||||
|
||||
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
|
||||
ar.len = ar.bits >> 3;
|
||||
ar.in -= ar.len;
|
||||
ar.bits -= ar.len << 3;
|
||||
ar.hold &= (1U << ar.bits) - 1;
|
||||
|
||||
/* update state and return */
|
||||
strm->next_in = ar.in;
|
||||
strm->next_out = ar.out;
|
||||
strm->avail_in = (unsigned)(ar.in < ar.last ?
|
||||
PAD_AVAIL_IN + (ar.last - ar.in) :
|
||||
PAD_AVAIL_IN - (ar.in - ar.last));
|
||||
strm->avail_out = (unsigned)(ar.out < ar.end ?
|
||||
PAD_AVAIL_OUT + (ar.end - ar.out) :
|
||||
PAD_AVAIL_OUT - (ar.out - ar.end));
|
||||
state->hold = (unsigned long)ar.hold;
|
||||
state->bits = ar.bits;
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,275 +1,275 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
|
||||
void MyDoMinus64(LARGE_INTEGER *R,LARGE_INTEGER A,LARGE_INTEGER B)
|
||||
{
|
||||
R->HighPart = A.HighPart - B.HighPart;
|
||||
if (A.LowPart >= B.LowPart)
|
||||
R->LowPart = A.LowPart - B.LowPart;
|
||||
else
|
||||
{
|
||||
R->LowPart = A.LowPart - B.LowPart;
|
||||
R->HighPart --;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _M_X64
|
||||
// see http://msdn2.microsoft.com/library/twchhe95(en-us,vs.80).aspx for __rdtsc
|
||||
unsigned __int64 __rdtsc(void);
|
||||
void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
// printf("rdtsc = %I64x\n",__rdtsc());
|
||||
pbeginTime64->QuadPart=__rdtsc();
|
||||
}
|
||||
|
||||
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
LARGE_INTEGER LIres;
|
||||
unsigned _int64 res=__rdtsc()-((unsigned _int64)(beginTime64.QuadPart));
|
||||
LIres.QuadPart=res;
|
||||
// printf("rdtsc = %I64x\n",__rdtsc());
|
||||
return LIres;
|
||||
}
|
||||
#else
|
||||
#ifdef _M_IX86
|
||||
void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
DWORD dwEdx,dwEax;
|
||||
_asm
|
||||
{
|
||||
rdtsc
|
||||
mov dwEax,eax
|
||||
mov dwEdx,edx
|
||||
}
|
||||
pbeginTime64->LowPart=dwEax;
|
||||
pbeginTime64->HighPart=dwEdx;
|
||||
}
|
||||
|
||||
void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
myGetRDTSC32(pbeginTime64);
|
||||
}
|
||||
|
||||
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
LARGE_INTEGER LIres,endTime64;
|
||||
myGetRDTSC32(&endTime64);
|
||||
|
||||
LIres.LowPart=LIres.HighPart=0;
|
||||
MyDoMinus64(&LIres,endTime64,beginTime64);
|
||||
return LIres;
|
||||
}
|
||||
#else
|
||||
void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
}
|
||||
|
||||
void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
}
|
||||
|
||||
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
LARGE_INTEGER lr;
|
||||
lr.QuadPart=0;
|
||||
return lr;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void BeginCountPerfCounter(LARGE_INTEGER * pbeginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(pbeginTime64)))
|
||||
{
|
||||
pbeginTime64->LowPart = GetTickCount();
|
||||
pbeginTime64->HighPart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD GetMsecSincePerfCounter(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
LARGE_INTEGER endTime64,ticksPerSecond,ticks;
|
||||
DWORDLONG ticksShifted,tickSecShifted;
|
||||
DWORD dwLog=16+0;
|
||||
DWORD dwRet;
|
||||
if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(&endTime64)))
|
||||
dwRet = (GetTickCount() - beginTime64.LowPart)*1;
|
||||
else
|
||||
{
|
||||
MyDoMinus64(&ticks,endTime64,beginTime64);
|
||||
QueryPerformanceFrequency(&ticksPerSecond);
|
||||
|
||||
|
||||
{
|
||||
ticksShifted = Int64ShrlMod32(*(DWORDLONG*)&ticks,dwLog);
|
||||
tickSecShifted = Int64ShrlMod32(*(DWORDLONG*)&ticksPerSecond,dwLog);
|
||||
|
||||
}
|
||||
|
||||
dwRet = (DWORD)((((DWORD)ticksShifted)*1000)/(DWORD)(tickSecShifted));
|
||||
dwRet *=1;
|
||||
}
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
int ReadFileMemory(const char* filename,long* plFileSize,void** pFilePtr)
|
||||
{
|
||||
FILE* stream;
|
||||
void* ptr;
|
||||
int retVal=1;
|
||||
stream=fopen(filename, "rb");
|
||||
if (stream==NULL)
|
||||
return 0;
|
||||
|
||||
fseek(stream,0,SEEK_END);
|
||||
|
||||
*plFileSize=ftell(stream);
|
||||
fseek(stream,0,SEEK_SET);
|
||||
ptr=malloc((*plFileSize)+1);
|
||||
if (ptr==NULL)
|
||||
retVal=0;
|
||||
else
|
||||
{
|
||||
if (fread(ptr, 1, *plFileSize,stream) != (*plFileSize))
|
||||
retVal=0;
|
||||
}
|
||||
fclose(stream);
|
||||
*pFilePtr=ptr;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int BlockSizeCompress=0x8000;
|
||||
int BlockSizeUncompress=0x8000;
|
||||
int cprLevel=Z_DEFAULT_COMPRESSION ;
|
||||
long lFileSize;
|
||||
unsigned char* FilePtr;
|
||||
long lBufferSizeCpr;
|
||||
long lBufferSizeUncpr;
|
||||
long lCompressedSize=0;
|
||||
unsigned char* CprPtr;
|
||||
unsigned char* UncprPtr;
|
||||
long lSizeCpr,lSizeUncpr;
|
||||
DWORD dwGetTick,dwMsecQP;
|
||||
LARGE_INTEGER li_qp,li_rdtsc,dwResRdtsc;
|
||||
|
||||
if (argc<=1)
|
||||
{
|
||||
printf("run TestZlib <File> [BlockSizeCompress] [BlockSizeUncompress] [compres. level]\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ReadFileMemory(argv[1],&lFileSize,&FilePtr)==0)
|
||||
{
|
||||
printf("error reading %s\n",argv[1]);
|
||||
return 1;
|
||||
}
|
||||
else printf("file %s read, %u bytes\n",argv[1],lFileSize);
|
||||
|
||||
if (argc>=3)
|
||||
BlockSizeCompress=atol(argv[2]);
|
||||
|
||||
if (argc>=4)
|
||||
BlockSizeUncompress=atol(argv[3]);
|
||||
|
||||
if (argc>=5)
|
||||
cprLevel=(int)atol(argv[4]);
|
||||
|
||||
lBufferSizeCpr = lFileSize + (lFileSize/0x10) + 0x200;
|
||||
lBufferSizeUncpr = lBufferSizeCpr;
|
||||
|
||||
CprPtr=(unsigned char*)malloc(lBufferSizeCpr + BlockSizeCompress);
|
||||
|
||||
BeginCountPerfCounter(&li_qp,TRUE);
|
||||
dwGetTick=GetTickCount();
|
||||
BeginCountRdtsc(&li_rdtsc);
|
||||
{
|
||||
z_stream zcpr;
|
||||
int ret=Z_OK;
|
||||
long lOrigToDo = lFileSize;
|
||||
long lOrigDone = 0;
|
||||
int step=0;
|
||||
memset(&zcpr,0,sizeof(z_stream));
|
||||
deflateInit(&zcpr,cprLevel);
|
||||
|
||||
zcpr.next_in = FilePtr;
|
||||
zcpr.next_out = CprPtr;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
long all_read_before = zcpr.total_in;
|
||||
zcpr.avail_in = min(lOrigToDo,BlockSizeCompress);
|
||||
zcpr.avail_out = BlockSizeCompress;
|
||||
ret=deflate(&zcpr,(zcpr.avail_in==lOrigToDo) ? Z_FINISH : Z_SYNC_FLUSH);
|
||||
lOrigDone += (zcpr.total_in-all_read_before);
|
||||
lOrigToDo -= (zcpr.total_in-all_read_before);
|
||||
step++;
|
||||
} while (ret==Z_OK);
|
||||
|
||||
lSizeCpr=zcpr.total_out;
|
||||
deflateEnd(&zcpr);
|
||||
dwGetTick=GetTickCount()-dwGetTick;
|
||||
dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);
|
||||
dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);
|
||||
printf("total compress size = %u, in %u step\n",lSizeCpr,step);
|
||||
printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.);
|
||||
printf("defcpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.);
|
||||
printf("defcpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
|
||||
}
|
||||
|
||||
CprPtr=(unsigned char*)realloc(CprPtr,lSizeCpr);
|
||||
UncprPtr=(unsigned char*)malloc(lBufferSizeUncpr + BlockSizeUncompress);
|
||||
|
||||
BeginCountPerfCounter(&li_qp,TRUE);
|
||||
dwGetTick=GetTickCount();
|
||||
BeginCountRdtsc(&li_rdtsc);
|
||||
{
|
||||
z_stream zcpr;
|
||||
int ret=Z_OK;
|
||||
long lOrigToDo = lSizeCpr;
|
||||
long lOrigDone = 0;
|
||||
int step=0;
|
||||
memset(&zcpr,0,sizeof(z_stream));
|
||||
inflateInit(&zcpr);
|
||||
|
||||
zcpr.next_in = CprPtr;
|
||||
zcpr.next_out = UncprPtr;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
long all_read_before = zcpr.total_in;
|
||||
zcpr.avail_in = min(lOrigToDo,BlockSizeUncompress);
|
||||
zcpr.avail_out = BlockSizeUncompress;
|
||||
ret=inflate(&zcpr,Z_SYNC_FLUSH);
|
||||
lOrigDone += (zcpr.total_in-all_read_before);
|
||||
lOrigToDo -= (zcpr.total_in-all_read_before);
|
||||
step++;
|
||||
} while (ret==Z_OK);
|
||||
|
||||
lSizeUncpr=zcpr.total_out;
|
||||
inflateEnd(&zcpr);
|
||||
dwGetTick=GetTickCount()-dwGetTick;
|
||||
dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);
|
||||
dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);
|
||||
printf("total uncompress size = %u, in %u step\n",lSizeUncpr,step);
|
||||
printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.);
|
||||
printf("uncpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.);
|
||||
printf("uncpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
|
||||
}
|
||||
|
||||
if (lSizeUncpr==lFileSize)
|
||||
{
|
||||
if (memcmp(FilePtr,UncprPtr,lFileSize)==0)
|
||||
printf("compare ok\n");
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
|
||||
void MyDoMinus64(LARGE_INTEGER *R,LARGE_INTEGER A,LARGE_INTEGER B)
|
||||
{
|
||||
R->HighPart = A.HighPart - B.HighPart;
|
||||
if (A.LowPart >= B.LowPart)
|
||||
R->LowPart = A.LowPart - B.LowPart;
|
||||
else
|
||||
{
|
||||
R->LowPart = A.LowPart - B.LowPart;
|
||||
R->HighPart --;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _M_X64
|
||||
// see http://msdn2.microsoft.com/library/twchhe95(en-us,vs.80).aspx for __rdtsc
|
||||
unsigned __int64 __rdtsc(void);
|
||||
void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
// printf("rdtsc = %I64x\n",__rdtsc());
|
||||
pbeginTime64->QuadPart=__rdtsc();
|
||||
}
|
||||
|
||||
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
LARGE_INTEGER LIres;
|
||||
unsigned _int64 res=__rdtsc()-((unsigned _int64)(beginTime64.QuadPart));
|
||||
LIres.QuadPart=res;
|
||||
// printf("rdtsc = %I64x\n",__rdtsc());
|
||||
return LIres;
|
||||
}
|
||||
#else
|
||||
#ifdef _M_IX86
|
||||
void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
DWORD dwEdx,dwEax;
|
||||
_asm
|
||||
{
|
||||
rdtsc
|
||||
mov dwEax,eax
|
||||
mov dwEdx,edx
|
||||
}
|
||||
pbeginTime64->LowPart=dwEax;
|
||||
pbeginTime64->HighPart=dwEdx;
|
||||
}
|
||||
|
||||
void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
myGetRDTSC32(pbeginTime64);
|
||||
}
|
||||
|
||||
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
LARGE_INTEGER LIres,endTime64;
|
||||
myGetRDTSC32(&endTime64);
|
||||
|
||||
LIres.LowPart=LIres.HighPart=0;
|
||||
MyDoMinus64(&LIres,endTime64,beginTime64);
|
||||
return LIres;
|
||||
}
|
||||
#else
|
||||
void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
}
|
||||
|
||||
void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
|
||||
{
|
||||
}
|
||||
|
||||
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
LARGE_INTEGER lr;
|
||||
lr.QuadPart=0;
|
||||
return lr;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void BeginCountPerfCounter(LARGE_INTEGER * pbeginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(pbeginTime64)))
|
||||
{
|
||||
pbeginTime64->LowPart = GetTickCount();
|
||||
pbeginTime64->HighPart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD GetMsecSincePerfCounter(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
|
||||
{
|
||||
LARGE_INTEGER endTime64,ticksPerSecond,ticks;
|
||||
DWORDLONG ticksShifted,tickSecShifted;
|
||||
DWORD dwLog=16+0;
|
||||
DWORD dwRet;
|
||||
if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(&endTime64)))
|
||||
dwRet = (GetTickCount() - beginTime64.LowPart)*1;
|
||||
else
|
||||
{
|
||||
MyDoMinus64(&ticks,endTime64,beginTime64);
|
||||
QueryPerformanceFrequency(&ticksPerSecond);
|
||||
|
||||
|
||||
{
|
||||
ticksShifted = Int64ShrlMod32(*(DWORDLONG*)&ticks,dwLog);
|
||||
tickSecShifted = Int64ShrlMod32(*(DWORDLONG*)&ticksPerSecond,dwLog);
|
||||
|
||||
}
|
||||
|
||||
dwRet = (DWORD)((((DWORD)ticksShifted)*1000)/(DWORD)(tickSecShifted));
|
||||
dwRet *=1;
|
||||
}
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
int ReadFileMemory(const char* filename,long* plFileSize,void** pFilePtr)
|
||||
{
|
||||
FILE* stream;
|
||||
void* ptr;
|
||||
int retVal=1;
|
||||
stream=fopen(filename, "rb");
|
||||
if (stream==NULL)
|
||||
return 0;
|
||||
|
||||
fseek(stream,0,SEEK_END);
|
||||
|
||||
*plFileSize=ftell(stream);
|
||||
fseek(stream,0,SEEK_SET);
|
||||
ptr=malloc((*plFileSize)+1);
|
||||
if (ptr==NULL)
|
||||
retVal=0;
|
||||
else
|
||||
{
|
||||
if (fread(ptr, 1, *plFileSize,stream) != (*plFileSize))
|
||||
retVal=0;
|
||||
}
|
||||
fclose(stream);
|
||||
*pFilePtr=ptr;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int BlockSizeCompress=0x8000;
|
||||
int BlockSizeUncompress=0x8000;
|
||||
int cprLevel=Z_DEFAULT_COMPRESSION ;
|
||||
long lFileSize;
|
||||
unsigned char* FilePtr;
|
||||
long lBufferSizeCpr;
|
||||
long lBufferSizeUncpr;
|
||||
long lCompressedSize=0;
|
||||
unsigned char* CprPtr;
|
||||
unsigned char* UncprPtr;
|
||||
long lSizeCpr,lSizeUncpr;
|
||||
DWORD dwGetTick,dwMsecQP;
|
||||
LARGE_INTEGER li_qp,li_rdtsc,dwResRdtsc;
|
||||
|
||||
if (argc<=1)
|
||||
{
|
||||
printf("run TestZlib <File> [BlockSizeCompress] [BlockSizeUncompress] [compres. level]\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ReadFileMemory(argv[1],&lFileSize,&FilePtr)==0)
|
||||
{
|
||||
printf("error reading %s\n",argv[1]);
|
||||
return 1;
|
||||
}
|
||||
else printf("file %s read, %u bytes\n",argv[1],lFileSize);
|
||||
|
||||
if (argc>=3)
|
||||
BlockSizeCompress=atol(argv[2]);
|
||||
|
||||
if (argc>=4)
|
||||
BlockSizeUncompress=atol(argv[3]);
|
||||
|
||||
if (argc>=5)
|
||||
cprLevel=(int)atol(argv[4]);
|
||||
|
||||
lBufferSizeCpr = lFileSize + (lFileSize/0x10) + 0x200;
|
||||
lBufferSizeUncpr = lBufferSizeCpr;
|
||||
|
||||
CprPtr=(unsigned char*)malloc(lBufferSizeCpr + BlockSizeCompress);
|
||||
|
||||
BeginCountPerfCounter(&li_qp,TRUE);
|
||||
dwGetTick=GetTickCount();
|
||||
BeginCountRdtsc(&li_rdtsc);
|
||||
{
|
||||
z_stream zcpr;
|
||||
int ret=Z_OK;
|
||||
long lOrigToDo = lFileSize;
|
||||
long lOrigDone = 0;
|
||||
int step=0;
|
||||
memset(&zcpr,0,sizeof(z_stream));
|
||||
deflateInit(&zcpr,cprLevel);
|
||||
|
||||
zcpr.next_in = FilePtr;
|
||||
zcpr.next_out = CprPtr;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
long all_read_before = zcpr.total_in;
|
||||
zcpr.avail_in = min(lOrigToDo,BlockSizeCompress);
|
||||
zcpr.avail_out = BlockSizeCompress;
|
||||
ret=deflate(&zcpr,(zcpr.avail_in==lOrigToDo) ? Z_FINISH : Z_SYNC_FLUSH);
|
||||
lOrigDone += (zcpr.total_in-all_read_before);
|
||||
lOrigToDo -= (zcpr.total_in-all_read_before);
|
||||
step++;
|
||||
} while (ret==Z_OK);
|
||||
|
||||
lSizeCpr=zcpr.total_out;
|
||||
deflateEnd(&zcpr);
|
||||
dwGetTick=GetTickCount()-dwGetTick;
|
||||
dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);
|
||||
dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);
|
||||
printf("total compress size = %u, in %u step\n",lSizeCpr,step);
|
||||
printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.);
|
||||
printf("defcpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.);
|
||||
printf("defcpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
|
||||
}
|
||||
|
||||
CprPtr=(unsigned char*)realloc(CprPtr,lSizeCpr);
|
||||
UncprPtr=(unsigned char*)malloc(lBufferSizeUncpr + BlockSizeUncompress);
|
||||
|
||||
BeginCountPerfCounter(&li_qp,TRUE);
|
||||
dwGetTick=GetTickCount();
|
||||
BeginCountRdtsc(&li_rdtsc);
|
||||
{
|
||||
z_stream zcpr;
|
||||
int ret=Z_OK;
|
||||
long lOrigToDo = lSizeCpr;
|
||||
long lOrigDone = 0;
|
||||
int step=0;
|
||||
memset(&zcpr,0,sizeof(z_stream));
|
||||
inflateInit(&zcpr);
|
||||
|
||||
zcpr.next_in = CprPtr;
|
||||
zcpr.next_out = UncprPtr;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
long all_read_before = zcpr.total_in;
|
||||
zcpr.avail_in = min(lOrigToDo,BlockSizeUncompress);
|
||||
zcpr.avail_out = BlockSizeUncompress;
|
||||
ret=inflate(&zcpr,Z_SYNC_FLUSH);
|
||||
lOrigDone += (zcpr.total_in-all_read_before);
|
||||
lOrigToDo -= (zcpr.total_in-all_read_before);
|
||||
step++;
|
||||
} while (ret==Z_OK);
|
||||
|
||||
lSizeUncpr=zcpr.total_out;
|
||||
inflateEnd(&zcpr);
|
||||
dwGetTick=GetTickCount()-dwGetTick;
|
||||
dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);
|
||||
dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);
|
||||
printf("total uncompress size = %u, in %u step\n",lSizeUncpr,step);
|
||||
printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.);
|
||||
printf("uncpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.);
|
||||
printf("uncpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
|
||||
}
|
||||
|
||||
if (lSizeUncpr==lFileSize)
|
||||
{
|
||||
if (memcmp(FilePtr,UncprPtr,lFileSize)==0)
|
||||
printf("compare ok\n");
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
Building instructions for the DLL versions of Zlib 1.2.4
|
||||
========================================================
|
||||
|
||||
This directory contains projects that build zlib and minizip using
|
||||
Microsoft Visual C++ 9.0/10.0, and Visual C++ .
|
||||
|
||||
You don't need to build these projects yourself. You can download the
|
||||
binaries from:
|
||||
http://www.winimage.com/zLibDll
|
||||
|
||||
More information can be found at this site.
|
||||
|
||||
first compile assembly code by running
|
||||
bld_ml64.bat in contrib\masmx64
|
||||
bld_ml32.bat in contrib\masmx86
|
||||
|
||||
|
||||
|
||||
|
||||
Build instructions for Visual Studio 2008 (32 bits or 64 bits)
|
||||
--------------------------------------------------------------
|
||||
- Uncompress current zlib, including all contrib/* files
|
||||
- Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008.0
|
||||
- Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32"
|
||||
|
||||
Build instructions for Visual Studio 2010 (32 bits or 64 bits)
|
||||
--------------------------------------------------------------
|
||||
- Uncompress current zlib, including all contrib/* files
|
||||
- Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010.0
|
||||
|
||||
|
||||
Important
|
||||
---------
|
||||
- To use zlibwapi.dll in your application, you must define the
|
||||
macro ZLIB_WINAPI when compiling your application's source files.
|
||||
|
||||
|
||||
Additional notes
|
||||
----------------
|
||||
- This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built
|
||||
by Gilles Vollant from the zlib 1.1.x sources, and distributed at
|
||||
http://www.winimage.com/zLibDll
|
||||
It uses the WINAPI calling convention for the exported functions, and
|
||||
includes the minizip functionality. If your application needs that
|
||||
particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll.
|
||||
|
||||
- The new DLL was renamed because there exist several incompatible
|
||||
versions of zlib.dll on the Internet.
|
||||
|
||||
- There is also an official DLL build of zlib, named zlib1.dll. This one
|
||||
is exporting the functions using the CDECL convention. See the file
|
||||
win32\DLL_FAQ.txt found in this zlib distribution.
|
||||
|
||||
- There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol
|
||||
has a slightly different effect. To avoid compatibility problems, do
|
||||
not define it here.
|
||||
|
||||
|
||||
Gilles Vollant
|
||||
info@winimage.com
|
||||
Building instructions for the DLL versions of Zlib 1.2.4
|
||||
========================================================
|
||||
|
||||
This directory contains projects that build zlib and minizip using
|
||||
Microsoft Visual C++ 9.0/10.0, and Visual C++ .
|
||||
|
||||
You don't need to build these projects yourself. You can download the
|
||||
binaries from:
|
||||
http://www.winimage.com/zLibDll
|
||||
|
||||
More information can be found at this site.
|
||||
|
||||
first compile assembly code by running
|
||||
bld_ml64.bat in contrib\masmx64
|
||||
bld_ml32.bat in contrib\masmx86
|
||||
|
||||
|
||||
|
||||
|
||||
Build instructions for Visual Studio 2008 (32 bits or 64 bits)
|
||||
--------------------------------------------------------------
|
||||
- Uncompress current zlib, including all contrib/* files
|
||||
- Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008.0
|
||||
- Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32"
|
||||
|
||||
Build instructions for Visual Studio 2010 (32 bits or 64 bits)
|
||||
--------------------------------------------------------------
|
||||
- Uncompress current zlib, including all contrib/* files
|
||||
- Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010.0
|
||||
|
||||
|
||||
Important
|
||||
---------
|
||||
- To use zlibwapi.dll in your application, you must define the
|
||||
macro ZLIB_WINAPI when compiling your application's source files.
|
||||
|
||||
|
||||
Additional notes
|
||||
----------------
|
||||
- This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built
|
||||
by Gilles Vollant from the zlib 1.1.x sources, and distributed at
|
||||
http://www.winimage.com/zLibDll
|
||||
It uses the WINAPI calling convention for the exported functions, and
|
||||
includes the minizip functionality. If your application needs that
|
||||
particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll.
|
||||
|
||||
- The new DLL was renamed because there exist several incompatible
|
||||
versions of zlib.dll on the Internet.
|
||||
|
||||
- There is also an official DLL build of zlib, named zlib1.dll. This one
|
||||
is exporting the functions using the CDECL convention. See the file
|
||||
win32\DLL_FAQ.txt found in this zlib distribution.
|
||||
|
||||
- There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol
|
||||
has a slightly different effect. To avoid compatibility problems, do
|
||||
not define it here.
|
||||
|
||||
|
||||
Gilles Vollant
|
||||
info@winimage.com
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,92 +1,92 @@
|
|||
//----------------------------------------------------------------------------------
|
||||
// File: libs\jni\nv_event\nv_event_queue.h
|
||||
// Samples Version: NVIDIA Android Lifecycle samples 1_0beta
|
||||
// Email: tegradev@nvidia.com
|
||||
// Web: http://developer.nvidia.com/category/zone/mobile-development
|
||||
//
|
||||
// Copyright 2009-2011 NVIDIA® Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#ifndef NV_EVENT_QUEUE
|
||||
#define NV_EVENT_QUEUE
|
||||
|
||||
#include "nv_event.hpp"
|
||||
#include <pthread.h>
|
||||
|
||||
class NVEventSync
|
||||
{
|
||||
public:
|
||||
pthread_cond_t m_cond;
|
||||
bool m_block;
|
||||
};
|
||||
|
||||
class NVEventQueue {
|
||||
public:
|
||||
void Init();
|
||||
void Shutdown();
|
||||
void Flush();
|
||||
void UnblockConsumer();
|
||||
void UnblockProducer();
|
||||
// Events are copied, so caller can reuse ev immediately
|
||||
void Insert(const NVEvent* ev);
|
||||
// Waits until the event is consumed. Returns whether the
|
||||
// consumer indicates handling the event or ignoring it
|
||||
bool InsertBlocking(const NVEvent* ev);
|
||||
|
||||
// Returned event is valid only until the next call to
|
||||
// RemoveOldest or until a call to DoneWithEvent
|
||||
// Calling RemoveOldest again without calling DoneWithEvent
|
||||
// indicates that the last event returned was NOT handled, and
|
||||
// thus InsertNewestAndWait for that even would return false
|
||||
const NVEvent* RemoveOldest(int waitMSecs);
|
||||
|
||||
// Indicates that all processing of the last event returned
|
||||
// from RemoveOldest is complete. Also allows the app to indicate
|
||||
// whether it handled the event or not.
|
||||
// Do not dereference the last event pointer after calling this function
|
||||
void DoneWithEvent(bool ret);
|
||||
|
||||
protected:
|
||||
bool insert(const NVEvent* ev);
|
||||
|
||||
enum { QUEUE_ELEMS = 256 };
|
||||
enum { QUEUE_MASK = 0x000000ff };
|
||||
|
||||
int32_t m_nextInsertIndex;
|
||||
int32_t m_headIndex;
|
||||
|
||||
pthread_mutex_t m_accessLock;
|
||||
|
||||
NVEventSync m_blockerSync;
|
||||
NVEventSync m_consumerSync;
|
||||
|
||||
NVEvent m_events[QUEUE_ELEMS];
|
||||
const NVEvent* m_blocker;
|
||||
enum BlockerState
|
||||
{
|
||||
NO_BLOCKER,
|
||||
PENDING_BLOCKER,
|
||||
PROCESSING_BLOCKER,
|
||||
RETURNED_BLOCKER
|
||||
};
|
||||
BlockerState m_blockerState;
|
||||
bool m_blockerReturnVal;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // #ifndef NV_EVENT_QUEUE
|
||||
//----------------------------------------------------------------------------------
|
||||
// File: libs\jni\nv_event\nv_event_queue.h
|
||||
// Samples Version: NVIDIA Android Lifecycle samples 1_0beta
|
||||
// Email: tegradev@nvidia.com
|
||||
// Web: http://developer.nvidia.com/category/zone/mobile-development
|
||||
//
|
||||
// Copyright 2009-2011 NVIDIA® Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#ifndef NV_EVENT_QUEUE
|
||||
#define NV_EVENT_QUEUE
|
||||
|
||||
#include "nv_event.hpp"
|
||||
#include <pthread.h>
|
||||
|
||||
class NVEventSync
|
||||
{
|
||||
public:
|
||||
pthread_cond_t m_cond;
|
||||
bool m_block;
|
||||
};
|
||||
|
||||
class NVEventQueue {
|
||||
public:
|
||||
void Init();
|
||||
void Shutdown();
|
||||
void Flush();
|
||||
void UnblockConsumer();
|
||||
void UnblockProducer();
|
||||
// Events are copied, so caller can reuse ev immediately
|
||||
void Insert(const NVEvent* ev);
|
||||
// Waits until the event is consumed. Returns whether the
|
||||
// consumer indicates handling the event or ignoring it
|
||||
bool InsertBlocking(const NVEvent* ev);
|
||||
|
||||
// Returned event is valid only until the next call to
|
||||
// RemoveOldest or until a call to DoneWithEvent
|
||||
// Calling RemoveOldest again without calling DoneWithEvent
|
||||
// indicates that the last event returned was NOT handled, and
|
||||
// thus InsertNewestAndWait for that even would return false
|
||||
const NVEvent* RemoveOldest(int waitMSecs);
|
||||
|
||||
// Indicates that all processing of the last event returned
|
||||
// from RemoveOldest is complete. Also allows the app to indicate
|
||||
// whether it handled the event or not.
|
||||
// Do not dereference the last event pointer after calling this function
|
||||
void DoneWithEvent(bool ret);
|
||||
|
||||
protected:
|
||||
bool insert(const NVEvent* ev);
|
||||
|
||||
enum { QUEUE_ELEMS = 256 };
|
||||
enum { QUEUE_MASK = 0x000000ff };
|
||||
|
||||
int32_t m_nextInsertIndex;
|
||||
int32_t m_headIndex;
|
||||
|
||||
pthread_mutex_t m_accessLock;
|
||||
|
||||
NVEventSync m_blockerSync;
|
||||
NVEventSync m_consumerSync;
|
||||
|
||||
NVEvent m_events[QUEUE_ELEMS];
|
||||
const NVEvent* m_blocker;
|
||||
enum BlockerState
|
||||
{
|
||||
NO_BLOCKER,
|
||||
PENDING_BLOCKER,
|
||||
PROCESSING_BLOCKER,
|
||||
RETURNED_BLOCKER
|
||||
};
|
||||
BlockerState m_blockerState;
|
||||
bool m_blockerReturnVal;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // #ifndef NV_EVENT_QUEUE
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
//----------------------------------------------------------------------------------
|
||||
// File: libs\jni\nv_time\nv_time.h
|
||||
// Samples Version: NVIDIA Android Lifecycle samples 1_0beta
|
||||
// Email: tegradev@nvidia.com
|
||||
// Web: http://developer.nvidia.com/category/zone/mobile-development
|
||||
//
|
||||
// Copyright 2009-2011 NVIDIA® Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __INCLUDED_NV_TIME_H
|
||||
#define __INCLUDED_NV_TIME_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void NVTimeInit();
|
||||
|
||||
void nvAcquireTimeExtension();
|
||||
bool nvValidTimeExtension();
|
||||
long nvGetSystemTime();
|
||||
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------
|
||||
// File: libs\jni\nv_time\nv_time.h
|
||||
// Samples Version: NVIDIA Android Lifecycle samples 1_0beta
|
||||
// Email: tegradev@nvidia.com
|
||||
// Web: http://developer.nvidia.com/category/zone/mobile-development
|
||||
//
|
||||
// Copyright 2009-2011 NVIDIA® Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __INCLUDED_NV_TIME_H
|
||||
#define __INCLUDED_NV_TIME_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void NVTimeInit();
|
||||
|
||||
void nvAcquireTimeExtension();
|
||||
bool nvValidTimeExtension();
|
||||
long nvGetSystemTime();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="48px" height="64px" viewBox="0 0 48 64" enable-background="new 0 0 48 64" xml:space="preserve">
|
||||
<ellipse transform="matrix(0.168 0.9858 -0.9858 0.168 82.1781 21.0924)" opacity="0.5" fill="#808285" enable-background="new " cx="28.594" cy="59.229" rx="2.5" ry="7.5"/>
|
||||
<polygon opacity="0.6" fill="#6D6E71" enable-background="new " points="32,60 23,61 19,32 31,31 "/>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="294.6318" y1="-370.5283" x2="302.9692" y2="-369.7775" gradientTransform="matrix(1 0 0 -1 -273.5 -324)">
|
||||
<stop offset="0" style="stop-color:#E6E6E6"/>
|
||||
<stop offset="1" style="stop-color:#C4C4C4"/>
|
||||
</linearGradient>
|
||||
<polygon fill="url(#SVGID_1_)" points="30,59 25,60 21,33 29,32 "/>
|
||||
<circle opacity="0.8" fill="#A00215" cx="24" cy="21.917" r="20"/>
|
||||
<radialGradient id="SVGID_2_" cx="297.0215" cy="-344.8936" r="18.0152" fx="288.0799" fy="-338.1579" gradientTransform="matrix(1 0 0 -1 -273.5 -324)" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0.248" style="stop-color:#EEDBDC"/>
|
||||
<stop offset="0.2785" style="stop-color:#EECECA"/>
|
||||
<stop offset="0.3831" style="stop-color:#EDA598"/>
|
||||
<stop offset="0.4889" style="stop-color:#EB8473"/>
|
||||
<stop offset="0.5939" style="stop-color:#E96759"/>
|
||||
<stop offset="0.6981" style="stop-color:#E84D45"/>
|
||||
<stop offset="0.801" style="stop-color:#E73739"/>
|
||||
<stop offset="0.9023" style="stop-color:#E72432"/>
|
||||
<stop offset="1" style="stop-color:#E71D30"/>
|
||||
</radialGradient>
|
||||
<circle fill="url(#SVGID_2_)" cx="24" cy="21.917" r="18.015"/>
|
||||
</svg>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="48px" height="64px" viewBox="0 0 48 64" enable-background="new 0 0 48 64" xml:space="preserve">
|
||||
<ellipse transform="matrix(0.168 0.9858 -0.9858 0.168 82.1781 21.0924)" opacity="0.5" fill="#808285" enable-background="new " cx="28.594" cy="59.229" rx="2.5" ry="7.5"/>
|
||||
<polygon opacity="0.6" fill="#6D6E71" enable-background="new " points="32,60 23,61 19,32 31,31 "/>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="294.6318" y1="-370.5283" x2="302.9692" y2="-369.7775" gradientTransform="matrix(1 0 0 -1 -273.5 -324)">
|
||||
<stop offset="0" style="stop-color:#E6E6E6"/>
|
||||
<stop offset="1" style="stop-color:#C4C4C4"/>
|
||||
</linearGradient>
|
||||
<polygon fill="url(#SVGID_1_)" points="30,59 25,60 21,33 29,32 "/>
|
||||
<circle opacity="0.8" fill="#A00215" cx="24" cy="21.917" r="20"/>
|
||||
<radialGradient id="SVGID_2_" cx="297.0215" cy="-344.8936" r="18.0152" fx="288.0799" fy="-338.1579" gradientTransform="matrix(1 0 0 -1 -273.5 -324)" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0.248" style="stop-color:#EEDBDC"/>
|
||||
<stop offset="0.2785" style="stop-color:#EECECA"/>
|
||||
<stop offset="0.3831" style="stop-color:#EDA598"/>
|
||||
<stop offset="0.4889" style="stop-color:#EB8473"/>
|
||||
<stop offset="0.5939" style="stop-color:#E96759"/>
|
||||
<stop offset="0.6981" style="stop-color:#E84D45"/>
|
||||
<stop offset="0.801" style="stop-color:#E73739"/>
|
||||
<stop offset="0.9023" style="stop-color:#E72432"/>
|
||||
<stop offset="1" style="stop-color:#E71D30"/>
|
||||
</radialGradient>
|
||||
<circle fill="url(#SVGID_2_)" cx="24" cy="21.917" r="18.015"/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.8 KiB |
Loading…
Add table
Reference in a new issue