Re: On2's VP5

Mike Melanson <[email protected]> Tue, 10 Aug 2004 12:44:33 -0600 (MDT)
Newsgroups gmane.comp.video.xine.codec.devel
Message-ID <Pine.GSO.4.58.0408101216160.9283@shell>
On Mon, 9 Aug 2004, Benjamin Larsson wrote:

> http://www.kpdus.com/jad.html

	Got it, thanks. I have never disassembled Java code (never thought
anyone would write multimedia programs with it). This sure is a pretty
IDCT-looking function here:

    private void _mthdo(byte byte0)
    {
        int i1 = 0;
        int j1 = 0;
        _mthif(byte0, aZ);
        for(int k14 = 8; --k14 >= 0;)
        {
            int k10 = aZ[i1];
            int i11 = aZ[i1 + 1];
            int k11 = aZ[i1 + 2];
            int i12 = aZ[i1 + 3];
            int k12 = aZ[i1 + 4];
            int i13 = aZ[i1 + 5];
            int k13 = aZ[i1 + 6];
            int i14 = aZ[i1 + 7];
            if((k10 != 0) | (i11 != 0) | (k11 != 0) | (i12 != 0) | (k12 !=
0) | (
i13 != 0) | (k13 != 0) | (i14 != 0))
            {
                int k1 = (64277 * i11 >> 16) + (12785 * i14 >> 16);
                int i2 = (12785 * i11 >> 16) - (64277 * i14 >> 16);
                int k2 = (54491 * i12 >> 16) + (36410 * i13 >> 16);
[...]


	It looks like _mthif() is an overloaded (right term? I'm no OO
guy) function that handles bitstream reading. "private boolean d()"
allocates an array of 64 shorts and assigns it to member _fldgoto... 3
guesses what that will be used for. "private void h()", "private void
_mthint(byte abyte0[])", and "private void p()" are saturated output
functions. "private void a(byte abyte0[], byte byte0)" looks like it is
monkeying with motion vectors. "private boolean _mthdo(int i1, int j1)"
allocates a bunch of private work arrays. "public int VP5_DecodeFrame(byte
abyte0[])" looks like the main spot to go to work. This is an interesting
code construct:

        if(bw)
        {
            g();
            k();
            c();
        } else
        {
            k();
            c();
        }

What are the odds that bw means interframe and g() handles extra
interframe processing, while k() and c() handle common bitstream
processing? There are also vpx_init() and vpx_exit() public functions.
Further on, there is another a() function with a lot of parms and
switch-case statements (Java makes it possible to decompile switch-case
statements! I love it!). My first impression here is that it reminds me of
the coefficient unpacker from VP3.

	The end of the class has all kinds of data tables neatly arranged.
As this is a VPx codec, I shudder to guess what kind of weird-o prediction
algorithms it might use.


	This is all quite humorous as I recall attending a Java seminar a
long time ago. At this seminar, the instructor noted that a Java had a big
advantage over other "internet" languages, such as Perl, because companies
could sell their Java programs without giving away the source. Ironic,
espcially since I hear there are ways to compile Perl into machine code
which would likely be much harder to RE than this.

	Java rocks! We need to encourage companies to port all of their
multimedia stuff to Java.

--
	-Mike Melanson


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285