Page 1 of 1
preview of my project
Posted: Mon Apr 28, 2008 10:46 pm
by kouky
I've been working for a few weeks now on a project about mixing video loops via the playstation 2.
So far, just the very basic function is completed: loading and displaying 4 video loops. Files are loaded from the USB storage, and it's very slow, I need to investigate into it!
a screenshot:
a video of the software running can be seen here:
http://pikilipita.com/vj/future/
I hope I'll be able to have a public presentation in a London club on 10th of May at:
Soxan party, the Big Chill House, King's Cross, London, UK !!
If you're London based, come and visit me at this event :)
Posted: Mon Apr 28, 2008 11:54 pm
by Lukasz
Nice to see new PS2 stuff, although a bit different from what we normally see :-)
I'm not familiar with the code for usbd and usb_mass, but usually when reading from I/O it best to do so in as large blocks as the hardware supports.
So if you are try to read for instance 4 bytes at a time in a loop, this will be much slower than just reading one big chuck. This is because it takes a long time (compared to a instruction cycle) to access the hardware, so you want to read/write as much data as possible for each I/O access.
Another thing to remember is that PS2 only has USB 1.1.
Posted: Wed Apr 30, 2008 11:59 pm
by kouky
Unfortunately, thtat exactly what I'm doing : loading one bit at a time in a loop...
I've been able to regroup some loading together to speed up a little bit the processus, but it's still slow...
Posted: Thu May 01, 2008 5:44 am
by Lukasz
If you need to transform the data as you load it and you therefor load 1 byte at a time, then I recommend loading the entire file into a memory buffer B with one read and then load the data from B and transform it. Eg. use memory as temporary buffer/cache.
I did this with the Doom port, the loading from host: went from minutes to a few seconds. It gave a ~100x speed or atleast that's what it felt like. :-)
Posted: Thu May 01, 2008 5:55 am
by kouky
Yeah, I thought about this solution but didn't liked the idea of having a buffer between 1 to 3 megs, but I guess I'll have to do it anyway.
What the function to know the size of a file?
The project is going pretty well, my last bug issue is I can't find a way to display and browse my USB stick folders via my software.
Which are the best examples/sources to look at?
( I launch my software using uLaunchElf, ny software is stored on the USB drive and the data I want to broswe is on this same usb drive)
Posted: Thu May 01, 2008 6:02 am
by Lukasz
To know the size of a file you need to use fseek(fd, 0, SEEK_END) and then use ftell()
http://www.cplusplus.com/reference/clib ... ftell.html
For loading from USB drive have a look at usb_mass and the included example.
Code: Select all
svn co svn://svn.ps2dev.org/ps2/trunk/usb_mass
Posted: Sat May 03, 2008 8:49 am
by kouky
Thanks Lukasz,
the loading is much faster now!
But loading the complete file in one time freezes the whole software for a few seconds (as seen in the new video). I'm considering loading files in 5 or 10 parts.
The project is going really well, almost ready for a gig.
a new screenshot:
and a new preview video , showing the concept of video grid!
Watch the preview #2 from here:
http://pikilipita.com/vj/future/index.html
Questyion: is there a way to know how much RAM is still available while the software is running?
something simple like: u64 freeRAM= memoryAvailable(); ???
Posted: Sat May 03, 2008 6:15 pm
by Lukasz
kouky wrote:
Questyion: is there a way to know how much RAM is still available while the software is running?
something simple like: u64 freeRAM= memoryAvailable(); ???
I had a look inside malloc.c in PS2SDK and it does not keep track of how much memory has been allocated and freeed, so you need to keep track of this yourself.
Your program (ELF) along with the stack will most likely not take up more than 1 MB of memory and the EE kernel sits in the first 1 MB of memory, so I think it's safe to assume that you have 32 - 2 = 30 MB of memory which you can malloc.
I made a small HeapSize() function which tells you exactly how much memory you can avaliable before the first malloc of your program, eg. size of the heap.
Code: Select all
#include <tamtypes.h>
#include <kernel.h>
#include <stdio.h>
extern void * _end;
u32 HeapSize()
{
u32 endofprogram = (u32)&_end;
u32 endofheap = (u32)EndOfHeap();
return endofheap - endofprogram;
}
void PrintSize(FILE *fd, u32 size)
{
u32 mb = size / (1024*1024);
u32 kb = (size - (mb*1024*1024)) / 1024;
u32 b = size - (mb*1024*1024) - (kb*1024);
fprintf(fd, "%i MB %i KB %i B\n", mb, kb, b);
}
int main(int argc, char *argv[])
{
printf("HeapSize: ");
PrintSize(stdout, HeapSize());
return 0;
}
When running this program you get the following result.
Posted: Fri May 09, 2008 6:51 am
by TracerH
Nice work kouky! Have fun at the party.
Posted: Sat Jul 26, 2008 8:51 pm
by kouky
I've performed 3 sets of visuals with my PS2 last week at the Glade festival in UK, it was great! (apart from freezes every 15 minutes)
I've worked a lot on my project sine my last post.
An updated screenshot of the application:
And a video of the software running:
http://pikilipita.com/vj/flv-player.php?mov=17
The PS2 is sooooo cool :)
Posted: Sat Jul 26, 2008 9:00 pm
by kouky
And finally, a photo of my last week live set :
Glade festival / Overkill stage