Welcome! Log In Create A New Profile

Advanced

libjpeg using a buffer as data source

Posted by JustWoody 
libjpeg using a buffer as data source
August 02, 2008 10:23AM
Has anyone created there own decompression source manager for libjpeg that uses a buffer as a data source instead of a file?

Or can anyone point me in the right direction to do this?
Re: libjpeg using a buffer as data source
August 02, 2008 11:28PM
To do that, you'll probably need to find a way to draw onto the data source. May I reccomend a library to help get you started?

libwiisprite

GRRLIB
Re: libjpeg using a buffer as data source
August 03, 2008 01:48AM
Thank you Arikado, I already use GRRLIB.

GGRLIB and I think libwiisprite only deals with png files I want to use libjpeg to use jpeg files instead as these are about 4 times smaller.

I've read the documentation with libjpeg, but there is no input except from a file, whereas I would like to use a jpeg that has been converted to 'c' using something like raw2c
Re: libjpeg using a buffer as data source
August 03, 2008 02:01AM
You can set jpeg.inbuffer to any buffer and the size of the buffer with jpeg.inbufferlength then you only need to call JPEG_Decompress(&jpeg) and so on (see example).

like this
jpeg.inbuffer = bufferdata;
jpeg.inbufferlength = buffersize;

JPEG_Decompress(&jpeg);
Re: libjpeg using a buffer as data source
August 03, 2008 11:43AM
The version I am using does not have inbuffer or inbufferlength on the jpeg_decompress_struct. In fact it also doesn't have the jpeg_decompress() method too! I've got th eone from the SDL lib port.

Could you point me in the direction of the lib that does include this stuff please.
Re: libjpeg using a buffer as data source
August 03, 2008 03:56PM
You can find it here [tehwii.tehskeen.com]
or for a newer version on [www.tehskeen.com]
but if you using SDL i would recommend to use the SDL image functions it´s much easier you can find it here [code.google.com] the SDL_image.7z and SDL_gfx.7z (to manipulate the size and so).
Re: libjpeg using a buffer as data source
August 10, 2008 05:41PM
I am sure that there will be jpg support in libwiisprite soon enough.
Re: libjpeg using a buffer as data source
August 10, 2008 05:46PM
I'm sure it will never happen, chaosteil (or feesh, don't remember anymore) told me.
Sorry, only registered users may post in this forum.

Click here to login