├── .github └── psdb-jenkins-trigger.yml ├── CMakeLists.txt ├── LICENSE.txt ├── NOTICES ├── README.md ├── algos ├── bzip2 │ ├── CHANGES │ ├── LICENSE │ ├── Makefile │ ├── Makefile-libbz2_so │ ├── README │ ├── README.COMPILATION.PROBLEMS │ ├── README.XML.STUFF │ ├── README_DOXYGEN.md │ ├── blocksort.c │ ├── bzip.css │ ├── bzip2.1.preformatted │ ├── bzip2.c │ ├── bzip2.txt │ ├── bzip2recover.c │ ├── bzlib.c │ ├── bzlib.h │ ├── bzlib_private.h │ ├── code_alignment.c │ ├── compress.c │ ├── crctable.c │ ├── decompress.c │ ├── dlltest.c │ ├── dlltest.dsp │ ├── format.pl │ ├── huffman.c │ ├── libbz2.def │ ├── libbz2.dsp │ ├── libsais.c │ ├── libsais.h │ ├── makefile.msc │ ├── mk251.c │ ├── randtable.c │ ├── spewG.c │ └── unzcrash.c ├── common │ ├── aoclAlgoOpt.h │ ├── aoclFds.h │ ├── aoclHashChain.h │ └── aoclThreadUtils.h ├── lz4 │ ├── .gitignore │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── README_DOXYGEN_LZ4HC.md │ ├── code_alignment_lz4.c │ ├── code_alignment_lz4hc.c │ ├── liblz4-dll.rc.in │ ├── liblz4.pc.in │ ├── lz4.c │ ├── lz4.h │ ├── lz4_compress_aocl.h.in │ ├── lz4_decompress_aocl.h.in │ ├── lz4file.c │ ├── lz4file.h │ ├── lz4frame.c │ ├── lz4frame.h │ ├── lz4frame_static.h │ ├── lz4hc.c │ ├── lz4hc.h │ ├── xxhash.c │ └── xxhash.h ├── lzma │ ├── 7zTypes.h │ ├── Alloc.c │ ├── Alloc.h │ ├── Compiler.h │ ├── LICENSE │ ├── LzFind.c │ ├── LzFind.h │ ├── LzHash.h │ ├── LzmaDec.c │ ├── LzmaDec.h │ ├── LzmaEnc.c │ ├── LzmaEnc.h │ ├── Precomp.h │ ├── README_DOXYGEN.md │ ├── code_alignment.c │ ├── lzma.h │ └── xzlzma │ │ ├── XzLzma.c │ │ ├── XzLzma.h │ │ ├── XzVersion.h │ │ ├── base.h │ │ └── check.h ├── snappy │ ├── LICENSE │ ├── README.md │ ├── code_alignment.cc │ ├── config.h │ ├── snappy-c.cc │ ├── snappy-c.h │ ├── snappy-internal.h │ ├── snappy-sinksource.cc │ ├── snappy-sinksource.h │ ├── snappy-stubs-internal.cc │ ├── snappy-stubs-internal.h │ ├── snappy-stubs-public.h │ ├── snappy.cc │ └── snappy.h ├── zlib │ ├── LICENSE │ ├── README.md │ ├── adler32.c │ ├── adler32_x86.c │ ├── aocl_send_bits.h │ ├── aocl_zlib_setup.h │ ├── aocl_zlib_utils.c │ ├── aocl_zlib_utils.h │ ├── aocl_zlib_x86.h │ ├── chunkcopy.h │ ├── code_alignment.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── crc32_x86.h │ ├── crc32_x86_pclmul.c │ ├── crc32_x86_vpclmulqdq.c │ ├── deflate.c │ ├── deflate.h │ ├── deflate_medium.c │ ├── deflate_quick.c │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffast_chunk.c │ ├── inffast_chunk.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── longest_match_x86.c │ ├── longest_match_x86.h │ ├── ref_zlib_functions.h │ ├── slide_hash_x86.c │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── zconf.h │ ├── zlib.h │ ├── zutil.c │ └── zutil.h └── zstd │ ├── CHANGELOG │ ├── LICENSE │ ├── README.md │ ├── README_DOXYGEN.md │ └── lib │ ├── README.md │ ├── common │ ├── allocations.h │ ├── bits.h │ ├── bitstream.h │ ├── code_alignment.c │ ├── compiler.h │ ├── cpu.h │ ├── debug.c │ ├── debug.h │ ├── entropy_common.c │ ├── error_private.c │ ├── error_private.h │ ├── fse.h │ ├── fse_decompress.c │ ├── huf.h │ ├── mem.h │ ├── pool.c │ ├── pool.h │ ├── portability_macros.h │ ├── threading.c │ ├── threading.h │ ├── xxhash.c │ ├── xxhash.h │ ├── zstd_common.c │ ├── zstd_deps.h │ ├── zstd_internal.h │ └── zstd_trace.h │ ├── compress │ ├── clevels.h │ ├── fse_compress.c │ ├── hist.c │ ├── hist.h │ ├── huf_compress.c │ ├── zstd_compress.c │ ├── zstd_compress_internal.h │ ├── zstd_compress_literals.c │ ├── zstd_compress_literals.h │ ├── zstd_compress_sequences.c │ ├── zstd_compress_sequences.h │ ├── zstd_compress_superblock.c │ ├── zstd_compress_superblock.h │ ├── zstd_cwksp.h │ ├── zstd_double_fast.c │ ├── zstd_double_fast.h │ ├── zstd_double_fast_noDict_generic_fds_aocl.h.in │ ├── zstd_fast.c │ ├── zstd_fast.h │ ├── zstd_fast_noDict_generic_fds_aocl.h.in │ ├── zstd_lazy.c │ ├── zstd_lazy.h │ ├── zstd_lazy_aocl.h.in │ ├── zstd_ldm.c │ ├── zstd_ldm.h │ ├── zstd_ldm_geartab.h │ ├── zstd_opt.c │ ├── zstd_opt.h │ ├── zstdmt_compress.c │ └── zstdmt_compress.h │ ├── decompress │ ├── huf_decompress.c │ ├── huf_decompress_amd64.S │ ├── zstd_ddict.c │ ├── zstd_ddict.h │ ├── zstd_decompress.c │ ├── zstd_decompress_block.c │ ├── zstd_decompress_block.h │ ├── zstd_decompress_block_decode_sequence_aocl.h.in │ ├── zstd_decompress_block_decode_sequence_fds_aocl.h.in │ ├── zstd_decompress_block_decompress_sequences_fds_aocl.h.in │ ├── zstd_decompress_block_exec_sequence_fds_aocl.h.in │ └── zstd_decompress_internal.h │ ├── dictBuilder │ ├── cover.c │ ├── cover.h │ ├── divsufsort.c │ ├── divsufsort.h │ ├── fastcover.c │ └── zdict.c │ ├── zdict.h │ ├── zstd.h │ └── zstd_errors.h ├── api ├── aocl_compression.h ├── api.cpp ├── code_alignment.cpp ├── codec.cpp ├── codec.h └── types.h ├── cmake └── algos │ ├── lz4 │ ├── lz4_compress_config.cmake │ └── lz4_decompress_config.cmake │ └── zstd │ ├── zstd_compress_config.cmake │ └── zstd_decompress_config.cmake ├── docs ├── CMakeLists.txt ├── Doxyfile ├── EXAMPLE_README.md ├── INSTALLATION.md ├── README.md ├── rst │ ├── EXAMPLE_README.md │ ├── INSTALLATION.md │ ├── INTRODUCTION.md │ ├── _template │ │ └── flavors │ │ │ └── local │ │ │ ├── footer.jinja │ │ │ ├── header.jinja │ │ │ └── left-side-menu.jinja │ ├── algos.rst │ ├── bzip2.rst │ ├── conf.py │ ├── index.rst │ ├── lz4.rst │ ├── lz4hc.rst │ ├── lzma.rst │ ├── snappy.rst │ ├── unified_api.rst │ ├── zlib.rst │ └── zstd.rst └── styling │ ├── AMD_Logo.png │ ├── doxygen-awesome-sidebar-only.css │ ├── doxygen-awesome.css │ ├── doxygen-fragment-copy-button.js │ ├── doxygen-interactive-toc.js │ ├── footer.html │ └── header.html ├── examples ├── CMakeLists.txt ├── README.md ├── api │ ├── example_aocl_llc_skip_rap_frame.c │ └── example_unified_api.c ├── bzip2 │ └── example_BZ2_bzBuffToBuffCompress.c ├── lz4 │ └── example_LZ4_compress_default.c ├── lz4hc │ └── example_LZ4_compress_HC.c ├── lzma │ └── example_LzmaEncode.c ├── snappy │ └── example_snappy_compress.c ├── zlib │ ├── example_compress2.c │ ├── example_compress2_gzip.c │ └── example_compress2_raw.c └── zstd │ └── example_ZSTD_compress_advanced.c ├── gtest ├── CMakeLists.txt ├── api │ └── api_gtest.cpp ├── bzip2 │ └── bzip2_gtest.cpp ├── common │ └── common_gtest.cpp ├── gtest_utils.cpp ├── gtest_utils.h ├── lz4 │ └── lz4_gtest.cpp ├── lz4hc │ └── lz4hc_gtest.cpp ├── lzma │ └── lzma_gtest.cpp ├── snappy │ └── snappy_gtest.cpp ├── threads │ └── threads_gtest.cpp ├── utils │ └── utils_gtest.cpp ├── zlib │ ├── zlib_common_gtest.cpp │ ├── zlib_deflate_gtest.cpp │ ├── zlib_file_io_gtest.cpp │ ├── zlib_gtest.h │ └── zlib_inflate_gtest.cpp └── zstd │ ├── zstd_ctx_gtest.cpp │ ├── zstd_dict_gtest.cpp │ ├── zstd_gtest.cpp │ ├── zstd_gtest.h │ ├── zstd_stream_gtest.cpp │ └── zstd_unit_test_gtest.cpp ├── scripts └── test_speed.py ├── test ├── .valgrind-suppressions ├── CMakeLists.txt ├── codec_bench.c ├── codec_bench.h ├── codec_native_api_bench.c ├── ipp_codec_bench.c └── third_party │ ├── CMakeLists.txt │ ├── third_party_bench.c │ ├── third_party_bench.h │ ├── zlib │ ├── README.md │ └── test │ │ ├── example.c │ │ ├── infcover.c │ │ └── minigzip.c │ └── zstd │ ├── README.md │ ├── programs │ ├── benchfn.c │ ├── benchfn.h │ ├── benchzstd.c │ ├── benchzstd.h │ ├── datagen.c │ ├── datagen.h │ ├── dibio.c │ ├── dibio.h │ ├── fileio.c │ ├── fileio.h │ ├── fileio_asyncio.c │ ├── fileio_asyncio.h │ ├── fileio_common.h │ ├── fileio_types.h │ ├── platform.h │ ├── timefn.c │ ├── timefn.h │ ├── util.c │ ├── util.h │ ├── zstdcli.c │ ├── zstdcli_trace.c │ └── zstdcli_trace.h │ └── tests │ ├── aocl_thirdparty_zstd_test.h │ ├── bigdict.c │ ├── decodecorpus.c │ ├── external_matchfinder.c │ ├── external_matchfinder.h │ ├── fullbench.c │ ├── fuzzer.c │ ├── invalidDictionaries.c │ ├── longmatch.c │ ├── paramgrill.c │ ├── roundTripCrash.c │ ├── seqgen.c │ ├── seqgen.h │ └── zstreamtest.c ├── threads ├── code_alignment.c ├── threads.c └── threads.h └── utils ├── code_alignment.cpp ├── utils.cpp └── utils.h /.github/psdb-jenkins-trigger.yml: -------------------------------------------------------------------------------- 1 | jenkinsURLs: 2 | - https://swjenkins.amd.com/job/automations/job/entrypoints/job/github-psdb-entrypoint/ 3 | help: 4 | doc: https://confluence.amd.com/display/SI/PSDB+Jenkins+Trigger+-+GitHub+Guide 5 | enabled: false 6 | includeTriggers: false 7 | verbose: false 8 | message: This branch is configured to trigger PSDB. Comment __!help__ to get additional details 9 | triggerExclusions: 10 | all: 11 | - "psdb-jenkins-trigger-dev[bot]" 12 | - "psdb-jenkins-trigger[bot]" 13 | onEdit: 14 | - "swjenci" 15 | branches: 16 | - branchName: "amd-main" 17 | triggers: 18 | - triggerName: "!ai-review" 19 | description: Runs the AI Review job 20 | onOpen: false 21 | onSynchronize: false 22 | jobs: 23 | - "[jenkins-psdb, AI-Code-review/ai-code-review-psdb, queryFiles:summary-issues-clarity-aocl_compression]" 24 | - branchName: "amd/dev/sraut/ai-code-review-test" 25 | triggers: 26 | - triggerName: "!ai-review" 27 | description: Runs the AI Review job 28 | onOpen: true 29 | onSynchronize: true 30 | jobs: 31 | - "[jenkins-psdb, AI-Code-review/ai-code-review-psdb, queryFiles:summary-issues-clarity-aocl_compression]" -------------------------------------------------------------------------------- /algos/bzip2/Makefile-libbz2_so: -------------------------------------------------------------------------------- 1 | 2 | # This Makefile builds a shared version of the library, 3 | # libbz2.so.1.0.8, with soname libbz2.so.1.0, 4 | # at least on x86-Linux (RedHat 7.2), 5 | # with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98). 6 | # Please see the README file for some important info 7 | # about building the library like this. 8 | 9 | # ------------------------------------------------------------------ 10 | # This file is part of bzip2/libbzip2, a program and library for 11 | # lossless, block-sorting data compression. 12 | # 13 | # bzip2/libbzip2 version 1.0.8 of 13 July 2019 14 | # Copyright (C) 1996-2019 Julian Seward 15 | # 16 | # Please read the WARNING, DISCLAIMER and PATENTS sections in the 17 | # README file. 18 | # 19 | # This program is released under the terms of the license contained 20 | # in the file LICENSE. 21 | # ------------------------------------------------------------------ 22 | 23 | 24 | SHELL=/bin/sh 25 | CC=gcc 26 | BIGFILES=-D_FILE_OFFSET_BITS=64 27 | CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) 28 | 29 | OBJS= blocksort.o \ 30 | huffman.o \ 31 | crctable.o \ 32 | randtable.o \ 33 | compress.o \ 34 | decompress.o \ 35 | bzlib.o 36 | 37 | all: $(OBJS) 38 | $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.8 $(OBJS) 39 | $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8 40 | rm -f libbz2.so.1.0 41 | ln -s libbz2.so.1.0.8 libbz2.so.1.0 42 | 43 | clean: 44 | rm -f $(OBJS) bzip2.o libbz2.so.1.0.8 libbz2.so.1.0 bzip2-shared 45 | 46 | blocksort.o: blocksort.c 47 | $(CC) $(CFLAGS) -c blocksort.c 48 | huffman.o: huffman.c 49 | $(CC) $(CFLAGS) -c huffman.c 50 | crctable.o: crctable.c 51 | $(CC) $(CFLAGS) -c crctable.c 52 | randtable.o: randtable.c 53 | $(CC) $(CFLAGS) -c randtable.c 54 | compress.o: compress.c 55 | $(CC) $(CFLAGS) -c compress.c 56 | decompress.o: decompress.c 57 | $(CC) $(CFLAGS) -c decompress.c 58 | bzlib.o: bzlib.c 59 | $(CC) $(CFLAGS) -c bzlib.c 60 | -------------------------------------------------------------------------------- /algos/bzip2/README.COMPILATION.PROBLEMS: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------ 2 | This file is part of bzip2/libbzip2, a program and library for 3 | lossless, block-sorting data compression. 4 | 5 | bzip2/libbzip2 version 1.0.8 of 13 July 2019 6 | Copyright (C) 1996-2019 Julian Seward 7 | 8 | Please read the WARNING, DISCLAIMER and PATENTS sections in the 9 | README file. 10 | 11 | This program is released under the terms of the license contained 12 | in the file LICENSE. 13 | ------------------------------------------------------------------ 14 | 15 | bzip2 should compile without problems on the vast majority of 16 | platforms. Using the supplied Makefile, I've built and tested it 17 | myself for x86-linux and amd64-linux. With makefile.msc, Visual C++ 18 | 6.0 and nmake, you can build a native Win32 version too. Large file 19 | support seems to work correctly on at least on amd64-linux. 20 | 21 | When I say "large file" I mean a file of size 2,147,483,648 (2^31) 22 | bytes or above. Many older OSs can't handle files above this size, 23 | but many newer ones can. Large files are pretty huge -- most files 24 | you'll encounter are not Large Files. 25 | 26 | Early versions of bzip2 (0.1, 0.9.0, 0.9.5) compiled on a wide variety 27 | of platforms without difficulty, and I hope this version will continue 28 | in that tradition. However, in order to support large files, I've had 29 | to include the define -D_FILE_OFFSET_BITS=64 in the Makefile. This 30 | can cause problems. 31 | 32 | The technique of adding -D_FILE_OFFSET_BITS=64 to get large file 33 | support is, as far as I know, the Recommended Way to get correct large 34 | file support. For more details, see the Large File Support 35 | Specification, published by the Large File Summit, at 36 | 37 | http://ftp.sas.com/standards/large.file 38 | 39 | As a general comment, if you get compilation errors which you think 40 | are related to large file support, try removing the above define from 41 | the Makefile, ie, delete the line 42 | 43 | BIGFILES=-D_FILE_OFFSET_BITS=64 44 | 45 | from the Makefile, and do 'make clean ; make'. This will give you a 46 | version of bzip2 without large file support, which, for most 47 | applications, is probably not a problem. 48 | 49 | Alternatively, try some of the platform-specific hints listed below. 50 | 51 | You can use the spewG.c program to generate huge files to test bzip2's 52 | large file support, if you are feeling paranoid. Be aware though that 53 | any compilation problems which affect bzip2 will also affect spewG.c, 54 | alas. 55 | 56 | AIX: I have reports that for large file support, you need to specify 57 | -D_LARGE_FILES rather than -D_FILE_OFFSET_BITS=64. I have not tested 58 | this myself. 59 | -------------------------------------------------------------------------------- /algos/bzip2/README.XML.STUFF: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------- 2 | This file is part of bzip2/libbzip2, a program and library for 3 | lossless, block-sorting data compression. 4 | 5 | bzip2/libbzip2 version 1.0.8 of 13 July 2019 6 | Copyright (C) 1996-2019 Julian Seward 7 | 8 | Please read the WARNING, DISCLAIMER and PATENTS sections in the 9 | README file. 10 | 11 | This program is released under the terms of the license contained 12 | in the file LICENSE. 13 | ---------------------------------------------------------------- 14 | 15 | The script xmlproc.sh takes an xml file as input, 16 | and processes it to create .pdf, .html or .ps output. 17 | It uses format.pl, a perl script to format
 blocks nicely,
