Motion piQtures

Anything QL Software or Programming Related.
Post Reply
User avatar
Cristian
Aurora
Posts: 965
Joined: Mon Feb 16, 2015 1:40 pm
Location: Veneto

Re: Motion piQtures

Post by Cristian »

vanpeebles wrote:I've nearly finished my master frame and ready to add a slight animation to each frame.
It's wonderful! The best thing is Clive's picture on the table 8-)
Which drawing software did you use?
And... stay tuned because another basic motion-piqture is coming from my side ;)


User avatar
vanpeebles
Commissario Pebbli
Posts: 2821
Joined: Sat Nov 20, 2010 7:13 pm
Location: North East UK

Re: Motion piQtures

Post by vanpeebles »

Hehehe, just pixel art in paint shop pro and a mix of retraced images from google and hand drawn :D


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: Motion piQtures

Post by mk79 »

pjw wrote:Im not sure that PNGConvert uses the highest mode of compression available to SMSQ/E
It does. I've never implemented more than a simple RLE compression for it. On one hand because RLE is a very fast method that slow QL platforms can still handle and on the other hand because I wanted to keep my sanity (I'm not going to implement PNG in assembler, no thank you).
But the ideal way to go would be to devise a format that only records the changes between one frame and the next, with complete reference frames only for major changes of scene (eg more that 50% change).
Congratulations, you just invented MPEG ;-)
In other words, it could work with almost no speed penalty if a special version of unzip could be made: One that would take its instructions via a pipe, and output directly to RAM. Is anyone able to do this?
This is relatively easy to do in C, because the ZLIB library is free and so old it should work with the QL compilers. Alternatively I did something similar: I have ported a 68k test program to the QL. Problem was, the reference data (recorded on a real 68k) was almost 5GB in size. Compressing this with BZIP (better than ZIP) reduced this to 125MB and there is a BZIP port for the QL! Still I needed a way to process the data on-the-fly. In the end I used the existing bzcat utility to pipe the decompressed data into a channel and my test-runner EXE took the data directly from its standard input, like this:

Code: Select all

220 Exe$ = "win1_src_m68k_tester_exe"
230 Bzcat$ = "win1_src_m68k_tester_bzcat"
[...]
1020   EW Bzcat$,Dir$&File$&'.bz2' TO Exe$,#1;'test'
So all you'd basically need is an EXE file that takes data from its standard input and put it on the screen. If you make it understand the concept of a frame you can also pipe the whole movie in at once, without any EXE loading overhead.

Cheers, Marcel


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: Motion piQtures

Post by mk79 »

OK, I couldn't help myself. I wrote a quick&dirty movie player including sound: https://www.kilgus.net/2016/12/05/qmovi ... ie-player/ (135MB). Just start the QPC2.exe and it should work, no configuration necessary. Other platforms will probably not work anyway, no idea, you get into strange territory with files this large. I've tried copying the movie to a WIN device and failed, so it is played through the DOS device.

The movie file is some 320MB and contains 2 minutes of concert footage shot by me, so the player has to stream 2,6MB per second. I can now say with certainty that the system is not fast enough to decompress this amount of data on-the-fly, neither bzip2 nor gzip worked without major delays.

Source is included. Have fun.


User avatar
QLvsJAGUAR
Gold Card
Posts: 464
Joined: Tue Feb 15, 2011 8:42 am
Location: Lucerne, Switzerland
Contact:

Re: Motion piQtures

Post by QLvsJAGUAR »

mk79 wrote:Source is included. Have fun.
Great stuff (both the band and your work), Marcel!

Amazing how little code is needed (EXE size is 336 Bytes) to let SMSQ/E play videos! Windows and even Linux are so bloated those days, to get a tiny task done, almost everything goes in the hundreds if not thousands (references, declarations, files, megabytes) nowadays. The simplicity of our OS is what keeps me sticking with the QL.

Integration of QMovie into QL/E or any other distribution or personal environment is simple. To have QMovie_exe handier I would like two changes:
1. Input parameter should be either a channel or a filename
2. Additional parameter to pass the desired output, e.g. CON_480x270a16x36

I know, Marcel is challenging us to do such tiny changes on our own, but 68K Assembler is not my premier discipline.

