| PGFimage.h | | PGFimage.h | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| ////////////////////////////////////////////////////////////////////// | | ////////////////////////////////////////////////////////////////////// | |
| /// @file PGFimage.h | | /// @file PGFimage.h | |
| /// @brief PGF image class | | /// @brief PGF image class | |
| /// @author C. Stamm | | /// @author C. Stamm | |
| | | | |
| #ifndef PGF_PGFIMAGE_H | | #ifndef PGF_PGFIMAGE_H | |
| #define PGF_PGFIMAGE_H | | #define PGF_PGFIMAGE_H | |
| | | | |
| #include "PGFstream.h" | | #include "PGFstream.h" | |
| | | | |
|
| | | ////////////////////////////////////////////////////////////////////// | |
| | | // types | |
| | | enum ProgressMode { PM_Relative, PM_Absolute }; | |
| | | | |
| | | ////////////////////////////////////////////////////////////////////// | |
| | | // prototypes | |
| class CDecoder; | | class CDecoder; | |
| class CEncoder; | | class CEncoder; | |
| class CWaveletTransform; | | class CWaveletTransform; | |
| | | | |
| ////////////////////////////////////////////////////////////////////// | | ////////////////////////////////////////////////////////////////////// | |
| /// PGF image class is the main class. You always need a PGF object | | /// PGF image class is the main class. You always need a PGF object | |
| /// for encoding or decoding image data. | | /// for encoding or decoding image data. | |
| /// Decoding: | | /// Decoding: | |
| /// pgf.Open(...) | | /// pgf.Open(...) | |
| /// pgf.Read(...) | | /// pgf.Read(...) | |
| | | | |
| skipping to change at line 196 | | skipping to change at line 202 | |
| /// It might throw an IOException. | | /// It might throw an IOException. | |
| /// @param pitch The number of bytes of a row of the image buffer. | | /// @param pitch The number of bytes of a row of the image buffer. | |
| /// @param buff An image buffer. | | /// @param buff An image buffer. | |
| /// @param bpp The number of bits per pixel used in image buffer. | | /// @param bpp The number of bits per pixel used in image buffer. | |
| /// @param channelMap A integer array containing the mapping of inpu
t channel ordering to expected channel ordering. | | /// @param channelMap A integer array containing the mapping of inpu
t channel ordering to expected channel ordering. | |
| /// @param cb A pointer to a callback procedure. The procedure is ca
lled after each imported buffer row. If cb returns true, then it stops proc
eeding. | | /// @param cb A pointer to a callback procedure. The procedure is ca
lled after each imported buffer row. If cb returns true, then it stops proc
eeding. | |
| /// @param data Data Pointer to C++ class container to host callback
procedure. | | /// @param data Data Pointer to C++ class container to host callback
procedure. | |
| void ImportYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[] =
NULL, CallbackPtr cb = NULL, void *data = NULL) THROW_; | | void ImportYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[] =
NULL, CallbackPtr cb = NULL, void *data = NULL) THROW_; | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
|
| /// Encode and write a PGF image at current stream position. | | /// Encode and write a entire PGF image (header and image) at curren
t stream position. | |
| /// A PGF image is structered in levels, numbered between 0 and Leve
ls() - 1. | | /// A PGF image is structered in levels, numbered between 0 and Leve
ls() - 1. | |
| /// Each level can be seen as a single image, containing the same co
ntent | | /// Each level can be seen as a single image, containing the same co
ntent | |
| /// as all other levels, but in a different size (width, height). | | /// 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 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. | | /// The image at level 0 contains the original size. | |
| /// Precondition: the PGF image contains a valid header (see also Se
tHeader(...)). | | /// Precondition: the PGF image contains a valid header (see also Se
tHeader(...)). | |
|
| /// Please note: the earlier parameter nLevels has now to be set wit | | | |
| h SetHeader. Either specify the number of levels | | | |
| /// or use the value 0 for automatic setting. | | | |
| /// It might throw an IOException. | | /// It might throw an IOException. | |
| /// @param stream A PGF stream | | /// @param stream A PGF stream | |
| /// @param nWrittenBytes [in-out] The number of bytes written into s
tream are added to the input value. | | /// @param nWrittenBytes [in-out] The number of bytes written into s
tream are added to the input value. | |
| /// @param cb A pointer to a callback procedure. The procedure is ca
lled after writing a single level. If cb returns true, then it stops procee
ding. | | /// @param cb A pointer to a callback procedure. The procedure is ca
lled after writing a single level. If cb returns true, then it stops procee
ding. | |
| /// @param data Data Pointer to C++ class container to host callback
procedure. | | /// @param data Data Pointer to C++ class container to host callback
procedure. | |
| void Write(CPGFStream* stream, UINT32* nWrittenBytes = NULL, Callbac
kPtr cb = NULL, void *data = NULL) THROW_; | | void Write(CPGFStream* stream, UINT32* nWrittenBytes = NULL, Callbac
kPtr cb = NULL, void *data = NULL) THROW_; | |
| | | | |
| ////////////////////////////////////////////////////////////////// | | ////////////////////////////////////////////////////////////////// | |
|
| /// Create wavelet transform channels and encoder. | | /// Create wavelet transform channels and encoder. Write header at c | |
| /// Call this method before your first call of Write(int level), but | | urrent stream position. | |
| after SetHeader(). | | /// Call this method before your first call of Write(int level) or W | |
| /// Don't use this method when you call Write(). | | riteImage(), but after SetHeader(). | |
| | | /// This method is called inside of Write(stream, ...). | |
| /// It might throw an IOException. | | /// It might throw an IOException. | |
| /// @param stream A PGF stream | | /// @param stream A PGF stream | |
| /// @return The number of bytes written into stream. | | /// @return The number of bytes written into stream. | |
| UINT32 WriteHeader(CPGFStream* stream) THROW_; | | UINT32 WriteHeader(CPGFStream* stream) THROW_; | |
| | | | |
|
| | | //////////////////////////////////////////////////////////////////// | |
| | | // | |
| | | /// Encode and write the one and only image at current stream positi | |
| | | on. | |
| | | /// 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. | |
| | | /// @param stream A PGF stream | |
| | | /// @param cb A pointer to a callback procedure. The procedure is ca | |
| | | lled after writing a single level. If cb returns true, then it stops procee | |
| | | ding. | |
| | | /// @param data Data Pointer to C++ class container to host callback | |
| | | procedure. | |
| | | /// @return The number of bytes written into stream. | |
| | | UINT32 WriteImage(CPGFStream* stream, CallbackPtr cb = NULL, void *d | |
| | | ata = NULL) THROW_; | |
| | | | |
| #ifdef __PGFROISUPPORT__ | | #ifdef __PGFROISUPPORT__ | |
| ////////////////////////////////////////////////////////////////// | | ////////////////////////////////////////////////////////////////// | |
| /// Encode and write down to given level at current stream position. | | /// Encode and write down to given level at current stream position. | |
| /// A PGF image is structered in levels, numbered between 0 and Leve
ls() - 1. | | /// A PGF image is structered in levels, numbered between 0 and Leve
ls() - 1. | |
| /// Each level can be seen as a single image, containing the same co
ntent | | /// Each level can be seen as a single image, containing the same co
ntent | |
| /// as all other levels, but in a different size (width, height). | | /// 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 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. | | /// The image at level 0 contains the original size. | |
|
| /// Precondition: the PGF image contains a valid header (see also Se | | /// Preconditions: the PGF image contains a valid header (see also S | |
| tHeader(...)) and | | etHeader(...)) and | |
| /// WriteHeader() has been called before Write(). | | /// WriteHeader() has been called before. Levels() > 0. | |
| /// The ROI encoding scheme is used. | | /// The ROI encoding scheme must be used (see also SetHeader(...)). | |
| /// It might throw an IOException. | | /// It might throw an IOException. | |
| /// @param level [0, nLevels) The image level of the resulting image
in the internal image buffer. | | /// @param level [0, nLevels) The image level of the resulting image
in the internal image buffer. | |
| /// @param cb A pointer to a callback procedure. The procedure is ca
lled after writing a single level. If cb returns true, then it stops procee
ding. | | /// @param cb A pointer to a callback procedure. The procedure is ca
lled after writing a single level. If cb returns true, then it stops procee
ding. | |
| /// @param data Data Pointer to C++ class container to host callback
procedure. | | /// @param data Data Pointer to C++ class container to host callback
procedure. | |
| /// @return The number of bytes written into stream. | | /// @return The number of bytes written into stream. | |
| UINT32 Write(int level, CallbackPtr cb = NULL, void *data = NULL) TH
ROW_; | | UINT32 Write(int level, CallbackPtr cb = NULL, void *data = NULL) TH
ROW_; | |
| #endif | | #endif | |
| | | | |
| ////////////////////////////////////////////////////////////////////
/ | | ////////////////////////////////////////////////////////////////////
/ | |
| /// Configures the encoder. | | /// Configures the encoder. | |
| /// @param useOMP Use parallel threading with Open MP during encodin
g. Default value: true. Influences the encoding only if the codec has been
compiled with OpenMP support. | | /// @param useOMP Use parallel threading with Open MP during encodin
g. Default value: true. Influences the encoding only if the codec has been
compiled with OpenMP support. | |
| /// @param favorSpeedOverSize Favors encoding speed over compression
ratio. Default value: false | | /// @param favorSpeedOverSize Favors encoding speed over compression
ratio. Default value: false | |
| void ConfigureEncoder(bool useOMP = true, bool favorSpeedOverSize =
false) { m_useOMPinEncoder = useOMP; m_favorSpeedOverSize = favorSpeedOverS
ize; } | | void ConfigureEncoder(bool useOMP = true, bool favorSpeedOverSize =
false) { m_useOMPinEncoder = useOMP; m_favorSpeedOverSize = favorSpeedOverS
ize; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
/ | | ////////////////////////////////////////////////////////////////////
/ | |
|
| /// Configures the encoder. | | /// Configures the decoder. | |
| /// @param useOMP Use parallel threading with Open MP during decodin
g. Default value: true. Influences the decoding only if the codec has been
compiled with OpenMP support. | | /// @param useOMP Use parallel threading with Open MP during decodin
g. Default value: true. Influences the decoding only if the codec has been
compiled with OpenMP support. | |
|
| void ConfigureDecoder(bool useOMP = true) { m_useOMPinDecoder = useO | | /// @param skipUserData The file might contain user data (metadata). | |
| MP; } | | User data ist usually read during Open and stored in memory. Set this flag | |
| | | to false when storing in memory is not needed. | |
| //////////////////////////////////////////////////////////////////// | | void ConfigureDecoder(bool useOMP = true, bool skipUserData = false) | |
| // | | { m_useOMPinDecoder = useOMP; m_skipUserData = skipUserData; } | |
| /// Set background of an RGB image with transparency channel or rese | | | |
| t to default background. | | | |
| /// @param bg A pointer to a background color or NULL (reset to defa | | | |
| ult background) | | | |
| //void SetBackground(const RGBTRIPLE* bg); | | | |
| | | | |
|
| //////////////////////////////////////////////////////////////////// | | //////////////////////////////////////////////////////////////////// | |
| // | | /// Reset stream position to start of PGF pre-header | |
| /// Set background of an RGB image with transparency channel. | | void ResetStreamPos() THROW_; | |
| /// @param red A red value (0..255) | | | |
| /// @param green A green value (0..255) | | | |
| /// @param blue A blue value (0..255) | | | |
| //void SetBackground(BYTE red, BYTE green, BYTE blue) | | | |
| { /*m_backgroundSet = true;*/ m_header.background.rgbtRed = red | | | |
| ; m_header.background.rgbtGreen = green; m_header.background.rgbtBlue = blu | | | |
| e; } | | | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Set internal PGF image buffer channel. | | /// Set internal PGF image buffer channel. | |
| /// @param channel A YUV data channel | | /// @param channel A YUV data channel | |
| /// @param c A channel index | | /// @param c A channel index | |
| void SetChannel(DataT* channel, int c = 0)
{ ASSERT(c >= 0 && c < MaxChannels); m_channel[c] = cha
nnel; } | | void SetChannel(DataT* channel, int c = 0)
{ ASSERT(c >= 0 && c < MaxChannels); m_channel[c] = cha
nnel; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Set PGF header and user data. | | /// Set PGF header and user data. | |
| /// Precondition: The PGF image has been closed with Close(...) or n
ever opened with Open(...). | | /// Precondition: The PGF image has been closed with Close(...) or n
ever opened with Open(...). | |
| /// It might throw an IOException. | | /// It might throw an IOException. | |
| /// @param header A valid and already filled in PGF header structure | | /// @param header A valid and already filled in PGF header structure | |
|
| /// @param flags A combination of additional version flags | | /// @param flags A combination of additional version flags. In case | |
| /// @param userData A user-defined memory block | | you use level-wise encoding then set flag = PGFROI. | |
| | | /// @param userData A user-defined memory block containing any kind | |
| | | of cached metadata. | |
| /// @param userDataLength The size of user-defined memory block in b
ytes | | /// @param userDataLength The size of user-defined memory block in b
ytes | |
| void SetHeader(const PGFHeader& header, BYTE flags = 0, UINT8* userD
ata = 0, UINT32 userDataLength = 0) THROW_; // throws IOException | | void SetHeader(const PGFHeader& header, BYTE flags = 0, UINT8* userD
ata = 0, UINT32 userDataLength = 0) THROW_; // throws IOException | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Set maximum intensity value for image modes with more than eight
bits per channel. | | /// Set maximum intensity value for image modes with more than eight
bits per channel. | |
| /// Call this method after SetHeader, but before ImportBitmap. | | /// Call this method after SetHeader, but before ImportBitmap. | |
| /// @param maxValue The maximum intensity value. | | /// @param maxValue The maximum intensity value. | |
| void SetMaxValue(UINT32 maxValue); | | void SetMaxValue(UINT32 maxValue); | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
|
| /// Returns number of used bits per input/output image channel. | | /// Set progress mode used in Read and Write. | |
| /// Precondition: header must be initialized. | | /// Default mode is PM_Relative. | |
| /// @return number of used bits per input/output image channel. | | /// This method must be called before Open() or SetHeader(). | |
| BYTE UsedBitsPerChannel() const; | | /// PM_Relative: 100% = level difference between current level and t | |
| | | arget level of Read/Write | |
| | | /// PM_Absolute: 100% = number of levels | |
| | | void SetProgressMode(ProgressMode pm) | |
| | | { m_progressMode = pm; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Set refresh callback procedure and its parameter. | | /// Set refresh callback procedure and its parameter. | |
| /// The refresh callback is called during Read(...) after each level
read. | | /// The refresh callback is called during Read(...) after each level
read. | |
| /// @param callback A refresh callback procedure | | /// @param callback A refresh callback procedure | |
| /// @param arg A parameter of the refresh callback procedure | | /// @param arg A parameter of the refresh callback procedure | |
| void SetRefreshCallback(RefreshCB callback, void* arg)
{ m_cb = callback; m_cbArg = arg; } | | void SetRefreshCallback(RefreshCB callback, void* arg)
{ m_cb = callback; m_cbArg = arg; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Sets the red, green, blue (RGB) color values for a range of entr
ies in the palette (clut). | | /// Sets the red, green, blue (RGB) color values for a range of entr
ies in the palette (clut). | |
| /// It might throw an IOException. | | /// It might throw an IOException. | |
| /// @param iFirstColor The color table index of the first entry to s
et. | | /// @param iFirstColor The color table index of the first entry to s
et. | |
| /// @param nColors The number of color table entries to set. | | /// @param nColors The number of color table entries to set. | |
| /// @param prgbColors A pointer to the array of RGBQUAD structures t
o set the color table entries. | | /// @param prgbColors A pointer to the array of RGBQUAD structures t
o set the color table entries. | |
| void SetColorTable(UINT32 iFirstColor, UINT32 nColors, const RGBQUAD
* prgbColors) THROW_; | | void SetColorTable(UINT32 iFirstColor, UINT32 nColors, const RGBQUAD
* prgbColors) THROW_; | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
|
| /// Return the background color of an RGB image with transparency ch | | | |
| annel. | | | |
| /// @return Background color in RGB | | | |
| //RGBTRIPLE Background() const | | | |
| { return m_header.background; } | | | |
| | | | |
| //////////////////////////////////////////////////////////////////// | | | |
| // | | | |
| /// Return an internal YUV image channel. | | /// Return an internal YUV image channel. | |
| /// @param c A channel index | | /// @param c A channel index | |
| /// @return An internal YUV image channel | | /// @return An internal YUV image channel | |
| DataT* GetChannel(int c = 0)
{ ASSERT(c >= 0 && c < MaxChannels); return m_c
hannel[c]; } | | DataT* GetChannel(int c = 0)
{ ASSERT(c >= 0 && c < MaxChannels); return m_c
hannel[c]; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Retrieves red, green, blue (RGB) color values from a range of en
tries in the palette of the DIB section. | | /// Retrieves red, green, blue (RGB) color values from a range of en
tries in the palette of the DIB section. | |
| /// It might throw an IOException. | | /// It might throw an IOException. | |
| /// @param iFirstColor The color table index of the first entry to r
etrieve. | | /// @param iFirstColor The color table index of the first entry to r
etrieve. | |
| /// @param nColors The number of color table entries to retrieve. | | /// @param nColors The number of color table entries to retrieve. | |
| | | | |
| skipping to change at line 342 | | skipping to change at line 348 | |
| /// @return A PGF header structure | | /// @return A PGF header structure | |
| const PGFHeader* GetHeader() const
{ return &m_header; } | | const PGFHeader* GetHeader() const
{ return &m_header; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Get maximum intensity value for image modes with more than eight
bits per channel. | | /// 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. | | /// Don't call this method before the PGF header has been read. | |
| /// @return The maximum intensity value. | | /// @return The maximum intensity value. | |
| UINT32 GetMaxValue() const
{ return (1 << m_header.usedBitsPerChan
nel) - 1; } | | UINT32 GetMaxValue() const
{ return (1 << m_header.usedBitsPerChan
nel) - 1; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
|
| | | /// Return the stream position of the user data or 0. | |
| | | /// Precondition: The PGF image has been opened with a call of Open( | |
| | | ...). | |
| | | UINT64 GetUserDataPos() const | |
| | | { return m_userDataPos; } | |
| | | | |
| | | //////////////////////////////////////////////////////////////////// | |
| | | // | |
| /// Return user data and size of user data. | | /// Return user data and size of user data. | |
|
| | | /// Precondition: The PGF image has been opened with a call of Open(
...). | |
| /// @param size [out] Size of user data in bytes. | | /// @param size [out] Size of user data in bytes. | |
| /// @return A pointer to user data or NULL if there is no user data. | | /// @return A pointer to user data or NULL if there is no user data. | |
| const UINT8* GetUserData(UINT32& size) const; | | const UINT8* GetUserData(UINT32& size) const; | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Return the length of all encoded headers in bytes. | | /// Return the length of all encoded headers in bytes. | |
| /// Precondition: The PGF image has been opened with a call of Open(
...). | | /// Precondition: The PGF image has been opened with a call of Open(
...). | |
| /// @return The length of all encoded headers in bytes | | /// @return The length of all encoded headers in bytes | |
| UINT32 GetEncodedHeaderLength() const; | | UINT32 GetEncodedHeaderLength() const; | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Return the length of an encoded PGF level in bytes. | | /// Return the length of an encoded PGF level in bytes. | |
| /// Precondition: The PGF image has been opened with a call of Open(
...). | | /// Precondition: The PGF image has been opened with a call of Open(
...). | |
| /// @param level The image level | | /// @param level The image level | |
| /// @return The length of a PGF level in bytes | | /// @return The length of a PGF level in bytes | |
| UINT32 GetEncodedLevelLength(int level) const
{ ASSERT(level >= 0 && level < m_header.nLevels); return m_leve
lLength[m_header.nLevels - level - 1]; } | | UINT32 GetEncodedLevelLength(int level) const
{ ASSERT(level >= 0 && level < m_header.nLevels); return m_leve
lLength[m_header.nLevels - level - 1]; } | |
| | | | |
|
| //////////////////////////////////////////////////////////////////// | | | |
| /// Reset stream position to start of PGF pre-header | | | |
| void ResetStreamPos() THROW_; | | | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Reads the encoded PGF headers and copies it to a target buffer. | | /// Reads the encoded PGF headers and copies it to a target buffer. | |
| /// Precondition: The PGF image has been opened with a call of Open(
...). | | /// Precondition: The PGF image has been opened with a call of Open(
...). | |
| /// It might throw an IOException. | | /// It might throw an IOException. | |
| /// @param target The target buffer | | /// @param target The target buffer | |
| /// @param targetLen The length of the target buffer in bytes | | /// @param targetLen The length of the target buffer in bytes | |
| /// @return The number of bytes copied to the target buffer | | /// @return The number of bytes copied to the target buffer | |
| UINT32 ReadEncodedHeader(UINT8* target, UINT32 targetLen) const THRO
W_; | | UINT32 ReadEncodedHeader(UINT8* target, UINT32 targetLen) const THRO
W_; | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| | | | |
| skipping to change at line 450 | | skipping to change at line 458 | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Return the image mode. | | /// Return the image mode. | |
| /// An image mode is a predefined constant value (see also PGFtypes.
h) compatible with Adobe Photoshop. | | /// An image mode is a predefined constant value (see also PGFtypes.
h) compatible with Adobe Photoshop. | |
| /// It represents an image type and format. | | /// It represents an image type and format. | |
| /// @return Image mode | | /// @return Image mode | |
| BYTE Mode() const
{ return m_header.mode; } | | BYTE Mode() const
{ return m_header.mode; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Return the number of bits per pixel. | | /// Return the number of bits per pixel. | |
|
| /// Valid values can be 1, 8, 12, 16, 24, 31, 32, 48, 64. | | /// Valid values can be 1, 8, 12, 16, 24, 32, 48, 64. | |
| /// @return Number of bits per pixel. | | /// @return Number of bits per pixel. | |
| BYTE BPP() const
{ return m_header.bpp; } | | BYTE BPP() const
{ return m_header.bpp; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Return true if the pgf image supports Region Of Interest (ROI). | | /// Return true if the pgf image supports Region Of Interest (ROI). | |
| /// @return true if the pgf image supports ROI. | | /// @return true if the pgf image supports ROI. | |
| bool ROIisSupported() const
{ return (m_preHeader.version & PGFROI)
== PGFROI; } | | bool ROIisSupported() const
{ return (m_preHeader.version & PGFROI)
== PGFROI; } | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
|
| | | /// Returns number of used bits per input/output image channel. | |
| | | /// Precondition: header must be initialized. | |
| | | /// @return number of used bits per input/output image channel. | |
| | | BYTE UsedBitsPerChannel() const; | |
| | | | |
| | | //////////////////////////////////////////////////////////////////// | |
| | | // | |
| /// Returns images' PGF version | | /// Returns images' PGF version | |
| /// @return PGF codec version of the image | | /// @return PGF codec version of the image | |
| BYTE Version() const
{ return CurrentVersion(m_preHeader.ver
sion); } | | BYTE Version() const
{ return CurrentVersion(m_preHeader.ver
sion); } | |
| | | | |
| //class methods | | //class methods | |
| | | | |
| ////////////////////////////////////////////////////////////////////
// | | ////////////////////////////////////////////////////////////////////
// | |
| /// Check for valid import image mode. | | /// Check for valid import image mode. | |
| /// @param mode Image mode | | /// @param mode Image mode | |
| /// @return True if an image of given mode can be imported with Impo
rtBitmap(...) | | /// @return True if an image of given mode can be imported with Impo
rtBitmap(...) | |
| | | | |
| skipping to change at line 504 | | skipping to change at line 518 | |
| static BYTE CurrentChannelDepth(BYTE version = PGFVersion)
{ return (version & PGF32) ? 32 : 16; } | | static BYTE CurrentChannelDepth(BYTE version = PGFVersion)
{ return (version & PGF32) ? 32 : 16; } | |
| | | | |
| protected: | | protected: | |
| CWaveletTransform* m_wtChannel[MaxChannels]; ///< wavelet transfo
rmed color channels | | CWaveletTransform* m_wtChannel[MaxChannels]; ///< wavelet transfo
rmed color channels | |
| DataT* m_channel[MaxChannels]; ///<
untransformed channels in YUV format | | DataT* m_channel[MaxChannels]; ///<
untransformed channels in YUV format | |
| CDecoder* m_decoder; ///< PGF decoder | | CDecoder* m_decoder; ///< PGF decoder | |
| CEncoder* m_encoder; ///< PGF encoder | | CEncoder* m_encoder; ///< PGF encoder | |
| UINT32* m_levelLength; ///< length of each level in
bytes; first level starts immediately after this array | | UINT32* m_levelLength; ///< length of each level in
bytes; first level starts immediately after this array | |
| UINT32 m_width[MaxChannels]; ///< width of each channel at curren
t level | | UINT32 m_width[MaxChannels]; ///< width of each channel at curren
t level | |
| UINT32 m_height[MaxChannels]; ///< height of each channel at curre
nt level | | UINT32 m_height[MaxChannels]; ///< height of each channel at curre
nt level | |
|
| PGFPreHeader m_preHeader; ///< PGF pre header | | PGFPreHeader m_preHeader; ///< PGF pre-header | |
| PGFHeader m_header; ///< PGF file header | | PGFHeader m_header; ///< PGF file header | |
|
| PGFPostHeader m_postHeader; ///< PGF post header | | PGFPostHeader m_postHeader; ///< PGF post-header | |
| | | UINT64 m_userDataPos; ///< stream position of user | |
| | | data | |
| int m_currentLevel; ///< transform level
of current image | | int m_currentLevel; ///< transform level
of current image | |
| BYTE m_quant; ///< quantization pa
rameter | | BYTE m_quant; ///< quantization pa
rameter | |
| bool m_downsample; ///< chrominance cha
nnels are downsampled | | bool m_downsample; ///< chrominance cha
nnels are downsampled | |
| bool m_favorSpeedOverSize; ///< favor encoding speed ov
er compression ratio | | bool m_favorSpeedOverSize; ///< favor encoding speed ov
er compression ratio | |
| bool m_useOMPinEncoder; ///< use Open MP in encoder | | bool m_useOMPinEncoder; ///< use Open MP in encoder | |
| bool m_useOMPinDecoder; ///< use Open MP in decoder | | bool m_useOMPinDecoder; ///< use Open MP in decoder | |
|
| | | bool m_skipUserData; ///< skip user data (metadat
a) during open | |
| #ifdef __PGFROISUPPORT__ | | #ifdef __PGFROISUPPORT__ | |
|
| bool m_levelwise; ///< write level-wis
e (only used with WriteNextLevel) | | | |
| bool m_streamReinitialized; ///< stream has been reiniti
alized | | bool m_streamReinitialized; ///< stream has been reiniti
alized | |
| PGFRect m_roi; ///< region of inter
est | | PGFRect m_roi; ///< region of inter
est | |
| #endif | | #endif | |
| | | | |
| private: | | private: | |
| RefreshCB m_cb; ///< pointer to refr
esh callback procedure | | RefreshCB m_cb; ///< pointer to refr
esh callback procedure | |
| void *m_cbArg; ///< refresh callbac
k argument | | void *m_cbArg; ///< refresh callbac
k argument | |
|
| | | double m_percent; ///< progress [0..1] | |
| | | ProgressMode m_progressMode; ///< progress mode used in Read and | |
| | | Write; PM_Relative is default mode | |
| | | | |
| void ComputeLevels(); | | void ComputeLevels(); | |
| void CompleteHeader(); | | void CompleteHeader(); | |
| void RgbToYuv(int pitch, UINT8* rgbBuff, BYTE bpp, int channelMap[],
CallbackPtr cb, void *data) THROW_; | | void RgbToYuv(int pitch, UINT8* rgbBuff, BYTE bpp, int channelMap[],
CallbackPtr cb, void *data) THROW_; | |
| void Downsample(int nChannel); | | void Downsample(int nChannel); | |
|
| | | UINT32 UpdatePostHeaderSize() THROW_; | |
| void WriteLevel() THROW_; | | void WriteLevel() THROW_; | |
| | | | |
| #ifdef __PGFROISUPPORT__ | | #ifdef __PGFROISUPPORT__ | |
| void SetROI(PGFRect rect); | | void SetROI(PGFRect rect); | |
| #endif | | #endif | |
| | | | |
| UINT8 Clamp4(DataT v) const { | | UINT8 Clamp4(DataT v) const { | |
| if (v & 0xFFFFFFF0) return (v < 0) ? (UINT8)0: (UINT8)15; el
se return (UINT8)v; | | if (v & 0xFFFFFFF0) return (v < 0) ? (UINT8)0: (UINT8)15; el
se return (UINT8)v; | |
| } | | } | |
| UINT16 Clamp6(DataT v) const { | | UINT16 Clamp6(DataT v) const { | |
| | | | |
End of changes. 23 change blocks. |
| 55 lines changed or deleted | | 82 lines changed or added | |
|