igzip: Improve LARGE_WINDOW and change that option to be default.

Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
Reviewed-by: Greg Tucker <greg.b.tucker@intel.com>
This commit is contained in:
Roy Oursler 2016-07-29 17:57:19 -07:00 committed by Greg Tucker
parent ee2e2bce4f
commit 9d53af0c7c
11 changed files with 89 additions and 325 deletions

View File

@ -84,7 +84,7 @@
* hufftables.asm. The deflate standard max is 15.*/
#define LONG_DCODE_OFFSET 26
#define SHORT_DCODE_OFFSET 20
#define SHORT_DCODE_OFFSET 0
#define MAX_HEADER_SIZE IGZIP_MAX_DEF_HDR_SIZE

View File

@ -50,7 +50,7 @@
#ifdef LONGER_HUFFTABLE
# define DCODE_OFFSET 26
#else
# define DCODE_OFFSET 20
# define DCODE_OFFSET 0
#endif
#define DYN_HDR_START_LEN 17
#define MAX_HISTHEAP_SIZE LIT_LEN
@ -62,7 +62,7 @@
#define MAX_SAFE_DIST_CODE_LEN 12
#define LONG_DIST_TABLE_SIZE 8192
#define SHORT_DIST_TABLE_SIZE 1024
#define SHORT_DIST_TABLE_SIZE 2
#define LEN_TABLE_SIZE 256
#define LIT_TABLE_SIZE 257
#define LAST_BLOCK 1

View File

@ -41,8 +41,8 @@
%define DECODE_OFFSET 26
%endif
%else
%define DIST_TABLE_SIZE 1024
%define DECODE_OFFSET 20
%define DIST_TABLE_SIZE 2
%define DECODE_OFFSET 0
%endif
%define LEN_TABLE_SIZE 256
@ -90,7 +90,7 @@
%define %%len %3d ; 32-bit OUT
%define %%hufftables %4 ; address of the hufftable
mov %%len, [%%hufftables + DIST_TABLE_OFFSET + 4*%%dist ]
mov %%len, [%%hufftables + DIST_TABLE_OFFSET + 4*(%%dist + 1) ]
mov %%code, %%len
and %%len, 0x1F;
shr %%code, 5
@ -117,45 +117,43 @@
; Uses RCX, clobbers dist
; void compute_dist_code dist, code, len
%macro compute_dist_code 4
%define %%dist %1d ; IN, clobbered
%define %%dist %1 ; IN, clobbered
%define %%distq %1
%define %%code %2 ; OUT
%define %%len %3 ; OUT
%define %%hufftables %4
dec %%dist
bsr ecx, %%dist ; ecx = msb = bsr(dist)
dec ecx ; ecx = num_extra_bits = msb - N
mov %%code, 1
shl %%code, CL
dec %%code ; code = ((1 << num_extra_bits) - 1)
and %%code, %%dist ; code = extra_bits
shr %%dist, CL ; dist >>= num_extra_bits
lea %%dist, [%%dist + 2*ecx] ; dist = sym = dist + num_extra_bits*2
mov %%len, ecx ; len = num_extra_bits
movzx ecx, byte [hufftables + DCODE_TABLE_SIZE_OFFSET + %%distq WRT_OPT]
bsr rcx, %%dist ; ecx = msb = bsr(dist)
dec rcx ; ecx = num_extra_bits = msb - N
BZHI %%code, %%dist, rcx, %%len
SHRX %%dist, %%dist, rcx ; dist >>= num_extra_bits
lea %%dist, [%%dist + 2*rcx] ; dist = sym = dist + num_extra_bits*2
mov %%len, rcx ; len = num_extra_bits
movzx rcx, byte [hufftables + DCODE_TABLE_SIZE_OFFSET + %%distq WRT_OPT]
movzx %%dist, word [hufftables + DCODE_TABLE_OFFSET + 2 * %%distq WRT_OPT]
shl %%code, CL ; code = extra_bits << (sym & 0xF)
SHLX %%code, %%code, rcx ; code = extra_bits << (sym & 0xF)
or %%code, %%dist ; code = (sym >> 4) | (extra_bits << (sym & 0xF))
add %%len, ecx ; len = num_extra_bits + (sym & 0xF)
add %%len, rcx ; len = num_extra_bits + (sym & 0xF)
%endm
; Uses RCX, clobbers dist
; get_dist_code dist, code, len
%macro get_dist_code 4
%define %%dist %1d ; 32-bit IN, clobbered
%define %%dist %1 ; 32-bit IN, clobbered
%define %%distq %1 ; 64-bit IN, clobbered
%define %%code %2d ; 32-bit OUT
%define %%len %3d ; 32-bit OUT
%define %%code %2 ; 32-bit OUT
%define %%len %3 ; 32-bit OUT
%define %%hufftables %4
cmp %%dist, DIST_TABLE_SIZE
cmp %%dist, DIST_TABLE_SIZE - 1
jg %%do_compute
mov %%len, [hufftables + DIST_TABLE_OFFSET + 4*%%distq WRT_OPT]
%ifndef IACA
mov %%len %+ d, dword [hufftables + DIST_TABLE_OFFSET + 4*(%%distq + 1) WRT_OPT]
mov %%code, %%len
and %%len, 0x1F;
shr %%code, 5
jmp %%done
%endif
%%do_compute:
compute_dist_code %%distq, %%code, %%len, %%hufftables
%%done:

