arcode: An ANSI C implementation of arithmetic encoding and decoding
License
LGPL-3.0, GPL-3.0 licenses found
Licenses found
LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
MichaelDipperstein/arcode
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
DESCRIPTION ----------- This archive contains a simple and readable ANSI C implementation of Arithmetic coding and decoding. This implementation is not intended to be the best, fastest, smallest, or any other performance related adjective. More information on Arithmetic encoding may be found at: https://michaeldipperstein.github.io/arithmetic.html FILES ----- arcode.c - Library of Arithmetic encoding and decoding routines. arcode.h - Header containing prototypes for library functions. COPYING - Rules for copying and distributing LGPL software LICENSE - GNU Lesser General Public License Makefile - makefile for this project (assumes gcc compiler and GNU make) README - this file sample.c - Demonstration of how to use Arithmetic library functions optlist/ - Subtree containing optlist command line option parser library bitfile/ - Subtree containing bitfile bitwise file library BUILDING -------- To build these files with GNU make and gcc: 1. Windows users should define the environment variable OS to be Windows or Windows_NT. This is often already done. 2. Enter the command "make" from the command line or "make DEBUG=1" to compile with debug options. The executable will be named sample (or sample.exe). GIT NOTE: Updates to subtrees optlist and bitfile don't get pulled by "git pull" Use the following commands to pull their updates: git subtree pull --prefix optlist https://github.com/MichaelDipperstein/optlist.git master --squash git subtree pull --prefix bitfile https://github.com/MichaelDipperstein/bitfile.git master --squash USAGE ----- Usage: sample <options> options: -c : Encode input file to output file. -d : Decode input file to output file. -i <filename> : Name of input file. -o <filename> : Name of output file. -a : Use adaptive model instead of static. -h|? : Print out command line options. -a Compress/decompress using the adaptive model. Data compressed using the adaptive model must be decompressed using the adaptive model. -c Generate a probability range list for the specified input file (see -i) and use arithmetic coding compresses the file to the specified output file (see -o). -d Decompresses the specified input file (see -i) writing the results to the specified output file (see -o). Only files compressed by this program may be decompressed. -i <filename> The name of the input file. There is no valid usage of this program without a specified input file. -o <filename> The name of the output file. If no file is specified, stdout will be used. NOTE: Sending compressed output to stdout may produce undesirable results. LIBRARY API ----------- Encoding Data: int ArEncodeFile(FILE *inFile, FILE *outFile, const model_t model); inFile The file stream to be encoded. It must be opened and it must also be rewindable if a static model is used. If NULL, stdin will be used. outFile The file stream receiving the encoded results. It must be opened as binary. If NULL, stdout will be used. model model_t type value indicating whether a static model or a dynamic model is to be used. Return Value Non-zero for success, zero for failure. Decoding Data: int ArDecodeFile(FILE *inFile, FILE *outFile, const model_t model); inFile The file stream containing the encoded input. It must be opened as binary. If NULL, stdin will be used. outFile The file stream receiving the decoded results. It must be opened as binary. If NULL, stdout will be used. model model_t type value indicating whether a static model or a dynamic model is to be used. Return Value Zero for success, non-zero for failure. HISTORY ------- 04/01/04 - Initial Release 08/13/04 - Added support for adaptive encoding 06/21/05 - Corrected BitFileGetBits/PutBits error that accessed an extra byte when given an integral number of bytes. 01/11/06 - Uses BitFileGetBitsIntBit and FilePutBitsInt for reading and writing the header. - This makes the code a little cleaner, but the new header is not compatible with the old header. 03/17/14 - Changed the API so that encode and decode routines accept opened file streams instead of file names. - Eliminated all global variables. 10/26/14 - Upgrade to latest Bitfile and Oplist Libraries - Tighter adherence to Michael Barr's "Top 10 Bug-Killing Coding Standard Rules" (http://www.barrgroup.com/webinars/10rules). 07/15/17 - Changes for easier use with GitHub 09/19/19 - Updated e-mail address - Updated optlist and bitfile subtrees TODO ---- - Add support for higher order models. - Provide dynamic link library (DLL) example. AUTHOR ------ Michael Dipperstein (mdipperstein@gmail.com)
About
arcode: An ANSI C implementation of arithmetic encoding and decoding
Resources
License
LGPL-3.0, GPL-3.0 licenses found
Licenses found
LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published