libpgf 7.26.45
PGF - Progressive Graphics File
Loading...
Searching...
No Matches
pgf Namespace Reference

Namespaces

namespace  Orient
namespace  UP

Classes

class  CDecoder
 PGF decoder. More...
class  CEncoder
 PGF encoder. More...
class  CPGFFileStream
 File stream class. More...
class  CPGFImage
 PGF main class. More...
class  CPGFMemoryStream
 Memory stream class. More...
class  CPGFStream
 Abstract stream base class. More...
class  CSubband
 Wavelet channel class. More...
class  CWaveletTransform
 PGF wavelet transform. More...
struct  IOException
 PGF exception. More...
struct  PGFHeader
 PGF header. More...
struct  PGFMagicVersion
 PGF identification and version. More...
struct  PGFPostHeader
 Optional PGF post-header. More...
struct  PGFPreHeader
 PGF pre-header. More...
struct  PGFRect
 Rectangle. More...
struct  PGFVersionNumber
 version number stored in header since major version 7 More...
union  ROIBlockHeader
 Block header used with ROI coding scheme. More...

Typedefs

typedef int32_t DataT
typedef void(*) RefreshCB(void *p)

Enumerations

enum class  ProgressMode { Relative , Absolute }

Functions

void SetBit (uint32_t *stream, uint32_t pos)
void ClearBit (uint32_t *stream, uint32_t pos)
bool GetBit (uint32_t *stream, uint32_t pos)
bool CompareBitBlock (uint32_t *stream, uint32_t pos, uint32_t k, uint32_t val)
void SetValueBlock (uint32_t *stream, uint32_t pos, uint32_t val, uint32_t k)
uint32_t GetValueBlock (uint32_t *stream, uint32_t pos, uint32_t k)
void ClearBitBlock (uint32_t *stream, uint32_t pos, uint32_t len)
void SetBitBlock (uint32_t *stream, uint32_t pos, uint32_t len)
uint32_t SeekBitRange (uint32_t *stream, uint32_t pos, uint32_t len)
uint32_t SeekBit1Range (uint32_t *stream, uint32_t pos, uint32_t len)
uint32_t AlignWordPos (uint32_t pos)
uint32_t NumberOfWords (uint32_t pos)

Variables

constexpr const char * PGFMagic = "PGF"
 PGF identification.
constexpr int MaxLevel = 30
 maximum number of transform levels
constexpr int NSubbands = 4
 number of subbands per level
constexpr int MaxChannels = 8
 maximum number of (color) channels
constexpr int DownsampleThreshold = 3
 if quality is larger than this threshold than downsampling is used
constexpr int ColorTableLen = 256
 size of color lookup table (clut)
constexpr int Version2 = 2
 data structure PGFHeader of major version 2
constexpr int PGF32 = 4
 32 bit values are used -> allows at maximum 30 input bits, otherwise 16 bit values are used -> allows at maximum 14 input bits
constexpr int PGFROI = 8
 supports Regions Of Interest
constexpr int Version5 = 16
 new coding scheme since major version 5
constexpr int Version6 = 32
 hSize in PGFPreHeader uses 32 bits instead of 16 bits
constexpr int Version7 = 64
 Codec major and minor version number stored in PGFHeader.
constexpr int PGFVersion = (Version2 | PGF32 | Version5 | Version6 | Version7)
 current standard version
constexpr uint32_t BufferSize = 16384
 must be a multiple of WordWidth, BufferSize <= UINT16_MAX
constexpr uint32_t BufferLen = BufferSize/WordWidth
 number of words per buffer
constexpr uint32_t CodeBufferLen = BufferSize
 number of words in code buffer (CodeBufferLen > BufferLen)
constexpr int RLblockSizeLen = 15
 block size length (< 16): ld(BufferSize) < RLblockSizeLen <= 2*ld(BufferSize)
constexpr int LinBlockSize = 8
 side length of a coefficient block in a HH or LL subband
constexpr int InterBlockSize = 4
 side length of a coefficient block in a HL or LH subband
constexpr int MaxBitPlanes = 31
 maximum number of bit planes of m_value: 32 minus sign bit
constexpr int MaxBitPlanesLog = 5
 number of bits to code the maximum number of bit planes (in 32 or 16 bit mode)
constexpr int MaxQuality = MaxBitPlanes
 maximum quality
