jabcode
 All Classes Files Functions Variables Enumerations Macros
decoder.h
Go to the documentation of this file.
1 
14 #ifndef JABCODE_DECODER_H
15 #define JABCODE_DECODER_H
16 
17 #define DECODE_METADATA_FAILED -1
18 #define FATAL_ERROR -2 //e.g. out of memory
19 
20 #define MASTER_METADATA_X 6
21 #define MASTER_METADATA_Y 1
22 
23 #define MASTER_METADATA_PART1_LENGTH 6 //master metadata part 1 encoded length
24 #define MASTER_METADATA_PART2_LENGTH 12 //master metadata part 2 encoded length
25 #define MASTER_METADATA_PART3_MAX_LENGTH 32 //master metadata part 3 maximal encoded length
26 
30 static const jab_vector2d slave_palette_position[32] =
31  { {4, 5}, {4, 6}, {4, 7}, {4, 8}, {4, 9}, {4, 10}, {4, 11}, {4, 12},
32  {5, 12}, {5, 11}, {5, 10}, {5, 9}, {5, 8}, {5, 7}, {5, 6}, {5, 5},
33  {6, 5}, {6, 6}, {6, 7}, {6, 8}, {6, 9}, {6, 10}, {6, 11}, {6, 12},
34  {7, 12}, {7, 11}, {7, 10}, {7, 9}, {7, 8}, {7, 7}, {7, 6}, {7, 5}
35  };
36 
40 static const jab_byte jab_decoding_table_upper[27] = {32, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90};
41 static const jab_byte jab_decoding_table_lower[27] = {32, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122};
42 static const jab_byte jab_decoding_table_numeric[13] = {32, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 44, 46};
43 static const jab_byte jab_decoding_table_punct[16] = {33, 34, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 58, 59, 63, 64};
44 static const jab_byte jab_decoding_table_mixed[32] = {35, 42, 43, 60, 61, 62, 91, 92, 93, 94, 95, 96, 123, 124, 125, 126, 9, 10, 13, 0, 0, 0, 0, 164, 167, 196, 214, 220, 223, 228, 246, 252};
45 static const jab_byte jab_decoding_table_alphanumeric[63] = {32, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
46  86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122};
47 
51 typedef enum {
52  None = -1,
53  Upper = 0,
54  Lower,
55  Numeric,
56  Punct,
57  Mixed,
58  Alphanumeric,
59  Byte,
60  ECI,
61  FNC1
63 
64 extern jab_int32 decodeMaster(jab_bitmap* matrix, jab_decoded_symbol* symbol);
65 extern jab_int32 decodeSlave(jab_bitmap* matrix, jab_decoded_symbol* symbol);
66 extern jab_data* decodeData(jab_data* bits);
67 extern void deinterleaveData(jab_data* data, jab_float* p);
68 extern void getNextMetadataModuleInMaster(jab_int32 matrix_height, jab_int32 matrix_width, jab_int32 next_module_count, jab_int32* x, jab_int32* y);
69 extern void demaskSymbol(jab_data* data, jab_byte* data_map, jab_vector2d symbol_size, jab_int32 mask_type, jab_int32 color_number);
70 extern jab_int32 readColorPaletteInMaster(jab_bitmap* matrix, jab_decoded_symbol* symbol, jab_byte* data_map, jab_int32* module_count, jab_int32* x, jab_int32* y);
71 extern jab_int32 readColorPaletteInSlave(jab_bitmap* matrix, jab_decoded_symbol* symbol, jab_byte* data_map);
72 
73 #endif
void deinterleaveData(jab_data *data, jab_float *p)
In-place deinterleaving.
Definition: interleave.c:43
Decoded symbol.
Definition: jabcode.h:151
jab_data * decodeData(jab_data *bits)
Interpret decoded bits.
Definition: decoder.c:1771
jab_int32 readColorPaletteInSlave(jab_bitmap *matrix, jab_decoded_symbol *symbol, jab_byte *data_map)
Read the color palettes in master symbol.
Definition: decoder.c:226
Code bitmap.
Definition: jabcode.h:95
void demaskSymbol(jab_data *data, jab_byte *data_map, jab_vector2d symbol_size, jab_int32 mask_type, jab_int32 color_number)
Demask modules.
Definition: mask.c:410
jab_int32 decodeMaster(jab_bitmap *matrix, jab_decoded_symbol *symbol)
Decode master symbol.
Definition: decoder.c:1677
jab_int32 decodeSlave(jab_bitmap *matrix, jab_decoded_symbol *symbol)
Decode slave symbol.
Definition: decoder.c:1718
Data structure.
Definition: jabcode.h:87
2-dimensional integer vector
Definition: jabcode.h:71
void getNextMetadataModuleInMaster(jab_int32 matrix_height, jab_int32 matrix_width, jab_int32 next_module_count, jab_int32 *x, jab_int32 *y)
Get the coordinate of the next metadata module in master symbol.
Definition: decoder.c:755
jab_int32 readColorPaletteInMaster(jab_bitmap *matrix, jab_decoded_symbol *symbol, jab_byte *data_map, jab_int32 *module_count, jab_int32 *x, jab_int32 *y)
Read the color palettes in master symbol.
Definition: decoder.c:141
jab_encode_mode
Encoding mode.
Definition: decoder.h:51