18 |  and add CDATA tags so writers do not have to use eg. < 
19 | 
20 | The file "entities.xml" must be edited to reflect current
21 | version, year, etc.
22 | 
23 | 
24 | Usage:
25 | 
26 |   ./xmlproc.sh -v manual.xml
27 |   Validates an xml file to ensure no dtd-compliance errors
28 | 
29 |   ./xmlproc.sh -html manual.xml
30 |   Output: manual.html
31 | 
32 |   ./xmlproc.sh -pdf manual.xml
33 |   Output: manual.pdf
34 | 
35 |   ./xmlproc.sh -ps manual.xml
36 |   Output: manual.ps
37 | 
38 | 
39 | Notum bene: 
40 | - pdfxmltex barfs if given a filename with an underscore in it
41 | 
42 | - xmltex won't work yet - there's a bug in passivetex
43 |     which we are all waiting for Sebastian to fix.
44 |   So we are going the xml -> pdf -> ps route for the time being,
45 |     using pdfxmltex.
46 | 


--------------------------------------------------------------------------------
/algos/bzip2/README_DOXYGEN.md:
--------------------------------------------------------------------------------
 1 | BZIP2 - Introduction
 2 | ====================
 3 | Bzip2 compresses files using the Burrows-Wheeler block-sorting text compression algorithm, and Huffman coding. Compression is generally considerably better than that achieved by more conventional LZ77/LZ78-based compressors, and approaches the performance of the PPM family of statistical compressors.
 4 | 
 5 | This file is part of bzip2/libbzip2, a program and library for
 6 | lossless, block-sorting data compression.
 7 | 
 8 | bzip2/libbzip2 version 1.0.8 of 13 July 2019
 9 | Copyright (C) 1996-2019 Julian Seward 
10 | 
11 | Please read the WARNING, DISCLAIMER and PATENTS sections in the file
12 | available at https://github.com/joachimmetz/bzip2/blob/main/README .
13 | 
14 | This program is released under the terms of the license contained in the file LICENSE.
15 | 