constexpr size_t MagicVersionSize = sizeof(pgf::PGFMagicVersion)
constexpr size_t PreHeaderSize = sizeof(pgf::PGFPreHeader)
constexpr size_t HeaderSize = sizeof(pgf::PGFHeader)
constexpr size_t ColorTableSize = (ColorTableLen*sizeof(RGBQUAD))
constexpr size_t DataTSize = sizeof(pgf::DataT)
constexpr size_t MaxUserDataSize = 0x7FFFFFFF
static const uint32_t Filled = 0xFFFFFFFF
constexpr uint32_t CodeBufferBitLen = CodeBufferLen*WordWidth
 max number of bits in m_codeBuffer
constexpr uint32_t MaxCodeLen = (1 << RLblockSizeLen) - 1
 max length of RL encoded block
constexpr DataT YUVoffset4 = 8
constexpr DataT YUVoffset6 = 32
constexpr DataT YUVoffset8 = 128
constexpr DataT YUVoffset16 = 32768
constexpr DataT c1 = 1
constexpr DataT c2 = 2
constexpr uint32_t FilterSizeL = 5
 number of coefficients of the low pass filter
constexpr uint32_t FilterSizeH = 3
 number of coefficients of the high pass filter
constexpr uint32_t FilterSize = __max(FilterSizeL, FilterSizeH)

Typedef Documentation

◆ DataT

typedef int32_t pgf::DataT

Definition at line 367 of file PGFtypes.h.

◆ RefreshCB

typedef void(*) pgf::RefreshCB(void *p)

Definition at line 372 of file PGFtypes.h.

Enumeration Type Documentation

◆ ProgressMode

enum class pgf::ProgressMode
strong
Enumerator
Relative 
Absolute 

Definition at line 114 of file PGFtypes.h.

Function Documentation

◆ AlignWordPos()

uint32_t pgf::AlignWordPos ( uint32_t pos)
inline

Compute bit position of the next 32-bit word

Parameters
poscurrent bit stream position
Returns
bit position of next 32-bit word

Definition at line 328 of file BitStream.h.

328 {
329 // return ((pos + WordWidth - 1) >> WordWidthLog) << WordWidthLog;
330 return DWWIDTHBITS(pos);
331 }
constexpr uint32_t DWWIDTHBITS(uint32_t bits)
< aligns scanline width in bits to DWORD value
Definition PGFplatform.h:88

◆ ClearBit()

void pgf::ClearBit ( uint32_t * stream,
uint32_t pos )
inline

Set one bit of a bit stream to 0

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream

Definition at line 70 of file BitStream.h.

70 {
71 stream[pos >> WordWidthLog] &= ~(1 << (pos%WordWidth));
72 }
constexpr uint32_t WordWidth
WordBytes*8.
Definition PGFplatform.h:73
constexpr uint32_t WordWidthLog
ld of WordWidth
Definition PGFplatform.h:74

◆ ClearBitBlock()

void pgf::ClearBitBlock ( uint32_t * stream,
uint32_t pos,
uint32_t len )
inline

Clear block of size at least len at position pos in stream

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
lenNumber of bits set to 0

Definition at line 169 of file BitStream.h.

169 {
170 ASSERT(len > 0);
171 const uint32_t iFirstInt = pos >> WordWidthLog;
172 const uint32_t iLastInt = (pos + len - 1) >> WordWidthLog;
173
174 const uint32_t startMask = Filled << (pos%WordWidth);
175 // const uint32_t endMask=Filled>>(WordWidth-1-((pos+len-1)%WordWidth));
176
177 if (iFirstInt == iLastInt) {
178 stream[iFirstInt] &= ~(startMask /*& endMask*/);
179 } else {
180 stream[iFirstInt] &= ~startMask;
181 for (uint32_t i = iFirstInt + 1; i <= iLastInt; i++) { // changed <=
182 stream[i] = 0;
183 }
184 //stream[iLastInt] &= ~endMask;
185 }
186 }
static const uint32_t Filled
Definition BitStream.h:38

◆ CompareBitBlock()

bool pgf::CompareBitBlock ( uint32_t * stream,
uint32_t pos,
uint32_t k,
uint32_t val )
inline

Compare k-bit binary representation of stream at position pos with val

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
kNumber of bits to compare
valValue to compare with
Returns
true if equal

Definition at line 91 of file BitStream.h.

91 {
92 const uint32_t iLoInt = pos >> WordWidthLog;
93 const uint32_t iHiInt = (pos + k - 1) >> WordWidthLog;
94 ASSERT(iLoInt <= iHiInt);
95 const uint32_t mask = (Filled >> (WordWidth - k));
96
97 if (iLoInt == iHiInt) {
98 // fits into one integer
99 val &= mask;
100 val <<= (pos%WordWidth);
101 return (stream[iLoInt] & val) == val;
102 } else {
103 // must be splitted over integer boundary
104 uint64_t v1 = MAKEU64(stream[iLoInt], stream[iHiInt]);
105 uint64_t v2 = uint64_t(val & mask) << (pos%WordWidth);
106 return (v1 & v2) == v2;
107 }
108 }
#define MAKEU64(a, b)
Make 64 bit unsigned integer from two 32 bit unsigned integers.
Definition BitStream.h:41

