Closed z-pc closed 3 years ago
In "pixReadStreamJpeg(...)", why we did not use "jpeg_mem_src(...)" to read directly from buffer data instead of from FILE ?
We have to support all platforms, so writing to a temp file is a fallback when you don't have functions like fmemopen() that redirect to a buffer.
As for jpeg_mem_src(), this was added in jpeg-8 about 4 years ago. We can't assume that users have that version (or later) of lthe jpeg library. Maybe in a few years ...
Another option is to write the code to handle the buffers, as T. D. Hintz did for png. This is a significant job to get right, even though there are existing implementations, and it's not a high priority right now.
In any event, I know it is not ideal to use a temp file, but it doesn't cause a big hit to performance because the compression and decompression takes much longer than writing and reading bytes to file.
Yeppp, I tried changes that read from buffer, performance is not significantly reduced, at least with jpg, about 10% for "pixReadMem (...)". Thanks for responds
This is not issue, I'm using tesseract. On Windows, I trying read image from bytes array that I extracted from PDF file, pass to "pixReadMem(...)", some warning about leptonica write it to a temp file.
work-around: writing to a temp file
I'm interested in performance, looks like this will reduce its, only on Linux was supported "HAVE_FMEMOPEN". Will Windows be supported for this in the near future?
OS: Windows Compiler: MVC++ 14
Forgive me if this isn't where to discuss this, I can't find the user group