summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml33
-rw-r--r--indra/newview/app_settings/settings_per_account.xml11
-rw-r--r--indra/newview/llviewertexturelist.cpp31
-rw-r--r--indra/newview/skins/default/xui/en/floater_postcard.xml1
4 files changed, 75 insertions, 1 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index ac52cff49a..33c5e533be 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4284,6 +4284,39 @@
<key>Value</key>
<real>0.25</real>
</map>
+ <key>Jpeg2000AdvancedCompression</key>
+ <map>
+ <key>Comment</key>
+ <string>Use advanced Jpeg2000 compression options (precincts, blocks, ordering, markers)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
+ <key>Jpeg2000PrecinctsSize</key>
+ <map>
+ <key>Comment</key>
+ <string>Size of image precincts. Assumed square and same for all levels. Must be power of 2.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>256</integer>
+ </map>
+ <key>Jpeg2000BlocksSize</key>
+ <map>
+ <key>Comment</key>
+ <string>Size of encoding blocks. Assumed square and same for all levels. Must be power of 2. Max 64, Min 4.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>64</integer>
+ </map>
<key>KeepAspectForSnapshot</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index 8efec1cff0..ff24efaf2c 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -44,6 +44,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>LastPostcardRecipient</key>
+ <map>
+ <key>Comment</key>
+ <string>Last recipient of postcard</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string />
+ </map>
<key>LogNearbyChat</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 5afed721ac..8cf9b98d5d 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -932,16 +932,19 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
if (image.isNull())
{
+ image->setLastError("Couldn't open the image to be uploaded.");
return FALSE;
}
if (!image->load(filename))
{
+ image->setLastError("Couldn't load the image to be uploaded.");
return FALSE;
}
// Decompress or expand it in a raw image structure
LLPointer<LLImageRaw> raw_image = new LLImageRaw;
if (!image->decode(raw_image, 0.0f))
{
+ image->setLastError("Couldn't decode the image to be uploaded.");
return FALSE;
}
// Check the image constraints
@@ -952,8 +955,15 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
}
// Convert to j2c (JPEG2000) and save the file locally
LLPointer<LLImageJ2C> compressedImage = convertToUploadFile(raw_image);
+ if (compressedImage.isNull())
+ {
+ image->setLastError("Couldn't convert the image to jpeg2000.");
+ llinfos << "Couldn't convert to j2c, file : " << filename << llendl;
+ return FALSE;
+ }
if (!compressedImage->save(out_filename))
{
+ image->setLastError("Couldn't create the jpeg2000 image for upload.");
llinfos << "Couldn't create output file : " << out_filename << llendl;
return FALSE;
}
@@ -961,6 +971,7 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
if (!integrity_test->loadAndValidate( out_filename ))
{
+ image->setLastError("The created jpeg2000 image is corrupt.");
llinfos << "Image file : " << out_filename << " is corrupt" << llendl;
return FALSE;
}
@@ -978,7 +989,25 @@ LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImage
(raw_image->getWidth() * raw_image->getHeight() <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF))
compressedImage->setReversible(TRUE);
- compressedImage->encode(raw_image, 0.0f);
+
+ if (gSavedSettings.getBOOL("Jpeg2000AdvancedCompression"))
+ {
+ // This test option will create jpeg2000 images with precincts for each level, RPCL ordering
+ // and PLT markers. The block size is also optionally modifiable.
+ // Note: the images hence created are compatible with older versions of the viewer.
+ // Read the blocks and precincts size settings
+ S32 block_size = gSavedSettings.getS32("Jpeg2000BlocksSize");
+ S32 precinct_size = gSavedSettings.getS32("Jpeg2000PrecinctsSize");
+ llinfos << "Advanced JPEG2000 Compression: precinct = " << precinct_size << ", block = " << block_size << llendl;
+ compressedImage->initEncode(*raw_image, block_size, precinct_size, 0);
+ }
+
+ if (!compressedImage->encode(raw_image, 0.0f))
+ {
+ llinfos << "convertToUploadFile : encode returns with error!!" << llendl;
+ // Clear up the pointer so we don't leak that one
+ compressedImage = NULL;
+ }
return compressedImage;
}
diff --git a/indra/newview/skins/default/xui/en/floater_postcard.xml b/indra/newview/skins/default/xui/en/floater_postcard.xml
index b4ecedd981..8da35e9d7f 100644
--- a/indra/newview/skins/default/xui/en/floater_postcard.xml
+++ b/indra/newview/skins/default/xui/en/floater_postcard.xml
@@ -36,6 +36,7 @@
Recipient&apos;s Email:
</text>
<line_editor
+ control_name="LastPostcardRecipient"
follows="left|top"
height="20"
layout="topleft"