CDROM reading speed

Ask anything your want about Mega/SegaCD programming.

Moderator: Mask of Destiny

TmEE co.(TM)
Very interested
Posts: 2442
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Jan 31, 2007 1:37 pm

Fonzie wrote:Steve told me to put dummy data to reach maximum bitrate and avoid any seeking problem between each chunk of 1second fmv... That would work but it is extremely "sad" method.
I don't know if it helps, but Sonic CD uses this method, after 3 frames(or more, I don't remember) there's lots of "nothing". I guess, they used this to get some speed. Personally I don't use dummy data. Well, thing is on CD, lots of space, why not.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Sun Feb 04, 2007 6:24 pm

Yeah, i would like to avoid dummy... haha :P
Could someone add a feature in genskmod to log every D0 data at each 0x5f22 jump (subcpu 68000) in a .txt file ,it would be extremely usefull to know how the games do :P

So far, i think Bugblaster uses the dummy thing too...


I have another idea that would let loading two seconds of FMV in the buffer but it would require the fallowing :
-Do not use anymore the 128KB*2 Flip flop ram.
-Use BusRequest to dma 96tiles periodicaly from subcpu ram to VRAM (with finger crossed that it wouldn't slowdown the cdrom read rate).

I just wonder if any FMV engine do that (DMA from SubCpu ram to VRAM while subcpu is reading data off disc). Any idea?

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Mon Feb 12, 2007 10:15 am

Okay :D
I read that the cdrom exact speed is 75sectors a second :P

So I put 75sectors / second bitrate :P and it worked on real hardware :D
No need to pause/unpause or anything like that now :)
I fear that if the disc is scratched, the bitrate would slowdown => big glitches in the pcm playback...
But I hope it is a safe method for use in a real game... I hope :'(

http://www.genny4ever.net/temp/yatta_eqxpro8.mov

So, from what i've experimented, seeking or pause/unpause takes around 0.5 second if well done... So if you want to read a stream that require more than 0.4-0.5 second reading per second (around 50KB/sec), it cannot work on real hardware :)

Thank you all for all your advices.

Now I start to think that all the compression schemes I had to implement to make a mad VBR are quite useless, that's uber sad... LOL
Actualy, with a 75sectors/second bitrate, it could be possible to rise to 14fps FMV. But 10fps would be more reasonable (was 8fps actualy) :)

Mask of Destiny
Very interested
Posts: 616
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Tue Feb 13, 2007 5:39 am

Oh, so you were trying to pause the disc while you went and did something else for a while and then unpaused it afterwords because you didn't have an exact 75 sector/second data rate? No wonder you were having speed problems.

You're never going to get anywhere near full speed on the Sega CD CD-ROM drive unless you're reading a continuous stream of data. From the physical limitations of a 1X drive alone you could be looking at a .1 to .2 second delay just waiting for the disc to spin around to the right position again.
I fear that if the disc is scratched, the bitrate would slowdown => big glitches in the pcm playback...
But I hope it is a safe method for use in a real game... I hope :'(
I don't think you need to worry. None of the commercial FMV games handled disc errors very well from what I recall.

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Tue Feb 13, 2007 11:39 am

Oh, so you were trying to pause the disc while you went and did something else for a while and then unpaused it afterwords because you didn't have an exact 75 sector/second data rate? No wonder you were having speed problems.
haha, i'm a bit stupid... sorry :D
The advantage of 75sectors per second is that i can seek anywhere in my video file :P With VBR, it was impossible.
I don't think you need to worry. None of the commercial FMV games handled disc errors very well from what I recall.
Thx for the confirm, I added error detection... It says "error" but don't try any work around yet ;)

:D

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Tue Feb 13, 2007 9:38 pm

Okay, new issue :)

In fact, my previous code was synchronized with the PCM playback... :P
My maincpu code was displaying a bit faster than pcm playback and loading was also requested around the playback.

Now that I had (thx to your advices) synchronized with the cdrom fullspeed (suposely 75sectors per seconds)... I still let my display bit faster. But i get big trouble to get the pcm working correctly... If you get what i mean...

My actual pcm technique uses two banks of 16KB each (1second each), so, when one bank is played, i reload the other one...
To make the synch, i just wait that the pcm chip go from one bank to another.

As you may understood, i cannot use this method anymore (since it appear that the pcm plays a bit faster than the loading).

I had in mind a trick that would consist of slowdowning the pcm playback if the pcm buffer comes "too empty". And get it normal speed when it comes "too full" (if too full, i have to wait more, not good for loading synchro).
Do you think its a good idea?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue Feb 13, 2007 10:38 pm

Fonzie wrote:Okay, new issue :)

In fact, my previous code was synchronized with the PCM playback... :P
My maincpu code was displaying a bit faster than pcm playback and loading was also requested around the playback.

Now that I had (thx to your advices) synchronized with the cdrom fullspeed (suposely 75sectors per seconds)... I still let my display bit faster. But i get big trouble to get the pcm working correctly... If you get what i mean...

My actual pcm technique uses two banks of 16KB each (1second each), so, when one bank is played, i reload the other one...
To make the synch, i just wait that the pcm chip go from one bank to another.

As you may understood, i cannot use this method anymore (since it appear that the pcm plays a bit faster than the loading).

I had in mind a trick that would consist of slowdowning the pcm playback if the pcm buffer comes "too empty". And get it normal speed when it comes "too full" (if too full, i have to wait more, not good for loading synchro).
Do you think its a good idea?
I'm probably missing something but just in case :
what not use more than 2 buffer ? what about a circular 4 or 8 buffers ?
it's typically what i'm doing with all sound playback stuff : using a circular buffer where one is read, another is write and others buffer permit you some delay in fill compute. More you have buffer, more lag you can support ;)

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Tue Feb 13, 2007 11:13 pm

Haha, i think you missed something :) But yeah, i'm using a sort of circular buffer divided into two big loading banks of 1second each one (reloaded per chunck of 256bytes while reading data from disc, a mad system)... :P

My problem is that my audio streaming is fixed to the cdrom speed.... So after, lets say 20seconds, if there is a little speed difference, the pcm buffer gets stuck :P

I fixed it by slowdowning the playback when the pcm buffer is too empty and it works... but sounds a bit distord at some points LOL, like old road avenger game LOL :)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Feb 14, 2007 8:47 am

Fonzie wrote:Haha, i think you missed something :) But yeah, i'm using a sort of circular buffer divided into two big loading banks of 1second each one (reloaded per chunck of 256bytes while reading data from disc, a mad system)... :P

My problem is that my audio streaming is fixed to the cdrom speed.... So after, lets say 20seconds, if there is a little speed difference, the pcm buffer gets stuck :P

I fixed it by slowdowning the playback when the pcm buffer is too empty and it works... but sounds a bit distord at some points LOL, like old road avenger game LOL :)
ah ok i got it ;)
There is no way of perfectly synchronise cd speed and your audio stream by choosing a 1/75s multiplier output rate for your audio sample rate (11025, 15000 for example) ? anyway if your method works, it's ok :)

Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie » Wed Feb 14, 2007 11:27 am

No prob :), I think i'll try to find a good "speedup" ratio... that isn't noticable :)

The official documentation about the pcm chips is simply insane... All the addresses are wrong... and the "sample rate" registers are absolutely mad (i could find good values, but it was by checking allmost all possibilities).

But, wouldn't the segacd beeing a great system for DJ's ? :P oversampling and downsampling channels is simply amazing... we can make some scratch, reverb... :P And the segacd ram can store a lot of samples... I'm surprised that no segacd games did experimental things with it.

Post Reply