source: soft/tp12/correction/jpeg.h @ 13

Last change on this file since 13 was 13, checked in by alain, 14 years ago
File size: 2.8 KB
Line 
1#ifndef JPEG_H_
2#define JPEG_H_
3
4#define ROUND_UP(val, round) ((val+(round)-1)/(round)*(round))
5
6#define BLOCK_WIDTH 8
7#define BLOCK_HEIGHT 8
8#define WIDTH 48
9#define HEIGHT 48
10#define BLOCK_SIZE (BLOCK_WIDTH*BLOCK_HEIGHT)
11
12#define MAX_WIDTH ROUND_UP(WIDTH, BLOCK_WIDTH)
13#define MAX_HEIGHT ROUND_UP(HEIGHT, BLOCK_HEIGHT)
14
15#define BLOCKS_W (MAX_WIDTH/BLOCK_WIDTH)
16#define BLOCKS_H (MAX_HEIGHT/BLOCK_HEIGHT)
17
18#define NBLOCKS (BLOCKS_H*BLOCKS_W)
19
20/*
21 * JPEG format parsing markers
22 */
23#define SOI_MK  0xFFD8          /* start of image       */
24#define APP_MK  0xFFE0          /* custom, up to FFEF */
25#define COM_MK  0xFFFE          /* commment segment     */
26#define SOF_MK  0xFFC0          /* start of frame       */
27#define SOS_MK  0xFFDA          /* start of scan        */
28#define DHT_MK  0xFFC4          /* Huffman table        */
29#define DQT_MK  0xFFDB          /* Quant. table         */
30#define DRI_MK  0xFFDD          /* restart interval     */
31#define EOI_MK  0xFFD9          /* end of image         */
32#define MK_MSK  0xFFF0
33/* is x a restart interval ? */
34#define RST_MK(x)       ( (0xFFF8&(x)) == 0xFFD0 )
35
36
37#define DATA_MAGIC 0xda1a0000
38
39int bloc[6][64] = {{
40  1, 2, 3, 4, 5, 6, 7, 8,
41  1, 2, 3, 4, 5, 6, 7, 8,
42  1, 2, 3, 4, 5, 6, 7, 8,
43  1, 2, 3, 4, 5, 6, 7, 8,
44  1, 2, 3, 4, 5, 6, 7, 8,
45  1, 2, 3, 4, 5, 6, 7, 8,
46  1, 2, 3, 4, 5, 6, 7, 8,
47  1, 2, 3, 4, 5, 6, 7, 8
48},{
49  11, 12, 13, 14, 15, 16, 17, 18,
50  11, 12, 13, 14, 15, 16, 17, 18,
51  11, 12, 13, 14, 15, 16, 17, 18,
52  11, 12, 13, 14, 15, 16, 17, 18,
53  11, 12, 13, 14, 15, 16, 17, 18,
54  11, 12, 13, 14, 15, 16, 17, 18,
55  11, 12, 13, 14, 15, 16, 17, 18,
56  11, 12, 13, 14, 15, 16, 17, 18
57},{
58  21, 22, 23, 24, 25, 226, 27, 28,
59  21, 22, 23, 24, 25, 226, 27, 28,
60  21, 22, 23, 24, 25, 226, 27, 28,
61  21, 22, 23, 24, 25, 226, 27, 28,
62  21, 22, 23, 24, 25, 226, 27, 28,
63  21, 22, 23, 24, 25, 226, 27, 28,
64  21, 22, 23, 24, 25, 226, 27, 28,
65  21, 22, 23, 24, 25, 226, 27, 28
66},{
67  31, 32, 33, 34, 35, 36, 37, 38,
68  31, 32, 33, 34, 35, 36, 37, 38,
69  31, 32, 33, 34, 35, 36, 37, 38,
70  31, 32, 33, 34, 35, 36, 37, 38,
71  31, 32, 33, 34, 35, 36, 37, 38,
72  31, 32, 33, 34, 35, 36, 37, 38,
73  31, 32, 33, 34, 35, 36, 37, 38,
74  31, 32, 33, 34, 35, 36, 37, 38
75},{
76  41, 42, 43, 44, 45, 46, 47, 48,
77  41, 42, 43, 44, 45, 46, 47, 48,
78  41, 42, 43, 44, 45, 46, 47, 48,
79  41, 42, 43, 44, 45, 46, 47, 48,
80  41, 42, 43, 44, 45, 46, 47, 48,
81  41, 42, 43, 44, 45, 46, 47, 48,
82  41, 42, 43, 44, 45, 46, 47, 48,
83  41, 42, 43, 44, 45, 46, 47, 48
84},{
85  51, 52, 53, 54, 55, 56, 57, 58,
86  51, 52, 53, 54, 55, 56, 57, 58,
87  51, 52, 53, 54, 55, 56, 57, 58,
88  51, 52, 53, 54, 55, 56, 57, 58,
89  51, 52, 53, 54, 55, 56, 57, 58,
90  51, 52, 53, 54, 55, 56, 57, 58,
91  51, 52, 53, 54, 55, 56, 57, 58,
92  51, 52, 53, 54, 55, 56, 57, 58
93}
94};
95
96
97int out[64] = {
98  0, 0, 0, 0, 0, 0, 0, 0,
99  0, 0, 0, 0, 0, 0, 0, 0,
100  0, 0, 0, 0, 0, 0, 0, 0,
101  0, 0, 0, 0, 0, 0, 0, 0,
102  0, 0, 0, 0, 0, 0, 0, 0,
103  0, 0, 0, 0, 0, 0, 0, 0,
104  0, 0, 0, 0, 0, 0, 0, 0,
105  0, 0, 0, 0, 0, 0, 0, 0
106};
107
108#endif /* JPEG_H_ */
Note: See TracBrowser for help on using the repository browser.