Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.81k
stars
393
forks
source link
Make pix{Read,Write}MemJp2k work via direct memory access #732
On platforms lacking open_memstream(), pix{Read,Write}MemJp2k() worked via a temporary file, but this overhead is unnecessary as openjpeg2000's opj_stream interface allows one to read/write directly from a memory buffer by supplying it with appropriate callbacks. This PR makes pix{Read,Write}MemJp2k() use this more direct mechanism on all platforms.
In addition, since pixReadStreamJp2k() always reads the whole stream into memory when it called fgetJp2kResolution(), this PR saves a bit of compute resources by in effect making pixReadStreamJp2k() into a wrapper for pixReadMemJp2k().
On platforms lacking
open_memstream()
,pix{Read,Write}MemJp2k()
worked via a temporary file, but this overhead is unnecessary as openjpeg2000'sopj_stream
interface allows one to read/write directly from a memory buffer by supplying it with appropriate callbacks. This PR makespix{Read,Write}MemJp2k()
use this more direct mechanism on all platforms.In addition, since
pixReadStreamJp2k()
always reads the whole stream into memory when it calledfgetJp2kResolution()
, this PR saves a bit of compute resources by in effect makingpixReadStreamJp2k()
into a wrapper forpixReadMemJp2k()
.