Functional Specification of JPEG Decompression, and an Implementation for Free
A decoder for images compressed by the JPEG algorithm is stated in the pure functional programming language Gofer. The program can be regarded as a mathematical specification of the decompression algorithm; the concise description (which is included almost in full) is very suitable for learning about the algorithm. At the same time the ‘specification’ is an executable program, which shows the usefulness of a functional programming language as a prototyping tool for graphics algorithms.
All functions are defined as much as possible at the function level, i.e., as compositions of other functions. A tutorial on the important concept of a ‘State Monad’, which plays an important role in the program, is included. From a functional programming theoretical point of view, the new technique of currying a state monad, which is introduced, and its application in the program, are interesting.
KeywordsDiscrete Cosine Transform State Function Discrete Cosine Transform Coefficient Functional Programming Inverse Discrete Cosine Transform
Unable to display preview. Download preview PDF.
- Richard Bird and Philip Wadler. Introduction to functional programming. New York: Prentice Hall, 1988.Google Scholar
- Pieter Hartel and Willem Vree. ‘Arrays in a lazy functional language — a case study: the Fast Fourier Transform’. In: 2nd Arrays, functional languages, and parallel systems (G. Hains, ed.). Montréal: Dept. d’informatique, Université de Montréal (publication 841), 1992, pp. 52–66.Google Scholar
- Hudak and Fasel. ‘A gentle introduction to Haskell’. ACM Sigplan Notices 27, 5 (may 1992), pp. Tl—T53.Google Scholar
- Mark P. Jones. ‘A system of constructor classes: overloading and implicit higher-order polymorphism’. In: FPCA ‘83: Conference on Functional Programming and Computer Architecture. New York: ACM Press, 1993. http://www.cs.nott.ac.uk/Department/Staff/mpj/fpca93.html
- Mark P. Jones. Gofer 2.30 release notes. ftp.cs.nott.ac.uk/nott-fp/languages/gofer.Google Scholar
- Mark P. Jones. ‘Functional programming with overloading and higher-order polymorphism’. In: Lecture Notes of the 1st International Spring School on Advanced Functional Programming Techniques (Johan Jeuring and Erik Meijer, eds). Berlin: Springer, 1995 (LNCS 925).Google Scholar
- International Standards Organization. Digital compression and coding of continuous-tone still images. Draft International Standard DIS 10918–1. (reprinted in ).Google Scholar
- William Pennebaker and Joan Mitchell. JPEG still image data compression standard. New York: Van Nostrand Reinhold, 1993.Google Scholar
- Rinus Plasmeijer and Marko van Eekelen. Concurrent Clean Language Report. Nijmegen: Dept. of Computer Science, University of Nijmegen, the Netherlands, 1995 (to appear). ftp.cs.kun.nl/pub/Clean.Google Scholar
- Philip Wadler. ‘The Essence of Functional Programming’. In: 19th Annual ACM SIGPLAN Symposium on Principles of Programming Languages. Santa Fe, 1992 (pp. 1–14 ). also: ftp.dcs.glasgow.ac.uk/pub/glasgow-fp/papers/essence-of-fp.ps.Z. Google Scholar
- Gregory Wallace. ‘The JPEG still picture compression standard’. Communications of the ACM 34,4, 1991 (pp. 30 14). also: ftp.uu.net/graphics/jpeg/wallace.ps.gz. Google Scholar