pure D JPEG decoder, with progressive JPEG support, public domain
ketmar via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Fri Jun 17 07:20:14 PDT 2016
On Friday, 17 June 2016 at 13:51:29 UTC, Andrei Alexandrescu
wrote:
> Nice, thanks for this work. I see it has 3213 lines. I take it
> the source is https://github.com/richgel999/jpeg-compressor.
> How many lines from there are reflected in the D code? -- Andrei
it's a complete port of jpegd.h+jpegd.cpp (so, no encoder). it is
almost 1:1 to c++ code, including fancy templated row/col
decoders and 4x4 matrix mini-class. mostly sed work, and after i
made it to compile (and fixed silly bug in CLAMP that i
introduced) it "just works". i replaced stream reader class with
delegate (we have such a great delegates in D, so let's use 'em!
;-), but otherwise the code is unmodified.
ah, i also put `.ptr` to array access to skip bounds checking --
i love to build my code with bounds checking on, and i don't feel
that i need it in this decoder -- it should be fairly well-tested.
so you may assume that all of the lines there are came from c++
(sans some curly brackets).
of course, one can do much better work by writing "idiomatic" D
code, i guess, but that would be much greater work -- not a
"port", but "rewrite".
More information about the Digitalmars-d-announce
mailing list