Pages: 1 [2] 3   Go Down

Author Topic: Lightroom preview performance mini-rant  (Read 9420 times)

Rory

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 528
    • Recent images
Re: Lightroom preview performance mini-rant
« Reply #20 on: February 18, 2016, 10:41:32 am »

Who knows? PM-speed preview browsing was the thing I most expected when I first heard GPU acceleration was being added....

I'm not too knowledgeable about GPU acceleration, but I'm not sure this is the solution.  I think the main issue is that Adobe are not caching ahead.  There is a fair amount of overhead moving memory from the CPU to the GPU.  The time crunch is the amount of time to read the data from the storage medium.  It is challenging to get the read time under 700ms for a 36MP file.  Hence the need to cache ahead.
Logged
[url=http://www.flickr.com/photos/roryhi

john beardsworth

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 4755
    • My photography site
Re: Lightroom preview performance mini-rant
« Reply #21 on: February 18, 2016, 10:54:53 am »

I'm not too knowledgeable about GPU acceleration, but I'm not sure this is the solution.  I think the main issue is that Adobe are not caching ahead.  There is a fair amount of overhead moving memory from the CPU to the GPU.  The time crunch is the amount of time to read the data from the storage medium.  It is challenging to get the read time under 700ms for a 36MP file.  Hence the need to cache ahead.

Haven't PM always claimed that using the GPU allowed them that speed, and certainly it was said of Aperture. Providing it's PM-speed, I don't care how it's done in Library (I'm not worried about Import).
Logged

Rory

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 528
    • Recent images
Re: Lightroom preview performance mini-rant
« Reply #22 on: February 18, 2016, 11:06:41 am »

Haven't PM always claimed that using the GPU allowed them that speed, and certainly it was said of Aperture. Providing it's PM-speed, I don't care how it's done in Library (I'm not worried about Import).

Do you have a source for your assertion that PM uses the GPU?   
Logged
[url=http://www.flickr.com/photos/roryhi

john beardsworth

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 4755
    • My photography site
Re: Lightroom preview performance mini-rant
« Reply #23 on: February 18, 2016, 01:09:03 pm »

No
Logged

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Lightroom preview performance mini-rant
« Reply #24 on: February 18, 2016, 05:18:22 pm »

I'm not too knowledgeable about GPU acceleration, but I'm not sure this is the solution.  I think the main issue is that Adobe are not caching ahead.  There is a fair amount of overhead moving memory from the CPU to the GPU.  The time crunch is the amount of time to read the data from the storage medium.  It is challenging to get the read time under 700ms for a 36MP file.  Hence the need to cache ahead.

Very interesting thread I have to say. I can respect Rory for having to code his own app just to investigate this. That's hound dogging it. Good work, Rory.

Now some questions that aren't being asked concerning jpeg thumbnail generation in LR. For reference I just threw away an old LR catalog because it was titled "Lightroom Trail Catalog" and had to re-point LR to the "Licensed" version and now my new catalog is rebuilding all Raw thumbnails in Library module quite slowly for both xmp sidecar edited and untouched Raws.

Rory, I noticed your "Winnow" screen grab of the Nikon previews shows some very correct looking thumbnails and I'm wondering if those jpegs are color managed meaning they have an embedded profile either embedded by the camera or assigned to it by the OS/LR usually in sRGB if not tagged by the camera.

Is Winnow color managed? Maybe this is what's slowing things down in LR and not Winnow.

I have an old 2006 Pentax K100D set incamera to capture/render jpegs in AdobeRGB which will look less saturated on my sRGB display unless I embed Argb using an Apple script I can drag & drop the jpeg on the desktop because my camera does not embed the profile. I'm sure your more modern Nikon camera does this automatically to both jpeg and Raw formats.
Logged

Rory

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 528
    • Recent images
Re: Lightroom preview performance mini-rant
« Reply #25 on: February 18, 2016, 09:36:21 pm »

Is Winnow color managed? Maybe this is what's slowing things down in LR and not Winnow.

Winnow renders based on the assigned color space.  In this case, I have my Nikon set to Adobe RGB.  However, I seriously doubt that has much impact on performance.  By far, the most time intensive task is reading the file from the storage medium.  Even on a fast SSD a 36MP file takes around 700ms to read the embedded JPEG.  There are ways to speed this up if you are planning to scale the image down for a monitor size, but I want the full size image so I can zoom into 1:1.  The way programs like Photo Mechanic and even Bridge speed things up is by caching ahead.  I'm pretty sure Lr does not cache previews or the embedded JPEGs in the import module.  In my program I run up to four separate threads: the main thread, one to read metadata, one to read and display thumbnails, and one to populate the image cache. 

Running many threads is very complex in a program as complicated as Lightroom.  Based on problems I have encountered where some images never fully render in the library and comments made by an adobe engineer it is likely Lr is running into a race condition.  So, if Lr is already running into thread collisions that may explain why adobe has yet to turbocharge image previewing.  More likely IMO, it just has not been a priority, with the performance of the develop module warranting early attention.  Just my guess.
Logged
[url=http://www.flickr.com/photos/roryhi

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Lightroom preview performance mini-rant
« Reply #26 on: February 19, 2016, 04:37:42 pm »

By far, the most time intensive task is reading the file from the storage medium.

And I'm assuming this storage medium (SSD) is internal and not off an external drive?
Logged

Rory

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 528
    • Recent images
Re: Lightroom preview performance mini-rant
« Reply #27 on: February 19, 2016, 04:48:14 pm »

And I'm assuming this storage medium (SSD) is internal and not off an external drive?

Yes for the 700ms, which is a best case scenario.  So caching becomes even more important for reading media from a camera card over USB3.
Logged
[url=http://www.flickr.com/photos/roryhi

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Lightroom preview performance mini-rant
« Reply #28 on: February 19, 2016, 05:34:00 pm »

Rory, you know more about it than I do.

This slow thumbnail preview issue happens in Bridge as well but at least Bridge gives me the option of "Browse Quickly By Preferring Embedded Images" setting where they immediately show as low saturation, dim and fuzzy. Once I click on one of the newly transferred to HD from SD card images the ACR defaults kick in and the rest in the strip begin to slowly render the same.

In existing formerly worked on folder of images with their respective xmp edits, some are faster than others depending on Adjustment Brush, cropping, lens profile applied and spot removal. The fastest of course are those I hadn't gotten to which render with ACR defaults but even that is pretty slow and these are 6MP Raws viewed in CS5 Bridge.

I've actually located the directory that contains the jpeg previews of various sizes generated (cached) by Bridge and they all have sRGB embedded in them. They show the previews that reflect those that have been edited and those that have not. I wouldn't know how an app can keep track of that many thumbnails of various editing stages.
Logged

Rory

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 528
    • Recent images
Re: Lightroom preview performance mini-rant
« Reply #29 on: February 19, 2016, 05:36:48 pm »

Have you tried the latest version of Bridge (6.2.0.179) Tim?  I've noticed quite a boost in performance and rendering quality.
Logged
[url=http://www.flickr.com/photos/roryhi

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Lightroom preview performance mini-rant
« Reply #30 on: February 19, 2016, 06:14:18 pm »

No, Rory, I haven't tried it.

I'm a bit burned out on upgrading image editing software. I've had to re-edit quite few of my thousands of Raws/jpegs for the third time, first with CS3, then CS5 and now LR4 with PV2012 so I'm a bit tired of it.

I can live with the thumbnail slowness. Editing is fast enough and that's what counts for me. The preview appearance at different zoom levels has been the most help in CS5. At least I can get a decent preview match between ACR 6.7 at 25% view and how it shows up in Photoshop at the same zoom level. Even my 6MP Raws viewed at 100% is difficult to get an overall look in how it downsizes for the web. And it certainly doesn't tell me how it will look on an 8x10 print.
Logged

Rory

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 528
    • Recent images
Re: Lightroom preview performance mini-rant
« Reply #31 on: February 19, 2016, 06:36:18 pm »

I know what you mean.   ;D
Logged
[url=http://www.flickr.com/photos/roryhi

Osprey

  • Full Member
  • ***
  • Offline Offline
  • Posts: 102
Re: Lightroom preview performance mini-rant
« Reply #32 on: February 19, 2016, 11:50:04 pm »

I recently built a new photo machine, also Skylake, 6700k with 32gb of RAM. 50k or so photos in my catalog, I've been pleased with Lightroom's speed upgrade with browsing now. However, I installed an M2 PCI SSD drive that has my OS on it. I moved my Lightroom catalog and previews to it as well, but the browsing was still faster than it had been when the catalog was still sitting on a standard hard drive.
Logged

Rory

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 528
    • Recent images
Re: Lightroom preview performance mini-rant
« Reply #33 on: February 20, 2016, 12:12:01 am »

I recently built a new photo machine, also Skylake, 6700k with 32gb of RAM. 50k or so photos in my catalog, I've been pleased with Lightroom's speed upgrade with browsing now. However, I installed an M2 PCI SSD drive that has my OS on it. I moved my Lightroom catalog and previews to it as well, but the browsing was still faster than it had been when the catalog was still sitting on a standard hard drive.

Sounds like a nice setup.  What size monitor do you have and how big are your files?  How about run-on, where if you hold down the forward key, the previews keep on paging after you lift the key.  Try moving through images on a media card while in the import module.  This is pretty basic stuff that almost every image viewer does with ease on quite moderately powered machines.
Logged
[url=http://www.flickr.com/photos/roryhi

Simon Garrett

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 742
Re: Lightroom preview performance mini-rant
« Reply #34 on: February 20, 2016, 05:34:54 am »

I'm a bit burned out on upgrading image editing software. I've had to re-edit quite few of my thousands of Raws/jpegs for the third time, first with CS3, then CS5 and now LR4 with PV2012 so I'm a bit tired of it.

Why is that?  I mean: Lightroom still has PV2010 and PV2003, so photos you've finished editing still render the same as before.  Why would you need to re-edit?  You can still edit in those previous versions if you need further editing.  I'm not sure what changed in CS3 and CS5, but again, if you've finished editing, why would you need to re-edit?

I think I'm missing something!
Logged

Damon Lynch

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 330
    • http://www.damonlynch.net
Re: Lightroom preview performance mini-rant
« Reply #35 on: February 20, 2016, 05:36:34 am »

Exiv2 is the go-to library for image metadata in C++. It's not as fast as single-purpose highly tuned custom code, of course, but given how long it has been around it will surely cover far more edge cases, such as where manufacturers have encoded metadata in non-standard, surprising and  short-sighted ways. Having said that Exiftool is of course the gold standard for metadata coverage and reliability.

I haven't looked at your code Rory, but based on you mentioning having 4 threads, have you considered making the exif and thumbnail extraction an asynchronous operation after the file read? In other words, one thread that simply reads from disk and pretty much nothing else, and a small pool of threads that load the metadata and render the preview image in parallel to each other. That way you max out disk io, and take advantage of multiple cores to do the heavy rendering work. That's the approach my code takes. If all you're doing is extracting  the jpeg preview (and not rendering from the RAW data), you can read from only the portion of the RAW file you actually need, i.e. the metadata you want and the jpeg preview itself.  Unfortunately RAW files are not necessarily consistent in where they store that information in the file (some manufacturers are worse than others), but it can be made to work. Again that's what I do with my code.

Also did you look at the FOSS code the folks behind FastRawViewer maintain? I'm not sure if their code to render actual RAW previews (not the preview) using the GPU is FOSS or not. It might be. They've certainly done a lot of work to take dcraw in new directions.

I do agree with John that we need to compare apples with apples. LR and other converters are doing much more than extracting a preview. They're also doing a lot of heavy processing work, e.g. adding sharpening.
Logged

stingray

  • Full Member
  • ***
  • Offline Offline
  • Posts: 114
Re: Lightroom preview performance mini-rant
« Reply #36 on: February 20, 2016, 06:16:15 am »

Quote
Exiv2 is the go-to library for image metadata in C++

Thanks.
Logged

Rory

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 528
    • Recent images
Re: Lightroom preview performance mini-rant
« Reply #37 on: February 20, 2016, 11:20:15 am »

Thanks for your insight Damon.  I was not aware of rapid photo downloader.  Looks like a nice app and quite similar to mine in design goals.  I also have a renaming feature, albeit quite rudimentary,  which automatically creates a destination folder structure.  I have a selection option, where you can filter the import to only the images you pick.  I'm a wildlife photographer, and usually take many images of the same subject, hoping one or two will stand out.  No point in importing all the loser shots.

Exiv2 is the go-to library for image metadata in C++. It's not as fast as single-purpose highly tuned custom code, of course, but given how long it has been around it will surely cover far more edge cases, such as where manufacturers have encoded metadata in non-standard, surprising and  short-sighted ways. Having said that Exiftool is of course the gold standard for metadata coverage and reliability.

I tried Exiv2 but it had several problems.  First, it was a royal pain getting the library to work on a PC.  I never did get it to work with the 64 bit version of Qt.  Second, it does not work with some unicode, and I have unicode in my metadata.  Finally, this was an exercise for me to figure out how stuff works.

I haven't looked at your code Rory, but based on you mentioning having 4 threads, have you considered making the exif and thumbnail extraction an asynchronous operation after the file read? In other words, one thread that simply reads from disk and pretty much nothing else, and a small pool of threads that load the metadata and render the preview image in parallel to each other. That way you max out disk io, and take advantage of multiple cores to do the heavy rendering work. That's the approach my code takes. If all you're doing is extracting  the jpeg preview (and not rendering from the RAW data), you can read from only the portion of the RAW file you actually need, i.e. the metadata you want and the jpeg preview itself.  Unfortunately RAW files are not necessarily consistent in where they store that information in the file (some manufacturers are worse than others), but it can be made to work. Again that's what I do with my code.

Since reading the file is the most expensive operation, as you mention, I only read the parts I need: some metadata, the small thumbnail JPEG and the larger JPEG preview.  I need to read the metadata first in order to find the small and larger JPEG data and their dimensions.  I get thumbnails and the first couple of previews immediately, and then keep reading the rest to make the app as responsive as I can.  Since all I am doing is displaying the JPEGs without any processing, that part goes pretty fast.  I'll have to look at separating the read and the conversion to a bitmap - I had not thought about that.  The only raw files I have worked on so far are NEF and CR2.  If I get serious I'll likely have to go the third party route for metadata.

Also did you look at the FOSS code the folks behind FastRawViewer maintain? I'm not sure if their code to render actual RAW previews (not the preview) using the GPU is FOSS or not. It might be. They've certainly done a lot of work to take dcraw in new directions.

I'll check that out.  To date I have not looked at other folks code for a couple of reasons.  First I'm still learning and other code can be really hard to understand before you really know a language and the file structures - I've only been at this for 3 months and it has been one massive learning curve after another.  Second, as I've mentioned, this has been a bit of a challenge for me to see if I can figure this stuff out for myself.

I do agree with John that we need to compare apples with apples. LR and other converters are doing much more than extracting a preview. They're also doing a lot of heavy processing work, e.g. adding sharpening.

Lets break this up into the import and the library preview functions.

At the import stage all they need to show is the embedded previews, which are presharpened based on your camera settings.  It is pretty obvious to me that there is not any image precaching going on here.  This appears to be completely apples to apples with what I am doing.

In the library I understand there is a lot of processing that occurs to create the previews.  However, after the previews have been built it should be an apples to apples comparison.  However, Lr is not very smart at generating the previews I want when I want them.  It is not very good at fast sequential image review.  It is not very good at stopping when I do.
Logged
[url=http://www.flickr.com/photos/roryhi

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Lightroom preview performance mini-rant
« Reply #38 on: February 20, 2016, 02:33:19 pm »

Why is that?  I mean: Lightroom still has PV2010 and PV2003, so photos you've finished editing still render the same as before.  Why would you need to re-edit?  You can still edit in those previous versions if you need further editing.  I'm not sure what changed in CS3 and CS5, but again, if you've finished editing, why would you need to re-edit?

I think I'm missing something!

To be more clear the interface comprising previews and the way ALL sliders act on the preview are not intuitive and clear enough to know what to do on the next shot. I shoot under constantly changing available light, dynamic ranges and mixed color temps where each image requires changing exposure and thus different edits on an image by image basis.

Another fly in the ointment is when I've finished the image the second time in CS5 and decide to see if LR4's PV2012 can do it better, when I click the PV update button the entire image gets screwed up in both color, clarity and contrast that it's easier to just start from scratch under LR4 defaults. See image sample below. That's one of the better PV conversions, most are really bad.

Also some of the re-edits or re-visits ...(because Raw shooter proponents said to shoot Raw because Raw converter technology is constantly improving...remember that?)... are from spending more time getting more familiar with additional tools like the adjustment brush and the fact PV2010's linear exposure slider behavior by zeroing out all other sliders is something I didn't implement till later on. And that was a big improvement in getting more highlight detail.

LR4 PV2012 changed that so I had to re-learn where to get back the linearity in the other sliders. NOT SO INTUITIVE IS IT?!
Logged

Damon Lynch

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 330
    • http://www.damonlynch.net
Re: Lightroom preview performance mini-rant
« Reply #39 on: February 21, 2016, 01:29:14 am »

Thanks for your insight Damon.  I was not aware of rapid photo downloader.  Looks like a nice app and quite similar to mine in design goals.  I also have a renaming feature, albeit quite rudimentary,  which automatically creates a destination folder structure.  I have a selection option, where you can filter the import to only the images you pick.  I'm a wildlife photographer, and usually take many images of the same subject, hoping one or two will stand out.  No point in importing all the loser shots.

The only thing my app is meant to do is help you download, rename and backup. Nothing else.  Users ask me for new features like adding metadata entry but I tend to say no  8)

I'm in the middle of the biggest rewrite to the code since it I first developed it, moving the code from Gtk to Qt, 0MQ for interprocess messaging, and to call libgphoto2 directly, among many other changes and feature additions. Qt does have a steep learning curve, as do 0MQ and gphoto2 (and interacting with the Linux udisks subsystem)!

Hopefully with the move to Qt and 0MQ, it will make it relatively easy for someone to port it to Mac and Windows (allowing for the fact that Windows doesn't have gphoto2). I don't use a Mac, but it seems Mac users don't have the equivalent of Rapid Photo Downloader or Breeze Systems Downloader Pro. Is that right?

Quote
I tried Exiv2 but it had several problems.  First, it was a royal pain getting the library to work on a PC.  I never did get it to work with the 64 bit version of Qt.  Second, it does not work with some unicode, and I have unicode in my metadata.  Finally, this was an exercise for me to figure out how stuff works.

The KDE folks have a package that makes exiv2 callable directly from Qt. Did you try that? I think it's called libkexiv2.

Quote
Since reading the file is the most expensive operation, as you mention, I only read the parts I need: some metadata, the small thumbnail JPEG and the larger JPEG preview.  I need to read the metadata first in order to find the small and larger JPEG data and their dimensions.  I get thumbnails and the first couple of previews immediately, and then keep reading the rest to make the app as responsive as I can.  Since all I am doing is displaying the JPEGs without any processing, that part goes pretty fast.  I'll have to look at separating the read and the conversion to a bitmap - I had not thought about that.  The only raw files I have worked on so far are NEF and CR2.  If I get serious I'll likely have to go the third party route for metadata.

The challenge about separating the read from the conversion is that you'd need some kind of simple load balancer to keep the workers correctly loaded. Another challenge is the shared memory. I'm not a C++ coder so I''ve no idea how it handles memory between threads, especially given you'd like to avoid  expensive memory copy operations.

I wrote some code that analyzes what exiv2 reads when it loads metadata or metadata+previews from pretty much every RAW format I could get hold of. I'd have to say one or two manufacturers made some "interesting" choices regarding their format layout!

Quote
Lets break this up into the import and the library preview functions.

At the import stage all they need to show is the embedded previews, which are presharpened based on your camera settings.  It is pretty obvious to me that there is not any image precaching going on here.  This appears to be completely apples to apples with what I am doing.

It's interesting you should point that out, because that's the approach taken by Bibble 5 / Aftershot. Many folks here tend to look down upon that program as poor quality (and indeed its image conversion and feature set are absolutely subpar compared to LR) but I've long maintained that those guys got the performance side of things exactly right. It's simply very fast generating previews, and showing them as quickly as possible when you click on a folder full of thousands of images.

Logged
Pages: 1 [2] 3   Go Up