igzip: Setup optimized static header table to be default

Change-Id: Ia54682f7e1e321a26f941da8f884f385cfd42ad9
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
Roy Oursler 2018-08-07 10:34:16 -07:00
parent a673395ac0
commit c19657241a
4 changed files with 1360 additions and 5 deletions

View File

@ -34,7 +34,7 @@
#include <stdlib.h>
#include "igzip_lib.h"
#define STATIC_INFLATE_FILE "igzip/static_inflate.h"
#define STATIC_INFLATE_FILE "static_inflate.h"
/**
* @brief Prints a table of uint16_t elements to a file.
@ -107,7 +107,7 @@ void fprint_header(FILE * output_file)
"#if (LONG_BITS_CHECK == ISAL_DECODE_LONG_BITS) && (SHORT_BITS_CHECK == ISAL_DECODE_SHORT_BITS)\n"
"# define ISAL_STATIC_INFLATE_TABLE\n"
"#else\n"
"# error \"Incompatible compile time defines for static inflate table.\"\n"
"# warning \"Incompatible compile time defines for optimized static inflate table.\"\n"
"#endif\n\n");
}

View File

@ -33,7 +33,7 @@
#include "igzip_checksums.h"
#include "igzip_wrapper.h"
#ifdef USE_STATIC_INFLATE_H
#ifndef NO_STATIC_INFLATE_H
#include "static_inflate.h"
#endif
@ -938,6 +938,11 @@ static int inline setup_static_header(struct inflate_state *state)
memcpy(&state->lit_huff_code, &static_lit_huff_code, sizeof(static_lit_huff_code));
memcpy(&state->dist_huff_code, &static_dist_huff_code, sizeof(static_dist_huff_code));
#else
#ifndef NO_STATIC_INFLATE_H
# warning "Defaulting to static inflate table fallback."
# warning "For best performance, run generate_static_inflate, replace static_inflate.h, and recompile"
#endif
int i;
struct huff_code lit_code[LIT_LEN_ELEMS];
struct huff_code dist_code[DIST_LEN + 2];

1346
igzip/static_inflate.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -163,10 +163,14 @@ msg+=$'Examples run: Pass\n'
# Test custom hufftables
test_start "generate_custom_hufftables"
./generate_custom_hufftables $in_file
$MAKE -f Makefile.unx -j $cpus checks
$MAKE -f Makefile.unx -j $cpus D="NO_STATIC_INFLATE_H" checks
./igzip_rand_test $in_file
test_end "generate_custom_hufftables"
./generate_static_inflate
diff -q static_inflate.h igzip/static_inflate.h
rm -rf static_inflate.h
rm -rf hufftables_c.c
test_end "generate_custom_hufftables"
msg+=$'Custom hufftable build: Pass\n'
$MAKE -f Makefile.unx clean