caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sebastian Egner <sebastian.egner@philips.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] doing MMX through ocaml
Date: Mon, 21 Nov 2005 10:11:36 +0100	[thread overview]
Message-ID: <OF9E151C45.4128C423-ONC12570C0.002F1E03-C12570C0.0032A8D4@philips.com> (raw)
In-Reply-To: <437E2A06.4020608@tfb.com>

[-- Attachment #1: Type: text/plain, Size: 1985 bytes --]

> 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.

[-- Attachment #2: Type: text/html, Size: 2931 bytes --]

      reply	other threads:[~2005-11-21  9:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 21:13 Jonathan Roewen
2005-11-17 21:47 ` Oliver Bandel
2005-11-17 21:57   ` Jonathan Roewen
2005-11-17 22:16   ` Damien Bobillot
2005-11-17 22:43     ` Daniel Bünzli
2005-11-17 22:55       ` Jonathan Roewen
2005-11-18  1:26         ` Vincenzo Ciancia
2005-11-18 10:04         ` [Caml-list] " Alessandro Baretta
2005-11-17 22:55       ` Damien Bobillot
2005-11-17 23:01 ` Vincenzo Ciancia
2005-11-17 23:49 ` [Caml-list] " Erik de Castro Lopo
2005-11-18  1:52   ` Grégory Guyomarc'h
2005-11-18  3:06   ` Brian Hurt
2005-11-18  3:29     ` Jonathan Roewen
2005-11-18 19:22     ` Ken Rose
2005-11-21  9:11       ` Sebastian Egner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF9E151C45.4128C423-ONC12570C0.002F1E03-C12570C0.0032A8D4@philips.com \
    --to=sebastian.egner@philips.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).