diff options
Diffstat (limited to 'apps/recorder/jpeg_common.h')
-rw-r--r-- | apps/recorder/jpeg_common.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/apps/recorder/jpeg_common.h b/apps/recorder/jpeg_common.h new file mode 100644 index 0000000000..44bf81e435 --- /dev/null +++ b/apps/recorder/jpeg_common.h | |||
@@ -0,0 +1,97 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * JPEG image viewer | ||
11 | * Common structs and defines for plugin and core JPEG decoders | ||
12 | * | ||
13 | * File scrolling addition (C) 2005 Alexander Spyridakis | ||
14 | * Copyright (C) 2004 Jörg Hohensohn aka [IDC]Dragon | ||
15 | * Heavily borrowed from the IJG implementation (C) Thomas G. Lane | ||
16 | * Small & fast downscaling IDCT (C) 2002 by Guido Vollbeding JPEGclub.org | ||
17 | * | ||
18 | * This program is free software; you can redistribute it and/or | ||
19 | * modify it under the terms of the GNU General Public License | ||
20 | * as published by the Free Software Foundation; either version 2 | ||
21 | * of the License, or (at your option) any later version. | ||
22 | * | ||
23 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
24 | * KIND, either express or implied. | ||
25 | * | ||
26 | ****************************************************************************/ | ||
27 | |||
28 | #ifndef _JPEG_COMMON_H | ||
29 | #define _JPEG_COMMON_H | ||
30 | |||
31 | #define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ | ||
32 | #define JPEG_READ_BUF_SIZE 16 | ||
33 | struct derived_tbl | ||
34 | { | ||
35 | /* Basic tables: (element [0] of each array is unused) */ | ||
36 | long mincode[17]; /* smallest code of length k */ | ||
37 | long maxcode[18]; /* largest code of length k (-1 if none) */ | ||
38 | /* (maxcode[17] is a sentinel to ensure huff_DECODE terminates) */ | ||
39 | int valptr[17]; /* huffval[] index of 1st symbol of length k */ | ||
40 | |||
41 | /* Back link to public Huffman table (needed only in slow_DECODE) */ | ||
42 | int* pub; | ||
43 | |||
44 | /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of | ||
45 | the input data stream. If the next Huffman code is no more | ||
46 | than HUFF_LOOKAHEAD bits long, we can obtain its length and | ||
47 | the corresponding symbol directly from these tables. */ | ||
48 | int look_nbits[1<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */ | ||
49 | unsigned char look_sym[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */ | ||
50 | }; | ||
51 | |||
52 | #define QUANT_TABLE_LENGTH 64 | ||
53 | |||
54 | /* for type of Huffman table */ | ||
55 | #define DC_LEN 28 | ||
56 | #define AC_LEN 178 | ||
57 | |||
58 | struct huffman_table | ||
59 | { /* length and code according to JFIF format */ | ||
60 | int huffmancodes_dc[DC_LEN]; | ||
61 | int huffmancodes_ac[AC_LEN]; | ||
62 | }; | ||
63 | |||
64 | struct frame_component | ||
65 | { | ||
66 | int ID; | ||
67 | int horizontal_sampling; | ||
68 | int vertical_sampling; | ||
69 | int quanttable_select; | ||
70 | }; | ||
71 | |||
72 | struct scan_component | ||
73 | { | ||
74 | int ID; | ||
75 | int DC_select; | ||
76 | int AC_select; | ||
77 | }; | ||
78 | |||
79 | struct bitstream | ||
80 | { | ||
81 | unsigned long get_buffer; /* current bit-extraction buffer */ | ||
82 | int bits_left; /* # of unused bits in it */ | ||
83 | unsigned char* next_input_byte; | ||
84 | unsigned char* input_end; /* upper limit +1 */ | ||
85 | }; | ||
86 | |||
87 | /* possible return flags for process_markers() */ | ||
88 | #define HUFFTAB 0x0001 /* with huffman table */ | ||
89 | #define QUANTTAB 0x0002 /* with quantization table */ | ||
90 | #define APP0_JFIF 0x0004 /* with APP0 segment following JFIF standard */ | ||
91 | #define FILL_FF 0x0008 /* with 0xFF padding bytes at begin/end */ | ||
92 | #define SOF0 0x0010 /* with SOF0-Segment */ | ||
93 | #define DHT 0x0020 /* with Definition of huffman tables */ | ||
94 | #define SOS 0x0040 /* with Start-of-Scan segment */ | ||
95 | #define DQT 0x0080 /* with definition of quantization table */ | ||
96 | |||
97 | #endif /* _JPEG_COMMON_H */ | ||