Subject: Re: [boost] GIL io_new review
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2010-12-13 11:19:08


Lubomir Bourdev wrote:
> If your input is not a stream, the code doesn't use streams; it
> operates straight to FILE*. But if you start with a stream, then
> it uses a stream.

"Not a stream" does not always imply that it's a file. The case that
I, and I think Domagoj, would like to see handled better is when the
data is in memory. For example, libjpeg has a function jpeg_mem_src()
which could be used as follows:

void read_jpeg_image_from_mem(const char* begin, const char* end,
gil::image dest)
{
   .....
   jpeg_mem_src(...., begin, end-begin);
   .....
}

So there is basically no overhead. Wrapping a block of memory up in a
stream, and then unwrapping it again to pass it to the image library's
C API, and pulling in another Boost library like Boost.IOStreams to do
so, looks like overkill.

Regards, Phil.