◆ GetBit()

bool pgf::GetBit ( uint32_t * stream,
uint32_t pos )
inline

Return one bit of a bit stream

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
Returns
bit at position pos of bit stream stream

Definition at line 79 of file BitStream.h.

79 {
80 return (stream[pos >> WordWidthLog] & (1 << (pos%WordWidth))) > 0;
81
82 }

◆ GetValueBlock()

uint32_t pgf::GetValueBlock ( uint32_t * stream,
uint32_t pos,
uint32_t k )
inline

Read k-bit number from stream at position pos

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
kNumber of bits to read: 1 <= k <= 32

Definition at line 142 of file BitStream.h.

142 {
143 uint32_t count, hiCount;
144 const uint32_t iLoInt = pos >> WordWidthLog; // integer of first bit
145 const uint32_t iHiInt = (pos + k - 1) >> WordWidthLog; // integer of last bit
146 const uint32_t loMask = Filled << (pos%WordWidth);
147 const uint32_t hiMask = Filled >> (WordWidth - 1 - ((pos + k - 1)%WordWidth));
148
149 if (iLoInt == iHiInt) {
150 // inside integer boundary
151 count = stream[iLoInt] & (loMask & hiMask);
152 count >>= pos%WordWidth;
153 } else {
154 // overlapping integer boundary
155 count = stream[iLoInt] & loMask;
156 count >>= pos%WordWidth;
157 hiCount = stream[iHiInt] & hiMask;
158 hiCount <<= WordWidth - (pos%WordWidth);
159 count |= hiCount;
160 }
161 return count;
162 }

◆ NumberOfWords()

uint32_t pgf::NumberOfWords ( uint32_t pos)
inline

Compute number of the 32-bit words

Parameters
posCurrent bit stream position
Returns
Number of 32-bit words

Definition at line 337 of file BitStream.h.

337 {
338 return (pos + WordWidth - 1) >> WordWidthLog;
339 }

◆ SeekBit1Range()

uint32_t pgf::SeekBit1Range ( uint32_t * stream,
uint32_t pos,
uint32_t len )
inline

Returns the distance to the next 0 in stream at position pos. If no 0 is found within len bits, then len is returned.

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
lensize of search area (in bits) return The distance to the next 0 in stream at position pos

Definition at line 249 of file BitStream.h.

249 {
250 uint32_t count = 0;
251 uint32_t testMask = 1 << (pos%WordWidth);
252 uint32_t* word = stream + (pos >> WordWidthLog);
253
254 while (((*word & testMask) != 0) && (count < len)) {
255 count++;
256 testMask <<= 1;
257 if (!testMask) {
258 word++; testMask = 1;
259
260 // fast steps if all bits in a word are one
261 while ((count + WordWidth <= len) && (*word == Filled)) {
262 word++;
263 count += WordWidth;
264 }
265 }
266 }
267 return count;
268 }

◆ SeekBitRange()

uint32_t pgf::SeekBitRange ( uint32_t * stream,
uint32_t pos,
uint32_t len )
inline

Returns the distance to the next 1 in stream at position pos. If no 1 is found within len bits, then len is returned.

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
lensize of search area (in bits) return The distance to the next 1 in stream at position pos

Definition at line 220 of file BitStream.h.

220 {
221 uint32_t count = 0;
222 uint32_t testMask = 1 << (pos%WordWidth);
223 uint32_t* word = stream + (pos >> WordWidthLog);
224
225 while (((*word & testMask) == 0) && (count < len)) {
226 count++;
227 testMask <<= 1;
228 if (!testMask) {
229 word++; testMask = 1;
230
231 // fast steps if all bits in a word are zero
232 while ((count + WordWidth <= len) && (*word == 0)) {
233 word++;
234 count += WordWidth;
235 }
236 }
237 }
238
239 return count;
240 }

◆ SetBit()

void pgf::SetBit ( uint32_t * stream,
uint32_t pos )
inline

Set one bit of a bit stream to 1

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream

Definition at line 62 of file BitStream.h.

62 {
63 stream[pos >> WordWidthLog] |= (1 << (pos%WordWidth));
64 }

◆ SetBitBlock()

void pgf::SetBitBlock ( uint32_t * stream,
uint32_t pos,
uint32_t len )
inline

