jabcode
 All Classes Files Functions Variables Enumerations Macros
jabcode.h File Reference

Main libjabcode header. More...

Go to the source code of this file.

Classes

struct  jab_vector2d
 2-dimensional integer vector More...
 
struct  jab_point
 2-dimensional float vector More...
 
struct  jab_data
 Data structure. More...
 
struct  jab_bitmap
 Code bitmap. More...
 
struct  jab_symbol
 Symbol parameters. More...
 
struct  jab_encode
 Encode parameters. More...
 
struct  jab_metadata
 Decoded metadata. More...
 
struct  jab_decoded_symbol
 Decoded symbol. More...
 

Macros

#define VERSION   "1.0.0"
 
#define BUILD_DATE   __DATE__
 
#define MAX_SYMBOL_NUMBER   61
 
#define MAX_COLOR_NUMBER   256
 
#define MAX_SIZE_ENCODING_MODE   256
 
#define JAB_ENCODING_MODES   6
 
#define ENC_MAX   1000000
 
#define NUMBER_OF_MASK_PATTERNS   8
 
#define DEFAULT_SYMBOL_NUMBER   1
 
#define DEFAULT_MODULE_SIZE   12
 
#define DEFAULT_COLOR_NUMBER   8
 
#define DEFAULT_MODULE_COLOR_MODE   2
 
#define DEFAULT_ECC_LEVEL   3
 
#define DEFAULT_MASKING_REFERENCE   7
 
#define DISTANCE_TO_BORDER   4
 
#define MINIMUM_DISTANCE_BETWEEN_ALIGNMENTS   16
 
#define BITMAP_BITS_PER_PIXEL   32
 
#define BITMAP_BITS_PER_CHANNEL   8
 
#define BITMAP_CHANNEL_COUNT   4
 
#define JAB_SUCCESS   1
 
#define JAB_FAILURE   0
 
#define NORMAL_DECODE   0
 
#define COMPATIBLE_DECODE   1
 
#define VERSION2SIZE(x)   (x * 4 + 17)
 
#define SIZE2VERSION(x)   ((x - 17) / 4)
 
#define MAX(a, b)   ({__typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b;})
 
#define MIN(a, b)   ({__typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b;})
 
#define JAB_REPORT_ERROR(x)   { printf("JABCode Error: "); printf x; printf("\n"); }
 
#define JAB_REPORT_INFO(x)   { printf("JABCode Info: "); printf x; printf("\n"); }
 

Typedefs

typedef unsigned char jab_byte
 
typedef char jab_char
 
typedef unsigned char jab_boolean
 
typedef int jab_int32
 
typedef unsigned int jab_uint32
 
typedef short jab_int16
 
typedef unsigned short jab_uint16
 
typedef long long jab_int64
 
typedef unsigned long long jab_uint64
 
typedef float jab_float
 
typedef double jab_double
 

Functions

jab_encodecreateEncode (jab_int32 color_number, jab_int32 symbol_number)
 Create encode object. More...
 
void destroyEncode (jab_encode *enc)
 Destroy encode object. More...
 
jab_int32 generateJABCode (jab_encode *enc, jab_data *data)
 Generate JABCode. More...
 
jab_datadecodeJABCode (jab_bitmap *bitmap, jab_int32 mode, jab_int32 *status)
 Decode a JAB Code. More...
 
jab_datadecodeJABCodeEx (jab_bitmap *bitmap, jab_int32 mode, jab_int32 *status, jab_decoded_symbol *symbols, jab_int32 max_symbol_number)
 Extended function to decode a JAB Code. More...
 
jab_boolean saveImage (jab_bitmap *bitmap, jab_char *filename)
 Save code bitmap as png image. More...
 
jab_bitmapreadImage (jab_char *filename)
 Read image into code bitmap. More...
 
void reportError (jab_char *message)
 Report error message. More...
 

Detailed Description

Main libjabcode header.

libjabcode - JABCode Encoding/Decoding Library

Copyright 2016 by Fraunhofer SIT. All rights reserved. See LICENSE file for full terms of use and distribution.

Contact: Huajian Liu liu@s.nosp@m.it.f.nosp@m.raunh.nosp@m.ofer.nosp@m..de Waldemar Berchtold walde.nosp@m.mar..nosp@m.berch.nosp@m.told.nosp@m.@sit..nosp@m.frau.nosp@m.nhofe.nosp@m.r.de

Function Documentation

jab_encode* createEncode ( jab_int32  color_number,
jab_int32  symbol_number 
)

Create encode object.

Parameters
color_numberthe number of module colors
symbol_numberthe number of symbols
Returns
the created encode parameter object | NULL: fatal error (out of memory)
jab_data* decodeJABCode ( jab_bitmap bitmap,
jab_int32  mode,
jab_int32 *  status 
)

Decode a JAB Code.

Parameters
bitmapthe image bitmap
modethe decoding mode(NORMAL_DECODE: only output completely decoded data when all symbols are correctly decoded COMPATIBLE_DECODE: also output partly decoded data even if some symbols are not correctly decoded
statusthe decoding status code (0: not detectable, 1: not decodable, 2: partly decoded with COMPATIBLE_DECODE mode, 3: fully decoded)
Returns
the decoded data | NULL if failed
jab_data* decodeJABCodeEx ( jab_bitmap bitmap,
jab_int32  mode,
jab_int32 *  status,
jab_decoded_symbol symbols,
jab_int32  max_symbol_number 
)

Extended function to decode a JAB Code.

Parameters
bitmapthe image bitmap
modethe decoding mode(NORMAL_DECODE: only output completely decoded data when all symbols are correctly decoded COMPATIBLE_DECODE: also output partly decoded data even if some symbols are not correctly decoded
statusthe decoding status code (0: not detectable, 1: not decodable, 2: partly decoded with COMPATIBLE_DECODE mode, 3: fully decoded)
symbolsthe decoded symbols
max_symbol_numberthe maximal possible number of symbols to be decoded
Returns
the decoded data | NULL if failed
void destroyEncode ( jab_encode enc)

Destroy encode object.

Parameters
encthe encode object
jab_int32 generateJABCode ( jab_encode enc,
jab_data data 
)

Generate JABCode.

Parameters
encthe encode parameters
datathe input data
Returns
0:success | 1: out of memory | 2:no input data | 3:incorrect symbol version or position | 4: input data too long
jab_bitmap* readImage ( jab_char *  filename)

Read image into code bitmap.

Parameters
filenamethe image filename
Returns
Pointer to the code bitmap read from image | NULL
void reportError ( jab_char *  message)

Report error message.

Parameters
messagethe error message
jab_boolean saveImage ( jab_bitmap bitmap,
jab_char *  filename 
)

Save code bitmap as png image.

Parameters
bitmapthe code bitmap
filenamethe image filename
Returns
JAB_SUCCESS | JAB_FAILURE