preview of my project

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
User avatar
kouky
Posts: 48
Joined: Tue Sep 25, 2007 5:38 am
Location: London
Contact:

preview of my project

Post 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:
Image

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 :)
softwares for artists on video game systems - http://www.pikilipita.com
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post 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.
User avatar
kouky
Posts: 48
Joined: Tue Sep 25, 2007 5:38 am
Location: London
Contact:

Post 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...
softwares for artists on video game systems - http://www.pikilipita.com
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post 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. :-)
User avatar
kouky
Posts: 48
Joined: Tue Sep 25, 2007 5:38 am
Location: London
Contact:

Post 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)
softwares for artists on video game systems - http://www.pikilipita.com
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post 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
User avatar
kouky
Posts: 48
Joined: Tue Sep 25, 2007 5:38 am
Location: London
Contact:

Post 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:
Image

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(); ???
softwares for artists on video game systems - http://www.pikilipita.com
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post 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&#40;&#41;
&#123;
	u32 endofprogram = &#40;u32&#41;&_end;
	u32 endofheap = &#40;u32&#41;EndOfHeap&#40;&#41;;	

	return endofheap - endofprogram;
&#125;

void PrintSize&#40;FILE *fd, u32 size&#41;
&#123;
	u32 mb = size / &#40;1024*1024&#41;;
	u32 kb = &#40;size - &#40;mb*1024*1024&#41;&#41; / 1024;
	u32 b = size - &#40;mb*1024*1024&#41; - &#40;kb*1024&#41;;
	
	fprintf&#40;fd, "%i MB %i KB %i B\n", mb, kb, b&#41;;
&#125;

int main&#40;int argc, char *argv&#91;&#93;&#41;
&#123;
	printf&#40;"HeapSize&#58; "&#41;;
	PrintSize&#40;stdout, HeapSize&#40;&#41;&#41;;

	return 0;
&#125;
When running this program you get the following result.

Code: Select all

HeapSize&#58; 30 MB 839 KB 64 B
TracerH
Posts: 5
Joined: Sun Feb 24, 2008 8:55 pm

Post by TracerH »

Nice work kouky! Have fun at the party.
User avatar
kouky
Posts: 48
Joined: Tue Sep 25, 2007 5:38 am
Location: London
Contact:

Post 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:
Image

And a video of the software running:
http://pikilipita.com/vj/flv-player.php?mov=17

The PS2 is sooooo cool :)
softwares for artists on video game systems - http://www.pikilipita.com
User avatar
kouky
Posts: 48
Joined: Tue Sep 25, 2007 5:38 am
Location: London
Contact:

Post by kouky »

And finally, a photo of my last week live set :
Image
Glade festival / Overkill stage
softwares for artists on video game systems - http://www.pikilipita.com
Post Reply