> Brian Hurt wrote:
>
> > I'm pretty sure you need at least SSE for MPEG. The core
function is an
> > 8x8 2D FFT. You *might* be able to do in fixed point (and
thus in MMX),
> > but the SSE version would be a lot easier to get right.
>
> It's actually an 8x8 Discrete Cosine Transform. It can be done
in fixed
> point. IIRC, you need 18 bits.
>
> - ken
As far as I know, the computationally most intensive
part of an MPEG2
decoder are the 8x8 IDCT, the motion compensation,
and the YCrCb -> RGB
color space conversion. To get an impression, I ported
the IDCT and MC
from 'libmpeg2' to Ocaml, and optimized it with an
eye on the assembly code.
Performance will be fine---as far as one can come
without saturated SIMD
ops (e.g. MMX). 'Libmpeg2' is a good open source starting
point; it
it clean, reasonably well structured, and relatively
small.
The real pain in writing an MPEG2 decoder is probably
the complexity
of options (MPEG2 is infamous in that respect), and
right now I do not
have a lot of time to spend on such an enterprise.
Some advice on going about an MPEG2 decoder in Ocaml
to whom it might
concern: 1. Keep the standard document (ISO) close.
2. Make a choice
which options and configurations to support (and test!).
3. Don't
try too hard to convert 'libmpeg2' literally, but
design parts from
scratch. 'Libmpeg2' uses the C preprocessor to do
extensive strength
reduction, i.e. generating specialized functions for
the various signal
representations (RGB|BGR, 444|422|420, etc.) Since
the representation
affects the inner loops, you must do strength reduction
in Ocaml, too.
However, the Ocaml compiler is straight, and this
means you must find
other ways to have simple but efficient source code.
4. KISS: Keep it
simple and stupid! Forget about the little shop of
MPEG2 horror (e.g.
transport streams without a single I-frame, the hell
of timecodes etc.).
http://www.iso.org/iso/en/CombinedQueryResult.CombinedQueryResult?queryString=13818-2
Sebastian.