]> git.sesse.net Git - fjl/blob - zigzag.h
Add optional padding data at the end to the bit source (is that the right place?...
[fjl] / zigzag.h
1 #ifndef _ZIGZAG_H
2 #define _ZIGZAG_H
3
4 #include "idct.h"
5
6 // Table for transforming from zig-zag order to natural order.
7 // We use the same trick as libjpeg here; there are 16 extra entries
8 // after the end of the table, since the run-length decoder could
9 // potentially cause entries indices >= 64 to be decoded.
10 static const unsigned unzigzag[DCTSIZE2 + 16] = {
11         // Regular entries.
12          0,  1,  8, 16,  9,  2,  3, 10,
13         17, 24, 32, 25, 18, 11,  4,  5,
14         12, 19, 26, 33, 40, 48, 41, 34,
15         27, 20, 13,  6,  7, 14, 21, 28,
16         35, 42, 49, 56, 57, 50, 43, 36,
17         29, 22, 15, 23, 30, 37, 44, 51,
18         58, 59, 52, 45, 38, 31, 39, 46,
19         53, 60, 61, 54, 47, 55, 62, 63,
20
21         // Extra padding entries; should never be referenced in well-formed data.
22         63, 63, 63, 63, 63, 63, 63, 63,
23         63, 63, 63, 63, 63, 63, 63, 63,
24 };
25
26 #endif /* !defined(_ZIGZAG_H) */