Differences From Artifact [2f21e16d6f]:
- File
src/OFDeflateStream.h
— part of check-in
[d83d3aa719]
at
2013-10-10 13:18:35
on branch trunk
— Add OFDeflateStream.
No compression support yet, only decompression.
Decompression speed is acceptable for productive use, but there is still
a lot of room for optimization as this is a very straightforward
implementation without much optimization. (user: js, size: 2827) [annotate] [blame] [check-ins using]
To Artifact [ee0596ab39]:
- File src/OFDeflateStream.h — part of check-in [7aef43d648] at 2013-11-06 20:29:17 on branch trunk — Add OFDeflate64Stream. (user: js, size: 3037) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
15 16 17 18 19 20 21 | */ #import "OFStream.h" #define OF_DEFLATE_STREAM_BUFFER_SIZE 4096 /*! | | | | > > > > > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | */ #import "OFStream.h" #define OF_DEFLATE_STREAM_BUFFER_SIZE 4096 /*! * @brief A class for a stream that handles Deflate compression or decompression * transparently for an underlying stream. */ @interface OFDeflateStream: OFStream { #ifdef OF_DEFLATE_STREAM_M @public #endif OFStream *_stream; uint8_t _buffer[OF_DEFLATE_STREAM_BUFFER_SIZE]; uint_fast16_t _bufferIndex, _bufferLength; uint8_t _byte; uint_fast8_t _bitIndex, _savedBitsLength; uint_fast16_t _savedBits; @protected uint8_t *_slidingWindow; uint_fast16_t _slidingWindowIndex, _slidingWindowMask; struct { uint_fast8_t numDistanceCodes; const uint8_t *lengthCodes; const uint8_t *lengthExtraBits; const uint16_t *distanceCodes; const uint8_t *distanceExtraBits; } _codes; enum { OF_DEFLATE_STREAM_BLOCK_HEADER, OF_DEFLATE_STREAM_UNCOMPRESSED_BLOCK_HEADER, OF_DEFLATE_STREAM_UNCOMPRESSED_BLOCK, OF_DEFLATE_STREAM_HUFFMAN_TREE, OF_DEFLATE_STREAM_HUFFMAN_BLOCK } _state; |
︙ | ︙ |