#include <llimagedxt.h>
Public Types | |
enum | EFileFormat { FORMAT_UNKNOWN = 0, FORMAT_I8 = 1, FORMAT_A8, FORMAT_RGB8, FORMAT_RGBA8, FORMAT_DXT1, FORMAT_DXT2, FORMAT_DXT3, FORMAT_DXT4, FORMAT_DXT5, FORMAT_DXR1, FORMAT_DXR2, FORMAT_DXR3, FORMAT_DXR4, FORMAT_DXR5, FORMAT_NOFILE = 0xff } |
Public Member Functions | |
LLImageDXT () | |
BOOL | updateData () |
BOOL | decode (LLImageRaw *raw_image, F32 decode_time) |
BOOL | encode (const LLImageRaw *raw_image, F32 encode_time) |
S32 | calcHeaderSize () |
S32 | calcDataSize (S32 discard_level=0) |
BOOL | getMipData (LLPointer< LLImageRaw > &raw, S32 discard=-1) |
void | setFormat () |
S32 | getMipOffset (S32 discard) |
EFileFormat | getFileFormat () |
bool | isCompressed () |
bool | convertToDXR () |
Static Public Member Functions | |
static void | checkMinWidthHeight (EFileFormat format, S32 &width, S32 &height) |
static S32 | formatBits (EFileFormat format) |
static S32 | formatBytes (EFileFormat format, S32 width, S32 height) |
static S32 | formatOffset (EFileFormat format, S32 width, S32 height, S32 max_width, S32 max_height) |
static S32 | formatComponents (EFileFormat format) |
static EFileFormat | getFormat (S32 fourcc) |
static S32 | getFourCC (EFileFormat format) |
static void | calcDiscardWidthHeight (S32 discard_level, EFileFormat format, S32 &width, S32 &height) |
static S32 | calcNumMips (S32 width, S32 height) |
Protected Member Functions | |
~LLImageDXT () | |
Private Member Functions | |
BOOL | encodeDXT (const LLImageRaw *raw_image, F32 decode_time, bool explicit_mips) |
Static Private Member Functions | |
static void | extractMip (const U8 *indata, U8 *mipdata, int width, int height, int mip_width, int mip_height, EFileFormat format) |
Private Attributes | |
EFileFormat | mFileFormat |
S32 | mHeaderSize |
Classes | |
struct | dxtfile_header_old_t |
struct | dxtfile_header_t |
Definition at line 38 of file llimagedxt.h.
FORMAT_UNKNOWN | |
FORMAT_I8 | |
FORMAT_A8 | |
FORMAT_RGB8 | |
FORMAT_RGBA8 | |
FORMAT_DXT1 | |
FORMAT_DXT2 | |
FORMAT_DXT3 | |
FORMAT_DXT4 | |
FORMAT_DXT5 | |
FORMAT_DXR1 | |
FORMAT_DXR2 | |
FORMAT_DXR3 | |
FORMAT_DXR4 | |
FORMAT_DXR5 | |
FORMAT_NOFILE |
Definition at line 41 of file llimagedxt.h.
LLImageDXT::~LLImageDXT | ( | ) | [protected] |
Definition at line 174 of file llimagedxt.cpp.
LLImageDXT::LLImageDXT | ( | ) |
Definition at line 167 of file llimagedxt.cpp.
BOOL LLImageDXT::encodeDXT | ( | const LLImageRaw * | raw_image, | |
F32 | decode_time, | |||
bool | explicit_mips | |||
) | [private] |
Definition at line 311 of file llimagedxt.cpp.
References LLImageFormatted::allocateData(), calcNumMips(), checkMinWidthHeight(), extractMip(), indra::ipc::russ::format(), FORMAT_A8, FORMAT_RGB8, FORMAT_RGBA8, formatBytes(), LLImageDXT::dxtfile_header_t::pixel_format::fourcc, LLImageDXT::dxtfile_header_t::fourcc, LLImageBase::generateMip(), LLImageBase::getComponents(), LLImageBase::getData(), getFourCC(), LLImageBase::getHeight(), getMipOffset(), LLImageBase::getWidth(), llassert, llassert_always, llendl, llerrs, LLImageDXT::dxtfile_header_t::maxheight, LLImageDXT::dxtfile_header_t::maxwidth, mFileFormat, mHeaderSize, LLImageDXT::dxtfile_header_t::num_mips, LLImageDXT::dxtfile_header_t::pixel_fmt, S32, LLImageBase::setSize(), and TRUE.
Referenced by encode().
BOOL LLImageDXT::updateData | ( | ) | [virtual] |
Implements LLImageFormatted.
Definition at line 179 of file llimagedxt.cpp.
References LLImageFormatted::calcDiscardLevelBytes(), FALSE, LLImageDXT::dxtfile_header_old_t::format, formatComponents(), LLImageDXT::dxtfile_header_t::pixel_format::fourcc, LLImageDXT::dxtfile_header_t::fourcc, LLImageBase::getData(), LLImageBase::getDataSize(), getFormat(), llendl, llerrs, llmin(), MAX_IMAGE_MIP, LLImageDXT::dxtfile_header_t::maxheight, LLImageDXT::dxtfile_header_old_t::maxheight, LLImageDXT::dxtfile_header_old_t::maxlevel, LLImageDXT::dxtfile_header_t::maxwidth, LLImageDXT::dxtfile_header_old_t::maxwidth, mFileFormat, mHeaderSize, LLImageDXT::dxtfile_header_t::num_mips, LLImageDXT::dxtfile_header_t::pixel_fmt, LLImageBase::resetLastError(), S32, LLImageFormatted::setDiscardLevel(), LLImageBase::setLastError(), LLImageBase::setSize(), and TRUE.
Referenced by convertToDXR().
BOOL LLImageDXT::decode | ( | LLImageRaw * | raw_image, | |
F32 | decode_time | |||
) | [virtual] |
Implements LLImageFormatted.
Definition at line 264 of file llimagedxt.cpp.
References FALSE, FORMAT_DXR5, FORMAT_DXT1, formatBytes(), LLImageBase::getComponents(), LLImageBase::getData(), LLImageBase::getDataSize(), LLImageBase::getHeight(), getMipOffset(), LLImageBase::getWidth(), llassert_always, llendl, llwarns, mFileFormat, LLImageRaw::resize(), S32, LLImageBase::setLastError(), and TRUE.
BOOL LLImageDXT::encode | ( | const LLImageRaw * | raw_image, | |
F32 | encode_time | |||
) | [virtual] |
Implements LLImageFormatted.
Definition at line 397 of file llimagedxt.cpp.
References encodeDXT().
S32 LLImageDXT::calcHeaderSize | ( | ) | [virtual] |
Reimplemented from LLImageFormatted.
Definition at line 454 of file llimagedxt.cpp.
References llmax().
Referenced by setFormat().
Reimplemented from LLImageFormatted.
Definition at line 460 of file llimagedxt.cpp.
References FORMAT_UNKNOWN, formatBytes(), LLImageBase::getHeight(), getMipOffset(), LLImageBase::getWidth(), llendl, llerrs, LLImageFormatted::mDiscardLevel, mFileFormat, and S32.
BOOL LLImageDXT::getMipData | ( | LLPointer< LLImageRaw > & | raw, | |
S32 | discard = -1 | |||
) |
Definition at line 291 of file llimagedxt.cpp.
References calcDiscardWidthHeight(), LLImageBase::getComponents(), LLImageBase::getData(), getMipOffset(), llendl, llerrs, LLImageFormatted::mDiscardLevel, mFileFormat, S32, and TRUE.
Referenced by LLImageWorker::requestDecodedData().
void LLImageDXT::setFormat | ( | ) |
Definition at line 251 of file llimagedxt.cpp.
References calcHeaderSize(), FORMAT_DXR1, FORMAT_DXR3, LLImageBase::getComponents(), llendl, llerrs, mFileFormat, mHeaderSize, and S32.
Definition at line 227 of file llimagedxt.cpp.
References calcNumMips(), FORMAT_DXT1, FORMAT_DXT5, formatBytes(), LLImageBase::getHeight(), LLImageBase::getWidth(), llassert, llclamp(), llendl, llerrs, mFileFormat, mHeaderSize, and S32.
Referenced by calcDataSize(), convertToDXR(), decode(), encodeDXT(), and getMipData().
EFileFormat LLImageDXT::getFileFormat | ( | ) | [inline] |
bool LLImageDXT::isCompressed | ( | ) | [inline] |
bool LLImageDXT::convertToDXR | ( | ) |
Definition at line 403 of file llimagedxt.cpp.
References calcNumMips(), FORMAT_DXR1, FORMAT_DXR2, FORMAT_DXR3, FORMAT_DXR4, FORMAT_DXR5, FORMAT_DXT1, FORMAT_DXT2, FORMAT_DXT3, FORMAT_DXT4, FORMAT_DXT5, FORMAT_UNKNOWN, formatBytes(), LLImageDXT::dxtfile_header_t::pixel_format::fourcc, LLImageBase::getData(), LLImageBase::getDataSize(), getFourCC(), LLImageBase::getHeight(), getMipOffset(), LLImageBase::getWidth(), llassert, llendl, llerrs, llformat(), llwarns, mFileFormat, mHeaderSize, LLImageDXT::dxtfile_header_t::pixel_fmt, S32, LLImageFormatted::setData(), and updateData().
void LLImageDXT::checkMinWidthHeight | ( | EFileFormat | format, | |
S32 & | width, | |||
S32 & | height | |||
) | [static] |
Definition at line 36 of file llimagedxt.cpp.
References FORMAT_DXR5, FORMAT_DXT1, llmax(), and S32.
Referenced by calcDiscardWidthHeight(), encodeDXT(), and formatBytes().
S32 LLImageDXT::formatBits | ( | EFileFormat | format | ) | [static] |
Definition at line 44 of file llimagedxt.cpp.
References FORMAT_A8, FORMAT_DXR1, FORMAT_DXR3, FORMAT_DXR5, FORMAT_DXT1, FORMAT_DXT3, FORMAT_DXT5, FORMAT_I8, FORMAT_RGB8, FORMAT_RGBA8, llendl, and llerrs.
Referenced by formatBytes().
S32 LLImageDXT::formatBytes | ( | EFileFormat | format, | |
S32 | width, | |||
S32 | height | |||
) | [static] |
Definition at line 65 of file llimagedxt.cpp.
References checkMinWidthHeight(), formatBits(), and S32.
Referenced by calcDataSize(), convertToDXR(), decode(), encodeDXT(), extractMip(), and getMipOffset().
static S32 LLImageDXT::formatOffset | ( | EFileFormat | format, | |
S32 | width, | |||
S32 | height, | |||
S32 | max_width, | |||
S32 | max_height | |||
) | [static] |
S32 LLImageDXT::formatComponents | ( | EFileFormat | format | ) | [static] |
Definition at line 74 of file llimagedxt.cpp.
References FORMAT_A8, FORMAT_DXR1, FORMAT_DXR3, FORMAT_DXR5, FORMAT_DXT1, FORMAT_DXT3, FORMAT_DXT5, FORMAT_I8, FORMAT_RGB8, FORMAT_RGBA8, llendl, and llerrs.
Referenced by updateData().
LLImageDXT::EFileFormat LLImageDXT::getFormat | ( | S32 | fourcc | ) | [static] |
Definition at line 95 of file llimagedxt.cpp.
References FORMAT_A8, FORMAT_DXR1, FORMAT_DXR2, FORMAT_DXR3, FORMAT_DXR4, FORMAT_DXR5, FORMAT_DXT1, FORMAT_DXT2, FORMAT_DXT3, FORMAT_DXT4, FORMAT_DXT5, FORMAT_I8, FORMAT_RGB8, FORMAT_RGBA8, and FORMAT_UNKNOWN.
Referenced by updateData().
S32 LLImageDXT::getFourCC | ( | EFileFormat | format | ) | [static] |
Definition at line 118 of file llimagedxt.cpp.
References FORMAT_A8, FORMAT_DXR1, FORMAT_DXR2, FORMAT_DXR3, FORMAT_DXR4, FORMAT_DXR5, FORMAT_DXT1, FORMAT_DXT2, FORMAT_DXT3, FORMAT_DXT4, FORMAT_DXT5, FORMAT_I8, FORMAT_RGB8, and FORMAT_RGBA8.
Referenced by convertToDXR(), and encodeDXT().
void LLImageDXT::calcDiscardWidthHeight | ( | S32 | discard_level, | |
EFileFormat | format, | |||
S32 & | width, | |||
S32 & | height | |||
) | [static] |
Definition at line 141 of file llimagedxt.cpp.
References checkMinWidthHeight().
Referenced by getMipData().
Definition at line 153 of file llimagedxt.cpp.
References S32.
Referenced by convertToDXR(), encodeDXT(), and getMipOffset().
void LLImageDXT::extractMip | ( | const U8 * | indata, | |
U8 * | mipdata, | |||
int | width, | |||
int | height, | |||
int | mip_width, | |||
int | mip_height, | |||
EFileFormat | format | |||
) | [static, private] |
Definition at line 481 of file llimagedxt.cpp.
References formatBytes().
Referenced by encodeDXT().
EFileFormat LLImageDXT::mFileFormat [private] |
Definition at line 140 of file llimagedxt.h.
Referenced by calcDataSize(), convertToDXR(), decode(), encodeDXT(), getFileFormat(), getMipData(), getMipOffset(), isCompressed(), setFormat(), and updateData().
S32 LLImageDXT::mHeaderSize [private] |
Definition at line 141 of file llimagedxt.h.
Referenced by convertToDXR(), encodeDXT(), getMipOffset(), setFormat(), and updateData().