--------------------------------------------------------------------------------
/algos/bzip2/bzip.css:
--------------------------------------------------------------------------------
 1 | /* Colours:
 2 | #74240f  dark brown      h1, h2, h3, h4
 3 | #336699  medium blue     links
 4 | #339999  turquoise       link hover colour
 5 | #202020  almost black    general text
 6 | #761596  purple          md5sum text
 7 | #626262  dark gray       pre border
 8 | #eeeeee  very light gray pre background
 9 | #f2f2f9  very light blue nav table background
10 | #3366cc  medium blue     nav table border
11 | */
12 | 
13 | a, a:link, a:visited, a:active { color: #336699; }
14 | a:hover { color: #339999; }
15 | 
16 | body { font: 80%/126% sans-serif; }
17 | h1, h2, h3, h4 { color: #74240f; }
18 | 
19 | dt { color: #336699; font-weight: bold }
20 | dd { 
21 |  margin-left: 1.5em; 
22 |  padding-bottom: 0.8em;
23 | }
24 | 
25 | /* -- ruler -- */
26 | div.hr_blue { 
27 |   height:  3px; 
28 |   background:#ffffff url("../images/hr_blue.png") repeat-x; }
29 | div.hr_blue hr { display:none; }
30 | 
31 | /* release styles */
32 | #release p { margin-top: 0.4em; }
33 | #release .md5sum { color: #761596; }
34 | 
35 | 
36 | /* ------ styles for docs|manuals|howto ------ */
37 | /* -- lists -- */
38 | ul  { 
39 |  margin:     0px 4px 16px 16px;
40 |  padding:    0px;
41 |  list-style: url("../images/li-blue.png"); 
42 | }
43 | ul li { 
44 |  margin-bottom: 10px;
45 | }
46 | ul ul	{ 
47 |  list-style-type:  none; 
48 |  list-style-image: none; 
49 |  margin-left:      0px; 
50 | }
51 | 
52 | /* header / footer nav tables */
53 | table.nav {
54 |  border:     solid 1px #3366cc;
55 |  background: #f2f2f9;
56 |  background-color: #f2f2f9;
57 |  margin-bottom: 0.5em;
58 | }
59 | /* don't have underlined links in chunked nav menus */
60 | table.nav a { text-decoration: none; }
61 | table.nav a:hover { text-decoration: underline; }
62 | table.nav td { font-size: 85%; }
63 | 
64 | code, tt, pre { font-size: 120%; }
65 | code, tt { color: #761596; }
66 | 
67 | div.literallayout, pre.programlisting, pre.screen {
68 |  color:      #000000;
69 |  padding:    0.5em;
70 |  background: #eeeeee;
71 |  border:     1px solid #626262;
72 |  background-color: #eeeeee;
73 |  margin: 4px 0px 4px 0px; 
74 | }
75 | 


--------------------------------------------------------------------------------
/algos/bzip2/code_alignment.c:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | /* This function is used to ensure desired code alignment of bzip2 source files
30 |  * within aocl compression library. This file precedes other bzip2 source files
31 |  * in CMakeLists. Hence, code_alignment_bzip2 will be the top bzip2 function in
32 |  * the symbol table. __attribute__((aligned(64))) provides a buffer zone wrt
33 |  * functions from other modules preceeding it. Further alignment adjustments 
34 |  * are made to provide the best code alignment for bzip2 module.*/
35 | #if defined(__x86_64__)
36 | __attribute__((aligned(64)))
37 | int code_alignment_bzip2(void) {
38 | #if defined(__clang__)
39 |     // desired alignment: 64 bytes
40 |     __asm__("nop");
41 |     __asm__(".p2align 5"); //+ 32 bytes
42 |     __asm__("nop");
43 |     __asm__(".p2align 4"); //+ 16 bytes
44 | #else
45 |     // desired alignment: 16 bytes
46 | #endif
47 |     return 0; //+ 16 bytes
48 | }
49 | #endif
50 | 


--------------------------------------------------------------------------------
/algos/bzip2/dlltest.dsp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amd/aocl-compression/69dd0e31f563bbeaf248c0a434c76e89ca13f506/algos/bzip2/dlltest.dsp


--------------------------------------------------------------------------------
/algos/bzip2/format.pl:
--------------------------------------------------------------------------------
 1 | #!/usr/bin/perl -w
 2 | #
 3 | # ------------------------------------------------------------------
 4 | # This file is part of bzip2/libbzip2, a program and library for
 5 | # lossless, block-sorting data compression.
 6 | #
 7 | # bzip2/libbzip2 version 1.0.8 of 13 July 2019
 8 | # Copyright (C) 1996-2019 Julian Seward 
 9 | #
10 | # Please read the WARNING, DISCLAIMER and PATENTS sections in the 
11 | # README file.
12 | #
13 | # This program is released under the terms of the license contained
14 | # in the file LICENSE.
15 | # ------------------------------------------------------------------
16 | #
17 | use strict;
18 | 
19 | # get command line values:
20 | if ( $#ARGV !=1 ) {
21 |     die "Usage:  $0 xml_infile xml_outfile\n";
22 | }
23 | 
24 | my $infile = shift;
25 | # check infile exists
26 | die "Can't find file \"$infile\""
27 |   unless -f $infile;
28 | # check we can read infile
29 | if (! -r $infile) {
30 |     die "Can't read input $infile\n";
31 | }
32 | # check we can open infile
33 | open( INFILE,"<$infile" ) or 
34 |     die "Can't input $infile $!";
35 | 
36 | #my $outfile = 'fmt-manual.xml';
37 | my $outfile = shift;
38 | #print "Infile: $infile, Outfile: $outfile\n";
39 | # check we can write to outfile
40 | open( OUTFILE,">$outfile" ) or 
41 |     die "Can't output $outfile $! for writing";
42 | 
43 | my ($prev, $curr, $str);
44 | $prev = ''; $curr = '';
45 | while (  ) {
46 | 
47 | 		print OUTFILE $prev;
48 |     $prev = $curr;
49 |     $curr = $_;
50 |     $str = '';
51 | 
52 |     if ( $prev =~ /$|$/ ) {
53 |         chomp $prev;
54 |         $curr = join( '', $prev, "|<\/screen>/ ) {
59 |         chomp $prev;
60 |         $curr = join( '', $prev, "]]>", $curr );
61 | 				$prev = '';
62 |         next;
63 |     }
64 | }
65 | print OUTFILE $curr;
66 | close INFILE;
67 | close OUTFILE;
68 | exit;
69 | 


--------------------------------------------------------------------------------
/algos/bzip2/libbz2.def:
--------------------------------------------------------------------------------
 1 | LIBRARY			LIBBZ2
 2 | DESCRIPTION		"libbzip2: library for data compression"
 3 | EXPORTS
 4 | 	BZ2_bzCompressInit
 5 | 	BZ2_bzCompress
 6 | 	BZ2_bzCompressEnd
 7 | 	BZ2_bzDecompressInit
 8 | 	BZ2_bzDecompress
 9 | 	BZ2_bzDecompressEnd
10 | 	BZ2_bzReadOpen
11 | 	BZ2_bzReadClose
12 | 	BZ2_bzReadGetUnused
13 | 	BZ2_bzRead
14 | 	BZ2_bzWriteOpen
15 | 	BZ2_bzWrite
16 | 	BZ2_bzWriteClose
17 | 	BZ2_bzWriteClose64
18 | 	BZ2_bzBuffToBuffCompress
19 | 	BZ2_bzBuffToBuffDecompress
20 | 	BZ2_bzlibVersion
21 | 	BZ2_bzopen
22 | 	BZ2_bzdopen
23 | 	BZ2_bzread
24 | 	BZ2_bzwrite
25 | 	BZ2_bzflush
26 | 	BZ2_bzclose
27 | 	BZ2_bzerror
28 | 


--------------------------------------------------------------------------------
/algos/bzip2/libbz2.dsp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amd/aocl-compression/69dd0e31f563bbeaf248c0a434c76e89ca13f506/algos/bzip2/libbz2.dsp


--------------------------------------------------------------------------------
/algos/bzip2/makefile.msc:
--------------------------------------------------------------------------------
 1 | # Makefile for Microsoft Visual C++ 6.0
 2 | # usage: nmake -f makefile.msc
 3 | # K.M. Syring (syring@gsf.de)
 4 | # Fixed up by JRS for bzip2-0.9.5d release.
 5 | 
 6 | CC=cl
 7 | CFLAGS= -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo
 8 | 
 9 | OBJS= blocksort.obj  \
10 |       huffman.obj    \
11 |       crctable.obj   \
12 |       randtable.obj  \
13 |       compress.obj   \
14 |       decompress.obj \
15 |       bzlib.obj
16 | 
17 | all: lib bzip2 test
18 | 
19 | bzip2: lib
20 | 	$(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj
21 | 	$(CC) $(CFLAGS) -o bzip2recover bzip2recover.c
22 | 
23 | lib: $(OBJS)
24 | 	lib /out:libbz2.lib $(OBJS)
25 | 
26 | test: bzip2
27 | 	type words1
28 | 	.\\bzip2 -1  < sample1.ref > sample1.rb2
29 | 	.\\bzip2 -2  < sample2.ref > sample2.rb2
30 | 	.\\bzip2 -3  < sample3.ref > sample3.rb2
31 | 	.\\bzip2 -d  < sample1.bz2 > sample1.tst
32 | 	.\\bzip2 -d  < sample2.bz2 > sample2.tst
33 | 	.\\bzip2 -ds < sample3.bz2 > sample3.tst
34 | 	@echo All six of the fc's should find no differences.
35 | 	@echo If fc finds an error on sample3.bz2, this could be
36 | 	@echo because WinZip's 'TAR file smart CR/LF conversion'
37 | 	@echo is too clever for its own good.  Disable this option.
38 | 	@echo The correct size for sample3.ref is 120,244.  If it
39 | 	@echo is 150,251, WinZip has messed it up.
40 | 	fc sample1.bz2 sample1.rb2 
41 | 	fc sample2.bz2 sample2.rb2
42 | 	fc sample3.bz2 sample3.rb2
43 | 	fc sample1.tst sample1.ref
44 | 	fc sample2.tst sample2.ref
45 | 	fc sample3.tst sample3.ref
46 | 
47 | 
48 | 
49 | clean: 
50 | 	del *.obj
51 | 	del libbz2.lib 
52 | 	del bzip2.exe
53 | 	del bzip2recover.exe
54 | 	del sample1.rb2 
55 | 	del sample2.rb2 
56 | 	del sample3.rb2
57 | 	del sample1.tst 
58 | 	del sample2.tst
59 | 	del sample3.tst
60 | 
61 | .c.obj: 
62 | 	$(CC) $(CFLAGS) -c $*.c -o $*.obj
63 | 
64 | 


--------------------------------------------------------------------------------
/algos/bzip2/mk251.c:
--------------------------------------------------------------------------------
 1 | 
 2 | /* Spew out a long sequence of the byte 251.  When fed to bzip2
 3 |    versions 1.0.0 or 1.0.1, causes it to die with internal error
 4 |    1007 in blocksort.c.  This assertion misses an extremely rare
 5 |    case, which is fixed in this version (1.0.2) and above.
 6 | */
 7 | 
 8 | /* ------------------------------------------------------------------
 9 |    This file is part of bzip2/libbzip2, a program and library for
10 |    lossless, block-sorting data compression.
11 | 
12 |    bzip2/libbzip2 version 1.0.8 of 13 July 2019
13 |    Copyright (C) 1996-2019 Julian Seward 
14 | 
15 |    Please read the WARNING, DISCLAIMER and PATENTS sections in the 
16 |    README file.
17 | 
18 |    This program is released under the terms of the license contained
19 |    in the file LICENSE.
20 |    ------------------------------------------------------------------ */
21 | 
22 | 
23 | #include 
24 | 
25 | int main ()
26 | {
27 |    int i;
28 |    for (i = 0; i < 48500000 ; i++)
29 |      putchar(251);
30 |    return 0;
31 | }
32 | 


--------------------------------------------------------------------------------
/algos/bzip2/randtable.c:
--------------------------------------------------------------------------------
 1 | 
 2 | /*-------------------------------------------------------------*/
 3 | /*--- Table for randomising repetitive blocks               ---*/
 4 | /*---                                           randtable.c ---*/
 5 | /*-------------------------------------------------------------*/
 6 | 
 7 | /* ------------------------------------------------------------------
 8 |    This file is part of bzip2/libbzip2, a program and library for
 9 |    lossless, block-sorting data compression.
10 | 
11 |    bzip2/libbzip2 version 1.0.8 of 13 July 2019
12 |    Copyright (C) 1996-2019 Julian Seward 
13 | 
14 |    Please read the WARNING, DISCLAIMER and PATENTS sections in the 
15 |    README file.
16 | 
17 |    This program is released under the terms of the license contained
18 |    in the file LICENSE.
19 |    ------------------------------------------------------------------ */
20 | 
21 | 
22 | #include "bzlib_private.h"
23 | 
24 | 
25 | /*---------------------------------------------*/
26 | Int32 BZ2_rNums[512] = { 
27 |    619, 720, 127, 481, 931, 816, 813, 233, 566, 247, 
28 |    985, 724, 205, 454, 863, 491, 741, 242, 949, 214, 
29 |    733, 859, 335, 708, 621, 574, 73, 654, 730, 472, 
30 |    419, 436, 278, 496, 867, 210, 399, 680, 480, 51, 
31 |    878, 465, 811, 169, 869, 675, 611, 697, 867, 561, 
32 |    862, 687, 507, 283, 482, 129, 807, 591, 733, 623, 
33 |    150, 238, 59, 379, 684, 877, 625, 169, 643, 105, 
34 |    170, 607, 520, 932, 727, 476, 693, 425, 174, 647, 
35 |    73, 122, 335, 530, 442, 853, 695, 249, 445, 515, 
36 |    909, 545, 703, 919, 874, 474, 882, 500, 594, 612, 
37 |    641, 801, 220, 162, 819, 984, 589, 513, 495, 799, 
38 |    161, 604, 958, 533, 221, 400, 386, 867, 600, 782, 
39 |    382, 596, 414, 171, 516, 375, 682, 485, 911, 276, 
40 |    98, 553, 163, 354, 666, 933, 424, 341, 533, 870, 
41 |    227, 730, 475, 186, 263, 647, 537, 686, 600, 224, 
42 |    469, 68, 770, 919, 190, 373, 294, 822, 808, 206, 
43 |    184, 943, 795, 384, 383, 461, 404, 758, 839, 887, 
44 |    715, 67, 618, 276, 204, 918, 873, 777, 604, 560, 
45 |    951, 160, 578, 722, 79, 804, 96, 409, 713, 940, 
46 |    652, 934, 970, 447, 318, 353, 859, 672, 112, 785, 
47 |    645, 863, 803, 350, 139, 93, 354, 99, 820, 908, 
48 |    609, 772, 154, 274, 580, 184, 79, 626, 630, 742, 
49 |    653, 282, 762, 623, 680, 81, 927, 626, 789, 125, 
50 |    411, 521, 938, 300, 821, 78, 343, 175, 128, 250, 
51 |    170, 774, 972, 275, 999, 639, 495, 78, 352, 126, 
52 |    857, 956, 358, 619, 580, 124, 737, 594, 701, 612, 
53 |    669, 112, 134, 694, 363, 992, 809, 743, 168, 974, 
54 |    944, 375, 748, 52, 600, 747, 642, 182, 862, 81, 
55 |    344, 805, 988, 739, 511, 655, 814, 334, 249, 515, 
56 |    897, 955, 664, 981, 649, 113, 974, 459, 893, 228, 
57 |    433, 837, 553, 268, 926, 240, 102, 654, 459, 51, 
58 |    686, 754, 806, 760, 493, 403, 415, 394, 687, 700, 
59 |    946, 670, 656, 610, 738, 392, 760, 799, 887, 653, 
60 |    978, 321, 576, 617, 626, 502, 894, 679, 243, 440, 
61 |    680, 879, 194, 572, 640, 724, 926, 56, 204, 700, 
62 |    707, 151, 457, 449, 797, 195, 791, 558, 945, 679, 
63 |    297, 59, 87, 824, 713, 663, 412, 693, 342, 606, 
64 |    134, 108, 571, 364, 631, 212, 174, 643, 304, 329, 
65 |    343, 97, 430, 751, 497, 314, 983, 374, 822, 928, 
66 |    140, 206, 73, 263, 980, 736, 876, 478, 430, 305, 
67 |    170, 514, 364, 692, 829, 82, 855, 953, 676, 246, 
68 |    369, 970, 294, 750, 807, 827, 150, 790, 288, 923, 
69 |    804, 378, 215, 828, 592, 281, 565, 555, 710, 82, 
70 |    896, 831, 547, 261, 524, 462, 293, 465, 502, 56, 
71 |    661, 821, 976, 991, 658, 869, 905, 758, 745, 193, 
72 |    768, 550, 608, 933, 378, 286, 215, 979, 792, 961, 
73 |    61, 688, 793, 644, 986, 403, 106, 366, 905, 644, 
74 |    372, 567, 466, 434, 645, 210, 389, 550, 919, 135, 
75 |    780, 773, 635, 389, 707, 100, 626, 958, 165, 504, 
76 |    920, 176, 193, 713, 857, 265, 203, 50, 668, 108, 
77 |    645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 
78 |    936, 638
79 | };
80 | 
81 | 
82 | /*-------------------------------------------------------------*/
83 | /*--- end                                       randtable.c ---*/
84 | /*-------------------------------------------------------------*/
85 | 


--------------------------------------------------------------------------------
/algos/bzip2/spewG.c:
--------------------------------------------------------------------------------
 1 | 
 2 | /* spew out a thoroughly gigantic file designed so that bzip2
 3 |    can compress it reasonably rapidly.  This is to help test
 4 |    support for large files (> 2GB) in a reasonable amount of time.
 5 |    I suggest you use the undocumented --exponential option to
 6 |    bzip2 when compressing the resulting file; this saves a bit of
 7 |    time.  Note: *don't* bother with --exponential when compressing 
 8 |    Real Files; it'll just waste a lot of CPU time :-)
 9 |    (but is otherwise harmless).
10 | */
11 | 
12 | /* ------------------------------------------------------------------
13 |    This file is part of bzip2/libbzip2, a program and library for
14 |    lossless, block-sorting data compression.
15 | 
16 |    bzip2/libbzip2 version 1.0.8 of 13 July 2019
17 |    Copyright (C) 1996-2019 Julian Seward 
18 | 
19 |    Please read the WARNING, DISCLAIMER and PATENTS sections in the 
20 |    README file.
21 | 
22 |    This program is released under the terms of the license contained
23 |    in the file LICENSE.
24 | 	 ------------------------------------------------------------------ */
25 | 
26 | 
27 | #define _FILE_OFFSET_BITS 64
28 | 
29 | #include 
30 | #include 
31 | 
32 | /* The number of megabytes of junk to spew out (roughly) */
33 | #define MEGABYTES 5000
34 | 
35 | #define N_BUF 1000000
36 | char buf[N_BUF];
37 | 
38 | int main ( int argc, char** argv )
39 | {
40 |    int ii, kk, p;
41 |    srandom(1);
42 |    setbuffer ( stdout, buf, N_BUF );
43 |    for (kk = 0; kk < MEGABYTES * 515; kk+=3) {
44 |       p = 25+random()%50;
45 |       for (ii = 0; ii < p; ii++)
46 |          printf ( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" );
47 |       for (ii = 0; ii < p-1; ii++)
48 |          printf ( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" );
49 |       for (ii = 0; ii < p+1; ii++)
50 |          printf ( "ccccccccccccccccccccccccccccccccccccc" );
51 |    }
52 |    fflush(stdout);
53 |    return 0;
54 | }
55 | 


--------------------------------------------------------------------------------
/algos/common/aoclAlgoOpt.h:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023-2024, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 |  /** @file aoclAlgoOpt.h
30 |  *
31 |  *  @brief AOCL Optimization flags.
32 |  *
33 |  *  For native compilation comment out below flags based on ISA support
34 |  *
35 |  *  @author Ashish Sriram
36 |  */
37 | 
38 | /* BZIP2 */
39 | #define AOCL_BZIP2_OPT
40 | #ifdef AOCL_BZIP2_OPT
41 |     #define AOCL_BZIP2_AVX_OPT
42 | #endif
43 | 
44 | /* LZ4 */
45 | #define AOCL_LZ4_OPT
46 | #ifdef AOCL_LZ4_OPT
47 |     #define AOCL_LZ4_AVX_OPT
48 |     /* LZ4HC */
49 |     #define AOCL_LZ4HC_OPT
50 | #endif /* AOCL_LZ4_OPT */
51 | 
52 | /* LZMA */
53 | #define AOCL_LZMA_OPT
54 | 
55 | /* SNAPPY */
56 | #define AOCL_SNAPPY_OPT
57 | #ifdef AOCL_SNAPPY_OPT
58 |     #define AOCL_SNAPPY_AVX_OPT
59 |     #ifdef AOCL_SNAPPY_AVX_OPT
60 |         #define AOCL_SNAPPY_AVX2_OPT
61 |     #endif /* AOCL_SNAPPY_AVX_OPT */
62 | #endif /* AOCL_SNAPPY_OPT */
63 | 
64 | /* ZSTD */
65 | #define AOCL_ZSTD_OPT
66 | 
67 | /* ZLIB */
68 | #define AOCL_ZLIB_OPT
69 | #ifdef AOCL_ZLIB_OPT
70 |      #define AOCL_ZLIB_SSE2_OPT
71 |      #ifdef AOCL_ZLIB_SSE2_OPT
72 |           #define AOCL_ZLIB_AVX_OPT
73 |           #ifdef AOCL_ZLIB_AVX_OPT
74 |                #define AOCL_ZLIB_AVX2_OPT
75 |                #ifdef AOCL_ZLIB_AVX2_OPT
76 |                     #define AOCL_ZLIB_AVX512_OPT
77 |                #endif /* AOCL_ZLIB_AVX2_OPT */
78 |           #endif /* AOCL_ZLIB_AVX_OPT */
79 |      #endif /* AOCL_ZLIB_SSE2_OPT */
80 | #endif /* AOCL_ZLIB_OPT */
81 | 


--------------------------------------------------------------------------------
/algos/common/aoclFds.h:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2024, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 |  /** @file aoclFds.h
30 |  *
31 |  *  @brief Definitions for Fast Decompression Settings (FDS) mode.
32 |  *
33 |  *  This file contains definitions for Fast Decompression Settings (FDS) mode
34 |  *  that can be used across different algos in AOCL compression library.
35 |  *
36 |  *  @author Ashish Sriram
37 |  */
38 | 
39 | #ifndef __COMMON_FDS_H
40 | #define __COMMON_FDS_H
41 | 
42 | #if AOCL_DECOMPRESS_FAST > 1
43 | /*
44 | * AOCL fast decompress settings (FDS) frame format:
45 | *
46 | * | <-- FDS Magic word (8 bytes) --> | <-- Settings (8 bytes) --> |
47 | *
48 | * Settings are specific to each compression method
49 | */
50 | 
51 | // AOCL Fast Decompress Settings
52 | #define FDS_MAGIC_WORD 0x5344465F4C434F41 // ASCII encoding of AOCL_FDS
53 | #define FDS_MAGIC_WORD_BYTES 8
54 | #define FDS_METADATA_BYTES 8
55 | #define FDS_FRAME_LENGTH (FDS_MAGIC_WORD_BYTES + FDS_METADATA_BYTES)
56 | #endif /* AOCL_DECOMPRESS_FAST > 1 */
57 | 
58 | #endif /* __COMMON_FDS_H */
59 | 


--------------------------------------------------------------------------------
/algos/common/aoclThreadUtils.h:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2024, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 |  /** @file aoclThreadUtils.h
30 |  *
31 |  *  @brief Common routines used in multithreaded implementations.
32 |  *
33 |  *  This file contains common routines and definitions used in multithreaded 
34 |  *  implementations across methods.
35 |  *
36 |  *  @author Ashish Sriram
37 |  */
38 | 
39 | #ifndef __COMMON_THREAD_UTILS_H
40 | #define __COMMON_THREAD_UTILS_H
41 | 
42 | #define AOCL_MT_NO_PARTITIONS(thread_group_handle) (thread_group_handle.threads_info_list == NULL) /* no partitions found after setup */
43 | 
44 | #define AOCL_MT_CUR_THREAD_SERIAL_ID(ti_cur) ti_cur->thread_id /* serialized id of partition associated with a thread */
45 | 
46 | #define AOCL_MT_IS_FIRST_PARTITION(ti_cur) \
47 |         (AOCL_MT_CUR_THREAD_SERIAL_ID(ti_cur) == 0) /* is first partition of first thread? */
48 | 
49 | #define AOCL_MT_IS_LAST_PARTITION(thread_group_handle, ti_cur, thread_id) ( /* is last partition of last thread? */ \
50 |         (thread_id == (thread_group_handle.num_threads - 1) /* last thread */) \
51 |         && ti_cur->next == NULL /* last partition for this thread */)
52 | 
53 | #define AOCL_MT_PROCESS_PARTITION_START(thread_group_handle, ti_cur, thread_id) /* processing partitions serially. loop start */ \
54 |         aocl_thread_info_t* ti_cur = &thread_group_handle.threads_info_list[thread_id]; \
55 |         while (ti_cur) {
56 | 
57 | 
58 | #define AOCL_MT_PROCESS_PARTITION_END(ti_cur) /* processing partitions serially. loop end */ \
59 |         ti_cur = ti_cur->next; /* next linked partition */ \
60 |         }
61 | 
62 | #endif /* __COMMON_THREAD_UTILS_H */
63 | 


--------------------------------------------------------------------------------
/algos/lz4/.gitignore:
--------------------------------------------------------------------------------
1 | # make install artefact
2 | liblz4.pc
3 | 


--------------------------------------------------------------------------------
/algos/lz4/LICENSE:
--------------------------------------------------------------------------------
 1 | LZ4 Library
 2 | Copyright (c) 2011-2016, Yann Collet
 3 | All rights reserved.
 4 | 
 5 | Redistribution and use in source and binary forms, with or without modification,
 6 | are permitted provided that the following conditions are met:
 7 | 
 8 | * Redistributions of source code must retain the above copyright notice, this
 9 |   list of conditions and the following disclaimer.
10 | 
11 | * Redistributions in binary form must reproduce the above copyright notice, this
12 |   list of conditions and the following disclaimer in the documentation and/or
13 |   other materials provided with the distribution.
14 | 
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | 


--------------------------------------------------------------------------------
/algos/lz4/README_DOXYGEN_LZ4HC.md:
--------------------------------------------------------------------------------
 1 | LZ4HC - Introduction
 2 | ====================
 3 | LZ4HC is the High Compression variant of LZ4.
 4 | It offers more compression ratio at the cost of compression speed.
 5 | The files lz4hc.c and lz4hc.h add the support for LZ4HC.
 6 | 
 7 | This variant also compresses data using the LZ4 block format, 
 8 | and depends on regular lib/lz4.* source files.
 9 | 
10 | It is covered by the same LICENSE as that of LZ4.


--------------------------------------------------------------------------------
/algos/lz4/code_alignment_lz4.c:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | /* This function is used to ensure desired code alignment of lz4 source files
30 |  * within aocl compression library. This file precedes other lz4 source files
31 |  * in CMakeLists. Hence, code_alignment_lz4 will be the top lz4 function in
32 |  * the symbol table. __attribute__((aligned(64))) provides a buffer zone wrt
33 |  * functions from other modules preceeding it. Further alignment adjustments 
34 |  * are made to provide the best code alignment for lz4 module.*/
35 | #if defined(__x86_64__)
36 | __attribute__((aligned(64)))
37 | int code_alignment_lz4(void) {
38 | #if defined(__clang__)
39 |     // desired alignment: 32 bytes
40 |     __asm__("nop");
41 |     __asm__(".p2align 4"); //+ 16 bytes
42 | #else
43 |     // desired alignment: 32 bytes
44 |     __asm__("nop");
45 |     __asm__(".p2align 4"); //+ 16 bytes
46 | #endif
47 |     return 0; //+ 16 bytes
48 | }
49 | #endif
50 | 


--------------------------------------------------------------------------------
/algos/lz4/code_alignment_lz4hc.c:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | /* This function is used to ensure desired code alignment of lz4hc source files
30 |  * within aocl compression library. This file precedes other lz4hc source files
31 |  * in CMakeLists. Hence, code_alignment_lz4hc will be the top lz4hc function in 
32 |  * the symbol table. __attribute__((aligned(64))) provides a buffer zone wrt
33 |  * functions from other modules preceeding it. Further alignment adjustments 
34 |  * are made to provide the best code alignment for lz4hc module.*/
35 | #if defined(__x86_64__)
36 | __attribute__((aligned(64)))
37 | int code_alignment_lz4hc(void) {
38 | #if defined(__clang__)
39 |     // desired alignment: 64 bytes
40 |     __asm__("nop");
41 |     __asm__(".p2align 5"); //+ 32 bytes
42 |     __asm__("nop");
43 |     __asm__(".p2align 4"); //+ 16 bytes
44 | #else
45 |     // desired alignment: 16 bytes
46 | #endif
47 |     return 0; //+ 16 bytes
48 | }
49 | #endif
50 | 


--------------------------------------------------------------------------------
/algos/lz4/liblz4-dll.rc.in:
--------------------------------------------------------------------------------
 1 | #include 
 2 | 
 3 | // DLL version information.
 4 | 1 VERSIONINFO
 5 | FILEVERSION       @LIBVER_MAJOR@,@LIBVER_MINOR@,@LIBVER_PATCH@,0
 6 | PRODUCTVERSION    @LIBVER_MAJOR@,@LIBVER_MINOR@,@LIBVER_PATCH@,0
 7 | FILEFLAGSMASK      VS_FFI_FILEFLAGSMASK
 8 | #ifdef _DEBUG
 9 |   FILEFLAGS        VS_FF_DEBUG | VS_FF_PRERELEASE
10 | #else
11 |   FILEFLAGS        0
12 | #endif
13 | FILEOS             VOS_NT_WINDOWS32
14 | FILETYPE           VFT_DLL
15 | FILESUBTYPE        VFT2_UNKNOWN
16 | BEGIN
17 |     BLOCK "StringFileInfo"
18 |     BEGIN
19 |         BLOCK "040904B0"
20 |         BEGIN
21 |             VALUE "CompanyName", "Yann Collet"
22 |             VALUE "FileDescription", "Extremely fast compression"
23 |             VALUE "FileVersion", "@LIBVER_MAJOR@.@LIBVER_MINOR@.@LIBVER_PATCH@.0"
24 |             VALUE "InternalName", "@LIBLZ4@"
25 |             VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet"
26 |             VALUE "OriginalFilename", "@LIBLZ4@.dll"
27 |             VALUE "ProductName", "LZ4"
28 |             VALUE "ProductVersion", "@LIBVER_MAJOR@.@LIBVER_MINOR@.@LIBVER_PATCH@.0"
29 |         END
30 |     END
31 |     BLOCK "VarFileInfo"
32 |     BEGIN
33 |         VALUE "Translation", 0x0409, 1200
34 |     END
35 | END
36 | 


--------------------------------------------------------------------------------
/algos/lz4/liblz4.pc.in:
--------------------------------------------------------------------------------
 1 | #   LZ4 - Fast LZ compression algorithm
 2 | #   Copyright (C) 2011-2020, Yann Collet.
 3 | #   BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
 4 | 
 5 | prefix=@PREFIX@
 6 | libdir=@LIBDIR@
 7 | includedir=@INCLUDEDIR@
 8 | 
 9 | Name: lz4
10 | Description: extremely fast lossless compression algorithm library
11 | URL: http://www.lz4.org/
12 | Version: @VERSION@
13 | Libs: -L${libdir} -llz4
14 | Cflags: -I${includedir}
15 | 


--------------------------------------------------------------------------------
/algos/lz4/lz4file.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |    LZ4 file library
 3 |    Header File
 4 |    Copyright (C) 2022, Xiaomi Inc.
 5 |    BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
 6 | 
 7 |    Redistribution and use in source and binary forms, with or without
 8 |    modification, are permitted provided that the following conditions are
 9 |    met:
10 | 
11 |        * Redistributions of source code must retain the above copyright
12 |    notice, this list of conditions and the following disclaimer.
13 |        * Redistributions in binary form must reproduce the above
14 |    copyright notice, this list of conditions and the following disclaimer
15 |    in the documentation and/or other materials provided with the
16 |    distribution.
17 | 
18 |    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 |    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 |    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 |    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 |    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 |    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 |    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 |    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 |    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 |    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 |    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | 
30 |    You can contact the author at :
31 |    - LZ4 source repository : https://github.com/lz4/lz4
32 |    - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
33 | */
34 | #if defined (__cplusplus)
35 | extern "C" {
36 | #endif
37 | 
38 | #ifndef LZ4FILE_H
39 | #define LZ4FILE_H
40 | 
41 | #include 
42 | #include "lz4frame_static.h"
43 | 
44 | typedef struct LZ4_readFile_s LZ4_readFile_t;
45 | typedef struct LZ4_writeFile_s LZ4_writeFile_t;
46 | 
47 | /*! LZ4F_readOpen() :
48 |  * Set read lz4file handle.
49 |  * `lz4f` will set a lz4file handle.
50 |  * `fp` must be the return value of the lz4 file opened by fopen.
51 |  */
52 | LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_readOpen(LZ4_readFile_t** lz4fRead, FILE* fp);
53 | 
54 | /*! LZ4F_read() :
55 |  * Read lz4file content to buffer.
56 |  * `lz4f` must use LZ4_readOpen to set first.
57 |  * `buf` read data buffer.
58 |  * `size` read data buffer size.
59 |  */
60 | LZ4FLIB_STATIC_API size_t LZ4F_read(LZ4_readFile_t* lz4fRead, void* buf, size_t size);
61 | 
62 | /*! LZ4F_readClose() :
63 |  * Close lz4file handle.
64 |  * `lz4f` must use LZ4_readOpen to set first.
65 |  */
66 | LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_readClose(LZ4_readFile_t* lz4fRead);
67 | 
68 | /*! LZ4F_writeOpen() :
69 |  * Set write lz4file handle.
70 |  * `lz4f` will set a lz4file handle.
71 |  * `fp` must be the return value of the lz4 file opened by fopen.
72 |  */
73 | LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeOpen(LZ4_writeFile_t** lz4fWrite, FILE* fp, const LZ4F_preferences_t* prefsPtr);
74 | 
75 | /*! LZ4F_write() :
76 |  * Write buffer to lz4file.
77 |  * `lz4f` must use LZ4F_writeOpen to set first.
78 |  * `buf` write data buffer.
79 |  * `size` write data buffer size.
80 |  */
81 | LZ4FLIB_STATIC_API size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, void* buf, size_t size);
82 | 
83 | /*! LZ4F_writeClose() :
84 |  * Close lz4file handle.
85 |  * `lz4f` must use LZ4F_writeOpen to set first.
86 |  */
87 | LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeClose(LZ4_writeFile_t* lz4fWrite);
88 | 
89 | #endif /* LZ4FILE_H */
90 | 
91 | #if defined (__cplusplus)
92 | }
93 | #endif
94 | 


--------------------------------------------------------------------------------
/algos/lz4/lz4frame_static.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |    LZ4 auto-framing library
 3 |    Header File for static linking only
 4 |    Copyright (C) 2011-2020, Yann Collet.
 5 | 
 6 |    BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
 7 | 
 8 |    Redistribution and use in source and binary forms, with or without
 9 |    modification, are permitted provided that the following conditions are
10 |    met:
11 | 
12 |        * Redistributions of source code must retain the above copyright
13 |    notice, this list of conditions and the following disclaimer.
14 |        * Redistributions in binary form must reproduce the above
15 |    copyright notice, this list of conditions and the following disclaimer
16 |    in the documentation and/or other materials provided with the
17 |    distribution.
18 | 
19 |    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 |    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 |    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 |    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 |    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 |    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 |    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 |    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 |    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 |    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 |    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | 
31 |    You can contact the author at :
32 |    - LZ4 source repository : https://github.com/lz4/lz4
33 |    - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
34 | */
35 | 
36 | #ifndef LZ4FRAME_STATIC_H_0398209384
37 | #define LZ4FRAME_STATIC_H_0398209384
38 | 
39 | /* The declarations that formerly were made here have been merged into
40 |  * lz4frame.h, protected by the LZ4F_STATIC_LINKING_ONLY macro. Going forward,
41 |  * it is recommended to simply include that header directly.
42 |  */
43 | 
44 | #define LZ4F_STATIC_LINKING_ONLY
45 | #include "lz4frame.h"
46 | 
47 | #endif /* LZ4FRAME_STATIC_H_0398209384 */
48 | 


--------------------------------------------------------------------------------
/algos/lzma/Alloc.h:
--------------------------------------------------------------------------------
 1 | /* Alloc.h -- Memory allocation functions
 2 | 2021-07-13 : Igor Pavlov : Public domain */
 3 | 
 4 | #ifndef __COMMON_ALLOC_H
 5 | #define __COMMON_ALLOC_H
 6 | 
 7 | #include "7zTypes.h"
 8 | 
 9 | EXTERN_C_BEGIN
10 | 
11 | void *MyAlloc(size_t size);
12 | void MyFree(void *address);
13 | 
14 | #ifdef _WIN32
15 | 
16 | void SetLargePageSize(void);
17 | 
18 | void *MidAlloc(size_t size);
19 | void MidFree(void *address);
20 | void *BigAlloc(size_t size);
21 | void BigFree(void *address);
22 | 
23 | #else
24 | 
25 | #define MidAlloc(size) MyAlloc(size)
26 | #define MidFree(address) MyFree(address)
27 | #define BigAlloc(size) MyAlloc(size)
28 | #define BigFree(address) MyFree(address)
29 | 
30 | #endif
31 | 
32 | extern const ISzAlloc g_Alloc;
33 | 
34 | #ifdef _WIN32
35 | extern const ISzAlloc g_BigAlloc;
36 | extern const ISzAlloc g_MidAlloc;
37 | #else
38 | #define g_BigAlloc g_AlignedAlloc
39 | #define g_MidAlloc g_AlignedAlloc
40 | #endif
41 | 
42 | extern const ISzAlloc g_AlignedAlloc;
43 | 
44 | 
45 | typedef struct
46 | {
47 |   ISzAlloc vt;
48 |   ISzAllocPtr baseAlloc;
49 |   unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */
50 |   size_t offset;         /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */
51 | } CAlignOffsetAlloc;
52 | 
53 | void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p);
54 | 
55 | 
56 | EXTERN_C_END
57 | 
58 | #endif
59 | 


--------------------------------------------------------------------------------
/algos/lzma/Compiler.h:
--------------------------------------------------------------------------------
 1 | /* Compiler.h
 2 | 2017-04-03 : Igor Pavlov : Public domain */
 3 | 
 4 | #ifndef __7Z_COMPILER_H
 5 | #define __7Z_COMPILER_H
 6 | 
 7 | #ifdef _MSC_VER
 8 | 
 9 |   #ifdef UNDER_CE
10 |     #define RPC_NO_WINDOWS_H
11 |     /* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */
12 |     #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
13 |     #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int
14 |   #endif
15 | 
16 |   #if _MSC_VER >= 1300
17 |     #pragma warning(disable : 4996) // This function or variable may be unsafe
18 |   #else
19 |     #pragma warning(disable : 4511) // copy constructor could not be generated
20 |     #pragma warning(disable : 4512) // assignment operator could not be generated
21 |     #pragma warning(disable : 4514) // unreferenced inline function has been removed
22 |     #pragma warning(disable : 4702) // unreachable code
23 |     #pragma warning(disable : 4710) // not inlined
24 |     #pragma warning(disable : 4714) // function marked as __forceinline not inlined
25 |     #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information
26 |   #endif
27 | 
28 | #endif
29 | 
30 | #define UNUSED_VAR(x) (void)x;
31 | /* #define UNUSED_VAR(x) x=x; */
32 | 
33 | #endif
34 | 


--------------------------------------------------------------------------------
/algos/lzma/LICENSE:
--------------------------------------------------------------------------------
1 | LZMA SDK is placed in the public domain.
2 | 
3 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute
4 | the original LZMA SDK code, either in source code form or as a compiled binary,
5 | for any purpose, commercial or non-commercial, and by any means.


--------------------------------------------------------------------------------
/algos/lzma/LzHash.h:
--------------------------------------------------------------------------------
 1 | /* LzHash.h -- HASH functions for LZ algorithms
 2 | 2019-10-30 : Igor Pavlov : Public domain */
 3 | 
 4 | #ifndef __LZ_HASH_H
 5 | #define __LZ_HASH_H
 6 | 
 7 | /*
 8 |   (kHash2Size >= (1 <<  8)) : Required
 9 |   (kHash3Size >= (1 << 16)) : Required
10 | */
11 | 
12 | #define kHash2Size (1 << 10)
13 | #define kHash3Size (1 << 16)
14 | // #define kHash4Size (1 << 20)
15 | 
16 | #define kFix3HashSize (kHash2Size)
17 | #define kFix4HashSize (kHash2Size + kHash3Size)
18 | // #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
19 | 
20 | /*
21 |   We use up to 3 crc values for hash:
22 |     crc0
23 |     crc1 << Shift_1
24 |     crc2 << Shift_2
25 |   (Shift_1 = 5) and (Shift_2 = 10) is good tradeoff.
26 |   Small values for Shift are not good for collision rate.
27 |   Big value for Shift_2 increases the minimum size
28 |   of hash table, that will be slow for small files.
29 | */
30 | 
31 | #define kLzHash_CrcShift_1 5
32 | #define kLzHash_CrcShift_2 10
33 | 
34 | #endif
35 | 


--------------------------------------------------------------------------------
/algos/lzma/Precomp.h:
--------------------------------------------------------------------------------
 1 | /* Precomp.h -- StdAfx
 2 | 2013-11-12 : Igor Pavlov : Public domain */
 3 | 
 4 | #ifndef __7Z_PRECOMP_H
 5 | #define __7Z_PRECOMP_H
 6 | 
 7 | #include "Compiler.h"
 8 | /* #include "7zTypes.h" */
 9 | 
10 | #endif
11 | 


--------------------------------------------------------------------------------
/algos/lzma/README_DOXYGEN.md:
--------------------------------------------------------------------------------
 1 | LZMA - Introduction
 2 | ===================
 3 | LZMA / LZMA2 are default and general compression methods of 7z format in the 7-Zip program.
 4 | LZMA provides a high compression ratio and fast decompression, so it is very suitable for 
 5 | embedded applications. For example, it can be used for ROM (firmware) compressing.
 6 | 
 7 | LZMA features:
 8 | 
 9 | Compression speed: 3 MB/s on 3 GHz dual-core CPU.
10 | Decompression speed:
11 | 20-50 MB/s on modern 3 GHz CPU (Intel, AMD, ARM).
12 | Small memory requirements for decompression: 8-32 KB + DictionarySize
13 | Small code size for decompression: 2-8 KB (depending on speed optimizations)
14 | 
15 | The LZMA decoder uses only CPU integer instructions and can be implemented for any modern 32-bit CPU.


--------------------------------------------------------------------------------
/algos/lzma/code_alignment.c:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | /* This function is used to ensure desired code alignment of lzma source files
30 |  * within aocl compression library. This file precedes other lzma source files
31 |  * in CMakeLists. Hence, code_alignment_lzma will be the top lzma function in
32 |  * the symbol table. __attribute__((aligned(64))) provides a buffer zone wrt
33 |  * functions from other modules preceeding it. Further alignment adjustments 
34 |  * are made to provide the best code alignment for lzma module.*/
35 | #if defined(__x86_64__)
36 | __attribute__((aligned(64)))
37 | int code_alignment_lzma(void) {
38 | #if defined(__clang__)
39 |     // desired alignment: 16 bytes
40 | #else
41 |     // desired alignment: 64 bytes
42 |     __asm__("nop");
43 |     __asm__(".p2align 5"); //+ 32 bytes
44 |     __asm__("nop");
45 |     __asm__(".p2align 4"); //+ 16 bytes
46 | #endif
47 |     return 0; //+ 16 bytes
48 | }
49 | #endif
50 | 


--------------------------------------------------------------------------------
/algos/snappy/LICENSE:
--------------------------------------------------------------------------------
 1 | Copyright 2011, Google Inc.
 2 | All rights reserved.
 3 | 
 4 | Redistribution and use in source and binary forms, with or without
 5 | modification, are permitted provided that the following conditions are
 6 | met:
 7 | 
 8 |     * Redistributions of source code must retain the above copyright
 9 | notice, this list of conditions and the following disclaimer.
10 |     * Redistributions in binary form must reproduce the above
11 | copyright notice, this list of conditions and the following disclaimer
12 | in the documentation and/or other materials provided with the
13 | distribution.
14 |     * Neither the name of Google Inc. nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 | 
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


--------------------------------------------------------------------------------
/algos/snappy/code_alignment.cc:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | /* This function is used to ensure desired code alignment of snappy source files
30 |  * within aocl compression library. This file precedes other snappy source files
31 |  * in CMakeLists. Hence, code_alignment_snappy will be the top snappy function in
32 |  * the symbol table. __attribute__((aligned(64))) provides a buffer zone wrt
33 |  * functions from other modules preceeding it. Further alignment adjustments 
34 |  * are made to provide the best code alignment for snappy module.*/
35 | #if defined(__x86_64__)
36 | __attribute__((aligned(64)))
37 | int code_alignment_snappy(void) {
38 | #if defined(__clang__)
39 |     // desired alignment: 64 bytes
40 |     __asm__("nop");
41 |     __asm__(".p2align 5"); //+ 32 bytes
42 |     __asm__("nop");
43 |     __asm__(".p2align 4"); //+ 16 bytes
44 | #else
45 |     // desired alignment: 64 bytes
46 |     __asm__("nop");
47 |     __asm__(".p2align 5"); //+ 32 bytes
48 |     __asm__("nop");
49 |     __asm__(".p2align 4"); //+ 16 bytes
50 | #endif
51 |     return 0; //+ 16 bytes
52 | }
53 | #endif
54 | 


--------------------------------------------------------------------------------
/algos/snappy/config.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amd/aocl-compression/69dd0e31f563bbeaf248c0a434c76e89ca13f506/algos/snappy/config.h


--------------------------------------------------------------------------------
/algos/snappy/snappy-stubs-internal.cc:
--------------------------------------------------------------------------------
 1 | // Copyright 2011 Google Inc. All Rights Reserved.
 2 | //
 3 | // Redistribution and use in source and binary forms, with or without
 4 | // modification, are permitted provided that the following conditions are
 5 | // met:
 6 | //
 7 | //     * Redistributions of source code must retain the above copyright
 8 | // notice, this list of conditions and the following disclaimer.
 9 | //     * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | //     * Neither the name of Google Inc. nor the names of its
14 | // contributors may be used to endorse or promote products derived from
15 | // this software without specific prior written permission.
16 | //
17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | 
29 | #include 
30 | #include 
31 | 
32 | #include "snappy-stubs-internal.h"
33 | 
34 | namespace snappy {
35 | 
36 | void Varint::Append32(std::string* s, uint32_t value) {
37 |   char buf[Varint::kMax32];
38 |   const char* p = Varint::Encode32(buf, value);
39 |   s->append(buf, p - buf);
40 | }
41 | 
42 | }  // namespace snappy
43 | 


--------------------------------------------------------------------------------
/algos/snappy/snappy-stubs-public.h:
--------------------------------------------------------------------------------
 1 | // Copyright 2011 Google Inc. All Rights Reserved.
 2 | //
 3 | // Redistribution and use in source and binary forms, with or without
 4 | // modification, are permitted provided that the following conditions are
 5 | // met:
 6 | //
 7 | //     * Redistributions of source code must retain the above copyright
 8 | // notice, this list of conditions and the following disclaimer.
 9 | //     * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | //     * Neither the name of Google Inc. nor the names of its
14 | // contributors may be used to endorse or promote products derived from
15 | // this software without specific prior written permission.
16 | //
17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 | //
29 | // Various type stubs for the open-source version of Snappy.
30 | //
31 | // This file cannot include config.h, as it is included from snappy.h,
32 | // which is a public header. Instead, snappy-stubs-public.h is generated by
33 | // from snappy-stubs-public.h.in at configure time.
34 | 
35 | #ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
36 | #define THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
37 | 
38 | #include 
39 | 
40 | #ifdef HAVE_SYS_UIO_H
41 | #include 
42 | #endif  // HAVE_SYS_UIO_H
43 | 
44 | #define SNAPPY_MAJOR 1
45 | #define SNAPPY_MINOR 2
46 | #define SNAPPY_PATCHLEVEL 1
47 | #define SNAPPY_VERSION \
48 |     ((SNAPPY_MAJOR << 16) | (SNAPPY_MINOR << 8) | SNAPPY_PATCHLEVEL)
49 | 
50 | namespace snappy {
51 | 
52 | #if !defined(HAVE_SYS_UIO_H)
53 | // Windows does not have an iovec type, yet the concept is universally useful.
54 | // It is simple to define it ourselves, so we put it inside our own namespace.
55 | struct iovec {
56 |   void* iov_base;
57 |   size_t iov_len;
58 | };
59 | #endif  // !HAVE_SYS_UIO_H
60 | 
61 | }  // namespace snappy
62 | 
63 | #endif  // THIRD_PARTY_SNAPPY_OPENSOURCE_SNAPPY_STUBS_PUBLIC_H_
64 | 


--------------------------------------------------------------------------------
/algos/zlib/LICENSE:
--------------------------------------------------------------------------------
 1 | Copyright notice:
 2 | 
 3 |  (C) 1995-2022 Jean-loup Gailly and Mark Adler
 4 | 
 5 |   This software is provided 'as-is', without any express or implied
 6 |   warranty.  In no event will the authors be held liable for any damages
 7 |   arising from the use of this software.
 8 | 
 9 |   Permission is granted to anyone to use this software for any purpose,
10 |   including commercial applications, and to alter it and redistribute it
11 |   freely, subject to the following restrictions:
12 | 
13 |   1. The origin of this software must not be misrepresented; you must not
14 |      claim that you wrote the original software. If you use this software
15 |      in a product, an acknowledgment in the product documentation would be
16 |      appreciated but is not required.
17 |   2. Altered source versions must be plainly marked as such, and must not be
18 |      misrepresented as being the original software.
19 |   3. This notice may not be removed or altered from any source distribution.
20 | 
21 |   Jean-loup Gailly        Mark Adler
22 |   jloup@gzip.org          madler@alumni.caltech.edu
23 | 


--------------------------------------------------------------------------------
/algos/zlib/README.md:
--------------------------------------------------------------------------------
 1 | ZLIB - Introduction
 2 | ===================
 3 | 
 4 | zlib 1.3 is a general-purpose data compression library.  All the code is
 5 | thread safe.  The data format used by the zlib library is described by
 6 | Request for Comments (RFCs) 1950 to 1952 in the files
 7 | http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format), and
 8 | rfc1952 (gzip format).
 9 | 
10 | All functions of the compression library are documented in the file zlib.h (volunteer to write man pages welcome, contact zlib@gzip.org).
11 | 
12 | 
13 | Notes:
14 | ======
15 | 
16 | - For 64-bit Irix, deflate.c must be compiled without any optimization. With
17 |   -O, one libpng test fails. The test works in 32-bit mode (with the -n32
18 |   compiler flag). The compiler bug has been reported to SGI.
19 | 
20 | - zlib doesn't work with GCC 2.6.3 on a DEC 3000/300LX under OSF/1 2.1. It works
21 |   when compiled with cc.
22 | 
23 | - On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the CC option -std1 is
24 |   necessary to get gzprintf working correctly. This is done by configure.
25 | 
26 | - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
27 |   the other compilers. Use "make test" to check your compiler.
28 | 
29 | - gzdopen is not supported on RISCOS or BEOS.
30 | 
31 | - For PalmOs, refer to http://palmzlib.sourceforge.net/
32 | 


--------------------------------------------------------------------------------
/algos/zlib/aocl_zlib_setup.h:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023-2024, Advanced Micro Devices. All rights reserved.
 3 |  * 
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | #ifndef AOCL_ZLIB_SETUP_H
29 | #define AOCL_ZLIB_SETUP_H
30 | 
31 | #ifdef AOCL_ZLIB_OPT
32 | 
33 | extern void aocl_register_slide_hash(int optOff, int optLevel);
34 | extern void aocl_destroy_slide_hash(void);
35 | 
36 | extern void aocl_register_longest_match(int optOff, int optLevel);
37 | extern void aocl_destroy_longest_match(void);
38 | 
39 | extern void aocl_setup_adler32(int optOff, int optLevel);
40 | extern void aocl_destroy_adler32(void);
41 | 
42 | extern void aocl_setup_deflate(int optOff, int optLevel);
43 | extern void aocl_destroy_deflate(void);
44 | 
45 | extern void aocl_setup_tree(int optOff, int optLevel);
46 | extern void aocl_destroy_tree(void);
47 | 
48 | extern void aocl_setup_inflate(int optOff, int optLevel);
49 | extern void aocl_destroy_inflate(void);
50 | 
51 | #endif /* AOCL_ZLIB_OPT */
52 | 
53 | #endif /* AOCL_ZLIB_SETUP_H */
54 | 


--------------------------------------------------------------------------------
/algos/zlib/aocl_zlib_utils.h:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2024, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | #ifndef AOCL_ZLIB_UTILS_H
30 | #define AOCL_ZLIB_UTILS_H
31 | 
32 | #define DQUICK_LIT_MAX_BITS 9
33 | #define DQUICK_OVERHEAD(x) ((x * (DQUICK_LIT_MAX_BITS - 8) + 7) >> 3)
34 | /* deflate_quick worst-case overhead: 9 bits per literal, round up to next byte (+7) */
35 | 
36 | #define FIXED_HUFFFMAN_COMPRESSED_SIZE(x) (x + DQUICK_OVERHEAD(x))
37 | #define STORED_ZLIB_COMPRESSED_SIZE(x) (x + (x >> 12) + (x >> 14) + (x >> 25) + 13)
38 | 
39 | extern void aocl_zlib_set_enable_dquick(int val);
40 | extern int aocl_zlib_get_enable_dquick(void);
41 | 
42 | #ifdef AOCL_ENABLE_THREADS
43 | 
44 | #define CALCULATE_CHECKSUM(source, len, wrap) \
45 |     (wrap == 1) ? adler32_x86(1L, (const Bytef *)source, len) : \
46 |     (wrap == 2) ? crc32(0L, (const Bytef *)source, len) : \
47 |     0
48 | 
49 | #define UPDATE_CHECKSUM(checksum1, checksum2, len2, wrap) \
50 |     (wrap == 1) ? adler32_combine(checksum1, checksum2, len2) : \
51 |     (wrap == 2) ? crc32_combine(checksum1, checksum2, len2) : \
52 |     0
53 | 
54 | extern int insert_Header_generic(Bytef *dest, int level, const int wrap);
55 | extern int insert_Trailer_generic(Bytef *dest, AOCL_UINT32 checksum, uLong sourceLen, const int wrap);
56 | #endif /* AOCL_ENABLE_THREADS */
57 | 
58 | #endif /* AOCL_ZLIB_UTILS_H */
59 | 


--------------------------------------------------------------------------------
/algos/zlib/aocl_zlib_x86.h:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023-2024, Advanced Micro Devices. All rights reserved.
 3 |  * 
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | #ifndef AOCL_X86_H
30 | #define AOCL_X86_H
31 | #include "deflate.h"
32 | 
33 | #ifdef AOCL_ZLIB_OPT
34 | ZEXTERN void slide_hash_x86(deflate_state *s);
35 | ZEXTERN uInt longest_match_x86 (deflate_state *s, IPos cur_match);
36 | ZEXTERN uInt longest_match_lazy_x86 (deflate_state *s, IPos cur_match);
37 | 
38 | /* Equivalent functions for adler32_x86
39 |  * that do not call AOCL_SETUP_NATIVE(). When these functions are called
40 |  * from other APIs, dynamic dispatcher setup is already done, and overhead
41 |  * from calling AOCL_SETUP_NATIVE() can be avoided. 
42 |  * This function also take care of copying data to sliding window when it 
43 |  * does not have enough data for further processing. It prevents copying
44 |  * twice, once during checksum calculation and other when data is copied
45 |  * to sliding window.
46 |  */
47 | ZEXTERN uint32_t adler32_x86_internal_with_copy(uint32_t adler, Bytef *dst, const Bytef *buf, z_size_t len, const short copy);
48 | #endif
49 | 
50 | #endif
51 | 


--------------------------------------------------------------------------------
/algos/zlib/code_alignment.c:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | /* This function is used to ensure desired code alignment of zlib source files
30 |  * within aocl compression library. This file precedes other zlib source files
31 |  * in CMakeLists. Hence, code_alignment_zlib will be the top zlib function in
32 |  * the symbol table. __attribute__((aligned(64))) provides a buffer zone wrt
33 |  * functions from other modules preceeding it. Further alignment adjustments 
34 |  * are made to provide the best code alignment for zlib module.*/
35 | #if defined(__x86_64__)
36 | __attribute__((aligned(64)))
37 | int code_alignment_zlib(void) {
38 | #if defined(__clang__)
39 |     // desired alignment: 64 bytes
40 |     __asm__("nop");
41 |     __asm__(".p2align 5"); //+ 32 bytes
42 |     __asm__("nop");
43 |     __asm__(".p2align 4"); //+ 16 bytes
44 | #else
45 |     // desired alignment: 16 bytes
46 | #endif
47 |     return 0; //+ 16 bytes
48 | }
49 | #endif
50 | 


--------------------------------------------------------------------------------
/algos/zlib/crc32_x86_pclmul.c:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2022-2025, Advanced Micro Devices. All rights reserved.
 3 |  * 
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | #include "aoclAlgoOpt.h"
30 | 
31 | #ifdef AOCL_ZLIB_AVX_OPT
32 | #define CRC_32_Z_X86_PCLMUL 1
33 | 
34 | #define CRC_32_Z_VARIANT CRC_32_Z_X86_PCLMUL
35 | #include "crc32_x86.h"
36 | #else
37 | // A dummy declaration to avoid "error: ISO C forbids an empty translation unit [-Werror=pedantic]"
38 | void dummy_function_crc32_x86_pclmul(void) {}
39 | #endif /* AOCL_ZLIB_AVX_OPT */
40 | 


--------------------------------------------------------------------------------
/algos/zlib/crc32_x86_vpclmulqdq.c:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2022-2025, Advanced Micro Devices. All rights reserved.
 3 |  * 
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | #include "aoclAlgoOpt.h"
30 | 
31 | #ifdef AOCL_ZLIB_AVX512_OPT
32 | #define CRC_32_Z_X86_VPCLMULQDQ 2
33 | 
34 | #define CRC_32_Z_VARIANT CRC_32_Z_X86_VPCLMULQDQ
35 | #include "crc32_x86.h"
36 | #else
37 | // A dummy declaration to avoid "error: ISO C forbids an empty translation unit [-Werror=pedantic]"
38 | void dummy_function_crc32_x86_vpclmulqdq(void) {}
39 | #endif /* AOCL_ZLIB_AVX512_OPT */
40 | 


--------------------------------------------------------------------------------
/algos/zlib/gzclose.c:
--------------------------------------------------------------------------------
 1 | /* gzclose.c -- zlib gzclose() function
 2 |  * Copyright (C) 2004, 2010 Mark Adler
 3 |  * For conditions of distribution and use, see copyright notice in zlib.h
 4 |  */
 5 | 
 6 | #include "gzguts.h"
 7 | 
 8 | /* gzclose() is in a separate file so that it is linked in only if it is used.
 9 |    That way the other gzclose functions can be used instead to avoid linking in
10 |    unneeded compression or decompression routines. */
11 | int ZEXPORT gzclose(gzFile file) {
12 | #ifndef NO_GZCOMPRESS
13 |     gz_statep state;
14 | 
15 |     if (file == NULL)
16 |         return Z_STREAM_ERROR;
17 |     state = (gz_statep)file;
18 | 
19 |     return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
20 | #else
21 |     return gzclose_r(file);
22 | #endif
23 | }
24 | 


--------------------------------------------------------------------------------
/algos/zlib/inffast.h:
--------------------------------------------------------------------------------
 1 | /* inffast.h -- header to use inffast.c
 2 |  * Copyright (C) 1995-2003, 2010 Mark Adler
 3 |  * Modifications Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 4 |  * For conditions of distribution and use, see copyright notice in zlib.h
 5 |  */
 6 | 
 7 | /* WARNING: this file should *not* be used by applications. It is
 8 |    part of the implementation of the compression library and is
 9 |    subject to change. Applications should only use zlib.h.
10 |  */
11 | #ifdef AOCL_ZLIB_OPT
12 | /* INFLATE_FAST_MIN_INPUT: the minimum number of input bytes needed so that
13 |    we can safely call inflate_fast() with only one up-front bounds check. One
14 |    length/distance code pair (15 bits for the length code, 5 bits for length
15 |    extra, 15 bits for the distance code, 13 bits for distance extra) requires
16 |    reading up to 48 input bits (6 bytes).
17 | */
18 | #define INFLATE_FAST_MIN_INPUT 6
19 | 
20 | /* INFLATE_FAST_MIN_OUTPUT: the minimum number of output bytes needed so that
21 |    we can safely call inflate_fast() with only one up-front bounds check. One
22 |    length/distance code pair can output up to 258 bytes, which is the maximum
23 |    length that can be coded.
24 | */
25 | #define INFLATE_FAST_MIN_OUTPUT 258
26 | 
27 | #endif /* AOCL_ZLIB_OPT */
28 | 
29 | void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start);
30 | 


--------------------------------------------------------------------------------
/algos/zlib/inffast_chunk.h:
--------------------------------------------------------------------------------
 1 | /* inffast_chunk.h -- header to use inffast_chunk.c
 2 |  * Copyright (C) 1995-2003, 2010 Mark Adler
 3 |  * Copyright (C) 2017 ARM, Inc.
 4 |  * Copyright 2023 The Chromium Authors
 5 |  * Modifications Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 6 |  * For conditions of distribution and use, see copyright notice in zlib.h
 7 |  */
 8 | /* WARNING: this file should *not* be used by applications. It is
 9 |    part of the implementation of the compression library and is
10 |    subject to change. Applications should only use zlib.h.
11 |  */
12 | #include "inffast.h"
13 | #include "zconf.h"
14 | /* INFLATE_FAST_MIN_INPUT:
15 |    The minimum number of input bytes needed so that we can safely call
16 |    inflate_fast() with only one up-front bounds check. One
17 |    length/distance code pair (15 bits for the length code, 5 bits for length
18 |    extra, 15 bits for the distance code, 13 bits for distance extra) requires
19 |    reading up to 48 input bits. Additionally, in the same iteraction, we may
20 |    decode two literals from the root-table (requiring MIN_OUTPUT = 258 + 2).
21 |    Each root-table entry is up to 10 bits, for a total of 68 input bits each
22 |    iteraction.
23 |    The refill variant reads 8 bytes from the buffer at a time, and advances
24 |    the input pointer by up to 7 bytes, ensuring there are at least 56-bits
25 |    available in the bit-buffer. The technique was documented by Fabian Giesen
26 |    on his blog as variant 4 in the article 'Reading bits in far too many ways':
27 |    https://fgiesen.wordpress.com/2018/02/20/
28 |    In the worst case, we may refill twice in the same iteraction, requiring
29 |    MIN_INPUT = 8 + 7.
30 | */
31 | #ifdef AOCL_ZLIB_SSE2_OPT
32 | #define INFLATE_CHUNK_READ_64LE
33 | #ifdef INFLATE_CHUNK_READ_64LE
34 | #undef INFLATE_FAST_MIN_INPUT
35 | #define INFLATE_FAST_MIN_INPUT 15
36 | #undef INFLATE_FAST_MIN_OUTPUT
37 | #define INFLATE_FAST_MIN_OUTPUT 260
38 | #endif
39 | void ZLIB_INTERNAL inflate_fast_chunk_ (z_streamp strm, unsigned start);
40 | #endif /* AOCL_ZLIB_SSE2_OPT */
41 | 


--------------------------------------------------------------------------------
/algos/zlib/inftrees.h:
--------------------------------------------------------------------------------
 1 | /* inftrees.h -- header to use inftrees.c
 2 |  * Copyright (C) 1995-2005, 2010 Mark Adler
 3 |  * Modifications Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 4 |  * For conditions of distribution and use, see copyright notice in zlib.h
 5 |  */
 6 | 
 7 | /* WARNING: this file should *not* be used by applications. It is
 8 |    part of the implementation of the compression library and is
 9 |    subject to change. Applications should only use zlib.h.
10 |  */
11 | 
12 | /* Structure for decoding tables.  Each entry provides either the
13 |    information needed to do the operation requested by the code that
14 |    indexed that table entry, or it provides a pointer to another
15 |    table that indexes more bits of the code.  op indicates whether
16 |    the entry is a pointer to another table, a literal, a length or
17 |    distance, an end-of-block, or an invalid code.  For a table
18 |    pointer, the low four bits of op is the number of index bits of
19 |    that table.  For a length or distance, the low four bits of op
20 |    is the number of extra bits to get after the code.  bits is
21 |    the number of bits in this code or part of the code to drop off
22 |    of the bit buffer.  val is the actual byte to output in the case
23 |    of a literal, the base length or distance, or the offset from
24 |    the current table to the next table.  Each entry is four bytes. */
25 | typedef struct {
26 |     unsigned char op;           /* operation, extra bits, table bits */
27 |     unsigned char bits;         /* bits in this part of the code */
28 |     unsigned short val;         /* offset in table or code value */
29 | } code;
30 | 
31 | /* op values as set by inflate_table():
32 |     00000000 - literal
33 |     0000tttt - table link, tttt != 0 is the number of table index bits
34 |     0001eeee - length or distance, eeee is the number of extra bits
35 |     01100000 - end of block
36 |     01000000 - invalid code
37 |  */
38 | 
39 | #ifndef AOCL_ZLIB_OPT
40 | /* Maximum size of the dynamic table.  The maximum number of code structures is
41 |    1444, which is the sum of 852 for literal/length codes and 592 for distance
42 |    codes.  These values were found by exhaustive searches using the program
43 |    examples/enough.c found in the zlib distribution.  The arguments to that
44 |    program are the number of symbols, the initial root table size, and the
45 |    maximum bit length of a code.  "enough 286 9 15" for literal/length codes
46 |    returns returns 852, and "enough 30 6 15" for distance codes returns 592.
47 |    The initial root table size (9 or 6) is found in the fifth argument of the
48 |    inflate_table() calls in inflate.c and infback.c.  If the root table size is
49 |    changed, then these maximum sizes would be need to be recalculated and
50 |    updated. */
51 | #define ENOUGH_LENS 852
52 | #else
53 | /* Maximum size of the dynamic table.  The maximum number of code structures is
54 |    1924, which is the sum of 1332 for literal/length codes and 592 for distance
55 |    codes.  These values were found by exhaustive searches using the program
56 |    examples/enough.c found in the zlib distribution.  The arguments to that
57 |    program are the number of symbols, the initial root table size, and the
58 |    maximum bit length of a code.  "enough 286 10 15" for literal/length codes
59 |    returns returns 1332, and "enough 30 9 15" for distance codes returns 592.
60 |    The initial root table size (10 or 9) is found in the fifth argument of the
61 |    inflate_table() calls in inflate.c and infback.c.  If the root table size is
62 |    changed, then these maximum sizes would be need to be recalculated and
63 |    updated. */
64 | #define ENOUGH_LENS 1332
65 | #endif /* AOCL_ZLIB_OPT */
66 | #define ENOUGH_DISTS 592
67 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
68 | 
69 | /* Type of code to build for inflate_table() */
70 | typedef enum {
71 |     CODES,
72 |     LENS,
73 |     DISTS
74 | } codetype;
75 | 
76 | int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
77 |                                 unsigned codes, code FAR * FAR *table,
78 |                                 unsigned FAR *bits, unsigned short FAR *work);
79 | 


--------------------------------------------------------------------------------
/algos/zstd/LICENSE:
--------------------------------------------------------------------------------
 1 | BSD License
 2 | 
 3 | For Zstandard software
 4 | 
 5 | Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
 6 | 
 7 | Redistribution and use in source and binary forms, with or without modification,
 8 | are permitted provided that the following conditions are met:
 9 | 
10 |  * Redistributions of source code must retain the above copyright notice, this
11 |    list of conditions and the following disclaimer.
12 | 
13 |  * Redistributions in binary form must reproduce the above copyright notice,
14 |    this list of conditions and the following disclaimer in the documentation
15 |    and/or other materials provided with the distribution.
16 | 
17 |  * Neither the name Facebook nor the names of its contributors may be used to
18 |    endorse or promote products derived from this software without specific
19 |    prior written permission.
20 | 
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | 


--------------------------------------------------------------------------------
/algos/zstd/README_DOXYGEN.md:
--------------------------------------------------------------------------------
 1 | ZSTD - Introduction
 2 | ===================
 3 | __Zstandard__, or `zstd` as short version, is a fast lossless compression algorithm,
 4 | targeting real-time compression scenarios at zlib-level and better compression ratios.
 5 | It's backed by a very fast entropy stage, provided by [Huff0 and FSE library](https://github.com/Cyan4973/FiniteStateEntropy).
 6 | 
 7 | The project is provided as an open-source dual [BSD](LICENSE) and [GPLv2](https://github.com/facebook/zstd/blob/dev/COPYING) licensed **C** library,
 8 | and a command line utility producing and decoding `.zst`, `.gz`, `.xz` and `.lz4` files.
 9 | Should your project require another programming language,
10 | a list of known ports and bindings is provided on [Zstandard homepage](http://www.zstd.net/#other-languages).
11 | 
12 | The negative compression levels, specified with `--fast=#`,
13 | offer faster compression and decompression speed in exchange for some loss in
14 | compression ratio compared to level 1, as seen in the table above.
15 | 
16 | Zstd can also offer stronger compression ratios at the cost of compression speed.
17 | Speed vs Compression trade-off is configurable by small increments.
18 | Decompression speed is preserved and remains roughly the same at all settings,
19 | a property shared by most LZ compression algorithms, such as [zlib] or lzma.
20 | 
21 | 
22 | ## The case for Small Data compression
23 | 
24 | The smaller the amount of data to compress, the more difficult it is to compress. This problem is common to all compression algorithms, and reason is, compression algorithms learn from past data how to compress future data. But at the beginning of a new data set, there is no "past" to build upon.
25 | 
26 | To solve this situation, Zstd offers a __training mode__, which can be used to tune the algorithm for a selected type of data.
27 | Training Zstandard is achieved by providing it with a few samples (one file per sample). The result of this training is stored in a file called "dictionary", which must be loaded before compression and decompression.
28 | Using this dictionary, the compression ratio achievable on small data improves dramatically.
29 | 
30 | Training works if there is some correlation in a family of small data samples. The more data-specific a dictionary is, the more efficient it is (there is no _universal dictionary_).
31 | Hence, deploying one dictionary per type of data will provide the greatest benefits.
32 | Dictionary gains are mostly effective in the first few KB. Then, the compression algorithm will gradually use previously decoded content to better compress the rest of the file.
33 | 
34 | ## License
35 | 
36 | Zstandard is dual-licensed under [BSD](LICENSE) and [GPLv2](https://github.com/facebook/zstd/blob/dev/COPYING).


--------------------------------------------------------------------------------
/algos/zstd/lib/common/allocations.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | /* This file provides custom allocation primitives
12 |  */
13 | 
14 | #define ZSTD_DEPS_NEED_MALLOC
15 | #include "zstd_deps.h"   /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */
16 | 
17 | #include "mem.h" /* MEM_STATIC */
18 | #define ZSTD_STATIC_LINKING_ONLY
19 | #include "../zstd.h" /* ZSTD_customMem */
20 | 
21 | #ifndef ZSTD_ALLOCATIONS_H
22 | #define ZSTD_ALLOCATIONS_H
23 | 
24 | /* custom memory allocation functions */
25 | 
26 | MEM_STATIC void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem)
27 | {
28 |     if (customMem.customAlloc)
29 |         return customMem.customAlloc(customMem.opaque, size);
30 |     return ZSTD_malloc(size);
31 | }
32 | 
33 | MEM_STATIC void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem)
34 | {
35 |     if (customMem.customAlloc) {
36 |         /* calloc implemented as malloc+memset;
37 |          * not as efficient as calloc, but next best guess for custom malloc */
38 |         void* const ptr = customMem.customAlloc(customMem.opaque, size);
39 |         ZSTD_memset(ptr, 0, size);
40 |         return ptr;
41 |     }
42 |     return ZSTD_calloc(1, size);
43 | }
44 | 
45 | MEM_STATIC void ZSTD_customFree(void* ptr, ZSTD_customMem customMem)
46 | {
47 |     if (ptr!=NULL) {
48 |         if (customMem.customFree)
49 |             customMem.customFree(customMem.opaque, ptr);
50 |         else
51 |             ZSTD_free(ptr);
52 |     }
53 | }
54 | 
55 | #endif /* ZSTD_ALLOCATIONS_H */
56 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/common/code_alignment.c:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | /* This function is used to ensure desired code alignment of zstd source files
30 |  * within aocl compression library. This file precedes other zstd source files
31 |  * in CMakeLists. Hence, code_alignment_zstd will be the top zstd function in
32 |  * the symbol table. __attribute__((aligned(64))) provides a buffer zone wrt
33 |  * functions from other modules preceeding it. Further alignment adjustments 
34 |  * are made to provide the best code alignment for zstd module.*/
35 | #if defined(__x86_64__)
36 | __attribute__((aligned(64)))
37 | int code_alignment_zstd(void) {
38 | #if defined(__clang__)
39 |     // desired alignment: 32 bytes
40 |     __asm__("nop");
41 |     __asm__(".p2align 4"); //+ 16 bytes
42 | #else
43 |     // desired alignment: 32 bytes
44 |     __asm__("nop");
45 |     __asm__(".p2align 4"); //+ 16 bytes
46 | #endif
47 |     return 0; //+ 16 bytes
48 | }
49 | #endif
50 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/common/debug.c:
--------------------------------------------------------------------------------
 1 | /* ******************************************************************
 2 |  * debug
 3 |  * Part of FSE library
 4 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 5 |  *
 6 |  * You can contact the author at :
 7 |  * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
 8 |  *
 9 |  * This source code is licensed under both the BSD-style license (found in the
10 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
11 |  * in the COPYING file in the root directory of this source tree).
12 |  * You may select, at your option, one of the above-listed licenses.
13 | ****************************************************************** */
14 | 
15 | 
16 | /*
17 |  * This module only hosts one global variable
18 |  * which can be used to dynamically influence the verbosity of traces,
19 |  * such as DEBUGLOG and RAWLOG
20 |  */
21 | 
22 | #include "debug.h"
23 | 
24 | int g_debuglevel = DEBUGLEVEL;
25 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/common/error_private.c:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | /* The purpose of this file is to have a single list of error strings embedded in binary */
12 | 
13 | #include "error_private.h"
14 | 
15 | const char* ERR_getErrorString(ERR_enum code)
16 | {
17 | #ifdef ZSTD_STRIP_ERROR_STRINGS
18 |     (void)code;
19 |     return "Error strings stripped";
20 | #else
21 |     static const char* const notErrorCode = "Unspecified error code";
22 |     switch( code )
23 |     {
24 |     case PREFIX(no_error): return "No error detected";
25 |     case PREFIX(GENERIC):  return "Error (generic)";
26 |     case PREFIX(prefix_unknown): return "Unknown frame descriptor";
27 |     case PREFIX(version_unsupported): return "Version not supported";
28 |     case PREFIX(frameParameter_unsupported): return "Unsupported frame parameter";
29 |     case PREFIX(frameParameter_windowTooLarge): return "Frame requires too much memory for decoding";
30 |     case PREFIX(corruption_detected): return "Data corruption detected";
31 |     case PREFIX(checksum_wrong): return "Restored data doesn't match checksum";
32 |     case PREFIX(literals_headerWrong): return "Header of Literals' block doesn't respect format specification";
33 |     case PREFIX(parameter_unsupported): return "Unsupported parameter";
34 |     case PREFIX(parameter_combination_unsupported): return "Unsupported combination of parameters";
35 |     case PREFIX(parameter_outOfBound): return "Parameter is out of bound";
36 |     case PREFIX(init_missing): return "Context should be init first";
37 |     case PREFIX(memory_allocation): return "Allocation error : not enough memory";
38 |     case PREFIX(workSpace_tooSmall): return "workSpace buffer is not large enough";
39 |     case PREFIX(stage_wrong): return "Operation not authorized at current processing stage";
40 |     case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported";
41 |     case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large";
42 |     case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small";
43 |     case PREFIX(stabilityCondition_notRespected): return "pledged buffer stability condition is not respected";
44 |     case PREFIX(dictionary_corrupted): return "Dictionary is corrupted";
45 |     case PREFIX(dictionary_wrong): return "Dictionary mismatch";
46 |     case PREFIX(dictionaryCreation_failed): return "Cannot create Dictionary from provided samples";
47 |     case PREFIX(dstSize_tooSmall): return "Destination buffer is too small";
48 |     case PREFIX(srcSize_wrong): return "Src size is incorrect";
49 |     case PREFIX(dstBuffer_null): return "Operation on NULL destination buffer";
50 |     case PREFIX(noForwardProgress_destFull): return "Operation made no progress over multiple calls, due to output buffer being full";
51 |     case PREFIX(noForwardProgress_inputEmpty): return "Operation made no progress over multiple calls, due to input being empty";
52 |         /* following error codes are not stable and may be removed or changed in a future version */
53 |     case PREFIX(frameIndex_tooLarge): return "Frame index is too large";
54 |     case PREFIX(seekableIO): return "An I/O error occurred when reading/seeking";
55 |     case PREFIX(dstBuffer_wrong): return "Destination buffer is wrong";
56 |     case PREFIX(srcBuffer_wrong): return "Source buffer is wrong";
57 |     case PREFIX(sequenceProducer_failed): return "Block-level external sequence producer returned an error code";
58 |     case PREFIX(externalSequences_invalid): return "External sequences are not valid";
59 |     case PREFIX(maxCode):
60 |     default: return notErrorCode;
61 |     }
62 | #endif
63 | }
64 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/common/pool.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | #ifndef POOL_H
12 | #define POOL_H
13 | 
14 | #if defined (__cplusplus)
15 | extern "C" {
16 | #endif
17 | 
18 | 
19 | #include "zstd_deps.h"
20 | #define ZSTD_STATIC_LINKING_ONLY   /* ZSTD_customMem */
21 | #include "../zstd.h"
22 | 
23 | typedef struct POOL_ctx_s POOL_ctx;
24 | 
25 | /*! POOL_create() :
26 |  *  Create a thread pool with at most `numThreads` threads.
27 |  * `numThreads` must be at least 1.
28 |  *  The maximum number of queued jobs before blocking is `queueSize`.
29 |  * @return : POOL_ctx pointer on success, else NULL.
30 | */
31 | POOL_ctx* POOL_create(size_t numThreads, size_t queueSize);
32 | 
33 | POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize,
34 |                                ZSTD_customMem customMem);
35 | 
36 | /*! POOL_free() :
37 |  *  Free a thread pool returned by POOL_create().
38 |  */
39 | void POOL_free(POOL_ctx* ctx);
40 | 
41 | 
42 | /*! POOL_joinJobs() :
43 |  *  Waits for all queued jobs to finish executing.
44 |  */
45 | void POOL_joinJobs(POOL_ctx* ctx);
46 | 
47 | /*! POOL_resize() :
48 |  *  Expands or shrinks pool's number of threads.
49 |  *  This is more efficient than releasing + creating a new context,
50 |  *  since it tries to preserve and re-use existing threads.
51 |  * `numThreads` must be at least 1.
52 |  * @return : 0 when resize was successful,
53 |  *           !0 (typically 1) if there is an error.
54 |  *    note : only numThreads can be resized, queueSize remains unchanged.
55 |  */
56 | int POOL_resize(POOL_ctx* ctx, size_t numThreads);
57 | 
58 | /*! POOL_sizeof() :
59 |  * @return threadpool memory usage
60 |  *  note : compatible with NULL (returns 0 in this case)
61 |  */
62 | size_t POOL_sizeof(const POOL_ctx* ctx);
63 | 
64 | /*! POOL_function :
65 |  *  The function type that can be added to a thread pool.
66 |  */
67 | typedef void (*POOL_function)(void*);
68 | 
69 | /*! POOL_add() :
70 |  *  Add the job `function(opaque)` to the thread pool. `ctx` must be valid.
71 |  *  Possibly blocks until there is room in the queue.
72 |  *  Note : The function may be executed asynchronously,
73 |  *         therefore, `opaque` must live until function has been completed.
74 |  */
75 | void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque);
76 | 
77 | 
78 | /*! POOL_tryAdd() :
79 |  *  Add the job `function(opaque)` to thread pool _if_ a queue slot is available.
80 |  *  Returns immediately even if not (does not block).
81 |  * @return : 1 if successful, 0 if not.
82 |  */
83 | int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque);
84 | 
85 | 
86 | #if defined (__cplusplus)
87 | }
88 | #endif
89 | 
90 | #endif
91 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/common/xxhash.c:
--------------------------------------------------------------------------------
 1 | /*
 2 |  *  xxHash - Fast Hash algorithm
 3 |  *  Copyright (c) Meta Platforms, Inc. and affiliates.
 4 |  *
 5 |  *  You can contact the author at :
 6 |  *  - xxHash homepage: https://cyan4973.github.io/xxHash/
 7 |  *  - xxHash source repository : https://github.com/Cyan4973/xxHash
 8 |  *
 9 |  * This source code is licensed under both the BSD-style license (found in the
10 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
11 |  * in the COPYING file in the root directory of this source tree).
12 |  * You may select, at your option, one of the above-listed licenses.
13 | */
14 | 
15 | 
16 | 
17 | /*
18 |  * xxhash.c instantiates functions defined in xxhash.h
19 |  */
20 | 
21 | #define XXH_STATIC_LINKING_ONLY   /* access advanced declarations */
22 | #define XXH_IMPLEMENTATION   /* access definitions */
23 | 
24 | #include "xxhash.h"
25 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/common/zstd_common.c:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | 
12 | 
13 | /*-*************************************
14 | *  Dependencies
15 | ***************************************/
16 | #define ZSTD_DEPS_NEED_MALLOC
17 | #include "error_private.h"
18 | #include "zstd_internal.h"
19 | 
20 | 
21 | /*-****************************************
22 | *  Version
23 | ******************************************/
24 | unsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; }
25 | 
26 | const char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; }
27 | 
28 | 
29 | /*-****************************************
30 | *  ZSTD Error Management
31 | ******************************************/
32 | #undef ZSTD_isError   /* defined within zstd_internal.h */
33 | /*! ZSTD_isError() :
34 |  *  tells if a return value is an error code
35 |  *  symbol is required for external callers */
36 | unsigned ZSTD_isError(size_t code) { return ERR_isError(code); }
37 | 
38 | /*! ZSTD_getErrorName() :
39 |  *  provides error code string from function result (useful for debugging) */
40 | const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); }
41 | 
42 | /*! ZSTD_getError() :
43 |  *  convert a `size_t` function result into a proper ZSTD_errorCode enum */
44 | ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); }
45 | 
46 | /*! ZSTD_getErrorString() :
47 |  *  provides error code string from enum */
48 | const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); }
49 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/common/zstd_deps.h:
--------------------------------------------------------------------------------
  1 | /*
  2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
  3 |  * Modifications Copyright (C) 2023-2024, Advanced Micro Devices. All rights reserved.
  4 |  * All rights reserved.
  5 |  *
  6 |  * This source code is licensed under both the BSD-style license (found in the
  7 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
  8 |  * in the COPYING file in the root directory of this source tree).
  9 |  * You may select, at your option, one of the above-listed licenses.
 10 |  */
 11 | 
 12 | /* This file provides common libc dependencies that zstd requires.
 13 |  * The purpose is to allow replacing this file with a custom implementation
 14 |  * to compile zstd without libc support.
 15 |  */
 16 | 
 17 | /* Need:
 18 |  * NULL
 19 |  * INT_MAX
 20 |  * UINT_MAX
 21 |  * ZSTD_memcpy()
 22 |  * ZSTD_memset()
 23 |  * ZSTD_memmove()
 24 |  */
 25 | #ifndef ZSTD_DEPS_COMMON
 26 | #define ZSTD_DEPS_COMMON
 27 | 
 28 | #include 
 29 | #include 
 30 | #include 
 31 | 
 32 | #ifdef AOCL_NO_REL_INC_PATH
 33 | #include "utils.h"
 34 | #else
 35 | #include "utils/utils.h"
 36 | #endif
 37 | 
 38 | #if defined(__GNUC__) && __GNUC__ >= 4
 39 | # define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
 40 | # define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
 41 | # define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
 42 | #else
 43 | # define ZSTD_memcpy(d,s,l) memcpy((d),(s),(l))
 44 | # define ZSTD_memmove(d,s,l) memmove((d),(s),(l))
 45 | # define ZSTD_memset(p,v,l) memset((p),(v),(l))
 46 | #endif
 47 | 
 48 | #endif /* ZSTD_DEPS_COMMON */
 49 | 
 50 | /* Need:
 51 |  * ZSTD_malloc()
 52 |  * ZSTD_free()
 53 |  * ZSTD_calloc()
 54 |  */
 55 | #ifdef ZSTD_DEPS_NEED_MALLOC
 56 | #ifndef ZSTD_DEPS_MALLOC
 57 | #define ZSTD_DEPS_MALLOC
 58 | 
 59 | #include 
 60 | 
 61 | #define ZSTD_malloc(s) malloc(s)
 62 | #define ZSTD_calloc(n,s) calloc((n), (s))
 63 | #define ZSTD_free(p) free((p))
 64 | 
 65 | #endif /* ZSTD_DEPS_MALLOC */
 66 | #endif /* ZSTD_DEPS_NEED_MALLOC */
 67 | 
 68 | /*
 69 |  * Provides 64-bit math support.
 70 |  * Need:
 71 |  * U64 ZSTD_div64(U64 dividend, U32 divisor)
 72 |  */
 73 | #ifdef ZSTD_DEPS_NEED_MATH64
 74 | #ifndef ZSTD_DEPS_MATH64
 75 | #define ZSTD_DEPS_MATH64
 76 | 
 77 | #define ZSTD_div64(dividend, divisor) ((dividend) / (divisor))
 78 | 
 79 | #endif /* ZSTD_DEPS_MATH64 */
 80 | #endif /* ZSTD_DEPS_NEED_MATH64 */
 81 | 
 82 | /* Need:
 83 |  * assert()
 84 |  */
 85 | #ifdef ZSTD_DEPS_NEED_ASSERT
 86 | #ifndef ZSTD_DEPS_ASSERT
 87 | #define ZSTD_DEPS_ASSERT
 88 | 
 89 | #include 
 90 | 
 91 | #endif /* ZSTD_DEPS_ASSERT */
 92 | #endif /* ZSTD_DEPS_NEED_ASSERT */
 93 | 
 94 | /* Need:
 95 |  * ZSTD_DEBUG_PRINT()
 96 |  */
 97 | #ifdef ZSTD_DEPS_NEED_IO
 98 | #ifndef ZSTD_DEPS_IO
 99 | #define ZSTD_DEPS_IO
