zstd-ruby 1.4.9.0 → 1.5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/README.md +1 -1
- data/ext/zstdruby/libzstd/BUCK +5 -7
- data/ext/zstdruby/libzstd/Makefile +42 -13
- data/ext/zstdruby/libzstd/README.md +8 -4
- data/ext/zstdruby/libzstd/common/bitstream.h +1 -1
- data/ext/zstdruby/libzstd/common/compiler.h +1 -1
- data/ext/zstdruby/libzstd/common/cpu.h +1 -1
- data/ext/zstdruby/libzstd/common/debug.c +1 -1
- data/ext/zstdruby/libzstd/common/debug.h +1 -1
- data/ext/zstdruby/libzstd/common/entropy_common.c +1 -1
- data/ext/zstdruby/libzstd/common/error_private.c +1 -1
- data/ext/zstdruby/libzstd/common/error_private.h +3 -3
- data/ext/zstdruby/libzstd/common/fse.h +2 -2
- data/ext/zstdruby/libzstd/common/fse_decompress.c +25 -15
- data/ext/zstdruby/libzstd/common/huf.h +3 -2
- data/ext/zstdruby/libzstd/common/mem.h +3 -5
- data/ext/zstdruby/libzstd/common/pool.c +1 -1
- data/ext/zstdruby/libzstd/common/pool.h +1 -1
- data/ext/zstdruby/libzstd/common/xxhash.c +2 -4
- data/ext/zstdruby/libzstd/common/xxhash.h +1 -1
- data/ext/zstdruby/libzstd/common/zstd_common.c +1 -1
- data/ext/zstdruby/libzstd/common/zstd_deps.h +1 -1
- data/ext/zstdruby/libzstd/common/zstd_internal.h +21 -9
- data/ext/zstdruby/libzstd/common/zstd_trace.h +7 -5
- data/ext/zstdruby/libzstd/compress/fse_compress.c +1 -1
- data/ext/zstdruby/libzstd/compress/hist.c +1 -1
- data/ext/zstdruby/libzstd/compress/hist.h +1 -1
- data/ext/zstdruby/libzstd/compress/huf_compress.c +51 -28
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +1373 -275
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +164 -21
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +2 -2
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +14 -6
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +5 -282
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +147 -46
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +3 -3
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +4 -4
- data/ext/zstdruby/libzstd/compress/zstd_fast.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +914 -142
- data/ext/zstdruby/libzstd/compress/zstd_lazy.h +39 -1
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +51 -15
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +2 -1
- data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +15 -6
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +5 -5
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +44 -43
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +1 -1
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +1 -1
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +3 -4
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +44 -36
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +1 -1
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +1 -2
- data/ext/zstdruby/libzstd/deprecated/zbuff.h +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +7 -6
- data/ext/zstdruby/libzstd/dictBuilder/cover.h +6 -5
- data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +7 -6
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +8 -7
- data/ext/zstdruby/libzstd/dll/example/Makefile +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v01.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v02.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v03.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v04.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v05.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v06.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v07.h +1 -1
- data/ext/zstdruby/libzstd/{dictBuilder/zdict.h → zdict.h} +148 -2
- data/ext/zstdruby/libzstd/zstd.h +165 -83
- data/ext/zstdruby/libzstd/{common/zstd_errors.h → zstd_errors.h} +1 -1
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +5 -5
- data/ext/zstdruby/libzstd/common/zstd_trace.c +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32e9b82b8d17f82c2e75104bbac8b5a63a510d1e46af93d31b103534cf947e40
|
4
|
+
data.tar.gz: 264b1409dd10bc7ba8436576a1de143116b2d4616a24d58e66bb7e1ccd024b98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 736aaee9390871b6dfb7a03254c2c3cf86ccb2e2f46936cc147e4b3772438591f11a589e6f38fbd52c24214007a9d2293ddb9fe987dba84912608af802f179f9
|
7
|
+
data.tar.gz: a9c3846d7ae00794301da5dce514b2f6ef90cea9a3cc293659a4d7f1bc54de82973ad90c86a388967eddb6466449cccacc5094f170b21870ffeb0208329c393d
|
data/README.md
CHANGED
data/ext/zstdruby/libzstd/BUCK
CHANGED
@@ -65,9 +65,7 @@ cxx_library(
|
|
65
65
|
name='zdict',
|
66
66
|
header_namespace='',
|
67
67
|
visibility=['PUBLIC'],
|
68
|
-
exported_headers=
|
69
|
-
('dictBuilder', 'zdict.h'),
|
70
|
-
]),
|
68
|
+
exported_headers=['zdict.h'],
|
71
69
|
headers=subdir_glob([
|
72
70
|
('dictBuilder', 'divsufsort.h'),
|
73
71
|
('dictBuilder', 'cover.h'),
|
@@ -131,10 +129,10 @@ cxx_library(
|
|
131
129
|
name='errors',
|
132
130
|
header_namespace='',
|
133
131
|
visibility=['PUBLIC'],
|
134
|
-
exported_headers=
|
135
|
-
|
136
|
-
|
137
|
-
]
|
132
|
+
exported_headers=[
|
133
|
+
'zstd_errors.h',
|
134
|
+
'common/error_private.h',
|
135
|
+
]
|
138
136
|
srcs=['common/error_private.c'],
|
139
137
|
)
|
140
138
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# ################################################################
|
2
|
-
# Copyright (c)
|
2
|
+
# Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
5
5
|
# This source code is licensed under both the BSD-style license (found in the
|
@@ -8,6 +8,9 @@
|
|
8
8
|
# You may select, at your option, one of the above-listed licenses.
|
9
9
|
# ################################################################
|
10
10
|
|
11
|
+
# Note: by default, the static library is built single-threaded and dynamic library is built
|
12
|
+
# multi-threaded. It is possible to force multi or single threaded builds by appending
|
13
|
+
# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded).
|
11
14
|
.PHONY: default
|
12
15
|
default: lib-release
|
13
16
|
|
@@ -68,6 +71,10 @@ DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
|
68
71
|
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
69
72
|
FLAGS = $(CPPFLAGS) $(CFLAGS)
|
70
73
|
|
74
|
+
CPPFLAGS_DYNLIB = -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded
|
75
|
+
LDFLAGS_DYNLIB = -pthread
|
76
|
+
CPPFLAGS_STATLIB = # static library build defaults to single-threaded
|
77
|
+
|
71
78
|
HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
|
72
79
|
GREP_OPTIONS ?=
|
73
80
|
ifeq ($HAVE_COLORNEVER, 1)
|
@@ -91,7 +98,7 @@ endif
|
|
91
98
|
ZSTD_LIB_COMPRESSION ?= 1
|
92
99
|
ZSTD_LIB_DECOMPRESSION ?= 1
|
93
100
|
ZSTD_LIB_DICTBUILDER ?= 1
|
94
|
-
ZSTD_LIB_DEPRECATED ?=
|
101
|
+
ZSTD_LIB_DEPRECATED ?= 0
|
95
102
|
|
96
103
|
# Legacy support
|
97
104
|
ZSTD_LEGACY_SUPPORT ?= 5
|
@@ -176,7 +183,9 @@ UNAME := $(shell uname)
|
|
176
183
|
|
177
184
|
ifndef BUILD_DIR
|
178
185
|
ifeq ($(UNAME), Darwin)
|
179
|
-
|
186
|
+
ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0)
|
187
|
+
HASH ?= md5
|
188
|
+
endif
|
180
189
|
else ifeq ($(UNAME), FreeBSD)
|
181
190
|
HASH ?= gmd5sum
|
182
191
|
else ifeq ($(UNAME), NetBSD)
|
@@ -222,6 +231,7 @@ all: lib
|
|
222
231
|
|
223
232
|
|
224
233
|
.PHONY: libzstd.a # must be run every time
|
234
|
+
libzstd.a: CPPFLAGS += $(CPPFLAGS_STATLIB)
|
225
235
|
|
226
236
|
ifndef BUILD_DIR
|
227
237
|
# determine BUILD_DIR from compilation flags
|
@@ -238,7 +248,10 @@ ZSTD_STATLIB_OBJ := $(addprefix $(ZSTD_STATLIB_DIR)/,$(ZSTD_LOCAL_OBJ))
|
|
238
248
|
$(ZSTD_STATLIB): ARFLAGS = rcs
|
239
249
|
$(ZSTD_STATLIB): | $(ZSTD_STATLIB_DIR)
|
240
250
|
$(ZSTD_STATLIB): $(ZSTD_STATLIB_OBJ)
|
241
|
-
|
251
|
+
# Check for multithread flag at target execution time
|
252
|
+
$(if $(filter -DZSTD_MULTITHREAD,$(CPPFLAGS)),\
|
253
|
+
@echo compiling multi-threaded static library $(LIBVER),\
|
254
|
+
@echo compiling single-threaded static library $(LIBVER))
|
242
255
|
$(AR) $(ARFLAGS) $@ $^
|
243
256
|
|
244
257
|
libzstd.a: $(ZSTD_STATLIB)
|
@@ -257,8 +270,9 @@ else # not Windows
|
|
257
270
|
|
258
271
|
LIBZSTD = libzstd.$(SHARED_EXT_VER)
|
259
272
|
.PHONY: $(LIBZSTD) # must be run every time
|
260
|
-
$(LIBZSTD):
|
261
|
-
$(LIBZSTD):
|
273
|
+
$(LIBZSTD): CPPFLAGS += $(CPPFLAGS_DYNLIB)
|
274
|
+
$(LIBZSTD): CFLAGS += -fPIC -fvisibility=hidden
|
275
|
+
$(LIBZSTD): LDFLAGS += -shared $(LDFLAGS_DYNLIB)
|
262
276
|
|
263
277
|
ifndef BUILD_DIR
|
264
278
|
# determine BUILD_DIR from compilation flags
|
@@ -275,7 +289,10 @@ ZSTD_DYNLIB_OBJ := $(addprefix $(ZSTD_DYNLIB_DIR)/,$(ZSTD_LOCAL_OBJ))
|
|
275
289
|
|
276
290
|
$(ZSTD_DYNLIB): | $(ZSTD_DYNLIB_DIR)
|
277
291
|
$(ZSTD_DYNLIB): $(ZSTD_DYNLIB_OBJ)
|
278
|
-
|
292
|
+
# Check for multithread flag at target execution time
|
293
|
+
$(if $(filter -DZSTD_MULTITHREAD,$(CPPFLAGS)),\
|
294
|
+
@echo compiling multi-threaded dynamic library $(LIBVER),\
|
295
|
+
@echo compiling single-threaded dynamic library $(LIBVER))
|
279
296
|
$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
|
280
297
|
@echo creating versioned links
|
281
298
|
ln -sf $@ libzstd.$(SHARED_EXT_MAJOR)
|
@@ -297,10 +314,17 @@ lib : libzstd.a libzstd
|
|
297
314
|
# note : do not define lib-mt or lib-release as .PHONY
|
298
315
|
# make does not consider implicit pattern rule for .PHONY target
|
299
316
|
|
300
|
-
%-mt :
|
301
|
-
%-mt :
|
317
|
+
%-mt : CPPFLAGS_DYNLIB := -DZSTD_MULTITHREAD
|
318
|
+
%-mt : CPPFLAGS_STATLIB := -DZSTD_MULTITHREAD
|
319
|
+
%-mt : LDFLAGS_DYNLIB := -pthread
|
302
320
|
%-mt : %
|
303
|
-
@echo multi-
|
321
|
+
@echo multi-threaded build completed
|
322
|
+
|
323
|
+
%-nomt : CPPFLAGS_DYNLIB :=
|
324
|
+
%-nomt : LDFLAGS_DYNLIB :=
|
325
|
+
%-nomt : CPPFLAGS_STATLIB :=
|
326
|
+
%-nomt : %
|
327
|
+
@echo single-threaded build completed
|
304
328
|
|
305
329
|
%-release : DEBUGFLAGS :=
|
306
330
|
%-release : %
|
@@ -332,7 +356,8 @@ include $(wildcard $(DEPFILES))
|
|
332
356
|
# Special case : building library in single-thread mode _and_ without zstdmt_compress.c
|
333
357
|
ZSTDMT_FILES = compress/zstdmt_compress.c
|
334
358
|
ZSTD_NOMT_FILES = $(filter-out $(ZSTDMT_FILES),$(ZSTD_FILES))
|
335
|
-
libzstd-nomt:
|
359
|
+
libzstd-nomt: CFLAGS += -fPIC -fvisibility=hidden
|
360
|
+
libzstd-nomt: LDFLAGS += -shared
|
336
361
|
libzstd-nomt: $(ZSTD_NOMT_FILES)
|
337
362
|
@echo compiling single-thread dynamic library $(LIBVER)
|
338
363
|
@echo files : $(ZSTD_NOMT_FILES)
|
@@ -411,10 +436,12 @@ libzstd.pc: libzstd.pc.in
|
|
411
436
|
install: install-pc install-static install-shared install-includes
|
412
437
|
@echo zstd static and shared library installed
|
413
438
|
|
439
|
+
.PHONY: install-pc
|
414
440
|
install-pc: libzstd.pc
|
415
441
|
[ -e $(DESTDIR)$(PKGCONFIGDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/
|
416
442
|
$(INSTALL_DATA) libzstd.pc $(DESTDIR)$(PKGCONFIGDIR)/
|
417
443
|
|
444
|
+
.PHONY: install-static
|
418
445
|
install-static:
|
419
446
|
# only generate libzstd.a if it's not already present
|
420
447
|
[ -e libzstd.a ] || $(MAKE) libzstd.a-release
|
@@ -422,6 +449,7 @@ install-static:
|
|
422
449
|
@echo Installing static library
|
423
450
|
$(INSTALL_DATA) libzstd.a $(DESTDIR)$(LIBDIR)
|
424
451
|
|
452
|
+
.PHONY: install-shared
|
425
453
|
install-shared:
|
426
454
|
# only generate libzstd.so if it's not already present
|
427
455
|
[ -e $(LIBZSTD) ] || $(MAKE) libzstd-release
|
@@ -431,12 +459,13 @@ install-shared:
|
|
431
459
|
ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
|
432
460
|
ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
|
433
461
|
|
462
|
+
.PHONY: install-includes
|
434
463
|
install-includes:
|
435
464
|
[ -e $(DESTDIR)$(INCLUDEDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/
|
436
465
|
@echo Installing includes
|
437
466
|
$(INSTALL_DATA) zstd.h $(DESTDIR)$(INCLUDEDIR)
|
438
|
-
$(INSTALL_DATA)
|
439
|
-
$(INSTALL_DATA)
|
467
|
+
$(INSTALL_DATA) zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
|
468
|
+
$(INSTALL_DATA) zdict.h $(DESTDIR)$(INCLUDEDIR)
|
440
469
|
|
441
470
|
.PHONY: uninstall
|
442
471
|
uninstall:
|
@@ -19,12 +19,16 @@ The scope can be reduced on demand (see paragraph _modular build_).
|
|
19
19
|
|
20
20
|
#### Multithreading support
|
21
21
|
|
22
|
-
|
22
|
+
When building with `make`, by default the dynamic library is multithreaded and static library is single-threaded (for compatibility reasons).
|
23
|
+
|
23
24
|
Enabling multithreading requires 2 conditions :
|
24
25
|
- set build macro `ZSTD_MULTITHREAD` (`-DZSTD_MULTITHREAD` for `gcc`)
|
25
26
|
- for POSIX systems : compile with pthread (`-pthread` compilation flag for `gcc`)
|
26
27
|
|
27
|
-
|
28
|
+
For convenience, we provide a build target to generate multi and single threaded libraries:
|
29
|
+
- Force enable multithreading on both dynamic and static libraries by appending `-mt` to the target, e.g. `make lib-mt`.
|
30
|
+
- Force disable multithreading on both dynamic and static libraries by appending `-nomt` to the target, e.g. `make lib-nomt`.
|
31
|
+
- By default, as mentioned before, dynamic library is multithreaded, and static library is single-threaded, e.g. `make lib`.
|
28
32
|
|
29
33
|
When linking a POSIX program with a multithreaded version of `libzstd`,
|
30
34
|
note that it's necessary to invoke the `-pthread` flag during link stage.
|
@@ -42,8 +46,8 @@ Zstandard's stable API is exposed within [lib/zstd.h](zstd.h).
|
|
42
46
|
|
43
47
|
Optional advanced features are exposed via :
|
44
48
|
|
45
|
-
- `lib/
|
46
|
-
|
49
|
+
- `lib/zstd_errors.h` : translates `size_t` function results
|
50
|
+
into a `ZSTD_ErrorCode`, for accurate error handling.
|
47
51
|
|
48
52
|
- `ZSTD_STATIC_LINKING_ONLY` : if this macro is defined _before_ including `zstd.h`,
|
49
53
|
it unlocks access to the experimental API,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* ******************************************************************
|
2
2
|
* bitstream
|
3
3
|
* Part of FSE library
|
4
|
-
* Copyright (c)
|
4
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
5
5
|
*
|
6
6
|
* You can contact the author at :
|
7
7
|
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* ******************************************************************
|
2
2
|
* debug
|
3
3
|
* Part of FSE library
|
4
|
-
* Copyright (c)
|
4
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
5
5
|
*
|
6
6
|
* You can contact the author at :
|
7
7
|
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* ******************************************************************
|
2
2
|
* debug
|
3
3
|
* Part of FSE library
|
4
|
-
* Copyright (c)
|
4
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
5
5
|
*
|
6
6
|
* You can contact the author at :
|
7
7
|
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ******************************************************************
|
2
2
|
* Common functions of New Generation Entropy library
|
3
|
-
* Copyright (c)
|
3
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
4
4
|
*
|
5
5
|
* You can contact the author at :
|
6
6
|
* - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -21,8 +21,8 @@ extern "C" {
|
|
21
21
|
/* ****************************************
|
22
22
|
* Dependencies
|
23
23
|
******************************************/
|
24
|
-
#include "
|
25
|
-
#include "
|
24
|
+
#include "../zstd_errors.h" /* enum list */
|
25
|
+
#include "zstd_deps.h" /* size_t */
|
26
26
|
|
27
27
|
|
28
28
|
/* ****************************************
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* ******************************************************************
|
2
2
|
* FSE : Finite State Entropy codec
|
3
3
|
* Public Prototypes declaration
|
4
|
-
* Copyright (c)
|
4
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
5
5
|
*
|
6
6
|
* You can contact the author at :
|
7
7
|
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
@@ -352,7 +352,7 @@ size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits);
|
|
352
352
|
size_t FSE_buildDTable_rle (FSE_DTable* dt, unsigned char symbolValue);
|
353
353
|
/**< build a fake FSE_DTable, designed to always generate the same symbolValue */
|
354
354
|
|
355
|
-
#define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue))
|
355
|
+
#define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1)
|
356
356
|
#define FSE_DECOMPRESS_WKSP_SIZE(maxTableLog, maxSymbolValue) (FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(unsigned))
|
357
357
|
size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize);
|
358
358
|
/**< same as FSE_decompress(), using an externally allocated `workSpace` produced with `FSE_DECOMPRESS_WKSP_SIZE_U32(maxLog, maxSymbolValue)` */
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ******************************************************************
|
2
2
|
* FSE : Finite State Entropy decoder
|
3
|
-
* Copyright (c)
|
3
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
4
4
|
*
|
5
5
|
* You can contact the author at :
|
6
6
|
* - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
@@ -310,6 +310,12 @@ size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size
|
|
310
310
|
return FSE_decompress_wksp_bmi2(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, /* bmi2 */ 0);
|
311
311
|
}
|
312
312
|
|
313
|
+
typedef struct {
|
314
|
+
short ncount[FSE_MAX_SYMBOL_VALUE + 1];
|
315
|
+
FSE_DTable dtable[1]; /* Dynamically sized */
|
316
|
+
} FSE_DecompressWksp;
|
317
|
+
|
318
|
+
|
313
319
|
FORCE_INLINE_TEMPLATE size_t FSE_decompress_wksp_body(
|
314
320
|
void* dst, size_t dstCapacity,
|
315
321
|
const void* cSrc, size_t cSrcSize,
|
@@ -318,33 +324,37 @@ FORCE_INLINE_TEMPLATE size_t FSE_decompress_wksp_body(
|
|
318
324
|
{
|
319
325
|
const BYTE* const istart = (const BYTE*)cSrc;
|
320
326
|
const BYTE* ip = istart;
|
321
|
-
short counting[FSE_MAX_SYMBOL_VALUE+1];
|
322
327
|
unsigned tableLog;
|
323
328
|
unsigned maxSymbolValue = FSE_MAX_SYMBOL_VALUE;
|
324
|
-
|
329
|
+
FSE_DecompressWksp* const wksp = (FSE_DecompressWksp*)workSpace;
|
330
|
+
|
331
|
+
DEBUG_STATIC_ASSERT((FSE_MAX_SYMBOL_VALUE + 1) % 2 == 0);
|
332
|
+
if (wkspSize < sizeof(*wksp)) return ERROR(GENERIC);
|
325
333
|
|
326
334
|
/* normal FSE decoding mode */
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
335
|
+
{
|
336
|
+
size_t const NCountLength = FSE_readNCount_bmi2(wksp->ncount, &maxSymbolValue, &tableLog, istart, cSrcSize, bmi2);
|
337
|
+
if (FSE_isError(NCountLength)) return NCountLength;
|
338
|
+
if (tableLog > maxLog) return ERROR(tableLog_tooLarge);
|
339
|
+
assert(NCountLength <= cSrcSize);
|
340
|
+
ip += NCountLength;
|
341
|
+
cSrcSize -= NCountLength;
|
342
|
+
}
|
333
343
|
|
334
344
|
if (FSE_DECOMPRESS_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(tableLog_tooLarge);
|
335
|
-
workSpace = dtable + FSE_DTABLE_SIZE_U32(tableLog);
|
336
|
-
wkspSize -= FSE_DTABLE_SIZE(tableLog);
|
345
|
+
workSpace = wksp->dtable + FSE_DTABLE_SIZE_U32(tableLog);
|
346
|
+
wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog);
|
337
347
|
|
338
|
-
CHECK_F( FSE_buildDTable_internal(dtable,
|
348
|
+
CHECK_F( FSE_buildDTable_internal(wksp->dtable, wksp->ncount, maxSymbolValue, tableLog, workSpace, wkspSize) );
|
339
349
|
|
340
350
|
{
|
341
|
-
const void* ptr = dtable;
|
351
|
+
const void* ptr = wksp->dtable;
|
342
352
|
const FSE_DTableHeader* DTableH = (const FSE_DTableHeader*)ptr;
|
343
353
|
const U32 fastMode = DTableH->fastMode;
|
344
354
|
|
345
355
|
/* select fast mode (static) */
|
346
|
-
if (fastMode) return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 1);
|
347
|
-
return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 0);
|
356
|
+
if (fastMode) return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, wksp->dtable, 1);
|
357
|
+
return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, wksp->dtable, 0);
|
348
358
|
}
|
349
359
|
}
|
350
360
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* ******************************************************************
|
2
2
|
* huff0 huffman codec,
|
3
3
|
* part of Finite State Entropy library
|
4
|
-
* Copyright (c)
|
4
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
5
5
|
*
|
6
6
|
* You can contact the author at :
|
7
7
|
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
@@ -192,6 +192,7 @@ size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize,
|
|
192
192
|
unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue);
|
193
193
|
size_t HUF_buildCTable (HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue, unsigned maxNbBits); /* @return : maxNbBits; CTable and count can overlap. In which case, CTable will overwrite count content */
|
194
194
|
size_t HUF_writeCTable (void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog);
|
195
|
+
size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog, void* workspace, size_t workspaceSize);
|
195
196
|
size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable);
|
196
197
|
size_t HUF_estimateCompressedSize(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue);
|
197
198
|
int HUF_validateCTable(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue);
|
@@ -278,7 +279,7 @@ U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize);
|
|
278
279
|
* a required workspace size greater than that specified in the following
|
279
280
|
* macro.
|
280
281
|
*/
|
281
|
-
#define HUF_DECOMPRESS_WORKSPACE_SIZE (2 << 10)
|
282
|
+
#define HUF_DECOMPRESS_WORKSPACE_SIZE ((2 << 10) + (1 << 9))
|
282
283
|
#define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32))
|
283
284
|
|
284
285
|
#ifndef HUF_FORCE_DECOMPRESS_X2
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -143,9 +143,7 @@ MEM_STATIC size_t MEM_swapST(size_t in);
|
|
143
143
|
* Prefer these methods in priority order (0 > 1 > 2)
|
144
144
|
*/
|
145
145
|
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
146
|
-
# if defined(
|
147
|
-
# define MEM_FORCE_MEMORY_ACCESS 2
|
148
|
-
# elif defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
146
|
+
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
149
147
|
# define MEM_FORCE_MEMORY_ACCESS 1
|
150
148
|
# endif
|
151
149
|
#endif
|
@@ -308,7 +306,7 @@ MEM_STATIC void MEM_writeLE16(void* memPtr, U16 val)
|
|
308
306
|
|
309
307
|
MEM_STATIC U32 MEM_readLE24(const void* memPtr)
|
310
308
|
{
|
311
|
-
return MEM_readLE16(memPtr) + (((const BYTE*)memPtr)[2] << 16);
|
309
|
+
return (U32)MEM_readLE16(memPtr) + ((U32)(((const BYTE*)memPtr)[2]) << 16);
|
312
310
|
}
|
313
311
|
|
314
312
|
MEM_STATIC void MEM_writeLE24(void* memPtr, U32 val)
|