|
libpgf 7.26.45
PGF - Progressive Graphics File
|
PGF main class. More...
#include <PGFimage.h>
Public Member Functions | |
| CPGFImage () | |
| Standard constructor. | |
| virtual | ~CPGFImage () |
| Destructor. | |
| void | Destroy () |
| void | Open (CPGFStream *stream) |
| bool | IsOpen () const |
| Returns true if the PGF has been opened for reading. | |
| void | Read (int level=0, CallbackPtr cb=nullptr, void *data=nullptr) |
| void | Read (PGFRect &rect, int level=0, CallbackPtr cb=nullptr, void *data=nullptr) |
| void | ReadPreview () |
| void | Reconstruct (int level=0) |
| void | GetBitmap (int pitch, uint8_t *buff, uint8_t bpp, int channelMap[]=nullptr, CallbackPtr cb=nullptr, void *data=nullptr) const |
| void | GetYUV (int pitch, DataT *buff, uint8_t bpp, int channelMap[]=nullptr, CallbackPtr cb=nullptr, void *data=nullptr) const |
| void | ImportBitmap (int pitch, uint8_t *buff, uint8_t bpp, int channelMap[]=nullptr, CallbackPtr cb=nullptr, void *data=nullptr) |
| void | ImportYUV (int pitch, DataT *buff, uint8_t bpp, int channelMap[]=nullptr, CallbackPtr cb=nullptr, void *data=nullptr) |
| void | Write (CPGFStream *stream, uint32_t *nWrittenBytes=nullptr, CallbackPtr cb=nullptr, void *data=nullptr) |
| uint32_t | WriteHeader (CPGFStream *stream) |
| uint32_t | WriteImage (CPGFStream *stream, CallbackPtr cb=nullptr, void *data=nullptr) |
| uint32_t | Write (int level, CallbackPtr cb=nullptr, void *data=nullptr) |
| void | ConfigureEncoder (bool useOMP=true, bool favorSpeedOverSize=false) |
| void | ConfigureDecoder (bool useOMP=true, UP::Policy policy=UP::CacheAll, uint32_t prefixSize=0) |
| void | ResetStreamPos (bool startOfData) |
| void | SetChannel (DataT *channel, int c=0) |
| void | SetHeader (const PGFHeader &header, uint8_t flags=0, const uint8_t *userData=0, uint32_t userDataLength=0) |
| void | SetMaxValue (uint32_t maxValue) |
| void | SetProgressMode (ProgressMode pm) |
| void | SetRefreshCallback (RefreshCB callback, void *arg) |
| void | SetColorTable (uint32_t iFirstColor, uint32_t nColors, const RGBQUAD *prgbColors) |
| DataT * | GetChannel (int c=0) |
| void | GetColorTable (uint32_t iFirstColor, uint32_t nColors, RGBQUAD *prgbColors) const |
| const RGBQUAD * | GetColorTable () const |
| const PGFHeader * | GetHeader () const |
| uint32_t | GetMaxValue () const |
| uint64_t | GetUserDataPos () const |
| const uint8_t * | GetUserData (uint32_t &cachedSize, uint32_t *pTotalSize=nullptr) const |
| uint32_t | GetEncodedHeaderLength () const |
| uint32_t | GetEncodedLevelLength (int level) const |
| uint32_t | ReadEncodedHeader (uint8_t *target, uint32_t targetLen) const |
| uint32_t | ReadEncodedData (int level, uint8_t *target, uint32_t targetLen) const |
| uint32_t | ChannelWidth (int c=0) const |
| uint32_t | ChannelHeight (int c=0) const |
| uint8_t | ChannelDepth () const |
| uint32_t | Width (int level=0) const |
| uint32_t | Height (int level=0) const |
| uint8_t | Level () const |
| uint8_t | Levels () const |
| bool | IsFullyRead () const |
| Return true if all levels have been read. | |
| uint8_t | Quality () const |
| uint8_t | Channels () const |
| uint8_t | Mode () const |
| uint8_t | BPP () const |
| bool | ROIisSupported () const |
| PGFRect | ComputeLevelROI () const |
| uint8_t | UsedBitsPerChannel () const |
| uint8_t | Version () const |
Static Public Member Functions | |
| static bool | ImportIsSupported (uint8_t mode) |
| static uint32_t | LevelSizeL (uint32_t size, int level) |
| static uint32_t | LevelSizeH (uint32_t size, int level) |
| static uint8_t | CodecMajorVersion (uint8_t version=PGFVersion) |
| Return major version. | |
| static uint8_t | MaxChannelDepth (uint8_t version=PGFVersion) |
Protected Attributes | |
| CWaveletTransform * | m_wtChannel [MaxChannels] |
| wavelet transformed color channels | |
| DataT * | m_channel [MaxChannels] |
| untransformed channels in YUV format | |
| CDecoder * | m_decoder |
| PGF decoder. | |
| CEncoder * | m_encoder |
| PGF encoder. | |
| uint32_t * | m_levelLength |
| length of each level in bytes; first level starts immediately after this array | |
| uint32_t | m_width [MaxChannels] |
| width of each channel at current level | |
| uint32_t | m_height [MaxChannels] |
| height of each channel at current level | |
| PGFPreHeader | m_preHeader |
| PGF pre-header. | |
| PGFHeader | m_header |
| PGF file header. | |
| PGFPostHeader | m_postHeader |
| PGF post-header. | |
| uint64_t | m_userDataPos |
| stream position of user data | |
| int | m_currentLevel |
| transform level of current image | |
| uint32_t | m_userDataPolicy |
| user data (metadata) policy during open | |
| uint8_t | m_quant |
| quantization parameter | |
| bool | m_downsample |
| chrominance channels are downsampled | |
| bool | m_favorSpeedOverSize |
| favor encoding speed over compression ratio | |
| bool | m_useOMPinEncoder |
| use Open MP in encoder | |
| bool | m_useOMPinDecoder |
| use Open MP in decoder | |
| bool | m_streamReinitialized |
| stream has been reinitialized | |
| PGFRect | m_roi |
| region of interest | |
Private Member Functions | |
| void | Init () |
| void | ComputeLevels () |
| bool | CompleteHeader () |
| void | RgbToYuv (int pitch, uint8_t *rgbBuff, uint8_t bpp, int channelMap[], CallbackPtr cb, void *data) |
| void | Downsample (int nChannel) |
| uint32_t | UpdatePostHeaderSize () |
| void | WriteLevel () |
| PGFRect | GetAlignedROI (int c=0) const |
| void | SetROI (PGFRect rect) |
| uint8_t | Clamp4 (DataT v) const |
| uint16_t | Clamp6 (DataT v) const |
| uint8_t | Clamp8 (DataT v) const |
| uint16_t | Clamp16 (DataT v) const |
| uint32_t | Clamp31 (DataT v) const |
Private Attributes | |
| RefreshCB | m_cb |
| pointer to refresh callback procedure | |
| void * | m_cbArg |
| refresh callback argument | |
| double | m_percent |
| progress [0..1] | |
| ProgressMode | m_progressMode |
| progress mode used in Read and Write; Relative is default mode | |
PGF main class.
PGF image class is the main class. You always need a PGF object for encoding or decoding image data. Decoding: Open() Read() GetBitmap() Encoding: SetHeader() ImportBitmap() Write()
Definition at line 53 of file PGFimage.h.
| pgf::CPGFImage::CPGFImage | ( | ) |
Standard constructor.
Definition at line 65 of file PGFimage.cpp.
|
virtual |
Destructor.
Definition at line 121 of file PGFimage.cpp.
|
inline |
Return the number of bits per pixel. Valid values can be 1, 8, 12, 16, 24, 32, 48, 64.
Definition at line 465 of file PGFimage.h.
|
inline |
Return bits per channel of the image's encoder.
Definition at line 410 of file PGFimage.h.
|
inline |
Return current image height of given channel in pixels. The returned height depends on the levels read so far and on ROI.
| c | A channel index |
Definition at line 405 of file PGFimage.h.
|
inline |
Return the number of image channels. An image of type RGB contains 3 image channels (B, G, R).
Definition at line 452 of file PGFimage.h.
|
inline |
Return current image width of given channel in pixels. The returned width depends on the levels read so far and on ROI.
| c | A channel index |
Definition at line 398 of file PGFimage.h.
|
inlineprivate |
Definition at line 577 of file PGFimage.h.
|
inlineprivate |
Definition at line 580 of file PGFimage.h.
|
inlineprivate |
Definition at line 567 of file PGFimage.h.
|
inlineprivate |
Definition at line 570 of file PGFimage.h.
|
inlineprivate |
Definition at line 573 of file PGFimage.h.
|
static |
Return major version.
Return codec major version.
| version | pgf pre-header version number |
Definition at line 772 of file PGFimage.cpp.
|
private |
Definition at line 222 of file PGFimage.cpp.
| PGFRect pgf::CPGFImage::ComputeLevelROI | ( | ) | const |
Return ROI of channel 0 at current level in pixels. The returned rect is only valid after reading a ROI.
Definition at line 587 of file PGFimage.cpp.
|
private |
Definition at line 858 of file PGFimage.cpp.
|
inline |
Configures the decoder.
| useOMP | Use parallel threading with Open MP during decoding. Default value: true. Influences the decoding only if the codec has been compiled with OpenMP support. |
| policy | The file might contain user data (e.g. metadata). The policy defines the behaviour during Open(). UP::CacheAll: User data is read and stored completely in a new allocated memory block. It can be accessed by GetUserData(). UP::CachePrefix: Only prefixSize bytes at the beginning of the user data are stored in a new allocated memory block. It can be accessed by GetUserData(). UP::Skip: User data is skipped and nothing is cached. |
| prefixSize | Is only used in combination with UP::CachePrefix. It defines the number of bytes cached. |
Definition at line 260 of file PGFimage.h.
|
inline |
Configures the encoder.
| useOMP | Use parallel threading with Open MP during encoding. Default value: true. Influences the encoding only if the codec has been compiled with OpenMP support. |
| favorSpeedOverSize | Favors encoding speed over compression ratio. Default value: false |
Definition at line 250 of file PGFimage.h.
| void pgf::CPGFImage::Destroy | ( | ) |
Definition at line 128 of file PGFimage.cpp.
|
private |
Definition at line 814 of file PGFimage.cpp.
|
private |
Returns aligned ROI in pixels of current level of channel c
| c | A channel index |
Definition at line 602 of file PGFimage.cpp.
| void pgf::CPGFImage::GetBitmap | ( | int | pitch, |
| uint8_t * | buff, | ||
| uint8_t | bpp, | ||
| int | channelMap[] = nullptr, | ||
| CallbackPtr | cb = nullptr, | ||
| void * | data = nullptr ) const |
Get image data in interleaved format: (ordering of RGB data is BGR[A]) Upsampling, YUV to RGB transform and interleaving are done here to reduce the number of passes over the data. The absolute value of pitch is the number of bytes of an image row of the given image buffer. If pitch is negative, then the image buffer must point to the last row of a bottom-up image (first byte on last row). if pitch is positive, then the image buffer must point to the first row of a top-down image (first byte). The sequence of output channels in the output image buffer does not need to be the same as provided by PGF. In case of different sequences you have to provide a channelMap of size of expected channels (depending on image mode). For example, PGF provides a channel sequence BGR in RGB color mode. If your provided image buffer expects a channel sequence ARGB, then the channelMap looks like { 3, 2, 1, 0 }. It might throw an IOException.
| pitch | The number of bytes of a row of the image buffer. |
| buff | An image buffer. |
| bpp | The number of bits per pixel used in image buffer. |
| channelMap | A integer array containing the mapping of PGF channel ordering to expected channel ordering. |
| cb | A pointer to a callback procedure. The procedure is called after each copied buffer row. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Definition at line 1793 of file PGFimage.cpp.
|
inline |
Return an internal YUV image channel.
| c | A channel index |
Definition at line 321 of file PGFimage.h.
|
inline |
Definition at line 334 of file PGFimage.h.
| void pgf::CPGFImage::GetColorTable | ( | uint32_t | iFirstColor, |
| uint32_t | nColors, | ||
| RGBQUAD * | prgbColors ) const |
Retrieves red, green, blue (RGB) color values from a range of entries in the palette of the DIB section. It might throw an IOException.
| iFirstColor | The color table index of the first entry to retrieve. |
| nColors | The number of color table entries to retrieve. |
| prgbColors | A pointer to the array of RGBQUAD structures to retrieve the color table entries. |
Definition at line 1354 of file PGFimage.cpp.
| uint32_t pgf::CPGFImage::GetEncodedHeaderLength | ( | ) | const |
Return the length of all encoded headers in bytes. Precondition: The PGF image has been opened with a call of Open(...).
Definition at line 652 of file PGFimage.cpp.
|
inline |
Return the length of an encoded PGF level in bytes. Precondition: The PGF image has been opened with a call of Open(...).
| level | The image level |
Definition at line 371 of file PGFimage.h.
|
inline |
Return the PGF header structure.
Definition at line 339 of file PGFimage.h.
|
inline |
Get maximum intensity value for image modes with more than eight bits per channel. Don't call this method before the PGF header has been read.
Definition at line 345 of file PGFimage.h.
| const uint8_t * pgf::CPGFImage::GetUserData | ( | uint32_t & | cachedSize, |
| uint32_t * | pTotalSize = nullptr ) const |
Return user data and size of user data. Precondition: The PGF image has been opened with a call of Open(...).
| cachedSize | [out] Size of returned user data in bytes. |
| pTotalSize | [optional out] Pointer to return the size of user data stored in image header in bytes. |
Return user data and size of user data. Precondition: The PGF image has been opened with a call of Open(...). In an encoder scenario don't call this method before WriteHeader().
| cachedSize | [out] Size of returned user data in bytes. |
| pTotalSize | [optional out] Pointer to return the size of user data stored in image header in bytes. |
Definition at line 341 of file PGFimage.cpp.
|
inline |
Return the stream position of the user data or 0. Precondition: The PGF image has been opened with a call of Open(...).
Definition at line 350 of file PGFimage.h.
| void pgf::CPGFImage::GetYUV | ( | int | pitch, |
| DataT * | buff, | ||
| uint8_t | bpp, | ||
| int | channelMap[] = nullptr, | ||
| CallbackPtr | cb = nullptr, | ||
| void * | data = nullptr ) const |
Get YUV image data in interleaved format: (ordering is YUV[A]) The absolute value of pitch is the number of bytes of an image row of the given image buffer. If pitch is negative, then the image buffer must point to the last row of a bottom-up image (first byte on last row). if pitch is positive, then the image buffer must point to the first row of a top-down image (first byte). The sequence of output channels in the output image buffer does not need to be the same as provided by PGF. In case of different sequences you have to provide a channelMap of size of expected channels (depending on image mode). For example, PGF provides a channel sequence BGR in RGB color mode. If your provided image buffer expects a channel sequence VUY, then the channelMap looks like { 2, 1, 0 }. It might throw an IOException.
| pitch | The number of bytes of a row of the image buffer. |
| buff | An image buffer. |
| bpp | The number of bits per pixel used in image buffer. |
| channelMap | A integer array containing the mapping of PGF channel ordering to expected channel ordering. |
| cb | A pointer to a callback procedure. The procedure is called after each copied buffer row. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Get YUV image data in interleaved format: (ordering is YUV[A]) The absolute value of pitch is the number of bytes of an image row of the given image buffer. If pitch is negative, then the image buffer must point to the last row of a bottom-up image (first byte on last row). if pitch is positive, then the image buffer must point to the first row of a top-down image (first byte). The sequence of output channels in the output image buffer does not need to be the same as provided by PGF. In case of different sequences you have to provide a channelMap of size of expected channels (depending on image mode). For example, PGF provides a channel sequence BGR in RGB color mode. If your provided image buffer expects a channel sequence VUY, then the channelMap looks like { 2, 1, 0 }. It might throw an IOException.
| pitch | The number of bytes of a row of the image buffer. |
| buff | An image buffer. |
| bpp | The number of bits per pixel used in image buffer. |
| channelMap | A integer array containing the mapping of PGF channel ordering to expected channel ordering. |
| cb | A pointer to a callback procedure. The procedure is called after each copied buffer row. If cb returns true, then it stops proceeding. |
Definition at line 2554 of file PGFimage.cpp.
|
inline |
Return image height of channel 0 at given level in pixels. The returned height is independent of any Read-operations and ROI.
| level | A level |
Definition at line 424 of file PGFimage.h.
| void pgf::CPGFImage::ImportBitmap | ( | int | pitch, |
| uint8_t * | buff, | ||
| uint8_t | bpp, | ||
| int | channelMap[] = nullptr, | ||
| CallbackPtr | cb = nullptr, | ||
| void * | data = nullptr ) |
Import an image from a specified image buffer. This method is usually called before Write(...) and after SetHeader(...). The absolute value of pitch is the number of bytes of an image row. If pitch is negative, then buff points to the last row of a bottom-up image (first byte on last row). If pitch is positive, then buff points to the first row of a top-down image (first byte). The sequence of input channels in the input image buffer does not need to be the same as expected from PGF. In case of different sequences you have to provide a channelMap of size of expected channels (depending on image mode). For example, PGF expects in RGB color mode a channel sequence BGR. If your provided image buffer contains a channel sequence ARGB, then the channelMap looks like { 3, 2, 1, 0 }. It might throw an IOException.
| pitch | The number of bytes of a row of the image buffer. |
| buff | An image buffer. |
| bpp | The number of bits per pixel used in image buffer. |
| channelMap | A integer array containing the mapping of input channel ordering to expected channel ordering. |
| cb | A pointer to a callback procedure. The procedure is called after each imported buffer row. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Definition at line 796 of file PGFimage.cpp.
|
static |
Check for valid import image mode.
| mode | Image mode |
Definition at line 1309 of file PGFimage.cpp.
| void pgf::CPGFImage::ImportYUV | ( | int | pitch, |
| DataT * | buff, | ||
| uint8_t | bpp, | ||
| int | channelMap[] = nullptr, | ||
| CallbackPtr | cb = nullptr, | ||
| void * | data = nullptr ) |
Import a YUV image from a specified image buffer. The absolute value of pitch is the number of bytes of an image row. If pitch is negative, then buff points to the last row of a bottom-up image (first byte on last row). If pitch is positive, then buff points to the first row of a top-down image (first byte). The sequence of input channels in the input image buffer does not need to be the same as expected from PGF. In case of different sequences you have to provide a channelMap of size of expected channels (depending on image mode). For example, PGF expects in RGB color mode a channel sequence BGR. If your provided image buffer contains a channel sequence VUY, then the channelMap looks like { 2, 1, 0 }. It might throw an IOException.
| pitch | The number of bytes of a row of the image buffer. |
| buff | An image buffer. |
| bpp | The number of bits per pixel used in image buffer. |
| channelMap | A integer array containing the mapping of input channel ordering to expected channel ordering. |
| cb | A pointer to a callback procedure. The procedure is called after each imported buffer row. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Import a YUV image from a specified image buffer. The absolute value of pitch is the number of bytes of an image row. If pitch is negative, then buff points to the last row of a bottom-up image (first byte on last row). If pitch is positive, then buff points to the first row of a top-down image (first byte). The sequence of input channels in the input image buffer does not need to be the same as expected from PGF. In case of different sequences you have to provide a channelMap of size of expected channels (depending on image mode). For example, PGF expects in RGB color mode a channel sequence BGR. If your provided image buffer contains a channel sequence VUY, then the channelMap looks like { 2, 1, 0 }. It might throw an IOException.
| pitch | The number of bytes of a row of the image buffer. |
| buff | An image buffer. |
| bpp | The number of bits per pixel used in image buffer. |
| channelMap | A integer array containing the mapping of input channel ordering to expected channel ordering. |
| cb | A pointer to a callback procedure. The procedure is called after each imported buffer row. If cb returns true, then it stops proceeding. |
Definition at line 2665 of file PGFimage.cpp.
|
private |
Definition at line 70 of file PGFimage.cpp.
|
inline |
|
inline |
|
inline |
Return current image level. Since Read(...) can be used to read each image level separately, it is helpful to know the current level. The current level immediately after Open(...) is Levels().
Definition at line 431 of file PGFimage.h.
|
inline |
Return the number of image levels.
Definition at line 436 of file PGFimage.h.
|
inlinestatic |
Compute and return image width/height of HH subband at given level.
| size | Original image size (e.g. width or height at level 0) |
| level | An image level |
Definition at line 510 of file PGFimage.h.
|
inlinestatic |
Compute and return image width/height of LL subband at given level.
| size | Original image size (e.g. width or height at level 0) |
| level | An image level |
Definition at line 503 of file PGFimage.h.
|
inlinestatic |
Return maximum channel depth.
| version | pgf pre-header version number |
Definition at line 522 of file PGFimage.h.
|
inline |
Return the image mode. An image mode is a predefined constant value (see also PGFtypes.h) compatible with Adobe Photoshop. It represents an image type and format.
Definition at line 459 of file PGFimage.h.
| void pgf::CPGFImage::Open | ( | CPGFStream * | stream | ) |
Open a PGF image at current stream position: read pre-header, header, and ckeck image type. Precondition: The stream has been opened for reading. It might throw an IOException.
| stream | A PGF stream |
Definition at line 145 of file PGFimage.cpp.
|
inline |
Return the PGF quality. The quality is inbetween 0 and MaxQuality. PGF quality 0 means lossless quality.
Definition at line 446 of file PGFimage.h.
| void pgf::CPGFImage::Read | ( | int | level = 0, |
| CallbackPtr | cb = nullptr, | ||
| void * | data = nullptr ) |
Read and decode some levels of a PGF image at current stream position. A PGF image is structered in levels, numbered between 0 and Levels() - 1. Each level can be seen as a single image, containing the same content as all other levels, but in a different size (width, height). The image size at level i is double the size (width, height) of the image at level i+1. The image at level 0 contains the original size. Precondition: The PGF image has been opened with a call of Open(...). It might throw an IOException.
| level | [0, nLevels) The image level of the resulting image in the internal image buffer. |
| cb | A pointer to a callback procedure. The procedure is called after reading a single level. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Definition at line 406 of file PGFimage.cpp.
| void pgf::CPGFImage::Read | ( | PGFRect & | rect, |
| int | level = 0, | ||
| CallbackPtr | cb = nullptr, | ||
| void * | data = nullptr ) |
Read a rectangular region of interest of a PGF image at current stream position. The origin of the coordinate axis is the top-left corner of the image. All coordinates are measured in pixels. It might throw an IOException.
| rect | [inout] Rectangular region of interest (ROI) at level 0. The rect might be cropped. |
| level | [0, nLevels) The image level of the resulting image in the internal image buffer. |
| cb | A pointer to a callback procedure. The procedure is called after reading a single level. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Read and decode rectangular region of interest (ROI) of a PGF image at current stream position. The origin of the coordinate axis is the top-left corner of the image. All coordinates are measured in pixels. It might throw an IOException.
| rect | [inout] Rectangular region of interest (ROI) at level 0. The rect might be cropped. |
| level | The image level of the resulting image in the internal image buffer. |
| cb | A pointer to a callback procedure. The procedure is called after reading a single level. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Definition at line 493 of file PGFimage.cpp.
| uint32_t pgf::CPGFImage::ReadEncodedData | ( | int | level, |
| uint8_t * | target, | ||
| uint32_t | targetLen ) const |
Reads the data of an encoded PGF level and copies it to a target buffer without decoding. Precondition: The PGF image has been opened with a call of Open(...). It might throw an IOException.
| level | The image level |
| target | The target buffer |
| targetLen | The length of the target buffer in bytes |
Definition at line 711 of file PGFimage.cpp.
| uint32_t pgf::CPGFImage::ReadEncodedHeader | ( | uint8_t * | target, |
| uint32_t | targetLen ) const |
Reads the encoded PGF header and copies it to a target buffer. Precondition: The PGF image has been opened with a call of Open(...). It might throw an IOException.
| target | The target buffer |
| targetLen | The length of the target buffer in bytes |
Definition at line 664 of file PGFimage.cpp.
|
inline |
Read and decode smallest level of a PGF image at current stream position. For details, please refert to Read(...) Precondition: The PGF image has been opened with a call of Open(...). It might throw an IOException.
Definition at line 111 of file PGFimage.h.
| void pgf::CPGFImage::Reconstruct | ( | int | level = 0 | ) |
After you've written a PGF image, you can call this method followed by GetBitmap/GetYUV to get a quick reconstruction (coded -> decoded image). It might throw an IOException.
| level | The image level of the resulting image in the internal image buffer. |
Definition at line 352 of file PGFimage.cpp.
| void pgf::CPGFImage::ResetStreamPos | ( | bool | startOfData | ) |
Reset stream position to start of PGF pre-header or start of data. Must not be called before Open() or before Write(). Use this method after Read() if you want to read the same image several times, e.g. reading different ROIs.
| startOfData | true: you want to read the same image several times. false: resets stream position to the initial position |
Definition at line 686 of file PGFimage.cpp.
|
private |
Definition at line 1393 of file PGFimage.cpp.
|
inline |
Return true if the pgf image supports Region Of Interest (ROI).
Definition at line 470 of file PGFimage.h.
|
inline |
Set internal PGF image buffer channel.
| channel | A YUV data channel |
| c | A channel index |
Definition at line 276 of file PGFimage.h.
| void pgf::CPGFImage::SetColorTable | ( | uint32_t | iFirstColor, |
| uint32_t | nColors, | ||
| const RGBQUAD * | prgbColors ) |
Sets the red, green, blue (RGB) color values for a range of entries in the palette (clut). It might throw an IOException.
| iFirstColor | The color table index of the first entry to set. |
| nColors | The number of color table entries to set. |
| prgbColors | A pointer to the array of RGBQUAD structures to set the color table entries. |
Definition at line 1368 of file PGFimage.cpp.
| void pgf::CPGFImage::SetHeader | ( | const PGFHeader & | header, |
| uint8_t | flags = 0, | ||
| const uint8_t * | userData = 0, | ||
| uint32_t | userDataLength = 0 ) |
Set PGF header and user data. Precondition: The PGF image has been never opened with Open(...). It might throw an IOException.
| header | A valid and already filled in PGF header structure |
| flags | A combination of additional version flags. In case you use level-wise encoding then set flag = PGFROI. |
| userData | A user-defined memory block containing any kind of cached metadata. |
| userDataLength | The size of user-defined memory block in bytes |
Definition at line 898 of file PGFimage.cpp.
| void pgf::CPGFImage::SetMaxValue | ( | uint32_t | maxValue | ) |
Set maximum intensity value for image modes with more than eight bits per channel. Call this method after SetHeader, but before ImportBitmap.
| maxValue | The maximum intensity value. |
Definition at line 742 of file PGFimage.cpp.
|
inline |
Set progress mode used in Read and Write. Default mode is Relative. This method must be called before Open() or SetHeader(). Relative: 100% = level difference between current level and target level of Read/Write Absolute: 100% = number of levels
Definition at line 300 of file PGFimage.h.
|
inline |
Set refresh callback procedure and its parameter. The refresh callback is called during Read(...) after each level read.
| callback | A refresh callback procedure |
| arg | A parameter of the refresh callback procedure |
Definition at line 307 of file PGFimage.h.
|
private |
Compute ROIs for each channel and each level <= current level Called inside of Read(rect, ...).
| rect | rectangular region of interest (ROI) at level 0 |
Definition at line 619 of file PGFimage.cpp.
|
private |
Definition at line 1128 of file PGFimage.cpp.
| uint8_t pgf::CPGFImage::UsedBitsPerChannel | ( | ) | const |
Returns number of used bits per input/output image channel. Precondition: header must be initialized.
Definition at line 760 of file PGFimage.cpp.
|
inline |
Returns the used codec major version of a pgf image
Definition at line 488 of file PGFimage.h.
|
inline |
Return image width of channel 0 at given level in pixels. The returned width is independent of any Read-operations and ROI.
| level | A level |
Definition at line 417 of file PGFimage.h.
| void pgf::CPGFImage::Write | ( | CPGFStream * | stream, |
| uint32_t * | nWrittenBytes = nullptr, | ||
| CallbackPtr | cb = nullptr, | ||
| void * | data = nullptr ) |
Encode and write an entire PGF image (header and image) at current stream position. A PGF image is structered in levels, numbered between 0 and Levels() - 1. Each level can be seen as a single image, containing the same content as all other levels, but in a different size (width, height). The image size at level i is double the size (width, height) of the image at level i+1. The image at level 0 contains the original size. Precondition: the PGF image contains a valid header (see also SetHeader(...)). It might throw an IOException.
| stream | A PGF stream |
| nWrittenBytes | [in-out] The number of bytes written into stream are added to the input value. |
| cb | A pointer to a callback procedure. The procedure is called after writing a single level. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Definition at line 1225 of file PGFimage.cpp.
| uint32_t pgf::CPGFImage::Write | ( | int | level, |
| CallbackPtr | cb = nullptr, | ||
| void * | data = nullptr ) |
Encode and write down to given level at current stream position. A PGF image is structered in levels, numbered between 0 and Levels() - 1. Each level can be seen as a single image, containing the same content as all other levels, but in a different size (width, height). The image size at level i is double the size (width, height) of the image at level i+1. The image at level 0 contains the original size. Preconditions: the PGF image contains a valid header (see also SetHeader(...)) and WriteHeader() has been called before. Levels() > 0. The ROI encoding scheme must be used (see also SetHeader(...)). It might throw an IOException.
| level | [0, nLevels) The image level of the resulting image in the internal image buffer. |
| cb | A pointer to a callback procedure. The procedure is called after writing a single level. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Definition at line 1254 of file PGFimage.cpp.
| uint32_t pgf::CPGFImage::WriteHeader | ( | CPGFStream * | stream | ) |
Create wavelet transform channels and encoder. Write header at current stream position. Call this method before your first call of Write(int level) or WriteImage(), but after SetHeader(). This method is called inside of Write(stream, ...). It might throw an IOException.
| stream | A PGF stream |
Create wavelet transform channels and encoder. Write header at current stream position. Performs forward FWT. Call this method before your first call of Write(int level) or WriteImage(), but after SetHeader(). This method is called inside of Write(stream, ...). It might throw an IOException.
| stream | A PGF stream |
Definition at line 983 of file PGFimage.cpp.
| uint32_t pgf::CPGFImage::WriteImage | ( | CPGFStream * | stream, |
| CallbackPtr | cb = nullptr, | ||
| void * | data = nullptr ) |
Encode and write an image at current stream position. Call this method after WriteHeader(). In case you want to write uncached metadata, then do that after WriteHeader() and before WriteImage(). This method is called inside of Write(stream, ...). It might throw an IOException.
| stream | A PGF stream |
| cb | A pointer to a callback procedure. The procedure is called after writing a single level. If cb returns true, then it stops proceeding. |
| data | Data Pointer to C++ class container to host callback procedure. |
Definition at line 1154 of file PGFimage.cpp.
|
private |
Definition at line 1072 of file PGFimage.cpp.
|
private |
pointer to refresh callback procedure
Definition at line 549 of file PGFimage.h.
|
private |
refresh callback argument
Definition at line 550 of file PGFimage.h.
|
protected |
untransformed channels in YUV format
Definition at line 526 of file PGFimage.h.
|
protected |
transform level of current image
Definition at line 536 of file PGFimage.h.
|
protected |
PGF decoder.
Definition at line 527 of file PGFimage.h.
|
protected |
chrominance channels are downsampled
Definition at line 539 of file PGFimage.h.
|
protected |
PGF encoder.
Definition at line 528 of file PGFimage.h.
|
protected |
favor encoding speed over compression ratio
Definition at line 540 of file PGFimage.h.
|
protected |
PGF file header.
Definition at line 533 of file PGFimage.h.
|
protected |
height of each channel at current level
Definition at line 531 of file PGFimage.h.
|
protected |
length of each level in bytes; first level starts immediately after this array
Definition at line 529 of file PGFimage.h.
|
private |
progress [0..1]
Definition at line 551 of file PGFimage.h.
|
protected |
PGF post-header.
Definition at line 534 of file PGFimage.h.
|
protected |
PGF pre-header.
Definition at line 532 of file PGFimage.h.
|
private |
progress mode used in Read and Write; Relative is default mode
Definition at line 552 of file PGFimage.h.
|
protected |
quantization parameter
Definition at line 538 of file PGFimage.h.
|
protected |
region of interest
Definition at line 545 of file PGFimage.h.
|
protected |
stream has been reinitialized
Definition at line 544 of file PGFimage.h.
|
protected |
use Open MP in decoder
Definition at line 542 of file PGFimage.h.
|
protected |
use Open MP in encoder
Definition at line 541 of file PGFimage.h.
|
protected |
user data (metadata) policy during open
Definition at line 537 of file PGFimage.h.
|
protected |
stream position of user data
Definition at line 535 of file PGFimage.h.
|
protected |
width of each channel at current level
Definition at line 530 of file PGFimage.h.
|
protected |
wavelet transformed color channels
Definition at line 525 of file PGFimage.h.