100 | 
101 | #include 
102 | #define ZSTD_DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
103 | 
104 | #endif /* ZSTD_DEPS_IO */
105 | #endif /* ZSTD_DEPS_NEED_IO */
106 | 
107 | /* Only requested when  is known to be present.
108 |  * Need:
109 |  * intptr_t
110 |  */
111 | #ifdef ZSTD_DEPS_NEED_STDINT
112 | #ifndef ZSTD_DEPS_STDINT
113 | #define ZSTD_DEPS_STDINT
114 | 
115 | #include 
116 | 
117 | #endif /* ZSTD_DEPS_STDINT */
118 | #endif /* ZSTD_DEPS_NEED_STDINT */
119 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/compress/hist.h:
--------------------------------------------------------------------------------
 1 | /* ******************************************************************
 2 |  * hist : Histogram functions
 3 |  * part of Finite State Entropy project
 4 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 5 |  *
 6 |  *  You can contact the author at :
 7 |  *  - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy
 8 |  *  - Public forum : https://groups.google.com/forum/#!forum/lz4c
 9 |  *
10 |  * This source code is licensed under both the BSD-style license (found in the
11 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
12 |  * in the COPYING file in the root directory of this source tree).
13 |  * You may select, at your option, one of the above-listed licenses.
14 | ****************************************************************** */
15 | 
16 | /* --- dependencies --- */
17 | #include "../common/zstd_deps.h"   /* size_t */
18 | 
19 | 
20 | /* --- simple histogram functions --- */
21 | 
22 | /*! HIST_count():
23 |  *  Provides the precise count of each byte within a table 'count'.
24 |  * 'count' is a table of unsigned int, of minimum size (*maxSymbolValuePtr+1).
25 |  *  Updates *maxSymbolValuePtr with actual largest symbol value detected.
26 |  * @return : count of the most frequent symbol (which isn't identified).
27 |  *           or an error code, which can be tested using HIST_isError().
28 |  *           note : if return == srcSize, there is only one symbol.
29 |  */
30 | size_t HIST_count(unsigned* count, unsigned* maxSymbolValuePtr,
31 |                   const void* src, size_t srcSize);
32 | 
33 | unsigned HIST_isError(size_t code);  /**< tells if a return value is an error code */
34 | 
35 | 
36 | /* --- advanced histogram functions --- */
37 | 
38 | #define HIST_WKSP_SIZE_U32 1024
39 | #define HIST_WKSP_SIZE    (HIST_WKSP_SIZE_U32 * sizeof(unsigned))
40 | /** HIST_count_wksp() :
41 |  *  Same as HIST_count(), but using an externally provided scratch buffer.
42 |  *  Benefit is this function will use very little stack space.
43 |  * `workSpace` is a writable buffer which must be 4-bytes aligned,
44 |  * `workSpaceSize` must be >= HIST_WKSP_SIZE
45 |  */
46 | size_t HIST_count_wksp(unsigned* count, unsigned* maxSymbolValuePtr,
47 |                        const void* src, size_t srcSize,
48 |                        void* workSpace, size_t workSpaceSize);
49 | 
50 | /** HIST_countFast() :
51 |  *  same as HIST_count(), but blindly trusts that all byte values within src are <= *maxSymbolValuePtr.
52 |  *  This function is unsafe, and will segfault if any value within `src` is `> *maxSymbolValuePtr`
53 |  */
54 | size_t HIST_countFast(unsigned* count, unsigned* maxSymbolValuePtr,
55 |                       const void* src, size_t srcSize);
56 | 
57 | /** HIST_countFast_wksp() :
58 |  *  Same as HIST_countFast(), but using an externally provided scratch buffer.
59 |  * `workSpace` is a writable buffer which must be 4-bytes aligned,
60 |  * `workSpaceSize` must be >= HIST_WKSP_SIZE
61 |  */
62 | size_t HIST_countFast_wksp(unsigned* count, unsigned* maxSymbolValuePtr,
63 |                            const void* src, size_t srcSize,
64 |                            void* workSpace, size_t workSpaceSize);
65 | 
66 | /*! HIST_count_simple() :
67 |  *  Same as HIST_countFast(), this function is unsafe,
68 |  *  and will segfault if any value within `src` is `> *maxSymbolValuePtr`.
69 |  *  It is also a bit slower for large inputs.
70 |  *  However, it does not need any additional memory (not even on stack).
71 |  * @return : count of the most frequent symbol.
72 |  *  Note this function doesn't produce any error (i.e. it must succeed).
73 |  */
74 | unsigned HIST_count_simple(unsigned* count, unsigned* maxSymbolValuePtr,
75 |                            const void* src, size_t srcSize);
76 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/compress/zstd_compress_literals.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | #ifndef ZSTD_COMPRESS_LITERALS_H
12 | #define ZSTD_COMPRESS_LITERALS_H
13 | 
14 | #include "zstd_compress_internal.h" /* ZSTD_hufCTables_t, ZSTD_minGain() */
15 | 
16 | 
17 | size_t ZSTD_noCompressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize);
18 | 
19 | /* ZSTD_compressRleLiteralsBlock() :
20 |  * Conditions :
21 |  * - All bytes in @src are identical
22 |  * - dstCapacity >= 4 */
23 | size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize);
24 | 
25 | /* ZSTD_compressLiterals():
26 |  * @entropyWorkspace: must be aligned on 4-bytes boundaries
27 |  * @entropyWorkspaceSize : must be >= HUF_WORKSPACE_SIZE
28 |  * @suspectUncompressible: sampling checks, to potentially skip huffman coding
29 |  */
30 | size_t ZSTD_compressLiterals (void* dst, size_t dstCapacity,
31 |                         const void* src, size_t srcSize,
32 |                               void* entropyWorkspace, size_t entropyWorkspaceSize,
33 |                         const ZSTD_hufCTables_t* prevHuf,
34 |                               ZSTD_hufCTables_t* nextHuf,
35 |                               ZSTD_strategy strategy, int disableLiteralCompression,
36 |                               int suspectUncompressible,
37 |                               int bmi2);
38 | 
39 | #endif /* ZSTD_COMPRESS_LITERALS_H */
40 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/compress/zstd_compress_sequences.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | #ifndef ZSTD_COMPRESS_SEQUENCES_H
12 | #define ZSTD_COMPRESS_SEQUENCES_H
13 | 
14 | #include "../common/fse.h" /* FSE_repeat, FSE_CTable */
15 | #include "../common/zstd_internal.h" /* symbolEncodingType_e, ZSTD_strategy */
16 | 
17 | typedef enum {
18 |     ZSTD_defaultDisallowed = 0,
19 |     ZSTD_defaultAllowed = 1
20 | } ZSTD_defaultPolicy_e;
21 | 
22 | symbolEncodingType_e
23 | ZSTD_selectEncodingType(
24 |         FSE_repeat* repeatMode, unsigned const* count, unsigned const max,
25 |         size_t const mostFrequent, size_t nbSeq, unsigned const FSELog,
26 |         FSE_CTable const* prevCTable,
27 |         short const* defaultNorm, U32 defaultNormLog,
28 |         ZSTD_defaultPolicy_e const isDefaultAllowed,
29 |         ZSTD_strategy const strategy);
30 | 
31 | size_t
32 | ZSTD_buildCTable(void* dst, size_t dstCapacity,
33 |                 FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type,
34 |                 unsigned* count, U32 max,
35 |                 const BYTE* codeTable, size_t nbSeq,
36 |                 const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax,
37 |                 const FSE_CTable* prevCTable, size_t prevCTableSize,
38 |                 void* entropyWorkspace, size_t entropyWorkspaceSize);
39 | 
40 | size_t ZSTD_encodeSequences(
41 |             void* dst, size_t dstCapacity,
42 |             FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
43 |             FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
44 |             FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable,
45 |             seqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2);
46 | 
47 | size_t ZSTD_fseBitCost(
48 |     FSE_CTable const* ctable,
49 |     unsigned const* count,
50 |     unsigned const max);
51 | 
52 | size_t ZSTD_crossEntropyCost(short const* norm, unsigned accuracyLog,
53 |                              unsigned const* count, unsigned const max);
54 | #endif /* ZSTD_COMPRESS_SEQUENCES_H */
55 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/compress/zstd_compress_superblock.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | #ifndef ZSTD_COMPRESS_ADVANCED_H
12 | #define ZSTD_COMPRESS_ADVANCED_H
13 | 
14 | /*-*************************************
15 | *  Dependencies
16 | ***************************************/
17 | 
18 | #include "../zstd.h" /* ZSTD_CCtx */
19 | 
20 | /*-*************************************
21 | *  Target Compressed Block Size
22 | ***************************************/
23 | 
24 | /* ZSTD_compressSuperBlock() :
25 |  * Used to compress a super block when targetCBlockSize is being used.
26 |  * The given block will be compressed into multiple sub blocks that are around targetCBlockSize. */
27 | size_t ZSTD_compressSuperBlock(ZSTD_CCtx* zc,
28 |                                void* dst, size_t dstCapacity,
29 |                                void const* src, size_t srcSize,
30 |                                unsigned lastBlock);
31 | 
32 | #endif /* ZSTD_COMPRESS_ADVANCED_H */
33 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/compress/zstd_double_fast.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | #ifndef ZSTD_DOUBLE_FAST_H
12 | #define ZSTD_DOUBLE_FAST_H
13 | 
14 | #if defined (__cplusplus)
15 | extern "C" {
16 | #endif
17 | 
18 | #include "../common/mem.h"      /* U32 */
19 | #include "zstd_compress_internal.h"     /* ZSTD_CCtx, size_t */
20 | 
21 | void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
22 |                               void const* end, ZSTD_dictTableLoadMethod_e dtlm,
23 |                               ZSTD_tableFillPurpose_e tfp);
24 | size_t ZSTD_compressBlock_doubleFast(
25 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
26 |         void const* src, size_t srcSize);
27 | size_t ZSTD_compressBlock_doubleFast_dictMatchState(
28 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
29 |         void const* src, size_t srcSize);
30 | size_t ZSTD_compressBlock_doubleFast_extDict(
31 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
32 |         void const* src, size_t srcSize);
33 | 
34 | #ifdef AOCL_ZSTD_OPT
35 | 
36 | size_t AOCL_ZSTD_compressBlock_doubleFast(
37 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
38 |         void const* src, size_t srcSize);
39 | #define AOCL_ZSTD_compressBlock_doubleFast_dictMatchState ZSTD_compressBlock_doubleFast_dictMatchState
40 | size_t AOCL_ZSTD_compressBlock_doubleFast_extDict(
41 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
42 |         void const* src, size_t srcSize);
43 | 
44 | #endif /* AOCL_ZSTD_OPT */
45 | 
46 | #if defined (__cplusplus)
47 | }
48 | #endif
49 | 
50 | #endif /* ZSTD_DOUBLE_FAST_H */
51 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/compress/zstd_fast.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | #ifndef ZSTD_FAST_H
12 | #define ZSTD_FAST_H
13 | 
14 | #if defined (__cplusplus)
15 | extern "C" {
16 | #endif
17 | 
18 | #include "../common/mem.h"      /* U32 */
19 | #include "zstd_compress_internal.h"
20 | 
21 | void ZSTD_fillHashTable(ZSTD_matchState_t* ms,
22 |                         void const* end, ZSTD_dictTableLoadMethod_e dtlm,
23 |                         ZSTD_tableFillPurpose_e tfp);
24 | size_t ZSTD_compressBlock_fast(
25 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
26 |         void const* src, size_t srcSize);
27 | size_t ZSTD_compressBlock_fast_dictMatchState(
28 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
29 |         void const* src, size_t srcSize);
30 | size_t ZSTD_compressBlock_fast_extDict(
31 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
32 |         void const* src, size_t srcSize);
33 | 
34 | #ifdef AOCL_ZSTD_OPT
35 | 
36 | size_t AOCL_ZSTD_compressBlock_fast(
37 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
38 |         void const* src, size_t srcSize);
39 | #define AOCL_ZSTD_compressBlock_fast_dictMatchState ZSTD_compressBlock_fast_dictMatchState
40 | size_t AOCL_ZSTD_compressBlock_fast_extDict(
41 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
42 |         void const* src, size_t srcSize);
43 | 
44 | #endif /* AOCL_ZSTD_OPT */
45 | 
46 | #if defined (__cplusplus)
47 | }
48 | #endif
49 | 
50 | #endif /* ZSTD_FAST_H */
51 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/compress/zstd_opt.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | #ifndef ZSTD_OPT_H
12 | #define ZSTD_OPT_H
13 | 
14 | #if defined (__cplusplus)
15 | extern "C" {
16 | #endif
17 | 
18 | #include "zstd_compress_internal.h"
19 | 
20 | /* used in ZSTD_loadDictionaryContent() */
21 | void ZSTD_updateTree(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend);
22 | 
23 | size_t ZSTD_compressBlock_btopt(
24 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
25 |         void const* src, size_t srcSize);
26 | size_t ZSTD_compressBlock_btultra(
27 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
28 |         void const* src, size_t srcSize);
29 | size_t ZSTD_compressBlock_btultra2(
30 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
31 |         void const* src, size_t srcSize);
32 | 
33 | 
34 | size_t ZSTD_compressBlock_btopt_dictMatchState(
35 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
36 |         void const* src, size_t srcSize);
37 | size_t ZSTD_compressBlock_btultra_dictMatchState(
38 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
39 |         void const* src, size_t srcSize);
40 | 
41 | size_t ZSTD_compressBlock_btopt_extDict(
42 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
43 |         void const* src, size_t srcSize);
44 | size_t ZSTD_compressBlock_btultra_extDict(
45 |         ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
46 |         void const* src, size_t srcSize);
47 | 
48 |         /* note : no btultra2 variant for extDict nor dictMatchState,
49 |          * because btultra2 is not meant to work with dictionaries
50 |          * and is only specific for the first block (no prefix) */
51 | 
52 | #if defined (__cplusplus)
53 | }
54 | #endif
55 | 
56 | #endif /* ZSTD_OPT_H */
57 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/decompress/zstd_ddict.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * Copyright (c) Meta Platforms, Inc. and affiliates.
 3 |  * All rights reserved.
 4 |  *
 5 |  * This source code is licensed under both the BSD-style license (found in the
 6 |  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
 7 |  * in the COPYING file in the root directory of this source tree).
 8 |  * You may select, at your option, one of the above-listed licenses.
 9 |  */
