Jump to content
IGNORED

MP_STE video player for ATari ST(E) tutorial


Recommended Posts

I had a few ideas of a better way to do my Amiga movie player. Feedback appreciated.

 

Fix the resolution of the movie for my first attempt at doing this to simplify things. So for example I will take a 320x160 32 colour resolution as a start point.

 

So I could create a single file and load in blocks as you suggest. This file will be composed of uncompressed data so the images for the frames and the associated sound for each grouping of frames are at fixed regular intervals in the file. This means that if I create a file and this file goes as follows.....

 

| Frame1 | Frame2 | Frame3 | Frame4 | Frame5 | 0.2sec Sound Frames1-5 | Frame6 | ...

 

So the start of each 5 frames of video and it's associated 1/5th of a second of uncompressed 8 bit sampled sound will be at fixed points and can easily be loaded in segments of repeating equal sizes for each 20% of a second worth of movie.

 

So here is the key, the bit that sort of struck me after thinking about removing seek time delays for lots of tiny files and distinct separate audio/video files. What if I do the following....

 

1. Load the first 180kb (5 x 32kb frames and 20kb of sample data) of the file and begin to transfer it via DMA starting at one of two predefined chip memory address locations called start_addr1.

 

2. Load the next 180kb of the file into the second predefined address in chip memory called start_addr2.

 

REPEAT

 

3. IF audio sample not currently playing on left channel 2 and right channel 2 THEN......

Begin to play the 20kb of audio data stored at start and end address locations

(start_addr1 + 160kb) - (start_addr1 + 180kb) using left channel 2 and right channel 2.

ELSE go back to 3

 

4 Begin a loop to set beginning of screen memory to 5 values stepped through

(start_addr1) + 0

WAIT VSYNC x2

(start_addr1) + 32

WAIT VSYNC x2

(start_addr1) + 64

WAIT VSYNC x2

(start_addr1) + 96

WAIT VSYNC x2

(start_addr1) + 128

 

5 Start reading in next 180kb segment of file into chip ram at start_addr1 via DMA

 

6. IF audio sample finished playing on left channel 1 and right channel 1 THEN......

Begin to play the 20kb of audio data stored at start and end address locations

(start_addr2 + 160kb) - (start_addr2 + 180kb) using left channel 2 and right channel 2.

ELSE go back to 6

 

7 Begin a loop to set beginning of screen memory to 5 values stepped through

(start_addr2) + 0

WAIT VSYNC x2

(start_addr2) + 32

WAIT VSYNC x2

(start_addr2) + 64

WAIT VSYNC x2

(start_addr2) + 96

WAIT VSYNC x2

(start_addr2) + 128

 

8 Start reading in next 180kb segment of file into chip ram at start_addr2 via DMA

 

UNTIL end of file.

 

Worried audio would crackle due to gaps when no audio is being played or even overlap because I am locked to a VSYNC fiftieths of a second and that only gives the code as much time effectively as two 2/50th of a second for

 

a. setting the 5th,10th,15th,20th...... frames to display by writing a new screen memory location

b. initiate DMA transfer operation for reading in next segment of 180kb of data.

c. polling the hardware to start playing next 0.2 second segment of audio

d. setting screen memory to display frames 6,11,16,21....etc

 

It's not accurate enough for synchronizing each audio segment perfectly is it OR will it be OK as long as I can get to part c. within 2/50ths of a second to check (and start if it has just finished playing) the next audio segment before continuing to display the first frame of next five segments.

 

What do you think feasible?

 

Obviously on an Amiga 600/1200/4000 I could load in 20 frames and 0.8 seconds audio in each segment (so 2x 720kb segments in memory for double buffered audio and video) as you have 2mb chipram and this would help with the odd out of sync issue on audio as it happens once a second not 4 times. This would not work on 512kb chip ram models like first Amiga 500/2000s and Amiga 1000 so is of little interest to me.

 

(two VSYNCs between frame advance 5 step loop as I'm trying for 25FPS at the moment)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...