Image cache memory can't be set above 2047MB

Bug #761231 reported by David Burton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Hugin
Fix Released
High
Unassigned

Bug Description

When setting the image cache memory (file/preferences/general) to any value above 2047MB it resets to 1MB.

If I then click cancel, it does not stay at 2047, but goes ahead and sets the cache to 1MB.

Windows 7 64 bit, AMD Phenom II 6 core 1100T, 8GB RAM
Hugin 2011.0.0.8f1447ab8649

Revision history for this message
wedge (nobodyhome) wrote :

I can confirm this.

Revision history for this message
Yuv (yuv) wrote :

Must be Windows only - I don't see this in Kubuntu

Changed in hugin:
status: New → Confirmed
importance: Undecided → High
tags: added: windows
Revision history for this message
Matthew Petroff (matthewpetroff) wrote :

Are you using a 32-bit or 64-bit build?

Revision history for this message
David Burton (dburton97128) wrote :

64 bit
2011.0.0.8f1447ab8649 built by Matthew Petroff

Revision history for this message
Matthew Petroff (matthewpetroff) wrote :

wxWidgets stores long integers in the Windows Registry as DWORD keys that are 32-bit unsigned integers. Hugin was reading these as signed integers, so anything above 2047 was read as negative and displayed as 1; values above 2047 were properly saved, just displayed incorrectly. I committed a fix for this.

However, there is a new limit at 4095 MB due to an incompatibility between how Hugin saves this setting and the Windows registry. While Windows 2000 and later supports QWORD keys that are 64-bit integers, wxWidgets does not support these, leaving only 32-bit DWORD keys. Hugin shifts the setting's value left 20 bits before saving it, causing a DWORD, or a 32-bit unsigned integer, to rollover back to 0 for any values above 4095, preventing the use of more the 4GB of memory for image cache. This could be resolved by shifting the value when it is read instead of when it is saved, but this would break all existing settings.

Revision history for this message
Yuv (yuv) wrote : Re: [Bug 761231] Re: Image cache memory can't be set above 2047MB

On May 9, 2011 10:53:22 PM Matthew Petroff wrote:
> incompatibility
> between how Hugin saves this setting and the Windows registry.

how about using two 32bit DWORDs?

for backward compatibility, the existing DWORD saves the lower 32 bit and the
new DWORD would save the higher 32 bit.

On read:
- read legacy DWORD.
- try to read the new DWORD.
- If not existing, set to zero.
- Shift 32 bits.
- Add the two.
- apply the value.

On write:
- decompose the 64 bit value into high 32 and low 32
- write high 32 to new DWORD and low 32 to legacy DWORD

And a path to the future: when a newer version of wxWidgets that supports
QWORD becomes widely available, the legacy DWORD can be silenty upgraded to a
QWORD and the (temporary) new DWORD can be deleted / ignored.

I've added this quickly to default but I do not have Windows and can't test if
it builds nor if it makes sense. Please check

http://hugin.hg.sourceforge.net/hgweb/hugin/hugin/rev/085b637a788d

Yuv

Revision history for this message
Matthew Petroff (matthewpetroff) wrote :

After tweaking the code a bit to get around compiler issues when reading the stored value, it seems to work. I also updated the code where the setting is actually used, so it actually does something.

Changed in hugin:
status: Confirmed → Fix Committed
Yuv (yuv)
Changed in hugin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.