10 | 
11 | 
12 | #ifndef ZSTD_DDICT_H
13 | #define ZSTD_DDICT_H
14 | 
15 | /*-*******************************************************
16 |  *  Dependencies
17 |  *********************************************************/
18 | #include "../common/zstd_deps.h"   /* size_t */
19 | #include "../zstd.h"     /* ZSTD_DDict, and several public functions */
20 | 
21 | 
22 | /*-*******************************************************
23 |  *  Interface
24 |  *********************************************************/
25 | 
26 | /* note: several prototypes are already published in `zstd.h` :
27 |  * ZSTD_createDDict()
28 |  * ZSTD_createDDict_byReference()
29 |  * ZSTD_createDDict_advanced()
30 |  * ZSTD_freeDDict()
31 |  * ZSTD_initStaticDDict()
32 |  * ZSTD_sizeof_DDict()
33 |  * ZSTD_estimateDDictSize()
34 |  * ZSTD_getDictID_fromDict()
35 |  */
36 | 
37 | const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict);
38 | size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict);
39 | 
40 | void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
41 | 
42 | 
43 | 
44 | #endif /* ZSTD_DDICT_H */
45 | 


--------------------------------------------------------------------------------
/algos/zstd/lib/dictBuilder/divsufsort.h:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * divsufsort.h for libdivsufsort-lite
 3 |  * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved.
 4 |  *
 5 |  * Permission is hereby granted, free of charge, to any person
 6 |  * obtaining a copy of this software and associated documentation
 7 |  * files (the "Software"), to deal in the Software without
 8 |  * restriction, including without limitation the rights to use,
 9 |  * copy, modify, merge, publish, distribute, sublicense, and/or sell