View File

@ -2121,263 +2121,7 @@ const struct isal_hufftables hufftables_default = {
0x01fe37f4, 0x01fe77f4, 0x01feb7f4, 0x01fef7f4,
0x01ff37f4, 0x01ff77f4, 0x01ffb7f4, 0x01fff7f4 },
#else
.dist_table = {
0x00001be9, 0x00003be9, 0x00000be8, 0x000007e9,
0x000001e7, 0x000009e7, 0x000027ea, 0x000067ea,
0x000003e9, 0x000013e9, 0x000023e9, 0x000033e9,
0x000005e8, 0x00000de8, 0x000015e8, 0x00001de8,
0x00000068, 0x00000468, 0x00000868, 0x00000c68,
0x00001068, 0x00001468, 0x00001868, 0x00001c68,
0x00000268, 0x00000668, 0x00000a68, 0x00000e68,
0x00001268, 0x00001668, 0x00001a68, 0x00001e68,
0x00000048, 0x00000248, 0x00000448, 0x00000648,
0x00000848, 0x00000a48, 0x00000c48, 0x00000e48,
0x00001048, 0x00001248, 0x00001448, 0x00001648,
0x00001848, 0x00001a48, 0x00001c48, 0x00001e48,
0x00000148, 0x00000348, 0x00000548, 0x00000748,
0x00000948, 0x00000b48, 0x00000d48, 0x00000f48,
0x00001148, 0x00001348, 0x00001548, 0x00001748,
0x00001948, 0x00001b48, 0x00001d48, 0x00001f48,
0x000000c9, 0x000002c9, 0x000004c9, 0x000006c9,
0x000008c9, 0x00000ac9, 0x00000cc9, 0x00000ec9,
0x000010c9, 0x000012c9, 0x000014c9, 0x000016c9,
0x000018c9, 0x00001ac9, 0x00001cc9, 0x00001ec9,
0x000020c9, 0x000022c9, 0x000024c9, 0x000026c9,
0x000028c9, 0x00002ac9, 0x00002cc9, 0x00002ec9,
0x000030c9, 0x000032c9, 0x000034c9, 0x000036c9,
0x000038c9, 0x00003ac9, 0x00003cc9, 0x00003ec9,
0x0000016a, 0x0000056a, 0x0000096a, 0x00000d6a,
0x0000116a, 0x0000156a, 0x0000196a, 0x00001d6a,
0x0000216a, 0x0000256a, 0x0000296a, 0x00002d6a,
0x0000316a, 0x0000356a, 0x0000396a, 0x00003d6a,
0x0000416a, 0x0000456a, 0x0000496a, 0x00004d6a,
0x0000516a, 0x0000556a, 0x0000596a, 0x00005d6a,
0x0000616a, 0x0000656a, 0x0000696a, 0x00006d6a,
0x0000716a, 0x0000756a, 0x0000796a, 0x00007d6a,
0x000001ca, 0x000003ca, 0x000005ca, 0x000007ca,
0x000009ca, 0x00000bca, 0x00000dca, 0x00000fca,
0x000011ca, 0x000013ca, 0x000015ca, 0x000017ca,
0x000019ca, 0x00001bca, 0x00001dca, 0x00001fca,
0x000021ca, 0x000023ca, 0x000025ca, 0x000027ca,
0x000029ca, 0x00002bca, 0x00002dca, 0x00002fca,
0x000031ca, 0x000033ca, 0x000035ca, 0x000037ca,
0x000039ca, 0x00003bca, 0x00003dca, 0x00003fca,
0x000041ca, 0x000043ca, 0x000045ca, 0x000047ca,
0x000049ca, 0x00004bca, 0x00004dca, 0x00004fca,
0x000051ca, 0x000053ca, 0x000055ca, 0x000057ca,
0x000059ca, 0x00005bca, 0x00005dca, 0x00005fca,
0x000061ca, 0x000063ca, 0x000065ca, 0x000067ca,
0x000069ca, 0x00006bca, 0x00006dca, 0x00006fca,
0x000071ca, 0x000073ca, 0x000075ca, 0x000077ca,
0x000079ca, 0x00007bca, 0x00007dca, 0x00007fca,
0x0000002a, 0x0000022a, 0x0000042a, 0x0000062a,
0x0000082a, 0x00000a2a, 0x00000c2a, 0x00000e2a,
0x0000102a, 0x0000122a, 0x0000142a, 0x0000162a,
0x0000182a, 0x00001a2a, 0x00001c2a, 0x00001e2a,
0x0000202a, 0x0000222a, 0x0000242a, 0x0000262a,
0x0000282a, 0x00002a2a, 0x00002c2a, 0x00002e2a,
0x0000302a, 0x0000322a, 0x0000342a, 0x0000362a,
0x0000382a, 0x00003a2a, 0x00003c2a, 0x00003e2a,
0x0000402a, 0x0000422a, 0x0000442a, 0x0000462a,
0x0000482a, 0x00004a2a, 0x00004c2a, 0x00004e2a,
0x0000502a, 0x0000522a, 0x0000542a, 0x0000562a,
0x0000582a, 0x00005a2a, 0x00005c2a, 0x00005e2a,
0x0000602a, 0x0000622a, 0x0000642a, 0x0000662a,
0x0000682a, 0x00006a2a, 0x00006c2a, 0x00006e2a,
0x0000702a, 0x0000722a, 0x0000742a, 0x0000762a,
0x0000782a, 0x00007a2a, 0x00007c2a, 0x00007e2a,
0x0000000a, 0x0000010a, 0x0000020a, 0x0000030a,
0x0000040a, 0x0000050a, 0x0000060a, 0x0000070a,
0x0000080a, 0x0000090a, 0x00000a0a, 0x00000b0a,
0x00000c0a, 0x00000d0a, 0x00000e0a, 0x00000f0a,
0x0000100a, 0x0000110a, 0x0000120a, 0x0000130a,
0x0000140a, 0x0000150a, 0x0000160a, 0x0000170a,
0x0000180a, 0x0000190a, 0x00001a0a, 0x00001b0a,
0x00001c0a, 0x00001d0a, 0x00001e0a, 0x00001f0a,
0x0000200a, 0x0000210a, 0x0000220a, 0x0000230a,
0x0000240a, 0x0000250a, 0x0000260a, 0x0000270a,
0x0000280a, 0x0000290a, 0x00002a0a, 0x00002b0a,
0x00002c0a, 0x00002d0a, 0x00002e0a, 0x00002f0a,
0x0000300a, 0x0000310a, 0x0000320a, 0x0000330a,
0x0000340a, 0x0000350a, 0x0000360a, 0x0000370a,
0x0000380a, 0x0000390a, 0x00003a0a, 0x00003b0a,
0x00003c0a, 0x00003d0a, 0x00003e0a, 0x00003f0a,
0x0000400a, 0x0000410a, 0x0000420a, 0x0000430a,
0x0000440a, 0x0000450a, 0x0000460a, 0x0000470a,
0x0000480a, 0x0000490a, 0x00004a0a, 0x00004b0a,
0x00004c0a, 0x00004d0a, 0x00004e0a, 0x00004f0a,
0x0000500a, 0x0000510a, 0x0000520a, 0x0000530a,
0x0000540a, 0x0000550a, 0x0000560a, 0x0000570a,
0x0000580a, 0x0000590a, 0x00005a0a, 0x00005b0a,
0x00005c0a, 0x00005d0a, 0x00005e0a, 0x00005f0a,
0x0000600a, 0x0000610a, 0x0000620a, 0x0000630a,
0x0000640a, 0x0000650a, 0x0000660a, 0x0000670a,
0x0000680a, 0x0000690a, 0x00006a0a, 0x00006b0a,
0x00006c0a, 0x00006d0a, 0x00006e0a, 0x00006f0a,
0x0000700a, 0x0000710a, 0x0000720a, 0x0000730a,
0x0000740a, 0x0000750a, 0x0000760a, 0x0000770a,
0x0000780a, 0x0000790a, 0x00007a0a, 0x00007b0a,
0x00007c0a, 0x00007d0a, 0x00007e0a, 0x00007f0a,
0x0000012b, 0x0000032b, 0x0000052b, 0x0000072b,
0x0000092b, 0x00000b2b, 0x00000d2b, 0x00000f2b,
0x0000112b, 0x0000132b, 0x0000152b, 0x0000172b,
0x0000192b, 0x00001b2b, 0x00001d2b, 0x00001f2b,
0x0000212b, 0x0000232b, 0x0000252b, 0x0000272b,
0x0000292b, 0x00002b2b, 0x00002d2b, 0x00002f2b,
0x0000312b, 0x0000332b, 0x0000352b, 0x0000372b,
0x0000392b, 0x00003b2b, 0x00003d2b, 0x00003f2b,
0x0000412b, 0x0000432b, 0x0000452b, 0x0000472b,
0x0000492b, 0x00004b2b, 0x00004d2b, 0x00004f2b,
0x0000512b, 0x0000532b, 0x0000552b, 0x0000572b,
0x0000592b, 0x00005b2b, 0x00005d2b, 0x00005f2b,
0x0000612b, 0x0000632b, 0x0000652b, 0x0000672b,
0x0000692b, 0x00006b2b, 0x00006d2b, 0x00006f2b,
0x0000712b, 0x0000732b, 0x0000752b, 0x0000772b,
0x0000792b, 0x00007b2b, 0x00007d2b, 0x00007f2b,
0x0000812b, 0x0000832b, 0x0000852b, 0x0000872b,
0x0000892b, 0x00008b2b, 0x00008d2b, 0x00008f2b,
0x0000912b, 0x0000932b, 0x0000952b, 0x0000972b,
0x0000992b, 0x00009b2b, 0x00009d2b, 0x00009f2b,
0x0000a12b, 0x0000a32b, 0x0000a52b, 0x0000a72b,
0x0000a92b, 0x0000ab2b, 0x0000ad2b, 0x0000af2b,
0x0000b12b, 0x0000b32b, 0x0000b52b, 0x0000b72b,
0x0000b92b, 0x0000bb2b, 0x0000bd2b, 0x0000bf2b,
0x0000c12b, 0x0000c32b, 0x0000c52b, 0x0000c72b,
0x0000c92b, 0x0000cb2b, 0x0000cd2b, 0x0000cf2b,
0x0000d12b, 0x0000d32b, 0x0000d52b, 0x0000d72b,
0x0000d92b, 0x0000db2b, 0x0000dd2b, 0x0000df2b,
0x0000e12b, 0x0000e32b, 0x0000e52b, 0x0000e72b,
0x0000e92b, 0x0000eb2b, 0x0000ed2b, 0x0000ef2b,
0x0000f12b, 0x0000f32b, 0x0000f52b, 0x0000f72b,
0x0000f92b, 0x0000fb2b, 0x0000fd2b, 0x0000ff2b,
0x0000008b, 0x0000018b, 0x0000028b, 0x0000038b,
0x0000048b, 0x0000058b, 0x0000068b, 0x0000078b,
0x0000088b, 0x0000098b, 0x00000a8b, 0x00000b8b,
0x00000c8b, 0x00000d8b, 0x00000e8b, 0x00000f8b,
0x0000108b, 0x0000118b, 0x0000128b, 0x0000138b,
0x0000148b, 0x0000158b, 0x0000168b, 0x0000178b,
0x0000188b, 0x0000198b, 0x00001a8b, 0x00001b8b,
0x00001c8b, 0x00001d8b, 0x00001e8b, 0x00001f8b,
0x0000208b, 0x0000218b, 0x0000228b, 0x0000238b,
0x0000248b, 0x0000258b, 0x0000268b, 0x0000278b,
0x0000288b, 0x0000298b, 0x00002a8b, 0x00002b8b,
0x00002c8b, 0x00002d8b, 0x00002e8b, 0x00002f8b,
0x0000308b, 0x0000318b, 0x0000328b, 0x0000338b,
0x0000348b, 0x0000358b, 0x0000368b, 0x0000378b,
0x0000388b, 0x0000398b, 0x00003a8b, 0x00003b8b,
0x00003c8b, 0x00003d8b, 0x00003e8b, 0x00003f8b,
0x0000408b, 0x0000418b, 0x0000428b, 0x0000438b,
0x0000448b, 0x0000458b, 0x0000468b, 0x0000478b,
0x0000488b, 0x0000498b, 0x00004a8b, 0x00004b8b,
0x00004c8b, 0x00004d8b, 0x00004e8b, 0x00004f8b,
0x0000508b, 0x0000518b, 0x0000528b, 0x0000538b,
0x0000548b, 0x0000558b, 0x0000568b, 0x0000578b,
0x0000588b, 0x0000598b, 0x00005a8b, 0x00005b8b,
0x00005c8b, 0x00005d8b, 0x00005e8b, 0x00005f8b,
0x0000608b, 0x0000618b, 0x0000628b, 0x0000638b,
0x0000648b, 0x0000658b, 0x0000668b, 0x0000678b,
0x0000688b, 0x0000698b, 0x00006a8b, 0x00006b8b,
0x00006c8b, 0x00006d8b, 0x00006e8b, 0x00006f8b,
0x0000708b, 0x0000718b, 0x0000728b, 0x0000738b,
0x0000748b, 0x0000758b, 0x0000768b, 0x0000778b,
0x0000788b, 0x0000798b, 0x00007a8b, 0x00007b8b,
0x00007c8b, 0x00007d8b, 0x00007e8b, 0x00007f8b,
0x0000808b, 0x0000818b, 0x0000828b, 0x0000838b,
0x0000848b, 0x0000858b, 0x0000868b, 0x0000878b,
0x0000888b, 0x0000898b, 0x00008a8b, 0x00008b8b,
0x00008c8b, 0x00008d8b, 0x00008e8b, 0x00008f8b,
0x0000908b, 0x0000918b, 0x0000928b, 0x0000938b,
0x0000948b, 0x0000958b, 0x0000968b, 0x0000978b,
0x0000988b, 0x0000998b, 0x00009a8b, 0x00009b8b,
0x00009c8b, 0x00009d8b, 0x00009e8b, 0x00009f8b,
0x0000a08b, 0x0000a18b, 0x0000a28b, 0x0000a38b,
0x0000a48b, 0x0000a58b, 0x0000a68b, 0x0000a78b,
0x0000a88b, 0x0000a98b, 0x0000aa8b, 0x0000ab8b,
0x0000ac8b, 0x0000ad8b, 0x0000ae8b, 0x0000af8b,
0x0000b08b, 0x0000b18b, 0x0000b28b, 0x0000b38b,
0x0000b48b, 0x0000b58b, 0x0000b68b, 0x0000b78b,
0x0000b88b, 0x0000b98b, 0x0000ba8b, 0x0000bb8b,
0x0000bc8b, 0x0000bd8b, 0x0000be8b, 0x0000bf8b,
0x0000c08b, 0x0000c18b, 0x0000c28b, 0x0000c38b,
0x0000c48b, 0x0000c58b, 0x0000c68b, 0x0000c78b,
0x0000c88b, 0x0000c98b, 0x0000ca8b, 0x0000cb8b,
0x0000cc8b, 0x0000cd8b, 0x0000ce8b, 0x0000cf8b,
0x0000d08b, 0x0000d18b, 0x0000d28b, 0x0000d38b,
0x0000d48b, 0x0000d58b, 0x0000d68b, 0x0000d78b,
0x0000d88b, 0x0000d98b, 0x0000da8b, 0x0000db8b,
0x0000dc8b, 0x0000dd8b, 0x0000de8b, 0x0000df8b,
0x0000e08b, 0x0000e18b, 0x0000e28b, 0x0000e38b,
0x0000e48b, 0x0000e58b, 0x0000e68b, 0x0000e78b,
0x0000e88b, 0x0000e98b, 0x0000ea8b, 0x0000eb8b,
0x0000ec8b, 0x0000ed8b, 0x0000ee8b, 0x0000ef8b,
0x0000f08b, 0x0000f18b, 0x0000f28b, 0x0000f38b,
0x0000f48b, 0x0000f58b, 0x0000f68b, 0x0000f78b,
0x0000f88b, 0x0000f98b, 0x0000fa8b, 0x0000fb8b,
0x0000fc8b, 0x0000fd8b, 0x0000fe8b, 0x0000ff8b,
0x000000ac, 0x000002ac, 0x000004ac, 0x000006ac,
0x000008ac, 0x00000aac, 0x00000cac, 0x00000eac,
0x000010ac, 0x000012ac, 0x000014ac, 0x000016ac,
0x000018ac, 0x00001aac, 0x00001cac, 0x00001eac,
0x000020ac, 0x000022ac, 0x000024ac, 0x000026ac,
0x000028ac, 0x00002aac, 0x00002cac, 0x00002eac,
0x000030ac, 0x000032ac, 0x000034ac, 0x000036ac,
0x000038ac, 0x00003aac, 0x00003cac, 0x00003eac,
0x000040ac, 0x000042ac, 0x000044ac, 0x000046ac,
0x000048ac, 0x00004aac, 0x00004cac, 0x00004eac,
0x000050ac, 0x000052ac, 0x000054ac, 0x000056ac,
0x000058ac, 0x00005aac, 0x00005cac, 0x00005eac,
0x000060ac, 0x000062ac, 0x000064ac, 0x000066ac,
0x000068ac, 0x00006aac, 0x00006cac, 0x00006eac,
0x000070ac, 0x000072ac, 0x000074ac, 0x000076ac,
0x000078ac, 0x00007aac, 0x00007cac, 0x00007eac,
0x000080ac, 0x000082ac, 0x000084ac, 0x000086ac,
0x000088ac, 0x00008aac, 0x00008cac, 0x00008eac,
0x000090ac, 0x000092ac, 0x000094ac, 0x000096ac,
0x000098ac, 0x00009aac, 0x00009cac, 0x00009eac,
0x0000a0ac, 0x0000a2ac, 0x0000a4ac, 0x0000a6ac,
0x0000a8ac, 0x0000aaac, 0x0000acac, 0x0000aeac,
0x0000b0ac, 0x0000b2ac, 0x0000b4ac, 0x0000b6ac,
0x0000b8ac, 0x0000baac, 0x0000bcac, 0x0000beac,
0x0000c0ac, 0x0000c2ac, 0x0000c4ac, 0x0000c6ac,
0x0000c8ac, 0x0000caac, 0x0000ccac, 0x0000ceac,
0x0000d0ac, 0x0000d2ac, 0x0000d4ac, 0x0000d6ac,
0x0000d8ac, 0x0000daac, 0x0000dcac, 0x0000deac,
0x0000e0ac, 0x0000e2ac, 0x0000e4ac, 0x0000e6ac,
0x0000e8ac, 0x0000eaac, 0x0000ecac, 0x0000eeac,
0x0000f0ac, 0x0000f2ac, 0x0000f4ac, 0x0000f6ac,
0x0000f8ac, 0x0000faac, 0x0000fcac, 0x0000feac,
0x000100ac, 0x000102ac, 0x000104ac, 0x000106ac,
0x000108ac, 0x00010aac, 0x00010cac, 0x00010eac,
0x000110ac, 0x000112ac, 0x000114ac, 0x000116ac,
0x000118ac, 0x00011aac, 0x00011cac, 0x00011eac,
0x000120ac, 0x000122ac, 0x000124ac, 0x000126ac,
0x000128ac, 0x00012aac, 0x00012cac, 0x00012eac,
0x000130ac, 0x000132ac, 0x000134ac, 0x000136ac,
0x000138ac, 0x00013aac, 0x00013cac, 0x00013eac,
0x000140ac, 0x000142ac, 0x000144ac, 0x000146ac,
0x000148ac, 0x00014aac, 0x00014cac, 0x00014eac,
0x000150ac, 0x000152ac, 0x000154ac, 0x000156ac,
0x000158ac, 0x00015aac, 0x00015cac, 0x00015eac,
0x000160ac, 0x000162ac, 0x000164ac, 0x000166ac,
0x000168ac, 0x00016aac, 0x00016cac, 0x00016eac,
0x000170ac, 0x000172ac, 0x000174ac, 0x000176ac,
0x000178ac, 0x00017aac, 0x00017cac, 0x00017eac,
0x000180ac, 0x000182ac, 0x000184ac, 0x000186ac,
0x000188ac, 0x00018aac, 0x00018cac, 0x00018eac,
0x000190ac, 0x000192ac, 0x000194ac, 0x000196ac,
0x000198ac, 0x00019aac, 0x00019cac, 0x00019eac,
0x0001a0ac, 0x0001a2ac, 0x0001a4ac, 0x0001a6ac,
0x0001a8ac, 0x0001aaac, 0x0001acac, 0x0001aeac,
0x0001b0ac, 0x0001b2ac, 0x0001b4ac, 0x0001b6ac,
0x0001b8ac, 0x0001baac, 0x0001bcac, 0x0001beac,
0x0001c0ac, 0x0001c2ac, 0x0001c4ac, 0x0001c6ac,
0x0001c8ac, 0x0001caac, 0x0001ccac, 0x0001ceac,
0x0001d0ac, 0x0001d2ac, 0x0001d4ac, 0x0001d6ac,
0x0001d8ac, 0x0001daac, 0x0001dcac, 0x0001deac,
0x0001e0ac, 0x0001e2ac, 0x0001e4ac, 0x0001e6ac,
0x0001e8ac, 0x0001eaac, 0x0001ecac, 0x0001eeac,
0x0001f0ac, 0x0001f2ac, 0x0001f4ac, 0x0001f6ac,
0x0001f8ac, 0x0001faac, 0x0001fcac, 0x0001feac },
.dist_table = {0x00001be9, 0x00003be9},
#endif
.len_table = {
@ -2518,9 +2262,14 @@ const struct isal_hufftables hufftables_default = {
#ifndef LONGER_HUFFTABLE
.dcodes = {
0x000d, 0x001b, 0x0007, 0x0017, 0x00bf, 0x01bf, 0x007f, 0x017f,
0x00ff, 0x01ff },
.dcodes_sizes = { 0x4, 0x5, 0x5, 0x5, 0x9, 0x9, 0x9, 0x9,0x9, 0x9 }
0x00df, 0x01df, 0x005f, 0x003f, 0x000f, 0x013f, 0x001f, 0x002f,
0x0003, 0x0013, 0x0002, 0x000a, 0x0006, 0x000b, 0x000e, 0x0001,
0x0000, 0x0009, 0x0004, 0x0005, 0x000d, 0x001b, 0x0007, 0x0017,
0x00bf, 0x01bf, 0x007f, 0x017f, 0x00ff, 0x01ff},
.dcodes_sizes = {
0x9, 0x9, 0x8, 0x9, 0x6, 0x9, 0x7, 0x6, 0x5, 0x5,
0x4, 0x4, 0x4, 0x5, 0x4, 0x4, 0x3, 0x4, 0x3, 0x4,
0x4, 0x5, 0x5, 0x5, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9}
#else
.dcodes = { 0x007f, 0x017f, 0x00ff, 0x01ff },
.dcodes_sizes = { 0x9, 0x9, 0x9, 0x9 }

View File

@ -444,7 +444,7 @@ len_dist_lit_huffman_pre:
len_dist_lit_huffman:
neg dist2
add dist2, 1
%ifndef LONGER_HUFFTABLE
mov tmp4, dist2
get_dist_code tmp4, code4, code_len2, hufftables ;; clobbers dist, rcx
@ -524,7 +524,6 @@ len_dist_huffman_pre:
len_dist_huffman:
dec f_i
neg dist
add dist, 1
; get_dist_code(dist, &code2, &code_len2);
%ifndef LONGER_HUFFTABLE

View File

@ -190,6 +190,7 @@ loop2:
;; encode as dist/len
; get_dist_code(dist, &code2, &code_len2);
dec dist
get_dist_code dist, code2, code_len2, hufftables ;; clobbers dist, rcx
; get_len_code(len, &code, &code_len);

View File

@ -302,7 +302,7 @@ len_dist_lit_huffman_pre:
len_dist_lit_huffman:
neg dist2
add dist2, 1
%ifndef LONGER_HUFFTABLE
mov tmp4, dist2
get_dist_code tmp4, code4, code_len2, hufftables ;; clobbers dist, rcx
@ -383,7 +383,6 @@ len_dist_huffman_pre:
len_dist_huffman:
dec f_i
neg dist
add dist, 1
; get_dist_code(dist, &code2, &code_len2);
%ifndef LONGER_HUFFTABLE
@ -505,6 +504,7 @@ loop2_finish:
cmp len, SHORTEST_MATCH
jb encode_literal_finish
dec dist
;; Encode len/dist pair
%ifndef LONGER_HUFFTABLE
mov tmp3, dist

View File

@ -36,7 +36,10 @@
%define LAST_BYTES_COUNT 3 ;; Bytes to prevent reading out of array bounds
%define LA_STATELESS 258 ;; No round up since no data is copied to a buffer
%assign HASH_SIZE D
%ifndef HASH_SIZE
%assign HASH_SIZE (8 * K)
%endif
%assign HASH_MASK (HASH_SIZE - 1)
%assign SHORTEST_MATCH 4

View File

@ -44,11 +44,21 @@ default rel
; l - use longer huffman table
; f - fix cache read
%ifdef LARGE_WINDOW
%ifndef HIST_SIZE
%define HIST_SIZE 32
%endif
%if (HIST_SIZE > 32)
%undef HIST_SIZE
%define HIST_SIZE 32
%else
%endif
%ifdef LONGER_HUFFTABLE
%if (HIST_SIZE > 8)
%undef HIST_SIZE
%define HIST_SIZE 8
%endif
%endif
%ifdef USE_BITBUFB
%elifdef USE_BITBUF8
@ -62,16 +72,9 @@ default rel
; (h) limit hash update
%define LIMIT_HASH_UPDATE
; (l) longer huffman table
%define LONGER_HUFFTABLE
; (f) fix cache read problem
%define FIX_CACHE_READ
%if (HIST_SIZE > 8)
%undef LONGER_HUFFTABLE
%endif
%define IGZIP_MAX_DEF_HDR_SIZE 328
%ifidn __OUTPUT_FORMAT__, elf64

View File

@ -216,7 +216,7 @@ ssc:
%define %%tmp1 %4
%ifdef USE_HSWNI
bzhi %%src, %%dest, %%index
bzhi %%dest, %%src, %%index
%else
%ifnidn %%index, rcx
mov rcx, %%index

View File

@ -50,22 +50,25 @@
* in sync flush but also ensures that subsequent block's history does not
* look back beyond this point and new blocks are fully independent.
*
* Igzip's default configuration is:
* Igzip contians some behaviour configurable at compile time. These
* configureable options are:
*
* - 8K window size
* - HIST_SIZE - Defines the window size in 1K increments. The default value is
* 32, but 8 is also supported. Powers of 2 which are at most 32 may also work.
*
* This option can be overridden to enable:
* - LONGER_HUFFTABLES - Defines whether to use a larger hufftables structure
* which may increase performance with smaller HIST_SIZE values. By default
* this optoin is not defined. This define sets HIST_SIZE to be 8 if HIST_SIZE
* > 8.
*
* - 32K window size, by adding \#define LARGE_WINDOW 1 in igzip_lib.h and
* \%define LARGE_WINDOW in options.asm, or via the command line with
* @verbatim gmake D="-D LARGE_WINDOW" @endverbatim on Linux and FreeBSD, or
* with @verbatim nmake -f Makefile.nmake D="-D LARGE_WINDOW" @endverbatim on
* Windows.
* - IGZIP_USE_GZIP_FORMAT - Defines whether the compression should add gzip
* header and trailer to compressed data. By default this option is not
* defined
*
* KNOWN ISSUES:
* - If building the code on Windows with the 32K window enabled, the
* /LARGEADDRESSAWARE:NO link option must be added.
* - The 32K window isn't supported when used in a shared library.
* As an example, to compile gzip with an 8K window size and add the gzip
* header and trailer, in a terminal run @verbatim gmake D="-D HIST_SIZE=8 -D
* IGZIP_USE_GZIP_FORMAT" @endverbatim on Linux and FreeBSD, or with @verbatim
* nmake -f Makefile.nmake D="-D HIST_SIZE=8" @endverbatim on Windows.
*
*/
#include <stdint.h>
@ -83,10 +86,21 @@ extern "C" {
// l - use longer huffman table
// f - fix cache read
#if defined(LARGE_WINDOW)
# define HIST_SIZE 32
#else
# define HIST_SIZE 8
#ifndef HIST_SIZE
#define HIST_SIZE 32
#endif
#if (HIST_SIZE > 32)
#undef HIST_SIZE
#define HIST_SIZE 32
#endif
#ifdef LONGER_HUFFTABLE
#if (HIST_SIZE > 8)
#undef HIST_SIZE
#define HIST_SIZE 8
#endif
#endif
/* bit buffer types
@ -106,22 +120,19 @@ extern "C" {
*/
# define LIMIT_HASH_UPDATE
/* (l) longer huffman table */
#define LONGER_HUFFTABLE
/* (f) fix cache read problem */
#define FIX_CACHE_READ
#if (HIST_SIZE > 8)
# undef LONGER_HUFFTABLE
#endif
#define IGZIP_K 1024
#define IGZIP_D (HIST_SIZE * IGZIP_K) /* Amount of history */
#define IGZIP_LA (18 * 16) /* Max look-ahead, rounded up to 32 byte boundary */
#define BSIZE (2*IGZIP_D + IGZIP_LA) /* Nominal buffer size */
#define HASH_SIZE IGZIP_D
#ifndef HASH_SIZE
#define HASH_SIZE (8 * IGZIP_K)
#endif
#define HASH_MASK (HASH_SIZE - 1)
#define SHORTEST_MATCH 4
@ -134,9 +145,9 @@ enum {DIST_TABLE_SIZE = 8*1024};
/* DECODE_OFFSET is dist code index corresponding to DIST_TABLE_SIZE + 1 */
enum { DECODE_OFFSET = 26 };
#else
enum {DIST_TABLE_SIZE = 1024};
enum {DIST_TABLE_SIZE = 2};
/* DECODE_OFFSET is dist code index corresponding to DIST_TABLE_SIZE + 1 */
enum { DECODE_OFFSET = 20 };
enum { DECODE_OFFSET = 0 };
#endif
enum {LEN_TABLE_SIZE = 256};
enum {LIT_TABLE_SIZE = 257};