Differences From Artifact [da155ca87d]:
- File
src/OFDeflateStream.h
— part of check-in
[134a1121c7]
at
2016-05-29 13:02:05
on branch trunk
— Rename OFInflateStream back to OFDeflateStream
The reason for renaming to OFInflateStream was to have one stream for
decompression and one for compression in order to reduce memory usage if
only one of the two is needed, as the ivar layout will be smaller then.
However, it is more consistent with other stream classes to have one
stream that can handle both. The increased memory footprint of having
ivars for compression and decompression can be solved by having a
pointer to those instead. This will not incur any performance penalty,
as the pointer will be dereferenced instead of the ivars, meaning the
overhead is only getting the pointer from the ivars once. (user: js, size: 2902) [annotate] [blame] [check-ins using]
To Artifact [b05d4c196d]:
- File src/OFDeflateStream.h — part of check-in [e9e89aa4c0] at 2016-05-29 14:15:01 on branch trunk — OFDeflateStream: Separate ivars by (de)compression (user: js, size: 2560) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
28 29 30 31 32 33 34 | */ @interface OFDeflateStream: OFStream { #ifdef OF_INFLATE_STREAM_M @public #endif OFStream *_stream; | > | | | | | < | | < < < < < < | | | | | | | | | | | | | | | | | | | | < < < < < < | | | | | | > | 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | */ @interface OFDeflateStream: OFStream { #ifdef OF_INFLATE_STREAM_M @public #endif OFStream *_stream; struct of_deflate_stream_decompression_ivars { uint8_t buffer[OF_INFLATE_STREAM_BUFFER_SIZE]; uint16_t bufferIndex, bufferLength; uint8_t byte; uint8_t bitIndex, savedBitsLength; uint16_t savedBits; uint8_t *slidingWindow; uint16_t slidingWindowIndex, slidingWindowMask; int state; union { struct { uint8_t position; uint8_t length[4]; } uncompressedHeader; struct { uint16_t position, length; } uncompressed; struct { struct huffman_tree *litLenTree, *distTree; struct huffman_tree *codeLenTree, *treeIter; uint8_t *lengths; uint16_t receivedCount; uint8_t value, litLenCodesCount, distCodesCount; uint8_t codeLenCodesCount; } huffmanTree; struct { struct huffman_tree *litLenTree, *distTree; struct huffman_tree *treeIter; int state; uint16_t value, length, distance; uint16_t extraBits; } huffman; } context; bool inLastBlock, atEndOfStream; } *_decompression; } /*! * @brief Creates a new OFDeflateStream with the specified underlying stream. * * @param stream The underlying stream to which compressed data is written or * from which compressed data is read |
︙ | ︙ |