/usr/include/CharLS/jpegstreamwriter.h is in libcharls-dev 1.1.0+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | //
// (C) CharLS Team 2014, all rights reserved. See the accompanying "License.txt" for licensed use.
//
#ifndef CHARLS_JPEGSTREAMWRITER
#define CHARLS_JPEGSTREAMWRITER
#include "util.h"
#include "jpegsegment.h"
#include <vector>
//
// Purpose: 'Writer'class that can generate JPEG-LS file streams.
//
class JpegStreamWriter
{
friend class JpegMarkerSegment;
friend class JpegImageDataSegment;
public:
JpegStreamWriter(const JfifParameters& jfifParameters, Size size, LONG bitsPerSample, LONG ccomp);
virtual ~JpegStreamWriter();
void AddSegment(JpegSegment* segment)
{
_segments.push_back(segment);
}
void AddScan(ByteStreamInfo info, const JlsParameters* pparams);
void AddLSE(const JlsCustomParameters* pcustom);
void AddColorTransform(int i);
size_t GetBytesWritten()
{
return _byteOffset;
}
size_t GetLength()
{
return _data.count - _byteOffset;
}
size_t Write(ByteStreamInfo info);
void EnableCompare(bool bCompare)
{
_bCompare = bCompare;
}
private:
BYTE* GetPos() const
{
return _data.rawData + _byteOffset;
}
ByteStreamInfo OutputStream() const
{
ByteStreamInfo data = _data;
data.count -= _byteOffset;
data.rawData += _byteOffset;
return data;
}
void WriteByte(BYTE val)
{
ASSERT(!_bCompare || _data.rawData[_byteOffset] == val);
if (_data.rawStream != NULL)
{
_data.rawStream->sputc(val);
}
else
{
if (_byteOffset >= _data.count)
throw JlsException(CompressedBufferTooSmall);
_data.rawData[_byteOffset++] = val;
}
}
void WriteBytes(const std::vector<BYTE>& rgbyte)
{
for (size_t i = 0; i < rgbyte.size(); ++i)
{
WriteByte(rgbyte[i]);
}
}
void WriteWord(USHORT val)
{
WriteByte(BYTE(val / 0x100));
WriteByte(BYTE(val % 0x100));
}
void Seek(size_t byteCount)
{
if (_data.rawStream != NULL)
return;
_byteOffset += byteCount;
}
private:
bool _bCompare;
ByteStreamInfo _data;
size_t _byteOffset;
LONG _lastCompenentIndex;
std::vector<JpegSegment*> _segments;
};
#endif
|