LLImageDXT Class Reference

#include <llimagedxt.h>

Inheritance diagram for LLImageDXT:

Inheritance graph
[legend]
Collaboration diagram for LLImageDXT:

Collaboration graph
[legend]
List of all members.

Public Types

 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
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 time=0.0)
BOOL encode (const LLImageRaw *raw_image, F32 time, bool explicit_mips)
BOOL encode (const LLImageRaw *raw_image, F32 time=0.0)
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 ()

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

Detailed Description

Definition at line 38 of file llimagedxt.h.


Member Enumeration Documentation

enum LLImageDXT::EFileFormat

Enumerator:
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.


Constructor & Destructor Documentation

LLImageDXT::~LLImageDXT (  )  [protected]

Definition at line 174 of file llimagedxt.cpp.

LLImageDXT::LLImageDXT (  ) 

Definition at line 167 of file llimagedxt.cpp.


Member Function Documentation

S32 LLImageDXT::calcDataSize ( S32  discard_level = 0  )  [virtual]

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.

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().

S32 LLImageDXT::calcHeaderSize (  )  [virtual]

Reimplemented from LLImageFormatted.

Definition at line 454 of file llimagedxt.cpp.

References llmax().

Referenced by setFormat().

S32 LLImageDXT::calcNumMips ( S32  width,
S32  height 
) [static]

Definition at line 153 of file llimagedxt.cpp.

References S32.

Referenced by convertToDXR(), encode(), and getMipOffset().

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(), encode(), and formatBytes().

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(), height, llassert, llendl, llerrs, llformat(), llwarns, mFileFormat, mHeaderSize, LLImageDXT::dxtfile_header_t::pixel_fmt, S32, LLImageFormatted::setData(), updateData(), and width.

BOOL LLImageDXT::decode ( LLImageRaw raw_image,
F32  time = 0.0 
) [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(), height, llassert_always, llendl, llwarns, mFileFormat, LLImageRaw::resize(), S32, LLImageBase::setLastError(), TRUE, and width.

BOOL LLImageDXT::encode ( const LLImageRaw raw_image,
F32  time = 0.0 
) [virtual]

Implements LLImageFormatted.

Definition at line 397 of file llimagedxt.cpp.

References encode().

BOOL LLImageDXT::encode ( const LLImageRaw raw_image,
F32  time,
bool  explicit_mips 
)

Definition at line 311 of file llimagedxt.cpp.

References LLImageFormatted::allocateData(), calcNumMips(), checkMinWidthHeight(), extractMip(), 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(), height, 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(), TRUE, and width.

Referenced by encode().

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 encode().

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(), encode(), extractMip(), and getMipOffset().

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().

static S32 LLImageDXT::formatOffset ( EFileFormat  format,
S32  width,
S32  height,
S32  max_width,
S32  max_height 
) [static]

EFileFormat LLImageDXT::getFileFormat (  )  [inline]

Definition at line 116 of file llimagedxt.h.

References mFileFormat.

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 encode().

BOOL LLImageDXT::getMipData ( LLPointer< LLImageRaw > &  raw,
S32  discard = -1 
)

Definition at line 291 of file llimagedxt.cpp.

References calcDiscardWidthHeight(), LLImageBase::getComponents(), LLImageBase::getData(), getMipOffset(), height, llendl, llerrs, LLImageFormatted::mDiscardLevel, mFileFormat, S32, TRUE, and width.

S32 LLImageDXT::getMipOffset ( S32  discard  ) 

Definition at line 227 of file llimagedxt.cpp.

References calcNumMips(), FORMAT_DXT1, FORMAT_DXT5, formatBytes(), LLImageBase::getHeight(), LLImageBase::getWidth(), height, llassert, llclamp(), llendl, llerrs, mFileFormat, mHeaderSize, S32, and width.

Referenced by calcDataSize(), convertToDXR(), decode(), encode(), and getMipData().

bool LLImageDXT::isCompressed (  )  [inline]

Definition at line 117 of file llimagedxt.h.

References FORMAT_DXR5, FORMAT_DXT1, and mFileFormat.

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.

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(), height, 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(), TRUE, and width.

Referenced by convertToDXR().


Member Data Documentation

EFileFormat LLImageDXT::mFileFormat [private]

Definition at line 138 of file llimagedxt.h.

Referenced by calcDataSize(), convertToDXR(), decode(), encode(), getFileFormat(), getMipData(), getMipOffset(), isCompressed(), setFormat(), and updateData().

S32 LLImageDXT::mHeaderSize [private]

Definition at line 139 of file llimagedxt.h.

Referenced by convertToDXR(), encode(), getMipOffset(), setFormat(), and updateData().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:25 2010 for Second Life Viewer by  doxygen 1.4.7