unpack() performance?

Hi everyone,

I am new to LibRAW and I am wondering if the unpack() performance should be that slow. I am using LibRAW on a Windows 32-bit program and unpack()+dcraw_process() take around 20 seconds for a typical 6000x4000 image. I tried several RAW file formats: NEF, CR2, Sony, Olympus and all file load very slowly.

Then I took a look at FastRawViewer that is using LibRAW and (if I am right) do not display a JPEG preview, and it load the same RAW files in 1 second!

I double-checked that my program was compiled in released, so I don't understand... my PC is a Intel iCore7 with 8 Gb. What is the typical time to load a RAW file using LibRAW?

I did not tried RawSpeed as I read that speed up is only signifiant for CR2 files...

Thanks in advance for any help.

Forums: 

What do you measure, is it

What do you measure, is it unpack() or unpack()+dcraw_process()?

-- Alex Tutubalin

The sum of the two calls

The sum of the two calls unpack()+dcraw_process().

unpack() is about 8-10s (11 sec for a 24mp DNG) and dcraw_process() is around 8-10s too.

except for a raw file from Sony a6500 where unpack() take only 0.4 sec. May be uncompressed pixel data?

Are the timing normal? Are there any tips to reduce the loading time?

Thank you.

No, this is not normal (for

No, this is not normal (for unpack):
Simple test: - add return 0 to simple_dcraw.cpp test just before dcraw_process() called (so, only unpack)
$ time ./bin/simple_dcraw ~/CR2/IMG_0058.CR2 (this is Canon 6D MarkII image, 24Mpix)
time: real 0m1,310s
test computer: Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz , 8GB RAM.

What is your 'Intel i7' CPU, what specific model?

-- Alex Tutubalin

Thanks for your reply Alex

Thanks for your reply Alex and happy to read that this is not normal.

My CPU is Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz (4 CPUs), ~2.6GHz

I will try to compile your samples to see if I get the same result. At the moment, I just tried to use LibRaw by adding source code (internal, src and libraw folders) directly to my project, then builded it in release. The project is a C++/CLR dll that I call in C#, may be there is something that prevent optimizations. I will check and let you know :)

Problem solved.

Problem solved.

I think it was due to my C++/CLR project. When tested from Visual Studio in release, unpack time was 11s.
When tested outside of Visual Studio, time was 2.6s.
Then I tested to use the libraw.dll instead of embedding the code in my project directly and unpack time was 1.1 sec, same timing than the postprocessing_benchmark project.

I still don't know why the dll is faster than compiling the code in my project, but that's fine :)

Thank again for confirming that I had a problem!

Looks like you have some

Looks like you have some runtime checks turned on (not initialized variables, array bounds check, etc).

Also, Visual Studio's heap debug slows down every program w/ large memory allocations (when run inside Visual Studio)

-- Alex Tutubalin