Set block of size at least len at position pos in stream

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
lenNumber of bits set to 1

Definition at line 193 of file BitStream.h.

193 {
194 ASSERT(len > 0);
195
196 const uint32_t iFirstInt = pos >> WordWidthLog;
197 const uint32_t iLastInt = (pos + len - 1) >> WordWidthLog;
198
199 const uint32_t startMask = Filled << (pos%WordWidth);
200 // const uint32_t endMask=Filled>>(WordWidth-1-((pos+len-1)%WordWidth));
201
202 if (iFirstInt == iLastInt) {
203 stream[iFirstInt] |= (startMask /*& endMask*/);
204 } else {
205 stream[iFirstInt] |= startMask;
206 for (uint32_t i = iFirstInt + 1; i <= iLastInt; i++) { // changed <=
207 stream[i] = Filled;
208 }
209 //stream[iLastInt] &= ~endMask;
210 }
211 }

◆ SetValueBlock()

void pgf::SetValueBlock ( uint32_t * stream,
uint32_t pos,
uint32_t val,
uint32_t k )
inline

Store k-bit binary representation of val in stream at position pos

Parameters
streamA bit stream stored in array of unsigned integers
posA valid zero-based position in the bit stream
valValue to store in stream at position pos
kNumber of bits of integer representation of val

Definition at line 116 of file BitStream.h.

116 {
117 const uint32_t offset = pos%WordWidth;
118 const uint32_t iLoInt = pos >> WordWidthLog;
119 const uint32_t iHiInt = (pos + k - 1) >> WordWidthLog;
120 ASSERT(iLoInt <= iHiInt);
121 const uint32_t loMask = Filled << offset;
122 const uint32_t hiMask = Filled >> (WordWidth - 1 - ((pos + k - 1)%WordWidth));
123
124 if (iLoInt == iHiInt) {
125 // fits into one integer
126 stream[iLoInt] &= ~(loMask & hiMask); // clear bits
127 stream[iLoInt] |= val << offset; // write value
128 } else {
129 // must be splitted over integer boundary
130 stream[iLoInt] &= ~loMask; // clear bits
131 stream[iLoInt] |= val << offset; // write lower part of value
132 stream[iHiInt] &= ~hiMask; // clear bits
133 stream[iHiInt] |= val >> (WordWidth - offset); // write higher part of value
134 }
135 }

Variable Documentation

◆ BufferLen

uint32_t pgf::BufferLen = BufferSize/WordWidth
constexpr

number of words per buffer

Definition at line 85 of file PGFtypes.h.

◆ BufferSize

uint32_t pgf::BufferSize = 16384
constexpr

must be a multiple of WordWidth, BufferSize <= UINT16_MAX

Definition at line 84 of file PGFtypes.h.

◆ c1

DataT pgf::c1 = 1
constexpr

Definition at line 32 of file WaveletTransform.cpp.

◆ c2

DataT pgf::c2 = 2
constexpr

Definition at line 33 of file WaveletTransform.cpp.

◆ CodeBufferBitLen

uint32_t pgf::CodeBufferBitLen = CodeBufferLen*WordWidth
constexpr

max number of bits in m_codeBuffer

Definition at line 59 of file Decoder.cpp.

◆ CodeBufferLen

uint32_t pgf::CodeBufferLen = BufferSize
constexpr

number of words in code buffer (CodeBufferLen > BufferLen)

Definition at line 86 of file PGFtypes.h.

◆ ColorTableLen

int pgf::ColorTableLen = 256
constexpr

size of color lookup table (clut)

Definition at line 66 of file PGFtypes.h.

◆ ColorTableSize

size_t pgf::ColorTableSize = (ColorTableLen*sizeof(RGBQUAD))
constexpr

Definition at line 380 of file PGFtypes.h.

◆ DataTSize

size_t pgf::DataTSize = sizeof(pgf::DataT)
constexpr

Definition at line 381 of file PGFtypes.h.

◆ DownsampleThreshold

int pgf::DownsampleThreshold = 3
constexpr

if quality is larger than this threshold than downsampling is used

Definition at line 65 of file PGFtypes.h.

◆ Filled

const uint32_t pgf::Filled = 0xFFFFFFFF
static

Definition at line 38 of file BitStream.h.

◆ FilterSize

uint32_t pgf::FilterSize = __max(FilterSizeL, FilterSizeH)
constexpr

Definition at line 39 of file WaveletTransform.h.

◆ FilterSizeH

uint32_t pgf::FilterSizeH = 3
constexpr

number of coefficients of the high pass filter

Definition at line 38 of file WaveletTransform.h.

◆ FilterSizeL

