xref: /aosp_15_r20/external/zopfli/README (revision e47783fd9ac7e78d0523d35be12ee382df490d63)
1*e47783fdSXin LiZopfli Compression Algorithm is a compression library programmed in C to perform
2*e47783fdSXin Livery good, but slow, deflate or zlib compression.
3*e47783fdSXin Li
4*e47783fdSXin LiThe basic function to compress data is ZopfliCompress in zopfli.h. Use the
5*e47783fdSXin LiZopfliOptions object to set parameters that affect the speed and compression.
6*e47783fdSXin LiUse the ZopfliInitOptions function to place the default values in the
7*e47783fdSXin LiZopfliOptions first.
8*e47783fdSXin Li
9*e47783fdSXin LiZopfliCompress supports deflate, gzip and zlib output format with a parameter.
10*e47783fdSXin LiTo support only one individual format, you can instead use ZopfliDeflate in
11*e47783fdSXin Lideflate.h, ZopfliZlibCompress in zlib_container.h or ZopfliGzipCompress in
12*e47783fdSXin Ligzip_container.h.
13*e47783fdSXin Li
14*e47783fdSXin LiZopfliDeflate creates a valid deflate stream in memory, see:
15*e47783fdSXin Lihttp://www.ietf.org/rfc/rfc1951.txt
16*e47783fdSXin LiZopfliZlibCompress creates a valid zlib stream in memory, see:
17*e47783fdSXin Lihttp://www.ietf.org/rfc/rfc1950.txt
18*e47783fdSXin LiZopfliGzipCompress creates a valid gzip stream in memory, see:
19*e47783fdSXin Lihttp://www.ietf.org/rfc/rfc1952.txt
20*e47783fdSXin Li
21*e47783fdSXin LiThis library can only compress, not decompress. Existing zlib or deflate
22*e47783fdSXin Lilibraries can decompress the data.
23*e47783fdSXin Li
24*e47783fdSXin Lizopfli_bin.c is separate from the library and contains an example program to
25*e47783fdSXin Licreate very well compressed gzip files. Currently the makefile builds this
26*e47783fdSXin Liprogram with the library statically linked in.
27*e47783fdSXin Li
28*e47783fdSXin LiThe source code of Zopfli is under src/zopfli. Build instructions:
29*e47783fdSXin Li
30*e47783fdSXin LiTo build zopfli, compile all .c source files under src/zopfli to a single binary
31*e47783fdSXin Liwith C, and link to the standard C math library, e.g.:
32*e47783fdSXin Ligcc src/zopfli/*.c -O2 -W -Wall -Wextra -Wno-unused-function -ansi -pedantic -lm -o zopfli
33*e47783fdSXin Li
34*e47783fdSXin LiA makefile is provided as well, but only for linux. Use "make" to build the
35*e47783fdSXin Libinary, "make libzopfli" to build it as a shared library. For other platforms,
36*e47783fdSXin Liplease use the build instructions above instead.
37*e47783fdSXin Li
38*e47783fdSXin LiZopfli Compression Algorithm was created by Lode Vandevenne and Jyrki
39*e47783fdSXin LiAlakuijala, based on an algorithm by Jyrki Alakuijala.
40