CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lz4demo.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "lz4.h"
#include "lz4hc.h"
#include "bench.h"
Include dependency graph for lz4demo.c:

Go to the source code of this file.

Macros

#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_WARNINGS
#define ARCHIVE_MAGICNUMBER   0x184C2102
#define ARCHIVE_MAGICNUMBER_SIZE   4
#define AUTHOR   "Yann Collet"
#define CACHELINE   64
#define CHUNKSIZE   (8<<20)
#define COMPILED   __DATE__
#define COMPRESSOR_NAME   "Compression CLI using LZ4 algorithm"
#define COMPRESSOR_VERSION   ""
#define CPU_BIG_ENDIAN   (!CPU_LITTLE_ENDIAN)
#define CPU_LITTLE_ENDIAN   (*(char*)(&one))
#define DISPLAY(...)   fprintf(stderr, __VA_ARGS__)
#define EXTENSION   ".lz4"
#define GCC_VERSION   (__GNUC__ * 100 + __GNUC_MINOR__)
#define LITTLE_ENDIAN32(i)   if (CPU_BIG_ENDIAN) { i = swap32(i); }
#define WELCOME_MESSAGE   "*** %s %s, by %s (%s) ***\n", COMPRESSOR_NAME, COMPRESSOR_VERSION, AUTHOR, COMPILED

Functions

int badusage (char *exename)
int compress_file (char *input_filename, char *output_filename, int compressionlevel)
int decode_file (char *input_filename, char *output_filename)
int get_fileHandle (char *input_filename, char *output_filename, FILE **pfinput, FILE **pfoutput)
int main (int argc, char **argv)
static unsigned int swap32 (unsigned int x)
int usage (char *exename)

Variables

static const int one = 1

Macro Definition Documentation

#define _CRT_SECURE_NO_DEPRECATE

Definition at line 36 of file lz4demo.c.

#define _CRT_SECURE_NO_WARNINGS

Definition at line 35 of file lz4demo.c.

#define ARCHIVE_MAGICNUMBER   0x184C2102

Definition at line 86 of file lz4demo.c.

Referenced by compress_file(), and decode_file().

#define ARCHIVE_MAGICNUMBER_SIZE   4

Definition at line 87 of file lz4demo.c.

Referenced by compress_file(), and decode_file().

#define AUTHOR   "Yann Collet"

Definition at line 80 of file lz4demo.c.

#define CACHELINE   64

Definition at line 85 of file lz4demo.c.

#define CHUNKSIZE   (8<<20)

Definition at line 84 of file lz4demo.c.

Referenced by compress_file(), and decode_file().

#define COMPILED   __DATE__

Definition at line 79 of file lz4demo.c.

#define COMPRESSOR_NAME   "Compression CLI using LZ4 algorithm"

Definition at line 77 of file lz4demo.c.

#define COMPRESSOR_VERSION   ""

Definition at line 78 of file lz4demo.c.

#define CPU_BIG_ENDIAN   (!CPU_LITTLE_ENDIAN)

Definition at line 95 of file lz4demo.c.

#define CPU_LITTLE_ENDIAN   (*(char*)(&one))

Definition at line 94 of file lz4demo.c.

#define DISPLAY (   ...)    fprintf(stderr, __VA_ARGS__)

Definition at line 102 of file lz4demo.c.

Referenced by badusage(), compress_file(), decode_file(), get_fileHandle(), main(), and usage().

#define EXTENSION   ".lz4"

Definition at line 81 of file lz4demo.c.

#define GCC_VERSION   (__GNUC__ * 100 + __GNUC_MINOR__)

Definition at line 58 of file lz4demo.c.

#define LITTLE_ENDIAN32 (   i)    if (CPU_BIG_ENDIAN) { i = swap32(i); }

Definition at line 96 of file lz4demo.c.

Referenced by compress_file(), and decode_file().

#define WELCOME_MESSAGE   "*** %s %s, by %s (%s) ***\n", COMPRESSOR_NAME, COMPRESSOR_VERSION, AUTHOR, COMPILED

Definition at line 82 of file lz4demo.c.

Referenced by main().

Function Documentation

int badusage ( char *  exename)

Definition at line 125 of file lz4demo.c.

References DISPLAY, and usage().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int compress_file ( char *  input_filename,
char *  output_filename,
int  compressionlevel 
)

Definition at line 167 of file lz4demo.c.

References ARCHIVE_MAGICNUMBER, ARCHIVE_MAGICNUMBER_SIZE, CHUNKSIZE, DISPLAY, get_fileHandle(), LITTLE_ENDIAN32, LZ4_compress(), LZ4_compressBound(), and LZ4_compressHC().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int decode_file ( char *  input_filename,
char *  output_filename 
)

Definition at line 248 of file lz4demo.c.

References ARCHIVE_MAGICNUMBER, ARCHIVE_MAGICNUMBER_SIZE, CHUNKSIZE, chunkSize, DISPLAY, get_fileHandle(), LITTLE_ENDIAN32, LZ4_compressBound(), and LZ4_uncompress_unknownOutputSize().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int get_fileHandle ( char *  input_filename,
char *  output_filename,
FILE **  pfinput,
FILE **  pfoutput 
)

Definition at line 134 of file lz4demo.c.

References DISPLAY.

Referenced by compress_file(), and decode_file().

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 320 of file lz4demo.c.

References badusage(), BMK_benchFile(), BMK_SetBlocksize(), BMK_SetNbIterations(), BMK_SetPause(), compress_file(), decode_file(), DISPLAY, usage(), and WELCOME_MESSAGE.

Here is the call graph for this function:

static unsigned int swap32 ( unsigned int  x)
inlinestatic

Definition at line 65 of file lz4demo.c.

int usage ( char *  exename)

Definition at line 108 of file lz4demo.c.

References DISPLAY.

Referenced by badusage(), and main().

Here is the caller graph for this function:

Variable Documentation

const int one = 1
static

Definition at line 93 of file lz4demo.c.