Hi team,
I had a question about whether libraw can be used to read and process RAW files in a multithreaded application when using the single-threaded library version. I was not able to get a clear idea based on the API description page: https://www.libraw.org/docs/API-notes.html.
I plan to create a rawProcessor and read a file on a single thread. I plan to use multiple threads to read multiple files simultaneously.
My workflow is something like:
LibRaw rawProcessor;
rawProcessor.open_file(fileName);
rawProcessor.dcraw_process();
libraw_processed_image_t *image = rawProcessor.dcraw_make_mem_image(&ret);
OR
LibRaw rawProcessor;
rawProcessor.open_file(fileName);
copyData(rawData.raw_image, out)
on each thread.
Do I need to link against libraw_r version of the library on Linux and Mac? I believe the Windows version is already thread safe.
Dinesh
Yes, you need to link with
Yes, you need to link with libraw_r on Mac/Linux (and, yes, Windows build is thread-safe)
Also, thread stack may be too small for on stack allocation (LibRaw rawProcessor), so dynamic allocation is preferred (LibRaw *rawProcessor = new LibRaw;)
-- Alex Tutubalin @LibRaw LLC