fopen/open vs sceIoOpen vs libjpeg

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
willow :--)
Posts: 107
Joined: Sat Jan 13, 2007 11:50 am

fopen/open vs sceIoOpen vs libjpeg

Post by willow :--) »

I am using libjpeg.h in order to load lots of files.

The standard functions of libjpeg expect a FILE *.
for example the one I am currently using :

Code: Select all

jpeg_stdio_src(&cinfo, fp);
However I've read several times that it is preferred (for performance reasons) to use sceIoOpen rather than fopen when opening files...

However sceIoOpen returns as sceUID object, not a FILE *


What are my options ? Which one do you think is the best ?


- Should I use fopen anyways and not care about speed to much ?

- Is there a modified libjpeg for the PSP ? if so, where is it ? (where did the svn go ?)

- I saw an attempt to read a jpeg from memory rather than a file. Unfortunately the code doing this had a memory leak and is not usable currently. Do somebody know a way to do simply read a jpeg from memory rather than a file, using libjpeg ?

- Any other trick that I should know about ? Any easy way to convert a SceUID into a FILE * or something ?

Thanks in advance for your answers.
CpuWhiz
Posts: 42
Joined: Mon Jun 04, 2007 1:30 am

Post by CpuWhiz »

The SVN is still there:

Code: Select all

svn co svn://svn.ps2dev.org/psp/trunk/jpeg
If you look at jpeg_stdio_src in jdatasrc.c, I am sure you can get an idea of how to create a set of functions and fill your cinfo to get it reading any way you like (memory, file, network stream, whatever you like). I'm just not sure if it's worth your time. I have not benchmarked the two, but if it's working I would move on to something else. If when you go back to optimize it's really bogging things down, then I would look into fixing it.
willow :--)
Posts: 107
Joined: Sat Jan 13, 2007 11:50 am

Post by willow :--) »

Thanks, that answers my questions. I should rather focus on the rest of my project, then optimize when (if) it is complete and working.

And thanks for the svn. Apparently the Web interface disappeared, and I didn't even try with a standard svn client.
Post Reply