Panic in the Park - The Interactive Game
Technical Analysis and Fan Page

Content for everyone

Technical stuff

Links

YouTube Videos

(German or English)

Imagination Pilots Transparent AVI Driver (Codec)

IPMA (Imagination Pilots Matte) and IP20 (Imagination Pilots Matte Ver 2) are video codecs Imagination Pilots used for transparent AVI files in their games.

News 16 January 2022: The codec has finally been reverse-engineered, and the exact compression was determined!




Download (Decoders only)

Download the decoders IPMA and IP20 (14 KB)

With this package you can install the video codecs manually, so you can watch the videos without the game being installed. To install, right click Install.inf and choose "Install".

Attention: This driver is 16-bit only, so it will only work on 16- or 32-bit Windows versions. 64 Bit is not supported.

Help wanted! Who can create a Windows 32/64 bit codec together with me?




Frame extractor tool for Windows

This tool extracts frames from an IPMA/IP20 AVI file and saves them as Bitmap files.

Syntax:

ipma_frame_extractor.exe -o outputdir -i avifile

Download frame extractor executable for Windows

View source code in C++




Codec "ipma"

Identification

  • VIDC FourCC Handler: ipma (case-insensitive)
  • BITMAPINFOHEADER biCompression: Ipma (case-sensitive)

Used in games

  • Blown Away (1994)
  • Panic in the Park (1995)

Trivia

  • The official name is "Imagination Pilots Transparent AVI Driver [ipma]" as shown in the Windows 95 Multimedia Device Manager.
  • As seen in VirtualDub, the first frame is the background of the video, and the rest of the frames are a video which has a green background. I do not know how the transparent color is exactly determined. It is probably the color with index #0
  • Before the codec was renamed to "ipma.drv", the original filename is stated as "lzwcodec.drv" . Since the game also uses LZW for its graphics files, it is likely that the video codec also utilises LZW.
  • In VirtualDub, following information are displayed for this codec:
    • Name: Imagination Pilots Matte Compressor[16]
    • 16 Bits
    • Delta frames: Yes
    • FOURCC code: 'ipma'
    • Driver name: IPMA.DRV
    • About dialog: "Imagination Pilots Matte Compressor"
    • Configuration dialog: Imagination Pilots Transparent AVI Driver, Copyright (C) Imagination Pilots 1994, Version "1.10
    • IPMA.DRV is probably only a decompressor. VirtualDub is not able to encode videos using IPMA.
  • "IP-MATTE[16]" appears in the "Details" page of an AVI Property Page (Windows Explorer) file in Windows 95.
  • File "IPMA.DRV" has modification date 26 September 1994
  • Although the correct FourCC code (fccHandler) is "ipma", some AVI files use "IPMA".

Compression

Each frame is encoded using the same LZW implementation as the GIF graphics file standard (except that the stream of LZW data is not partitioned into blocks, instead the stream is continuous). So, the developers re-used the code they have used for the ART files in order to create the AVI codec. (It uses dynamic index size from 9 to 12 bits, code 256 means decoder reset and code 257 means end of stream, 258 is the first code).

A frame can be empty (0 byte data), which means that the previous frame should be repeated. Or in other words, the empty frame is a fully transparent frame.

Data interpretation

Each frame is "bottom-up", like a headless 256 color bitmap file.

Each pixel is 1 uncompressed byte long and is a reference to the 256 color bitmap palette of the AVI file.

The first frame is the background and will stay in the background for the whole length of the video.

The color #0 in the 256-color-palette means "transparent" and will result in the pixel of the previous frame(s), or the background.

The color #1 in the 256-color-palette has the special meaning "erase" and will reveal the background (frame #0).

The typical AVI file contains the background (e.g. a room) in frame #0 and the person (usually on a green-screen; but the color is not relevant) on the other frames.

It is unknown what happens if the colors #0 or #1 exist in the background frame #0.

In this example you can see a few uncompressed frames of LB05M03.AVI (the images have been flipped vertically):

Example files




Codec "IP20"

Identification

  • VIDC FourCC Handler: IP20 (case-insensitive)
  • BITMAPINFOHEADER biCompression: Ip20 (case-sensitive)

Used in games

  • Where's Waldo? At the Circus (1995)
  • Where's Waldo? Exploring Geography (1996, only leftover avi_test.avi)

