summaryrefslogtreecommitdiff
path: root/indra/llimage
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2011-05-18 07:33:08 -0400
committerOz Linden <oz@lindenlab.com>2011-05-18 07:33:08 -0400
commit5eb6cb8d86cf19da79d034df52a0254079f2c95f (patch)
treecd2853e9c7c2cbf0bce317ca9018a6f4fa46a23f /indra/llimage
parent66c078de5e5a6b685d435f7b1a462d64ca80f35e (diff)
parent644cbc44871992a95bcd5a6854dfc2a4d56a7b62 (diff)
merge up latest viewer-development (post mesh)
Diffstat (limited to 'indra/llimage')
-rw-r--r--indra/llimage/llimage.h13
-rw-r--r--indra/llimage/llimagej2c.cpp4
-rw-r--r--indra/llimage/llimagej2c.h4
3 files changed, 17 insertions, 4 deletions
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index 18444f3934..c464c3b2b6 100644
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -35,8 +35,21 @@
const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2
const S32 MAX_IMAGE_MIP = 11; // 2048x2048
+
+// *TODO : Use MAX_IMAGE_MIP as max discard level and modify j2c management so that the number
+// of levels is read from the header's file, not inferred from its size.
const S32 MAX_DISCARD_LEVEL = 5;
+// JPEG2000 size constraints
+// Those are declared here as they are germane to other image constraints used in the viewer
+// and declared right here. Some come from the JPEG2000 spec, some conventions specific to SL.
+const S32 MAX_DECOMPOSITION_LEVELS = 32; // Number of decomposition levels cannot exceed 32 according to jpeg2000 spec
+const S32 MIN_DECOMPOSITION_LEVELS = 5; // the SL viewer will *crash* trying to decode images with fewer than 5 decomposition levels (unless image is small that is)
+const S32 MAX_PRECINCT_SIZE = 2048; // No reason to be bigger than MAX_IMAGE_SIZE
+const S32 MIN_PRECINCT_SIZE = 4; // Can't be smaller than MIN_BLOCK_SIZE
+const S32 MAX_BLOCK_SIZE = 64; // Max total block size is 4096, hence 64x64 when using square blocks
+const S32 MIN_BLOCK_SIZE = 4; // Min block dim is 4 according to jpeg2000 spec
+
const S32 MIN_IMAGE_SIZE = (1<<MIN_IMAGE_MIP); // 4, only used for expand/contract power of 2
const S32 MAX_IMAGE_SIZE = (1<<MAX_IMAGE_MIP); // 2048
const S32 MIN_IMAGE_AREA = MIN_IMAGE_SIZE * MIN_IMAGE_SIZE;
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp
index a90df0f1c1..44e6b89dd3 100644
--- a/indra/llimage/llimagej2c.cpp
+++ b/indra/llimage/llimagej2c.cpp
@@ -144,9 +144,9 @@ BOOL LLImageJ2C::initDecode(LLImageRaw &raw_image, int discard_level, int* regio
return mImpl->initDecode(*this,raw_image,discard_level,region);
}
-BOOL LLImageJ2C::initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size)
+BOOL LLImageJ2C::initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels)
{
- return mImpl->initEncode(*this,raw_image,blocks_size,precincts_size);
+ return mImpl->initEncode(*this,raw_image,blocks_size,precincts_size,levels);
}
BOOL LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time)
diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h
index 6bba81aab5..914174fc57 100644
--- a/indra/llimage/llimagej2c.h
+++ b/indra/llimage/llimagej2c.h
@@ -57,7 +57,7 @@ public:
/*virtual*/ void setLastError(const std::string& message, const std::string& filename = std::string());
BOOL initDecode(LLImageRaw &raw_image, int discard_level, int* region);
- BOOL initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size);
+ BOOL initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels);
// Encode with comment text
BOOL encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time=0.0);
@@ -120,7 +120,7 @@ protected:
virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0,
BOOL reversible=FALSE) = 0;
virtual BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL) = 0;
- virtual BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1) = 0;
+ virtual BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0) = 0;
friend class LLImageJ2C;
};