10 |  * copies of the Software, and to permit persons to whom the
11 |  * Software is furnished to do so, subject to the following
12 |  * conditions:
13 |  *
14 |  * The above copyright notice and this permission notice shall be
15 |  * included in all copies or substantial portions of the Software.
16 |  *
17 |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 |  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 |  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 |  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 |  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 |  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 |  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 |  * OTHER DEALINGS IN THE SOFTWARE.
25 |  */
26 | 
27 | #ifndef _DIVSUFSORT_H
28 | #define _DIVSUFSORT_H 1
29 | 
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif /* __cplusplus */
33 | 
34 | 
35 | /*- Prototypes -*/
36 | 
37 | /**
38 |  * Constructs the suffix array of a given string.
39 |  * @param T [0..n-1] The input string.
40 |  * @param SA [0..n-1] The output array of suffixes.
41 |  * @param n The length of the given string.
42 |  * @param openMP enables OpenMP optimization.
43 |  * @return 0 if no error occurred, -1 or -2 otherwise.
44 |  */
45 | int
46 | divsufsort(const unsigned char *T, int *SA, int n, int openMP);
47 | 
48 | /**
49 |  * Constructs the burrows-wheeler transformed string of a given string.
50 |  * @param T [0..n-1] The input string.
51 |  * @param U [0..n-1] The output string. (can be T)
52 |  * @param A [0..n-1] The temporary array. (can be NULL)
53 |  * @param n The length of the given string.
54 |  * @param num_indexes The length of secondary indexes array. (can be NULL)
55 |  * @param indexes The secondary indexes array. (can be NULL)
56 |  * @param openMP enables OpenMP optimization.
57 |  * @return The primary index if no error occurred, -1 or -2 otherwise.
58 |  */
59 | int
60 | divbwt(const unsigned char *T, unsigned char *U, int *A, int n, unsigned char * num_indexes, int * indexes, int openMP);
61 | 
62 | 
63 | #ifdef __cplusplus
64 | } /* extern "C" */
65 | #endif /* __cplusplus */
66 | 
67 | #endif /* _DIVSUFSORT_H */
68 | 


