00001
00032 #ifndef LL_LLIMAGEJ2C_H
00033 #define LL_LLIMAGEJ2C_H
00034
00035 #include "llimage.h"
00036 #include "llassettype.h"
00037
00038 class LLImageJ2CImpl;
00039 class LLImageJ2C : public LLImageFormatted
00040 {
00041 protected:
00042 virtual ~LLImageJ2C();
00043
00044 public:
00045 LLImageJ2C();
00046
00047
00048 BOOL updateData();
00049 BOOL decode(LLImageRaw *raw_imagep, F32 decode_time=0.0);
00050 BOOL decode(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count);
00051 BOOL encode(const LLImageRaw *raw_imagep, F32 encode_time=0.0);
00052 S32 calcHeaderSize();
00053 S32 calcDataSize(S32 discard_level = 0);
00054 S32 calcDiscardLevelBytes(S32 bytes);
00055 S8 getRawDiscardLevel();
00056
00057
00058 BOOL encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time=0.0);
00059
00060 BOOL validate(U8 *data, U32 file_size);
00061 BOOL loadAndValidate(const LLString &filename);
00062
00063
00064 void setReversible(const BOOL reversible);
00065 void setRate(F32 rate);
00066 void setMaxBytes(S32 max_bytes);
00067 S32 getMaxBytes() const { return mMaxBytes; }
00068
00069 static S32 calcHeaderSizeJ2C();
00070 static S32 calcDataSizeJ2C(S32 w, S32 h, S32 comp, S32 discard_level, F32 rate = 0.f);
00071
00072 static void openDSO();
00073 static void closeDSO();
00074 static std::string getEngineInfo();
00075
00076 protected:
00077 friend class LLImageJ2CImpl;
00078 friend class LLImageJ2COJ;
00079 friend class LLImageJ2CKDU;
00080 void decodeFailed();
00081 void updateRawDiscardLevel();
00082
00083 S32 mMaxBytes;
00084 S8 mRawDiscardLevel;
00085 F32 mRate;
00086 BOOL mReversible;
00087 LLImageJ2CImpl *mImpl;
00088 };
00089
00090
00091 class LLImageJ2CImpl
00092 {
00093 public:
00094 virtual ~LLImageJ2CImpl();
00095 protected:
00096
00097
00098
00099
00100 virtual BOOL getMetadata(LLImageJ2C &base) = 0;
00101
00102
00103
00104
00105
00106
00107 virtual BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) = 0;
00108 virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0,
00109 BOOL reversible=FALSE) = 0;
00110
00111 friend class LLImageJ2C;
00112 };
00113
00114 #define LINDEN_J2C_COMMENT_PREFIX "LL_"
00115
00116 #endif