Author Topic: Closed: Filesize displayed incorrectly for very large files  (Read 4461 times)

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
PhotoMechanic displays an incorrect filesize for very large files. For instance a file of 2.28GB (2,279,912,238 bytes) gets displayed as -1967827K. As a consequence sorting on filesize doesn't work correctly either.

I guess PM is currently using a signed 32-bit integer for the filesize, which is fine until the file reaches a size of 2GB. With larger files, this goes wrong though so I think this needs to be changed into either a 64bit integer (to fix it completely) or at least an unsigned integer (which fixes the problem for files up to 4GB in size).

PM 4.6.4 b0429, Mac OS X 10.6.3.

Cheers,
    Hayo
« Last Edit: May 07, 2019, 12:17:57 AM by Hayo Baan »
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24770
    • View Profile
    • Camera Bits, Inc.
Re: Filesize displayed incorrectly for very large files
« Reply #1 on: May 05, 2010, 06:49:26 AM »
Hayo,

PhotoMechanic displays an incorrect filesize for very large files. For instance a file of 2.28GB (2,279,912,238 bytes) gets displayed as -1967827K. As a consequence sorting on filesize doesn't work correctly either.

I guess PM is currently using a signed 32-bit integer for the filesize, which is fine until the file reaches a size of 2GB. With larger files, this goes wrong though so I think this needs to be changed into either a 64bit integer (to fix it completely) or at least an unsigned integer (which fixes the problem for files up to 4GB in size).

In what parts of the application are you seeing this behavior?

-Kirk

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Filesize displayed incorrectly for very large files
« Reply #2 on: May 05, 2010, 12:17:58 PM »
I should probably have clarified it a bit more: It is the {filesize} variable that's incorrect.

E.g., the value is displayed incorrectly when you make it part of e.g. the infotext. Sorting the contact sheet on {filesize} results in the wrong sort order as mentioned too.

Hopefully the {filesize} variable is the only thing that records the wrong size as I guess then it is relatively easy to fix.

Thanks,
    Hayo
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24770
    • View Profile
    • Camera Bits, Inc.
Re: Filesize displayed incorrectly for very large files
« Reply #3 on: May 05, 2010, 06:06:20 PM »
Hayo,

I should probably have clarified it a bit more: It is the {filesize} variable that's incorrect.

E.g., the value is displayed incorrectly when you make it part of e.g. the infotext. Sorting the contact sheet on {filesize} results in the wrong sort order as mentioned too.

Hopefully the {filesize} variable is the only thing that records the wrong size as I guess then it is relatively easy to fix.

Please get the 4.6.4 beta 5 version:

http://forums.camerabits.com/index.php?topic=5527.0

Let me know if it does (or does not) solve your issue.

Thanks,

-Kirk

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Filesize displayed incorrectly for very large files
« Reply #4 on: May 05, 2010, 11:41:22 PM »
Kirk,

The b0505 fixed this issue. I just came across another issue (also present in b0429, haven't checked older versions) which I think is related to extremely large files too: the ICC profile for these >2GB files is shown as "undefined" (instead of Prophoto RGB, what it is).

exiftool shows the correct profile by the way (and so does Photoshop), so it is there…

Thanks,
    Hayo
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24770
    • View Profile
    • Camera Bits, Inc.
Re: Filesize displayed incorrectly for very large files
« Reply #5 on: May 06, 2010, 06:33:13 AM »
Hayo,

The b0505 fixed this issue. I just came across another issue (also present in b0429, haven't checked older versions) which I think is related to extremely large files too: the ICC profile for these >2GB files is shown as "undefined" (instead of Prophoto RGB, what it is).

exiftool shows the correct profile by the way (and so does Photoshop), so it is there…

What file format are these large files?  TIFF?  PSD?

-Kirk

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Filesize displayed incorrectly for very large files
« Reply #6 on: May 07, 2010, 12:36:35 AM »
For the record (I've already responded to Kirk in a personal message): The files are TIFFs.

(PSD is actually not capable of handling files with more than 30000 pixels on a side, which mine are, PSB (Photoshop's big document format) is, but that file format is not widely supported, and certainly not by PM.)
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Filesize displayed incorrectly for very large files
« Reply #7 on: May 15, 2010, 04:05:00 AM »
Update to my original problems with large files

While the latest PM (4.6.4) does solve the problems of the filesize and ICC profiles not being shown properly, I have now found another problem. The embedded IPTC data does not get recorded anymore. In fact trying to update the meta data now results in the error "Error: Unable to save IPTC".  (Note to Kirk and Dennis: this error message was not generated in the private beta you sent me, and the results were slightly different too.)

Analysing the file metadata with exiftool reveals a problem with the IFD0 pointer ("Warning: Error reading value for IFD0 entry 20") in these cases (files edited with the private beta have a different problem: "Warning: PhotoMechanic pointer references previous IPTC directory"). My guess is there's still a problem with pointers not allowing for extremely large (>2GB) files.

Hope this new problem can be fixed soon too  ;)

Thanks,
    Hayo
Hayo Baan - Photography
Web: www.hayobaan.nl