Accellent (DVDVideo API reverse engineering) v0.2 from 7/01/2006

For an introduction, read the release notes to v0.1 below.

The biggest news is that decoding 720p and 1080i sized material is now supported! The Accellent window adjusts to the size of the input. Aspect ratio is not preserved, so some material will look squashed.

This release includes a binary in the hope that more people might give it a whirl, and report the results on thier CPU + GPU configuration.

It still only runs on Panther, unless you get this framework from a Panther Mac OS X install and replace your Tiger Mac OS X version with it: /system/Library/Frameworks/DVDPlayback.framework. That will mean you have to use the Panther version of DVD Player.app also (and you probably can't use new DVD players like Front Row).

The other thing you have to do is get sample DVDs. Place a VIDEO_TS as described into each of the DummyXXXDVD folders. Hopefully the next release will include these dummy DVDs, and maybe even avoid the need for the Panther-vintage framework.

Note that it is still very possible to lock up your Mac with this program! The cursor will usually sitll move but you won't be able to do anythign else except a hard reset (hold in the power button for 10 secs).

If you undefine 'PANTHER' in the source, then it will run on Tiger, but I haven't found out how to get the DVDPlayback library in Tiger to choose a GPU-accelerated DVD renderer. In Tiger the DVDPlayback.ramework library itself includes an Altivec-based render which it prefers to use - at least on my machine it does. The debugger-enabling offsets have been updated in main.mm but not the jump table one. If anyone wants to figure this out on a low-end Mac 9i.e. where the GPU is still used) then please be my guest!

OK, that's enough writing. Go and try running it now!


Accellent (DVDVideo API reverse engineering) v0.1 from 11/04/2005

Hi.

This is a program that talks to the low-level DVDVideo library in order to play back MPEG-2 files. This is desirable because that library can use the hardware acceleration in the Mac's graphics card to help with the inverse discrete cosine transform calculations, as well as the motion compensation copies that are a big part of displaying MPEG-2.

The DVDPlayback API is a high-level public Apple API that allows you to play back MPEG-2 files with hardware acceleration. However, they first must be massaged into a VOB and put inside the file structure of a DVD. The DVD structure can be on a hard disk - not just a DVD disc - but it is still unfeasible for many applications, especially broadcast digital TV (i.e. DVB or ATSC, aka HDTV to Americans), since the full contents of the DVD must be present when DVDPlayback opens it. Also, the DVD specifications themselves are closed, although they have been reverse engeineered to a great extent. Anyway, massaging files to look like DVDs just for benefit of an unnecessarily limited API is a major pain and just plain stupid.

The DVDVideo library is one of Apple's private libraries with a closed API. It is the next layer down that DVDPlayback uses to get the video part of its job done. I have tried for almost two years through many different channels, direct and indirect, to obtain information on using it, but nothing has ever come of my enquiries. It is particularly frustrating that IDCT hardware acceleration APIs are public in both Windows (DXVA) and Linux (XVMC). So now I have given up waiting, taken matters into my own hands, and reverse-engineered the API to it.

Anyway, enough blurb, onto the release notes:

This release is just a proof of concept! There are no niceties like correctly-sized windows, resizable windows, scrubbing/seeking or anything of that nature.

To use Accellent, first go and get ffmpeg and copy the files in the libavcodec directory over the top of the ffmpeg ones. Then make ffmpeg. See what.txt for gotchas.

Now compile Accellent.xcode. At the top of main.mm there are some compile-time flags you can fiddle with, but I suggest that you don't initially. You may have to add an include path for libavcodec to the project if it doesn't find avcodec.h and friends.

When you have built the application, to play back an MPEG-2 program stream (e.g. recording from DVB or ATSC, VOB from a DVD, or other MPEG-2 file) simply drag the file onto the Accellent.app icon. You can also specify the file to open on the command line.

Accellent outputs lots of info to the command line, and I'd recommend using it from Terminal so you can see what's going on.

The best I've got it to play so far is some big 720p, that the network calls HD. 1080i is still locking up. Rough timings from my initial tests with 720p on one 1.25GHz G4 CPU are:
MPlayer OS X 2 b6: 75% CPU
iTele v0.5.8b1: 47% CPU
Accellent v0.1: 25% CPU

Of course Accellent is not outputting audio but I wouldn't expect that to account for the full discrepancy.

If you don't see similar results, try modifying the 'UseGPUDVDDriver' key in '/System/Library/PrivateFrameworks/DVD.framework/Resources/Info.plist'. Mine was set to false so I set it to true. I'm not at all sure if it has any effect, or if I'm actually using any IDCT hardware at all(!) but at the very least the work here is a step in the right direction, and it certainly does appear to be faster. The next API layer down is quite similar. It's called DVDDriver and I _know_ that's using the GPU. But hopefully we won't have to go there.


This release is distributed only in source for two reasons:
1. It's a lot smaller and I am out of web space.
2. I want to limit it to people who know how to compile at this stage, because:
3. It has the potential to lock up or kernel panic your machine if you encounter a bug.

Also, the sources are the only documentation. I did consider writing up a bit of the wheres and hows of the reverse engineering process here (hint: figuring out the format of the input to DVDVideoDecode was the hardest bit :), but I want to gauge the general reaction to the release first. And probably no-one wants to hear any of that stuff anyway, they just want it to work :)


Enjoy!

{P^/
