From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 984C1BB9C for ; Mon, 21 Nov 2005 10:13:58 +0100 (CET) Received: from gw-eur4.philips.com (gw-eur4.philips.com [161.85.125.10]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAL9DvQ0003994 for ; Mon, 21 Nov 2005 10:13:58 +0100 Received: from smtpscan-eur5.philips.com (smtpscan-eur5.mail.philips.com [130.144.57.168]) by gw-eur4.philips.com (Postfix) with ESMTP id B826B4972B for ; Mon, 21 Nov 2005 09:13:57 +0000 (UTC) Received: from smtpscan-eur5.philips.com (localhost [127.0.0.1]) by localhost.philips.com (Postfix) with ESMTP id 6788E7DDC for ; Mon, 21 Nov 2005 09:13:57 +0000 (GMT) Received: from smtprelay-eur2.philips.com (smtprelay-eur2.philips.com [130.144.57.171]) by smtpscan-eur5.philips.com (Postfix) with ESMTP id 02BEF7DD5 for ; Mon, 21 Nov 2005 09:13:56 +0000 (GMT) Received: from ehvrmh02.diamond.philips.com (ehvrmh02-srv.diamond.philips.com [130.139.27.125]) by smtprelay-eur2.philips.com (Postfix) with ESMTP id B5E613F for ; Mon, 21 Nov 2005 09:13:56 +0000 (GMT) In-Reply-To: <437E2A06.4020608@tfb.com> To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] doing MMX through ocaml MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.0.3 September 26, 2003 Message-ID: From: Sebastian Egner Date: Mon, 21 Nov 2005 10:11:36 +0100 X-MIMETrack: Serialize by Router on ehvrmh02/H/SERVER/PHILIPS(Release 6.5.3FP1HF291 | September 19, 2005) at 21/11/2005 10:12:14, Serialize complete at 21/11/2005 10:12:14 Content-Type: multipart/alternative; boundary="=_alternative 0032A8D1C12570C0_=" X-Miltered: at nez-perce with ID 43818FD5.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 fft:01 iirc:01 ocaml:01 simd:01 compiler:01 fft:01 iirc:01 simd:01 compiler:01 kiss:98 kiss:98 wrote:01 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=HTML_30_40,HTML_MESSAGE autolearn=disabled version=3.0.3 This is a multipart message in MIME format. --=_alternative 0032A8D1C12570C0_= Content-Type: text/plain; charset="US-ASCII" > 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. --=_alternative 0032A8D1C12570C0_= Content-Type: text/html; charset="US-ASCII"
> 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. --=_alternative 0032A8D1C12570C0_=--