#include <kis_abstract_compression.h>
Base class for compression operations
Definition at line 17 of file kis_abstract_compression.h.
◆ KisAbstractCompression()
| KisAbstractCompression::KisAbstractCompression |
( |
| ) |
|
◆ ~KisAbstractCompression()
| KisAbstractCompression::~KisAbstractCompression |
( |
| ) |
|
|
virtual |
◆ adjustForDataSize()
| void KisAbstractCompression::adjustForDataSize |
( |
qint32 | dataSize | ) |
|
|
virtual |
◆ compress()
| virtual qint32 KisAbstractCompression::compress |
( |
const quint8 * | input, |
|
|
qint32 | inputLength, |
|
|
quint8 * | output, |
|
|
qint32 | outputLength ) |
|
pure virtual |
Compresses input buffer into output buffer. WARNING: Be careful, output buffer must be at least outputBufferSize(inputLength) size!
- Parameters
-
| input | the input |
| inputLength | the input length |
| output | the output |
| outputLength | is not used! |
- Returns
- number of bytes written to the output buffer and 0 if error occurred.
- See also
- outputBufferSize()
Implemented in KisLzfCompression.
◆ decompress()
| virtual qint32 KisAbstractCompression::decompress |
( |
const quint8 * | input, |
|
|
qint32 | inputLength, |
|
|
quint8 * | output, |
|
|
qint32 | outputLength ) |
|
pure virtual |
Decompresses input buffer into output buffer. WARNING: output buffer must be able to fit the input data
- Parameters
-
| input | the input |
| inputLength | the input length |
| output | the output |
| outputLength | is not used! |
- Returns
- number of bytes written to the output buffer and 0 if error occurred.
Implemented in KisLzfCompression.
◆ delinearizeColors()
| void KisAbstractCompression::delinearizeColors |
( |
quint8 * | input, |
|
|
quint8 * | output, |
|
|
qint32 | dataSize, |
|
|
qint32 | pixelSize ) |
|
static |
e.g. RRRGGGBBBAAA -> RGBARGBARGBA NOTE: performs mixing of bytes, not channels!
In the beginning, i wrote "delinearization" in a way, that looks like a "linearization", but it turned to be quite inefficient. It seems like reading from random positions is much faster than writing to random areas. So this version is 13% faster.
Definition at line 38 of file kis_abstract_compression.cpp.
40{
49 quint8 *outputByte = output;
50 quint8 *lastByte = output + dataSize -1;
51
52 qint32 strideSize = dataSize / pixelSize;
53 quint8 *startByte = input;
54
55 while (outputByte <= lastByte) {
56 quint8 *inputByte = startByte;
57
58 for(qint32 i = 0; i < pixelSize; i++) {
59 *outputByte = *inputByte;
60 outputByte++;
61 inputByte += strideSize;
62 }
63
64 startByte++;
65 }
66}
◆ linearizeColors()
| void KisAbstractCompression::linearizeColors |
( |
quint8 * | input, |
|
|
quint8 * | output, |
|
|
qint32 | dataSize, |
|
|
qint32 | pixelSize ) |
|
static |
Additional interface for jumbling color channels order e.g. RGBARGBARGBA -> RRRGGGBBBAAA NOTE: performs mixing of bytes, not channels!
Definition at line 22 of file kis_abstract_compression.cpp.
24{
25 quint8 *outputByte = output;
26 quint8 *lastByte = input + dataSize -1;
27
28 for(qint32 i = 0; i < pixelSize; i++) {
29 quint8 *inputByte = input + i;
30 while (inputByte <= lastByte) {
31 *outputByte = *inputByte;
32 outputByte++;
33 inputByte+=pixelSize;
34 }
35 }
36}
◆ outputBufferSize()
| virtual qint32 KisAbstractCompression::outputBufferSize |
( |
qint32 | dataSize | ) |
|
|
pure virtual |
Returns minimal allowed size of output buffer for compression
Implemented in KisLzfCompression.
The documentation for this class was generated from the following files: