4.4. INTRODUCTION TO JPEGFILES
49
• jpegtest.c contains the test program we will use
• testbild.raw is a grayscale image in raw format.
• perfctr.c,perfctr.h This is the place to look if you want to add a new per-
formance counter
• jcdctmgr.c Contains the main computation loop and definitions of static vari-
ables. Also contains the forward_DCT function which calls the 2D DCT kernel
and does the quantization.
• jdct.c Contains the 2D DCT kernel
• jchuff.c Contains the Huffman and RLE encoder.
• webcam.c Another test application we will use
Below is a call graph of the important functions called by jpegtest:
main() (jpegtest.c)
+-- draw_image() (jpegtest.c)
+-- init_encoder() (jcdctmgr.c)
+-- encode_image() (jcdctmgr.c)
| +-- forward_DCT() (jcdctmgr.c)
| | +-- jpeg_fdct_islow() (jdct.c)
| +-- encode_mcu_huff() (jchuff.c)
| +-- emit_bits() (jchuff.c)
+-- finish_pass_huff (jchuff.c)
• encode_image() - Creates a buffer for an 8 × 8 block and calls forward_dct(8x8
buffer), the returned buffer is sent to encode_mcu_huff(8x8 buffer). This will
encode the first block of the image and save it in memory. The procedure is
then repeated until every block is encoded and then finish_pass_huff() is called
to write the memory buffer to file.
• forward_dct() - Extracts the first 8 × 8 block from the image and then runs the
DCT on this block. The result is returned to encode_image().
• encode_mcu_huff() - Uses a predefined Huffman code to compress the data re-
turned from forward_dct() and sends the Huffman codes to emit_bits().
• emit_bits() - Recieves Huffman codes and save them until enough bits to write a
byte are received, then a byte is written to buffer[].
• buffer[] - Storage for the encoded image memory during operation.
• finish_pass_huff() - Calls emit_bits() to write leftover bits to buffer[] and then
calls write_data().
• write_data() - Writes the contents of buffer[] to file.
Preparation task 8
Take a look at the file containing the 2D DCT kernel and figure out how to change it
to use your 2D DCT hardware.
Kommentare zu diesen Handbüchern