QL forever!
Urs
Attachments
QMovie playing Maidens, loosely integrated into QL/E v3.16 wip
QMovie playing Maidens, loosely integrated into QL/E v3.16 wip


QL forever!
https://www.sinclairql.net/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
User avatar
pjw
QL Wafer Drive
Posts: 1316
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Motion piQtures

Post by pjw »

mk79 wrote:
pjw wrote:Im not sure that PNGConvert uses the highest mode of compression available to SMSQ/E
It does. I've never implemented more than a simple RLE compression for it. On one hand because RLE is a very fast method that slow QL platforms can still handle and on the other hand because I wanted to keep my sanity (I'm not going to implement PNG in assembler, no thank you).
What I meant was I wasnt sure whether you used 8, 16 or 32 bit RLE in PNGConvert.
But the ideal way to go would be to devise a format that only records the changes between one frame and the next, with complete reference frames only for major changes of scene (eg more that 50% change).
Congratulations, you just invented MPEG ;-)
:ugeek: A simplified version mightnt be too hard to implement..
(The remainder of my reply was superseded by events ;))


Per
dont be happy. worry
- ?
User avatar
pjw
QL Wafer Drive
Posts: 1316
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Motion piQtures

Post by pjw »

mk79 wrote:OK, I couldn't help myself. I wrote a quick&dirty movie player including sound: https://www.kilgus.net/2016/12/05/qmovi ... ie-player/
I know the feeling, but Im manfully resisting the urge ;) I hope someone will pick up the baton, though, as it looks really hopeful
The movie file is some 320MB and contains 2 minutes of concert footage shot by me, so the player has to stream 2,6MB per second. I can now say with certainty that the system is not fast enough to decompress this amount of data on-the-fly, neither bzip2 nor gzip worked without major delays.
Surely that would depend on things like size and resolution? In my second test Im actually EXing unzip on the whole clip for each frame, and QPC still manages to keep up! In your clip you appear to be using the largest sprite size and resolution, not to mention sound, so that might be a tough act to keep up.
As Urs says, Great music (and nice girls (not sure Id like to find myself alone with them, without my dog.. ;)))


Per
dont be happy. worry
- ?
User avatar
Cristian
Aurora
Posts: 965
Joined: Mon Feb 16, 2015 1:40 pm
Location: Veneto

Re: Motion piQtures

Post by Cristian »

mk79 wrote: Source is included. Have fun.
Marcel, for what I can understand you made a little diamond! Unfortunately, as you can see from my rudimentary animations, I don't have at all the skills to help you.


User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: Motion piQtures

Post by dilwyn »

Taking this thread in a slightly different direction, here is a quick and dirty little routine (well, I don't exactly have much time on my hands at the moment!) for viewing animated GIFs in SBASIC. The attachment contains two of David Westbury's extension files used by the program - FGIF from phgtk to convert GIF to PIC, and FPIC_LOAD from his FUN.ZIP package elsewhere on this forum. These are included in the attachment, along with a few example animated gif files. Only tested in mode 32 on QPC2 v4.04, no idea how well (or if at all) it works on other systems. I think it will only work on a GD2 system in mode 16, 32, or 33.

1. Unzip the attached anim1.zip to somewhere on your SMSQ/E system. For best (fastest) results, put the .GIF files in ram1_
2. LRESPR the two BIN files FGIF_BIN and FUN_BIN
3. LOAD ANIM1_BAS - this is the program listed below.
4. Put the filename of one of the gif files in line 130 (or if you have menu extension use FILE_SELECT$ if you want to choose files from a menu)
5. If using MODE 16 (Aurora) or MODE 33 (Q40/Q60) change the 32 in line 5070 to 16 or 33 as appropriate.
6. RUN the program in SBASIC.

Some notes:
Line 160: the procedure ANIMATE is called with 4 parameters, the channel number in which the animation is to occur, the x and y co-ordinate of the top left of the animation, and the filename of the gif file.
Line 5020: uses MGIF to extract the number of frames of animation in the file

The program outputs each frame of the animation in turn to a temporary PIC file in RAM1_ (filename set in line 5060, extracted by line 5070 - the +1024 in line 5070 is to swap black/white transparency, omit if you don't want to swap white for black), gets the inter-frame timing (line 5100), displays the frame (line 5110), deletes the temporary frame PIC file (line 5120), waits between frames giving you the option to press ESC (line 5130). Obviously, this real-time frame extraction will slow things down a bit on slower systems, but at least it prevents generating large numbers of potentially large graphics frame files in ramdisk!

If you are using a different screen mode, change the 32 in line 5070 to 16 (Aurora mode) or 33 (Q40/Q60) as appropriate.

The repeat loop called 'animating' keeps the animation going over and over until you press ESC.

Where the inter-frame timing has a value of 1, you may find the animation goes too fast - you'll see this with the badpc.gif (Derek Stewart's avatar on this Forum - sorry Derek!). In essence, I think PAUSE 1 only waits until the nearest 1/50th second comes along, not necessarily a full 1/50th second :?

Line 5080 has a potential bad practice - an EXIT loop within a FOR loop exiting a REPeat loop. It seems to work, but I'm not sure if programming purists will give me a black mark for that one.

Code: Select all

100 REMark simple animated gif viewer for SBASIC
110 REMark needs David Westbury's FGIF, MGIF and FPIC_LOAD
120 :
130 gif_file$ = 'ram1_ag_whack.gif'
140 :
150 CLS : CLS #0
160 Animate #1,0,0,gif_file$
170 :
5000 DEFine PROCedure Animate (channel, x, y, ip$)
5010   LOCal animating,no_of_frames%,frame_no%,op$,err%
5020   no_of_frames% = MGIF(ip$,-1,-1)
5030   IF no_of_frames% < 0 THEN RETurn : REMark oops
5040   REPeat animating
5050     FOR frame_no% = 0 TO no_of_frames%-1
5060       op$ = 'ram1_frame'&frame_no%&'_pic'
5070       err% = FGIF(ip$,op$,32+512+1024,frame_no%)
5080       IF err% THEN EXIT animating : REMark oops
5090       REMark get frame timing
5100       OPEN_IN #3,op$ : BGET #3\9,frame_time% : CLOSE #3
5110       err% = FPIC_LOAD(#1,op$) : REMark display this frame
5120       DELETE op$ : REMark delete this frame from ramdisk
5130       IF INKEY$(frame_time%) = CHR$(27) THEN EXIT animating
5140     END FOR frame_no%
5150   END REPeat animating
5160 END DEFine Animate


User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: Motion piQtures

Post by dilwyn »

Minor bug fix: Line 5110 currently ignores channel number and x and y coordinate - will fix that at some point when I get time - the program will work as it stands but always display the gif in top left corner of window #1
Here's the SBASIC program fix, just use this in place of ANIM1_BAS in the previous post

Code: Select all

100 REMark simple animated gif viewer for SBASIC
110 REMark needs David Westbury's FGIF, MGIF and FPIC_LOAD
120 :
130 gif_file$ = 'ram1_ag_whack.gif'
140 :
150 CLS : CLS #0
160 Animate 1,0,0,gif_file$
170 :
5000 DEFine PROCedure Animate (channel, x, y, ip$)
5010   LOCal animating,no_of_frames%,frame_no%,op$,err%
5020   no_of_frames% = MGIF(ip$,-1,-1)
5030   IF no_of_frames% < 0 THEN RETurn : REMark oops
5040   REPeat animating
5050     FOR frame_no% = 0 TO no_of_frames%-1
5060       op$ = 'ram1_frame'&frame_no%&'_pic'
5070       err% = FGIF(ip$,op$,32+512+1024,frame_no%)
5080       IF err% THEN EXIT animating : REMark oops
5090       REMark get frame timing
5100       OPEN_IN #3,op$ : BGET #3\9,frame_time% : CLOSE #3
5110       err% = FPIC_LOAD(#channel,op$,x,y) : REMark display this frame
5120       DELETE op$ : REMark delete this frame from ramdisk
5130       IF INKEY$(frame_time%) = CHR$(27) THEN EXIT animating
5140     END FOR frame_no%
5150   END REPeat animating
5160 END DEFine Animate


Post Reply