--------------------------------------------------------------------------------
/api/code_alignment.cpp:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2023, Advanced Micro Devices. All rights reserved.
 3 |  *
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 | 
29 | /* This function is used to ensure desired code alignment of api source files
30 |  * within aocl compression library. This file precedes other api source files
31 |  * in CMakeLists. Hence, code_alignment_api will be the top api function in
32 |  * the symbol table. __attribute__((aligned(64))) provides a buffer zone wrt
33 |  * functions from other modules preceeding it. Further alignment adjustments 
34 |  * are made to provide the best code alignment for api module.*/
35 | #if defined(__x86_64__)
36 | __attribute__((aligned(64)))
37 | int code_alignment_api(void) {
38 | #if defined(__clang__)
39 |     // desired alignment: 64 bytes
40 |     __asm__("nop");
41 |     __asm__(".p2align 5"); //+ 32 bytes
42 |     __asm__("nop");
43 |     __asm__(".p2align 4"); //+ 16 bytes
44 | #else
45 |     // desired alignment: 64 bytes
46 |     __asm__("nop");
47 |     __asm__(".p2align 5"); //+ 32 bytes
48 |     __asm__("nop");
49 |     __asm__(".p2align 4"); //+ 16 bytes
50 | #endif
51 |     return 0; //+ 16 bytes
52 | }
53 | #endif
54 | 


--------------------------------------------------------------------------------
/api/types.h:
--------------------------------------------------------------------------------
 1 | /**
 2 |  * Copyright (C) 2022-2023, Advanced Micro Devices. All rights reserved.
 3 |  * 
 4 |  * Redistribution and use in source and binary forms, with or without
 5 |  * modification, are permitted provided that the following conditions are met:
 6 |  *
 7 |  * 1. Redistributions of source code must retain the above copyright notice,
 8 |  * this list of conditions and the following disclaimer.
 9 |  * 2. Redistributions in binary form must reproduce the above copyright notice,
10 |  * this list of conditions and the following disclaimer in the documentation
11 |  * and/or other materials provided with the distribution.
12 |  * 3. Neither the name of the copyright holder nor the names of its
13 |  * contributors may be used to endorse or promote products derived from this
14 |  * software without specific prior written permission.
15 |  *
16 |  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 |  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 |  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 |  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 |  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 |  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 |  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 |  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 |  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 |  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 |  * POSSIBILITY OF SUCH DAMAGE.
27 |  */
28 |  
29 |  /** @file types.h
30 |  *  
31 |  *  @brief Typedef declarations of data types 
32 |  *
33 |  *  This file contains the typedef declarations of different data types.
34 |  *
35 |  *  @author S. Biplab Raut
36 |  */
37 |  
38 | #ifndef TYPES_H
39 | #define TYPES_H
40 | 
41 | #include 
42 | #include 
43 | 
44 | typedef int64_t AOCL_INT64;          //fixed signed 64 bits int
45 | typedef int32_t AOCL_INT32;          //fixed signed 32 bits int : Use it for signed int
46 | typedef ptrdiff_t AOCL_INTP;         //portable signed int type : 4 bytes (ILP32), 8 bytes (LP64)
47 | typedef uint64_t AOCL_UINT64;        //fixed unsigned 64 bits int
48 | typedef uint32_t AOCL_UINT32;        //fixed unsigned 32 bits int : Use it for unsigned int
49 | typedef size_t AOCL_UINTP;           //portable unsigned int type : 4 bytes (ILP32), 8 bytes (LP64)
50 | typedef char AOCL_CHAR;              //signed character data type : 1 byte
51 | typedef unsigned char AOCL_UCHAR;    //unsigned character data type : 1 byte
52 | typedef short AOCL_SHORT;            //signed short integer : 2 bytes
53 | typedef unsigned short AOCL_USHORT;  //unsigned short integer : 2 bytes
54 | typedef void AOCL_VOID;              //void
55 | typedef float AOCL_FLOAT32;          //single-precision
56 | typedef double AOCL_FLOAT64;         //double-precision
57 | typedef double AOCL_DOUBLE;          //double-precision
58 | typedef uint8_t AOCL_UINT8;          //unsigned 1 byte integer
59 | typedef int8_t AOCL_INT8;            //signed 1 byte integer
60 | 
61 | #endif
62 | 
63 | 


