libjpeg, libpng

libjpeg, libpng

Post by Joachim Rosskop » Fri, 20 Apr 2001 02:18:26



Hello,

I'm currently working on a project which uses libpng and libjpeg. As it
is an embedded system there is no possibilty to use a real file system.
So image data grabbed from a v4l device is read into buffer referenced by
a pointer. This pointer should now be given to the compressing function.
And that is the problem: libjpeg as well as libpng can only write into a
file. We would prefer to get a buffer with the compressed image back.
Now i would like to know if anybody has solved this problem yet.

Thank you in advance ...

Joachim
--
Outta the depth of kernel:
/* * me gently with a chainsaw... */
/usr/src/linux/arch/sparc/kernel/ptrace.c:69

 
 
 

libjpeg, libpng

Post by Wolf Fau » Fri, 20 Apr 2001 09:58:30


On Wed, 18 Apr 2001 19:18:26 +0200, "Joachim Rosskopf"


>I'm currently working on a project which uses libpng and libjpeg. As it
>is an embedded system there is no possibilty to use a real file system.
>So image data grabbed from a v4l device is read into buffer referenced by
>a pointer. This pointer should now be given to the compressing function.
>And that is the problem: libjpeg as well as libpng can only write into a
>file. We would prefer to get a buffer with the compressed image back.
>Now i would like to know if anybody has solved this problem yet.

libpng allows the calling app to specify a file IO function (check out
png_set_read_fn() ). Works fine here. I do use this in order to do
double buffered async file IO for dramaticly increasing read/write
speed (speed increase of up to 100% on my machine are not uncommon...
impressive).

I would also recommend checking out the  libtiff package. In the
contrib drawer you find source for standard file IO functions working
on memory instead of a file.

When it comes to libjpeg: here you have to replace the fileIO
functions during compile time of the library. Again, things are rather
simple as all file IO is done using the JFREAD macro.

--

Tel: ++49-69-5486556                WWW:   www.coloraid.de
Mobile: ++49-179-6924769            Fax:  ++49-69-95409598

 
 
 

libjpeg, libpng

Post by Joachim Rosskop » Sat, 21 Apr 2001 06:26:21



> libpng allows the calling app to specify a file IO function (check out
> png_set_read_fn() ). Works fine here. I do use this in order to do
> double buffered async file IO for dramaticly increasing read/write speed
> (speed increase of up to 100% on my machine are not uncommon...
> impressive).

> I would also recommend checking out the  libtiff package. In the contrib
> drawer you find source for standard file IO functions working on memory
> instead of a file.

> When it comes to libjpeg: here you have to replace the fileIO functions
> during compile time of the library. Again, things are rather simple as
> all file IO is done using the JFREAD macro.

> --

> ++49-69-5486556                WWW:   www.coloraid.de Mobile:
> ++49-179-6924769            Fax:  ++49-69-95409598

Hello,

would you like to show me the snippet of code in which you advise libpng
by calling png_set_write_fn() to use your own png_usr_write() function.
I would be very grate if that is possible.

Thank you

Joachim
--
Outta the depth of kernel:
/* * me gently with a chainsaw... */
/usr/src/linux/arch/sparc/kernel/ptrace.c:69

 
 
 

libjpeg, libpng

Post by Ferenc Wagne » Thu, 26 Apr 2001 07:03:20



> And that is the problem: libjpeg as well as libpng can only write into a
> file. We would prefer to get a buffer with the compressed image back.
> Now i would like to know if anybody has solved this problem yet.

A possible option, if your library supports it:
info libc --i open_memstream
Good luck!
                                        Feri.