Trivia

  • The official name is "Imagination Pilots Transparent AVI Driver [IP20]" as shown in the Windows 95 Multimedia Device Manager.
  • Before the codec was renamed to "ip20.drv", the original filename is stated as "lzwcodec.drv" . Since the game also uses LZW for its graphics files, it is likely that the video codec also utilises LZW.
  • In VirtualDub, following information are displayed for this codec:
    • Name: Imagination Pilots Matte Compressor Ver. 2[16]
    • 16 Bits
    • Delta frames: Yes
    • FOURCC code: 'ip20' (NOT SURE IF THIS IS CORRECT OR IF VIRTUALDUB AUTOMATICALLY MAKE THEM LOWERCASE FOR DISPLAY)
    • Driver name: IP20.DRV
    • About dialog: "Imagination Pilots Matte Compressor Ver. 2"
    • Configuration dialog: Imagination Pilots Transparent AVI Driver, Copyright (C) Imagination Pilots 1994, Version "1.10 (sic. The version is still 1.10 and the copyright year still 1994. These things were probably missed during update.
    • IP20.DRV is probably only a decompressor. VirtualDub is not able to encode videos using IPMA.
  • "IP-MATTE[16]" appears in the "Details" page of an AVI Property Page (Windows Explorer) file in Windows 95.
  • File "IP20.DRV" has modification date 16 March 1995
  • Although the correct FourCC code (fccHandler) is "IP20", all AVI files use "ip20". VirtualDub says "ip20"; not sure if it converts codes to lower-case automatically for display.

Compression

The same compression like IPMA

Data interpretation

Like IPMA, each frame is "bottom-up", like a headless 256 color bitmap file, and each pixel is 1 uncompressed byte long and is a reference to the 256 color bitmap palette of the AVI file.

Unlike IPMA, the first frame is NOT interpreted as background. Instead, the whole video is pure transparent. (You can see the difference between IPMA and IP20 by changing the FourCC code of an AVI file using an hex editor and see the result.)

The color #0 has the special meaning "transparent" and will reveal the pixels of the previous frame(s), or the background.

The color #1 in the 256-color-palette has the special meaning "erase" and will reveal the background.

Example files




SUGR (Not a video codec handler FourCC!)

I first became aware of a possible third FOURCC code by the page wiki.multimedia.cx.

In the disassembly of IPMA.DRV and IP20.DRV you can see that beside the check of "IPMA" and "IP20", there is a check for "SUGR".

Disassembly shows that the game (e.g. BLOWNAWY.EXE) opens the codec transmits "SUGR" in the ICM_SETSTATE configuration data block:

Here is what happens: Among other things, the identifier "SUGR" is put in a struct (called configuration data block), and then the memory address of that struct is passed as arg0 into the function
ANIMDLL.OPEN_IPMA_DLL(arg0) which calls
MSVIDEO.ICOPEN(fccType=mmioMAKEFOURCC('v','i','d','c'), fccHandler=mmioMAKEFOURCC('I','P','M','A'), wMode=ICMODE_DECOMPRESS) followed by
MSVIDEO.ICSENDMESSAGE(hic, msg=ICM_SETSTATE, dw1=arg0, dw2=22h) (for "Blown Away") or
MSVIDEO.ICSENDMESSAGE(hic, msg=ICM_SETSTATE, dw1=arg0, dw2=3Ah) (for "Panic in the Park" and "Where's Waldo? At the Circus")

According to MSDN, ICM_SETSTATE, receives two parameters: The first parameter contains an configuration data block (which begins with "SUGR" in our case), and the second parameter contains the length of this configuration block).

TODO: Find out the structure of this configuration data block! Note that in "Blown Away" the configuration data block size is 22h, while in "Panic in the Park" and "Where's Waldo? At the Circus" it is 3Ah.

Another open question: Since the game only sends "SUGR" configuration data blocks in the ICM_SETSTATE messages, why does the codec then check for "IPMA", too? Theory: Could it be the case that "something" sends a "IPMA" configuration data block when it plays the animation, and if the game plays the animation, then a "SUGR" configuration data block is sent? My first idea was the the Operating System sends a "IPMA" configuration data block (but where would that be documented?) when the animation is played with Media Player. However, this does not seem to be true, because I modified IPMA.DRV so that it crashes (Division by 0) if the "IPMA" code branch is executed. But the animation still worked in the game and Media Player... The other theory (which is not so exciting) is that the "IPMA" configuration data block is a feature which is not used by the final version of the game (either it was a feature that was removed, or it is feature that was never used in the first place).

If "SUGR" gets changed to something else, then the IPMA graphics will be invisible in the game, but they can still be played (you just hear the sound).
Changing it in the game EXE to "IPMA" (in order to execute the first code branch) will result in the same behavior.

So, in conclusion, "SUGR" is not a FourCC Video Codec Handler, but it is an internal identifier for the ICM_SETSTATE message, since there are probably different types of states that could be set, or at least the code was made prepared for this.





© 2024 Daniel Marschall - - www.daniel-marschall.de

Please also see my pages for other Imagination Pilots games:
Blown Away | Panic in the Park | Waldo at the Circus | Waldo Exploring Geography | Eraser Turnabout | Virtual K'Nex