uint32_t pgf::FilterSizeL = 5
constexpr

number of coefficients of the low pass filter

Definition at line 37 of file WaveletTransform.h.

◆ HeaderSize

size_t pgf::HeaderSize = sizeof(pgf::PGFHeader)
constexpr

Definition at line 379 of file PGFtypes.h.

◆ InterBlockSize

int pgf::InterBlockSize = 4
constexpr

side length of a coefficient block in a HL or LH subband

Definition at line 89 of file PGFtypes.h.

◆ LinBlockSize

int pgf::LinBlockSize = 8
constexpr

side length of a coefficient block in a HH or LL subband

Definition at line 88 of file PGFtypes.h.

◆ MagicVersionSize

size_t pgf::MagicVersionSize = sizeof(pgf::PGFMagicVersion)
constexpr

Definition at line 377 of file PGFtypes.h.

◆ MaxBitPlanes

int pgf::MaxBitPlanes = 31
constexpr

maximum number of bit planes of m_value: 32 minus sign bit

Definition at line 91 of file PGFtypes.h.

◆ MaxBitPlanesLog

int pgf::MaxBitPlanesLog = 5
constexpr

number of bits to code the maximum number of bit planes (in 32 or 16 bit mode)

Definition at line 95 of file PGFtypes.h.

◆ MaxChannels

int pgf::MaxChannels = 8
constexpr

maximum number of (color) channels

Definition at line 64 of file PGFtypes.h.

◆ MaxCodeLen

uint32_t pgf::MaxCodeLen = (1 << RLblockSizeLen) - 1
constexpr

max length of RL encoded block

Definition at line 60 of file Decoder.cpp.

◆ MaxLevel

int pgf::MaxLevel = 30
constexpr

maximum number of transform levels

Definition at line 62 of file PGFtypes.h.

◆ MaxQuality

int pgf::MaxQuality = MaxBitPlanes
constexpr

maximum quality

Definition at line 96 of file PGFtypes.h.

◆ MaxUserDataSize

size_t pgf::MaxUserDataSize = 0x7FFFFFFF
constexpr

Definition at line 382 of file PGFtypes.h.

◆ NSubbands

int pgf::NSubbands = 4
constexpr

number of subbands per level

Definition at line 63 of file PGFtypes.h.

◆ PGF32

int pgf::PGF32 = 4
constexpr

32 bit values are used -> allows at maximum 30 input bits, otherwise 16 bit values are used -> allows at maximum 14 input bits

Definition at line 69 of file PGFtypes.h.

◆ PGFMagic

const char* pgf::PGFMagic = "PGF"
constexpr

PGF identification.

Definition at line 61 of file PGFtypes.h.

◆ PGFROI

int pgf::PGFROI = 8
constexpr

supports Regions Of Interest

Definition at line 70 of file PGFtypes.h.

◆ PGFVersion

int pgf::PGFVersion = (Version2 | PGF32 | Version5 | Version6 | Version7)
constexpr

current standard version

Definition at line 76 of file PGFtypes.h.

◆ PreHeaderSize

size_t pgf::PreHeaderSize = sizeof(pgf::PGFPreHeader)
constexpr

Definition at line 378 of file PGFtypes.h.

◆ RLblockSizeLen

int pgf::RLblockSizeLen = 15
constexpr

block size length (< 16): ld(BufferSize) < RLblockSizeLen <= 2*ld(BufferSize)

Definition at line 87 of file PGFtypes.h.

◆ Version2

int pgf::Version2 = 2
constexpr

data structure PGFHeader of major version 2

Definition at line 68 of file PGFtypes.h.

◆ Version5

int pgf::Version5 = 16
constexpr

new coding scheme since major version 5

Definition at line 71 of file PGFtypes.h.

◆ Version6

int pgf::Version6 = 32
constexpr

hSize in PGFPreHeader uses 32 bits instead of 16 bits

Definition at line 72 of file PGFtypes.h.

◆ Version7

int pgf::Version7 = 64
constexpr

Codec major and minor version number stored in PGFHeader.

Definition at line 73 of file PGFtypes.h.

◆ YUVoffset16

DataT pgf::YUVoffset16 = 32768
constexpr

Definition at line 40 of file PGFimage.cpp.

◆ YUVoffset4

DataT pgf::YUVoffset4 = 8
constexpr

Definition at line 37 of file PGFimage.cpp.

◆ YUVoffset6

DataT pgf::YUVoffset6 = 32
constexpr

Definition at line 38 of file PGFimage.cpp.

◆ YUVoffset8

DataT pgf::YUVoffset8 = 128
constexpr

Definition at line 39 of file PGFimage.cpp.