FIASCO—An Open-Source Fractal Image and Sequence Codec
The coding method of FIASCO is basically a straightforward generalization of the JPEG method. The JPEG algorithm subdivides an image into a set of image blocks of 8x8 pixels. Each of these blocks is then independently encoded by a linear combination of 64 basis images (the cosine basis, see Resources for details) as shown in Figure 2. The coefficients of these block approximations are then quantized and stored in the output file.
In Figure 2 the image is subdivided into 8x8 pixel blocks. Each of them is approximated by a linear combination of the cosine basis. The approximation coefficients (a and b in the figure) are then quantized and stored in the JPEG file. FIASCO extends this concept in the following ways:
The image is adaptively subdivided into subblocks (squares or rectangles) of different size. Smaller blocks than those used in smooth regions are used in difficult areas.
Each image block is approximated by image blocks of a dynamic dictionary. The dictionary not only contains a fixed set of basis images (e.g., the well-known JPEG cosine images) but also all previously encoded image blocks. This method is related to text compression algorithms, which also use dynamically generated dictionaries (e.g., LZW compression).
When coding videos, only the difference between subsequent frames is encoded by hierarchical motion compensation.
FIASCO exploits self-similarities within single pictures, and also sequences of pictures, to remove spatial, spectral and temporal redundancies, making it a typical fractal coding method.
The FIASCO package is released under the terms of the GNU General Public License and is built up of command line applications and a library to compress, decode and visualize images and videos. You just have to run the typical GNU build process (./configure;make;make install) to compile and install the FIASCO package. FIASCO is entirely written in ANSI C and should compile on most UNIX platforms.
Usage of the commandline FIASCO coder and decoder is similar to the cjpeg and djpeg applications of the IJPEG package (Independent JPEG group), which should be part of every Linux distribution.
cfiasco --quality=10 --output=video.fco frame0*.ppm
The above encodes the given video files (in raw PNM format) with quality ten, writing a single FIASCO file video.fco. Please note that you cannot compare the quality settings of FIASCO with JPEG. The typical quality range of FIASCO is 1-100, which corresponds to a JPEG quality less than five. FIASCO is intended for very low bit rates only; i.e., you cannot compute compressed images that correspond to a JPEG quality of 75.
dfiasco, the FIASCO decoder, is also used like djpeg:
dfiasco --output=image.ppm image.fco
This decodes the given FIASCO file and writes a new image in PNM format. But dfiasco also contains a display module to show video frames in an X11 window. Currently, only an Xlib-based window with the typical set of control buttons is available (play, stop, forward, etc.). Hopefully, this simple decoder and the FIASCO library provides a good starting point for developers to support the FIASCO format in their favorite image and video programs (Mozilla, GIMP, etc.). Please visit the home page of FIASCO to get some compressed images and videos (see Resources).
The coding and decoding functionality of FIASCO is available in a shared library. Data type definitions and function prototypes are provided by the include file fiasco.h, which is installed in the $prefix/include directory.
You can simply compress images or videos in your application by a function call:
fiasco_coder (image_names, fiasco_name, quality, NULL)
This call compresses the image file(s) given by the array image_names with the predefined approximation quality (1.0-100.0) and creates the new FIASCO output file fiasco_name. Several advanced compression parameters can be adjusted by using an optional parameter object which I don't describe here, see the FIASCO manual pages for details.
In order to decode a FIASCO file in your application, you have to instantiate an object of the decoder class fiasco_decoder_t with a call of the constructor function fiasco_decoder_new (fiasco_name, NULL). fiasco_name specifies the file to decode whereas the second parameter is an optional parameter object to adjust the behavior of the decoder.
Individual frames are then decoded by subsequent calls of the method fiasco_decoder_get_frame. These frames are returned in an internal FIASCO format, which then can be rendered in different ways to fit the needs of your application. For more information about the compression library, refer to the manual pages shipped with FIASCO.
Webinar: 8 Signs You’re Beyond Cron
On Demand NOW
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.View Now!
|My Humble Little Game Collection||May 28, 2015|
|New Linux Based OS Brings Internet of Things Closer to Reality||May 27, 2015|
|Non-Linux FOSS: All the Bitcoin, None of the Bloat||May 26, 2015|
|Dr Hjkl on the Command Line||May 21, 2015|
|Initializing and Managing Services in Linux: Past, Present and Future||May 20, 2015|
|Goodbye, Pi. Hello, C.H.I.P.||May 18, 2015|
- My Humble Little Game Collection
- New Linux Based OS Brings Internet of Things Closer to Reality
- Initializing and Managing Services in Linux: Past, Present and Future
- Dr Hjkl on the Command Line
- Using Hiera with Puppet
- Non-Linux FOSS: All the Bitcoin, None of the Bloat
- Infinite BusyBox with systemd
- Gartner Dubs DivvyCloud Cool Cloud Management Vendor
- Goodbye, Pi. Hello, C.H.I.P.
- It's Easier to Ask Forgiveness...