source: trunk/src/3rdparty/libjpeg/jutils.c@ 842

Last change on this file since 842 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 5.1 KB
Line 
1/*
2 * jutils.c
3 *
4 * Copyright (C) 1991-1996, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file.
7 *
8 * This file contains tables and miscellaneous utility routines needed
9 * for both compression and decompression.
10 * Note we prefix all global names with "j" to minimize conflicts with
11 * a surrounding application.
12 */
13
14#define JPEG_INTERNALS
15#include "jinclude.h"
16#include "jpeglib.h"
17
18
19/*
20 * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element
21 * of a DCT block read in natural order (left to right, top to bottom).
22 */
23
24#if 0 /* This table is not actually needed in v6a */
25
26const int jpeg_zigzag_order[DCTSIZE2] = {
27 0, 1, 5, 6, 14, 15, 27, 28,
28 2, 4, 7, 13, 16, 26, 29, 42,
29 3, 8, 12, 17, 25, 30, 41, 43,
30 9, 11, 18, 24, 31, 40, 44, 53,
31 10, 19, 23, 32, 39, 45, 52, 54,
32 20, 22, 33, 38, 46, 51, 55, 60,
33 21, 34, 37, 47, 50, 56, 59, 61,
34 35, 36, 48, 49, 57, 58, 62, 63
35};
36
37#endif
38
39/*
40 * jpeg_natural_order[i] is the natural-order position of the i'th element
41 * of zigzag order.
42 *
43 * When reading corrupted data, the Huffman decoders could attempt
44 * to reference an entry beyond the end of this array (if the decoded
45 * zero run length reaches past the end of the block). To prevent
46 * wild stores without adding an inner-loop test, we put some extra