Functional Specification of JPEG Decompression, and an Implementation for Free

  • Jeroen Fokker
Conference paper
Part of the Eurographics book series (EUROGRAPH)


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.


Discrete Cosine Transform State Function Discrete Cosine Transform Coefficient Functional Programming Inverse Discrete Cosine Transform 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    Richard Bird and Philip Wadler. Introduction to functional programming. New York: Prentice Hall, 1988.Google Scholar
  2. [2]
    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
  3. [3]
    Hudak and Fasel. ‘A gentle introduction to Haskell’. ACM Sigplan Notices 27, 5 (may 1992), pp. Tl—T53.Google Scholar
  4. [4]
    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.
  5. [5]
    Mark P. Jones. Gofer 2.30 release notes. Scholar
  6. [6]
    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
  7. [7]
    International Standards Organization. Digital compression and coding of continuous-tone still images. Draft International Standard DIS 10918–1. (reprinted in [8]).Google Scholar
  8. [8]
    William Pennebaker and Joan Mitchell. JPEG still image data compression standard. New York: Van Nostrand Reinhold, 1993.Google Scholar
  9. [9]
    Rinus Plasmeijer and Marko van Eekelen. Concurrent Clean Language Report. Nijmegen: Dept. of Computer Science, University of Nijmegen, the Netherlands, 1995 (to appear). Scholar
  10. [10]
    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: Google Scholar
  11. [11]
    Gregory Wallace. ‘The JPEG still picture compression standard’. Communications of the ACM 34,4, 1991 (pp. 30 14). also: Google Scholar

Copyright information

© Springer-Verlag/Wien 1995

Authors and Affiliations

  • Jeroen Fokker
    • 1
  1. 1.Department of Computer ScienceUtrecht UniversityUtrechtThe Netherlands

Personalised recommendations