--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
 1 | AOCL COMPRESSION
 2 | ================
 3 | @mainpage
 4 | 
 5 | #### Introduction
 6 | AOCL Compression is a software framework of various lossless compression and
 7 | decompression methods tuned and optimized for AMD Zen™ based CPUs.
 8 | This framework offers a single set of unified APIs for all the supported
 9 | compression and decompression methods which facilitate the applications to
10 | easily integrate and use them. For AOCL Compression framework APIs, refer to @ref API.
11 | 
12 | #### Methods Supported
13 | AOCL Compression supports compression and decompression methods of the following libraries along with their native APIs.
14 | 1. @ref LZ4_API "lz4"
15 | 2. @ref ZLIB_API "zlib/deflate"
16 | 3. @ref LZMA_API "lzma"
17 | 4. @ref ZSTD_API "zstd"
18 | 5. @ref BZIP2_API "bzip2" 
19 | 6. @ref SNAPPY_API "snappy"
20 | 7. @ref LZ4HC_API "lz4hc"
21 | 
22 | It supports the dynamic dispatcher feature that executes the most optimal
23 | function variant implemented using Function Multi-versioning thereby offering
24 | a single optimized library portable across different x86 CPU architectures.
25 | AOCL Compression framework is developed in C for UNIX® and Windows® based systems.
26 | A test suite is provided for the validation and performance benchmarking
27 | of the supported compression and decompression methods. This suite also
28 | supports the benchmarking of IPP compression methods, such as, lz4, lz4hc, zlib and bzip2.
29 | The library build framework offers CTest-based testing of the test cases
30 | implemented using GTest and the library test suite. Starting from AOCL-Compression 4.2,
31 | the library offers openMP based multi-threaded compression for a few methods.
32 | 
33 | #### Contacts
34 | 
35 | AOCL Compression is developed and maintained by AMD.
36 | For support, send an email to toolchainsupport@amd.com. 37 | -------------------------------------------------------------------------------- /docs/rst/_template/flavors/local/footer.jinja: -------------------------------------------------------------------------------- 1 | ## ############################################################################## 2 | ## Copyright (C) 2024-2025, Advanced Micro Devices. All rights reserved. 3 | ## 4 | ## Redistribution and use in source and binary forms, with or without 5 | ## modification, are permitted provided that the following conditions are met: 6 | ## 7 | ## 1. Redistributions of source code must retain the above copyright notice, 8 | ## this list of conditions and the following disclaimer. 9 | ## 2. Redistributions in binary form must reproduce the above copyright notice, 10 | ## this list of conditions and the following disclaimer in the documentation 11 | ## and/or other materials provided with the distribution. 12 | ## 3. Neither the name of the copyright holder nor the names of its 13 | ## contributors may be used to endorse or promote products derived from this 14 | ## software without specific prior written permission. 15 | ## 16 | ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | ## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | ## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | ## POSSIBILITY OF SUCH DAMAGE. 27 | ## 28 | ## ############################################################################## 29 | 30 | {% macro license_link() -%} 31 |
  • 2025, Advanced Micro Devices, Inc
  • 32 | {%- endmacro -%} 33 | -------------------------------------------------------------------------------- /docs/rst/_template/flavors/local/header.jinja: -------------------------------------------------------------------------------- 1 | ## ############################################################################## 2 | ## Copyright (C) 2024-2025, Advanced Micro Devices. All rights reserved. 3 | ## 4 | ## Redistribution and use in source and binary forms, with or without 5 | ## modification, are permitted provided that the following conditions are met: 6 | ## 7 | ## 1. Redistributions of source code must retain the above copyright notice, 8 | ## this list of conditions and the following disclaimer. 9 | ## 2. Redistributions in binary form must reproduce the above copyright notice, 10 | ## this list of conditions and the following disclaimer in the documentation 11 | ## and/or other materials provided with the distribution. 12 | ## 3. Neither the name of the copyright holder nor the names of its 13 | ## contributors may be used to endorse or promote products derived from this 14 | ## software without specific prior written permission. 15 | ## 16 | ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | ## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | ## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | ## POSSIBILITY OF SUCH DAMAGE. 27 | ## 28 | ## ############################################################################## 29 | 30 | {% 31 | macro top_level_header(branch, latest_version, release_candidate_version) -%} 32 | AOCL 33 | {%- endmacro -%} 34 | 35 | {% macro version_list() -%} 36 | 37 | {%- endmacro -%} 38 | -------------------------------------------------------------------------------- /docs/rst/_template/flavors/local/left-side-menu.jinja: -------------------------------------------------------------------------------- 1 | ## ############################################################################## 2 | ## Copyright (C) 2024-2025, Advanced Micro Devices. All rights reserved. 3 | ## 4 | ## Redistribution and use in source and binary forms, with or without 5 | ## modification, are permitted provided that the following conditions are met: 6 | ## 7 | ## 1. Redistributions of source code must retain the above copyright notice, 8 | ## this list of conditions and the following disclaimer. 9 | ## 2. Redistributions in binary form must reproduce the above copyright notice, 10 | ## this list of conditions and the following disclaimer in the documentation 11 | ## and/or other materials provided with the distribution. 12 | ## 3. Neither the name of the copyright holder nor the names of its 13 | ## contributors may be used to endorse or promote products derived from this 14 | ## software without specific prior written permission. 15 | ## 16 | ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | ## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | ## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | ## POSSIBILITY OF SUCH DAMAGE. 27 | ## 28 | ## ############################################################################## 29 | 30 | {% 31 | set main_doc_link = ("AOCL-Compression Documentation Home", "") 32 | %} 33 | -------------------------------------------------------------------------------- /docs/rst/algos.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | Algorithms 28 | ---------- 29 | 30 | AOCL Compression supports compression and decompression methods of the following libraries along with their native APIs. 31 | 32 | .. toctree:: 33 | :maxdepth: 1 34 | :numbered: 35 | 36 | lz4 37 | zlib 38 | lzma 39 | zstd 40 | bzip2 41 | snappy 42 | lz4hc 43 | -------------------------------------------------------------------------------- /docs/rst/bzip2.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | .. _ref-bzip2: 28 | 29 | BZIP2 30 | ----- 31 | 32 | .. doxygengroup:: BZIP2_API 33 | :project: compression 34 | :members: 35 | -------------------------------------------------------------------------------- /docs/rst/conf.py: -------------------------------------------------------------------------------- 1 | # ############################################################################## 2 | # Copyright (C) 2024-2025, Advanced Micro Devices. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, 10 | # this list of conditions and the following disclaimer in the documentation 11 | # and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the names of its 13 | # contributors may be used to endorse or promote products derived from this 14 | # software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | # ############################################################################## 29 | 30 | # Configuration file for the Sphinx documentation builder. 31 | 32 | import os 33 | # -- Project information ----------------------------------------------------- 34 | project = 'AOCL-Compression' 35 | copyright = '2020-2025, Advanced Micro Devices, Inc' 36 | author = 'Advanced Micro Devices, Inc' 37 | version = '5.1.0' 38 | release = '5.1.0' 39 | 40 | extensions = ['breathe', 'myst_parser'] 41 | pwd = os.path.dirname(os.path.abspath(__file__)) 42 | pwd = os.path.join(pwd, '..') 43 | pwd = os.path.join(pwd,'xml') 44 | breathe_projects = {"compression": pwd} 45 | 46 | # Add any paths that contain templates here, relative to this directory. 47 | templates_path = ['_template'] 48 | 49 | # tells the myst_parser to generate labels for heading anchors for h1, h2, and h3 level headings (corresponding to #, ##, and ### in markdown) 50 | myst_heading_anchors = 3 51 | 52 | # -- Options for HTML output ------------------------------------------------- 53 | 54 | html_theme = 'rocm_docs_theme' 55 | html_theme_options = { 56 | "link_main_doc": False, 57 | "flavor": "local", 58 | "repository_provider" : None, 59 | } 60 | -------------------------------------------------------------------------------- /docs/rst/index.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ================ 28 | AOCL COMPRESSION 29 | ================ 30 | 31 | 32 | Introduction 33 | ````````````` 34 | AOCL Compression is a software framework of various lossless compression and 35 | decompression methods tuned and optimized for AMD Zen™ based CPUs. 36 | This framework offers a single set of unified APIs for all the supported 37 | compression and decompression methods which facilitate the applications to 38 | easily integrate and use them. For AOCL Compression framework APIs, refer to :ref:`ref-unified-api`. 39 | 40 | 41 | Methods Supported 42 | .................. 43 | 44 | AOCL Compression supports compression and decompression methods of the following libraries along with their native APIs. 45 | 46 | #. :ref:`ref-lz4` 47 | #. :ref:`ref-zlib` 48 | #. :ref:`ref-lzma` 49 | #. :ref:`ref-zstd` 50 | #. :ref:`ref-bzip2` 51 | #. :ref:`ref-snappy` 52 | #. :ref:`ref-lz4hc` 53 | 54 | It supports the dynamic dispatcher feature that executes the most optimal 55 | function variant implemented using Function Multi-versioning thereby offering 56 | a single optimized library portable across different x86 CPU architectures. 57 | AOCL Compression framework is developed in C for UNIX® and Windows® based systems. 58 | A test suite is provided for the validation and performance benchmarking 59 | of the supported compression and decompression methods. This suite also 60 | supports the benchmarking of IPP compression methods, such as, lz4, lz4hc, zlib and bzip2. 61 | The library build framework offers CTest-based testing of the test cases 62 | implemented using GTest and the library test suite. Starting from AOCL-Compression 4.2, 63 | the library offers openMP based multi-threaded compression for a few methods. 64 | 65 | .. toctree:: 66 | :maxdepth: 1 67 | :caption: Table of Contents 68 | 69 | INSTALLATION 70 | unified_api 71 | INTRODUCTION 72 | algos 73 | EXAMPLE_README 74 | 75 | Contacts 76 | ........ 77 | 78 | AOCL Compression is developed and maintained by AMD. 79 | For support, send an email to toolchainsupport@amd.com. 80 | -------------------------------------------------------------------------------- /docs/rst/lz4.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | .. _ref-lz4: 28 | 29 | LZ4 30 | --- 31 | 32 | .. doxygengroup:: LZ4_API 33 | :project: compression 34 | :members: 35 | 36 | LZ4 Frame Format APIs 37 | ===================== 38 | 39 | .. doxygengroup:: LZ4FRAME_API 40 | :project: compression 41 | :members: 42 | 43 | -------------------------------------------------------------------------------- /docs/rst/lz4hc.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | .. _ref-lz4hc: 28 | 29 | LZ4HC 30 | ----- 31 | 32 | .. doxygengroup:: LZ4HC_API 33 | :project: compression 34 | :members: 35 | -------------------------------------------------------------------------------- /docs/rst/lzma.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | .. _ref-lzma: 28 | 29 | LZMA 30 | ---- 31 | 32 | .. doxygengroup:: LZMA_API 33 | :project: compression 34 | :members: 35 | -------------------------------------------------------------------------------- /docs/rst/snappy.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | .. _ref-snappy: 28 | 29 | SNAPPY 30 | ------ 31 | 32 | .. doxygengroup:: SNAPPY_API 33 | :project: compression 34 | :members: 35 | 36 | SNAPPY C APIs 37 | ============= 38 | 39 | .. doxygengroup:: SNAPPY_C_API 40 | :project: compression 41 | :members: 42 | -------------------------------------------------------------------------------- /docs/rst/unified_api.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | .. _ref-unified-api: 28 | 29 | Standardized/Unified API 30 | ------------------------ 31 | 32 | .. doxygengroup:: API 33 | :project: compression 34 | :members: 35 | -------------------------------------------------------------------------------- /docs/rst/zlib.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | .. _ref-zlib: 28 | 29 | ZLIB 30 | ---- 31 | 32 | .. doxygengroup:: ZLIB_API 33 | :project: compression 34 | :members: 35 | -------------------------------------------------------------------------------- /docs/rst/zstd.rst: -------------------------------------------------------------------------------- 1 | .. Copyright (C) 2024, Advanced Micro Devices. All rights reserved. 2 | 3 | .. Redistribution and use in source and binary forms, with or without 4 | .. modification, are permitted provided that the following conditions are met: 5 | 6 | .. 1. Redistributions of source code must retain the above copyright notice, 7 | .. this list of conditions and the following disclaimer. 8 | .. 2. Redistributions in binary form must reproduce the above copyright notice, 9 | .. this list of conditions and the following disclaimer in the documentation 10 | .. and/or other materials provided with the distribution. 11 | .. 3. Neither the name of the copyright holder nor the names of its 12 | .. contributors may be used to endorse or promote products derived from this 13 | .. software without specific prior written permission. 14 | 15 | .. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | .. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | .. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | .. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | .. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | .. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | .. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | .. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | .. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | .. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | .. POSSIBILITY OF SUCH DAMAGE. 26 | 27 | .. _ref-zstd: 28 | 29 | ZSTD 30 | ---- 31 | 32 | .. doxygengroup:: ZSTD_API 33 | :project: compression 34 | :members: 35 | -------------------------------------------------------------------------------- /docs/styling/AMD_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amd/aocl-compression/69dd0e31f563bbeaf248c0a434c76e89ca13f506/docs/styling/AMD_Logo.png -------------------------------------------------------------------------------- /docs/styling/doxygen-awesome-sidebar-only.css: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | Doxygen Awesome 4 | https://github.com/jothepro/doxygen-awesome-css 5 | 6 | MIT License 7 | 8 | Copyright (c) 2021 - 2023 jothepro 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | */ 29 | 30 | html { 31 | /* side nav width. MUST be = `TREEVIEW_WIDTH`. 32 | * Make sure it is wide enough to contain the page title (logo + title + version) 33 | */ 34 | --side-nav-fixed-width: 380px; 35 | --menu-display: none; 36 | 37 | --top-height: 100px; 38 | --toc-sticky-top: -25px; 39 | --toc-max-height: calc(100vh - 2 * var(--spacing-medium) - 25px); 40 | } 41 | 42 | #projectname { 43 | white-space: nowrap; 44 | } 45 | 46 | 47 | @media screen and (min-width: 768px) { 48 | html { 49 | --searchbar-background: var(--page-background-color); 50 | } 51 | 52 | #side-nav { 53 | min-width: var(--side-nav-fixed-width); 54 | max-width: var(--side-nav-fixed-width); 55 | top: var(--top-height); 56 | overflow: visible; 57 | } 58 | 59 | #nav-tree, #side-nav { 60 | height: calc(100vh - var(--top-height)) !important; 61 | } 62 | 63 | #nav-tree { 64 | padding: 0; 65 | } 66 | 67 | #top { 68 | display: block; 69 | border-bottom: none; 70 | height: var(--top-height); 71 | margin-bottom: calc(0px - var(--top-height)); 72 | max-width: var(--side-nav-fixed-width); 73 | overflow: hidden; 74 | background: var(--side-nav-background); 75 | } 76 | #main-nav { 77 | float: left; 78 | padding-right: 0; 79 | } 80 | 81 | .ui-resizable-handle { 82 | cursor: default; 83 | width: 1px !important; 84 | box-shadow: 0 calc(-2 * var(--top-height)) 0 0 var(--separator-color); 85 | } 86 | 87 | #nav-path { 88 | position: fixed; 89 | right: 0; 90 | left: var(--side-nav-fixed-width); 91 | bottom: 0; 92 | width: auto; 93 | } 94 | 95 | #doc-content { 96 | height: calc(100vh - 31px) !important; 97 | padding-bottom: calc(3 * var(--spacing-large)); 98 | padding-top: calc(var(--top-height) - 80px); 99 | box-sizing: border-box; 100 | margin-left: var(--side-nav-fixed-width) !important; 101 | } 102 | 103 | #MSearchBox { 104 | width: calc(var(--side-nav-fixed-width) - calc(2 * var(--spacing-medium))); 105 | } 106 | 107 | #MSearchField { 108 | width: calc(var(--side-nav-fixed-width) - calc(2 * var(--spacing-medium)) - 65px); 109 | } 110 | 111 | #MSearchResultsWindow { 112 | left: var(--spacing-medium) !important; 113 | right: auto; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /docs/styling/doxygen-interactive-toc.js: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | Doxygen Awesome 4 | https://github.com/jothepro/doxygen-awesome-css 5 | 6 | MIT License 7 | 8 | Copyright (c) 2022 jothepro 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | */ 29 | 30 | class DoxygenAwesomeInteractiveToc { 31 | static topOffset = 38 32 | static hideMobileMenu = true 33 | static headers = [] 34 | 35 | static init() { 36 | window.addEventListener("load", () => { 37 | let toc = document.querySelector(".contents > .toc") 38 | if(toc) { 39 | toc.classList.add("interactive") 40 | if(!DoxygenAwesomeInteractiveToc.hideMobileMenu) { 41 | toc.classList.add("open") 42 | } 43 | document.querySelector(".contents > .toc > h3")?.addEventListener("click", () => { 44 | if(toc.classList.contains("open")) { 45 | toc.classList.remove("open") 46 | } else { 47 | toc.classList.add("open") 48 | } 49 | }) 50 | 51 | document.querySelectorAll(".contents > .toc > ul a").forEach((node) => { 52 | let id = node.getAttribute("href").substring(1) 53 | DoxygenAwesomeInteractiveToc.headers.push({ 54 | node: node, 55 | headerNode: document.getElementById(id) 56 | }) 57 | 58 | document.getElementById("doc-content")?.addEventListener("scroll", () => { 59 | DoxygenAwesomeInteractiveToc.update() 60 | }) 61 | }) 62 | DoxygenAwesomeInteractiveToc.update() 63 | } 64 | }) 65 | } 66 | 67 | static update() { 68 | let active = DoxygenAwesomeInteractiveToc.headers[0]?.node 69 | DoxygenAwesomeInteractiveToc.headers.forEach((header) => { 70 | let position = header.headerNode.getBoundingClientRect().top 71 | header.node.classList.remove("active") 72 | header.node.classList.remove("aboveActive") 73 | if(position < DoxygenAwesomeInteractiveToc.topOffset) { 74 | active = header.node 75 | active?.classList.add("aboveActive") 76 | } 77 | }) 78 | active?.classList.add("active") 79 | active?.classList.remove("aboveActive") 80 | } 81 | } -------------------------------------------------------------------------------- /docs/styling/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |