Update: The missing Atom scene mentioned below was recovered in January 2020.
The Amiga group Triumph Software released the demos Dreamscape at The Gathering 1996 and Eclipse at The Gathering 1997. I recently watched them on YouTube, and... they hadn't aged well. Also, the emulator they ran on screwed up the sprite overlay in Eclipse. Hmm.
I located my old Amiga 4000 in storage earlier this year and thought it would be fun to make a 2019 digital remaster of these two demos: Jazz up the music (duh), bump the framerate a bit, make it smoother and more well-timed.
There was a 5MB (not GB) limit on demos in those days. Somebody had the brilliant (or stupid, I forget which) idea to use an MPEG-1 encoder to pack a lot of video frames into that space. That sounded simple enough, but this was back in 1996, and stuff had to run on an Amiga 1200 with a Motorola MC68EC020 processor running at 14 - fourteen - Mhz.
First problem: How to squeeze a lot of video frames into 5MB. The graphics guys rendered the video frames in Lightwave in a gigantic 160x120 resolution. Art Department Professional was used to convert those frames into something the semi-popular XING encoder would accept. The output was fed to a custom Triumph re-encoder that stripped away anything not needed and losslessly compressed the stream a second time, saving another 15%. The XING encoder could only output I-frames so streams could be played in any direction, order, or speed. Output rate was variable: The Gear scene is Y-plane only and uses around 8 kbit/frame. The others vary from that up to a max of 40 kbit/frame in the (missing) Atom scene.
Second problem: How to decode it fast enough. We got the source code to an MPEG-1 decoder, threw away a lot of stuff not needed or didn't seem to do anything, optimized here and there, the usual. After that, we converted the C-code to 68K assembler and made a new bit unpacker, redid the poor inlining, packed everything tighter, the list goes on. We kept doing that for a couple of months, added a crude YUV to RGB converter, and found a reasonably fast chunky to planar conversion routine somewhere. The end result would decode a 160x120 stream at a whopping 8 fps on a good day. Great!
The AGA color display routine used an 18-bit 640x240 HAM8 screen where the palette was not used. Instead, it had a pattern of GRBB in the 2 control planes, so each pixel would be correct at least 50% of the time and there were only 6 planes to deal with for the c2p routine. Rows were doubled downwards.
A few extensions were made in Eclipse from 1997. It supported a full-screen lo-res sprite overlay that would display logos and text and such. And it supported 18-bit resolution 320x240 images that would be displayed in 1280x240 using the method described above.
As mentioned, my Amiga was stuck in storage from 1999 until spring 2019. Another old Amiga hacker at my workplace, Sjur Julin, had lots of spare parts, like a mouse, a usable screen, and most important: A GoTek floppy emulator that could be used to copy files.
We hooked it up and expected to hear the sound of capacitors popping when the power was turned on the first time. But they didn't pop, and it booted up without any issues. Amazing! (The only thing that eventually died was the CPU fan, but it had been struggling before I put it in storage.)
I was looking for the original XING MPEG-1 files that was used as input to our custom second stage compressor. Most of them were found, except the Atom scene from Dreamscape and the Laser Logo and Triumph Zoom from Eclipse. I also found better versions of the still images from Eclipse, and some higher-res pictures meant for Dreamscape that were never used.
Mr Julin worked his Amiga magic, and the files were restored using his GoTek drive. Time to get cracking!
We listened to the original music for Dreamscape by Kim Berg: NecroDance v2. It's really an excellent production, but the samples could use a tune-up. Mr Julin pointed out that most of the samples were from Music for the Jilted Generation by The Prodigy, and that he should be able to resample them and make an improved version. Excellent! He added the intro sequence and took some artistic freedoms here and there, resulting in a great 2019 version of Mr Berg's work.
The music clocked in at roughly 4 minutes, and I had about 4 minutes of video, so we didn't use the music from Eclipse. Maybe in a later demo.
I take my hat off for the two guys who made the still frames for the videos: Morten Johnsen and Ivan Moen. Absolutely excellent work!
Now, a big blunder in both demos was that the videos were encoded in limited range. The range wasn't stretched on playback, so the colors in some of them look really washed out. The color space conversion wasn't pretty, but it was quick. The scaling was iffy, and everything was really blocky. Playback speed was 6-7 fps on a 50hz screen: It was sort of timed for that, but it would look much nicer with a higher framerate.
FFmpeg was used to convert the XING MPEG-1 files to raw yuv444. Worked without a hitch. Pretty impressive. The 14 rescued MPEG-1 files used about 7MB. The raw files were roughly 150MB total, but RAM is cheap these days.
I decided to take my work back underground... err, make a new player, from scratch, on a PC (eeek!). In C, of course. Got to keep the loonies on the path.
I wanted to keep the grittiness of the original demos, without the entire thing being totally blurry. Going from 160x120 to 1440x1080 (to keep the aspect ratio) is a pretty massive upscale. I tried out some fancy scalers from the interwebs, with assorted results. I ended up using my own SSE2 scaler. The result wasn't that bad, and it ran so much quicker than all the other crap.
The frames were resampled to full range before scaling. The base framerate was bumped to 15 fps, but playback speed was set to 60 fps. The extra frames contain a mix of the current and next frame, giving the impression of higher framerate. (Yeah, I know, it's not fooling anybody.) It works pretty well on most of the animations, except the Robot scene, where it's turned off.
The still images were in the ever-popular SunRaster RGB-format. I converted them with some random tool to bmp. They were in 320x240 resolution but had full 24-bit colors. The Dreamscape logo and the Triumph Motion Pictures logo were in 912x684 resolution. I suspect they were originally in 640x480, but I scaled them up to be used as background pictures on my WorkBench back in the day.
Then there was the usual 2 weeks of getting it just right: Time it reasonably well with the music, make the font more old-schoolish, put texts in the right spots, add some obscure popular culture references, tweak the filter until the balance is ok.
The player generates a busload of 1920x1080 YUV or RGB frames depending on whether it's playing video, showing images, or drawing text or whatever. These are fed to libjpeg-turbo which saves them as YUV444 100% quality JPEG images. The fun part is that all 14252 frames were generated in 3 minutes and 30 seconds, meaning that it runs at more than 60 fps, with all the conversion, scaling, file saving etc. going on. On a single core. Things were a lot harder back in the middle of the 90s. I must be getting lazy. FFmpeg was used to glue the music and frames back together. Job done!
It's low res, it's gritty, it's 1996 all over again, with a 2019 flair.
Source code (zip archives): remix2_2019.zip, recycler_2020.zip.
As usual, I guess YouTube will totally ruin the framerate and quality. I have the generated MP4 file available for anyone who wants it. Check out availability in the Videos section.