qrencode  4.1.1
About: libqrencode is a fast and compact library and command-line utility for encoding data in a QR Code symbol.
  Fossies Dox: qrencode-4.1.1.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

qrspec.h File Reference
#include "qrencode.h"
Include dependency graph for qrspec.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define QRSPEC_WIDTH_MAX   177
 Version and capacity. More...
 
#define QRspec_rsBlockNum(__spec__)   (__spec__[0] + __spec__[3])
 
#define QRspec_rsBlockNum1(__spec__)   (__spec__[0])
 
#define QRspec_rsDataCodes1(__spec__)   (__spec__[1])
 
#define QRspec_rsEccCodes1(__spec__)   (__spec__[2])
 
#define QRspec_rsBlockNum2(__spec__)   (__spec__[3])
 
#define QRspec_rsDataCodes2(__spec__)   (__spec__[4])
 
#define QRspec_rsEccCodes2(__spec__)   (__spec__[2])
 
#define QRspec_rsDataLength(__spec__)
 
#define QRspec_rsEccLength(__spec__)    (QRspec_rsBlockNum(__spec__) * QRspec_rsEccCodes1(__spec__))
 
#define QRSPEC_MODEID_ECI   7
 Mode indicator. More...
 
#define QRSPEC_MODEID_NUM   1
 
#define QRSPEC_MODEID_AN   2
 
#define QRSPEC_MODEID_8   4
 
#define QRSPEC_MODEID_KANJI   8
 
#define QRSPEC_MODEID_FNC1FIRST   5
 
#define QRSPEC_MODEID_FNC1SECOND   9
 
#define QRSPEC_MODEID_STRUCTURE   3
 
#define QRSPEC_MODEID_TERMINATOR   0
 

Functions

int QRspec_getDataLength (int version, QRecLevel level)
 Return maximum data code length (bytes) for the version. More...
 
int QRspec_getECCLength (int version, QRecLevel level)
 Return maximum error correction code length (bytes) for the version. More...
 
int QRspec_getMinimumVersion (int size, QRecLevel level)
 Return a version number that satisfies the input code length. More...
 
int QRspec_getWidth (int version)
 Return the width of the symbol for the version. More...
 
int QRspec_getRemainder (int version)
 Return the numer of remainder bits. More...
 
int QRspec_lengthIndicator (QRencodeMode mode, int version)
 Length indicator. More...
 
int QRspec_maximumWords (QRencodeMode mode, int version)
 Return the maximum length for the mode and version. More...
 
void QRspec_getEccSpec (int version, QRecLevel level, int spec[5])
 Error correction code. More...
 
unsigned int QRspec_getVersionPattern (int version)
 Version information pattern. More...
 
unsigned int QRspec_getFormatInfo (int mask, QRecLevel level)
 Format information. More...
 
unsigned char * QRspec_newFrame (int version)
 Frame. More...
 

Macro Definition Documentation

◆ QRSPEC_MODEID_8

#define QRSPEC_MODEID_8   4

Definition at line 167 of file qrspec.h.

◆ QRSPEC_MODEID_AN

#define QRSPEC_MODEID_AN   2

Definition at line 166 of file qrspec.h.

◆ QRSPEC_MODEID_ECI

#define QRSPEC_MODEID_ECI   7

Mode indicator.

Mode indicator. See Table 2 of JIS X0510:2004, pp.16.

Definition at line 164 of file qrspec.h.

◆ QRSPEC_MODEID_FNC1FIRST

#define QRSPEC_MODEID_FNC1FIRST   5

Definition at line 169 of file qrspec.h.

◆ QRSPEC_MODEID_FNC1SECOND

#define QRSPEC_MODEID_FNC1SECOND   9

Definition at line 170 of file qrspec.h.

◆ QRSPEC_MODEID_KANJI

#define QRSPEC_MODEID_KANJI   8

Definition at line 168 of file qrspec.h.

◆ QRSPEC_MODEID_NUM

#define QRSPEC_MODEID_NUM   1

Definition at line 165 of file qrspec.h.

◆ QRSPEC_MODEID_STRUCTURE

#define QRSPEC_MODEID_STRUCTURE   3

Definition at line 171 of file qrspec.h.

◆ QRSPEC_MODEID_TERMINATOR

#define QRSPEC_MODEID_TERMINATOR   0

Definition at line 172 of file qrspec.h.

◆ QRspec_rsBlockNum

#define QRspec_rsBlockNum (   __spec__)    (__spec__[0] + __spec__[3])

Definition at line 108 of file qrspec.h.

◆ QRspec_rsBlockNum1

#define QRspec_rsBlockNum1 (   __spec__)    (__spec__[0])

Definition at line 109 of file qrspec.h.

◆ QRspec_rsBlockNum2

#define QRspec_rsBlockNum2 (   __spec__)    (__spec__[3])

Definition at line 112 of file qrspec.h.

◆ QRspec_rsDataCodes1

#define QRspec_rsDataCodes1 (   __spec__)    (__spec__[1])

Definition at line 110 of file qrspec.h.

◆ QRspec_rsDataCodes2

#define QRspec_rsDataCodes2 (   __spec__)    (__spec__[4])

Definition at line 113 of file qrspec.h.

◆ QRspec_rsDataLength

#define QRspec_rsDataLength (   __spec__)
Value:
((QRspec_rsBlockNum1(__spec__) * QRspec_rsDataCodes1(__spec__)) + \
(QRspec_rsBlockNum2(__spec__) * QRspec_rsDataCodes2(__spec__)))
#define QRspec_rsDataCodes1(__spec__)
Definition: qrspec.h:110
#define QRspec_rsDataCodes2(__spec__)
Definition: qrspec.h:113
#define QRspec_rsBlockNum1(__spec__)
Definition: qrspec.h:109
#define QRspec_rsBlockNum2(__spec__)
Definition: qrspec.h:112

Definition at line 116 of file qrspec.h.

◆ QRspec_rsEccCodes1

#define QRspec_rsEccCodes1 (   __spec__)    (__spec__[2])

Definition at line 111 of file qrspec.h.

◆ QRspec_rsEccCodes2

#define QRspec_rsEccCodes2 (   __spec__)    (__spec__[2])

Definition at line 114 of file qrspec.h.

◆ QRspec_rsEccLength

#define QRspec_rsEccLength (   __spec__)     (QRspec_rsBlockNum(__spec__) * QRspec_rsEccCodes1(__spec__))

Definition at line 119 of file qrspec.h.

◆ QRSPEC_WIDTH_MAX

#define QRSPEC_WIDTH_MAX   177

Version and capacity.

Maximum width of a symbol

Definition at line 34 of file qrspec.h.

Function Documentation

◆ QRspec_getDataLength()

int QRspec_getDataLength ( int  version,
QRecLevel  level 
)

Return maximum data code length (bytes) for the version.

Parameters
versionversion of the symbol
levelerror correction level
Returns
maximum size (bytes)

Definition at line 98 of file qrspec.c.

References QRspec_Capacity::ec, level, qrspecCapacity, version, and QRspec_Capacity::words.

Referenced by QRinput_appendPaddingBit(), QRinput_splitQRinputToStruct(), and QRspec_getEccSpec().

◆ QRspec_getECCLength()

int QRspec_getECCLength ( int  version,
QRecLevel  level 
)

Return maximum error correction code length (bytes) for the version.

Parameters
versionversion of the symbol
levelerror correction level
Returns
ECC size (bytes)

Definition at line 103 of file qrspec.c.

References QRspec_Capacity::ec, level, qrspecCapacity, and version.

Referenced by QRspec_getEccSpec().

◆ QRspec_getEccSpec()

void QRspec_getEccSpec ( int  version,
QRecLevel  level,
int  spec[5] 
)

Error correction code.

Return an array of ECC specification.

Parameters
versionversion of the symbol
levelerror correction level
specan array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code,

of type2 blocks, # of data code}

Definition at line 234 of file qrspec.c.

References eccTable, level, QRspec_getDataLength(), QRspec_getECCLength(), and version.

Referenced by QRraw_new().

◆ QRspec_getFormatInfo()

unsigned int QRspec_getFormatInfo ( int  mask,
QRecLevel  level 
)

Format information.

Return BCH encoded format information pattern.

Parameters
maskmask number
levelerror correction level
Returns
BCH encoded format information pattern

Definition at line 383 of file qrspec.c.

References formatInfo, and level.

Referenced by Mask_writeFormatInformation().

◆ QRspec_getMinimumVersion()

int QRspec_getMinimumVersion ( int  size,
QRecLevel  level 
)

Return a version number that satisfies the input code length.

Parameters
sizeinput code length (byte)
levelerror correction level
Returns
version number

Definition at line 108 of file qrspec.c.

References QRspec_Capacity::ec, level, QRSPEC_VERSION_MAX, qrspecCapacity, size, and QRspec_Capacity::words.

Referenced by QRinput_convertData(), and QRinput_estimateVersion().

◆ QRspec_getRemainder()

int QRspec_getRemainder ( int  version)

Return the numer of remainder bits.

Parameters
versionvesion of the symbol
Returns
number of remainder bits

Definition at line 126 of file qrspec.c.

References qrspecCapacity, QRspec_Capacity::remainder, and version.

Referenced by QRcode_encodeMask().

◆ QRspec_getVersionPattern()

unsigned int QRspec_getVersionPattern ( int  version)

Version information pattern.

Return BCH encoded version information pattern that is used for the symbol of version 7 or greater. Use lower 18 bits.

Parameters
versionversion of the symbol
Returns
BCH encoded version information pattern

Definition at line 364 of file qrspec.c.

References QRSPEC_VERSION_MAX, version, and versionPattern.

Referenced by QRspec_createFrame().

◆ QRspec_getWidth()

int QRspec_getWidth ( int  version)

Return the width of the symbol for the version.

Parameters
versionvesion of the symbol
Returns
width of the symbol

Definition at line 121 of file qrspec.c.

References qrspecCapacity, version, and QRspec_Capacity::width.

Referenced by QRcode_encodeMask().

◆ QRspec_lengthIndicator()

int QRspec_lengthIndicator ( QRencodeMode  mode,
int  version 
)

Length indicator.

Return the size of length indicator for the mode and version.

Parameters
modeencode mode
versionvesion of the symbol
Returns
the size of the appropriate length indicator (bits).

Definition at line 142 of file qrspec.c.

References lengthTableBits, QRinput_isSplittableMode(), and version.

Referenced by QRinput_encodeMode8(), QRinput_encodeModeAn(), QRinput_encodeModeKanji(), QRinput_encodeModeNum(), QRinput_estimateBitStreamSizeOfEntry(), QRinput_lengthOfCode(), Split_eat8(), Split_eatAn(), and Split_eatNum().

◆ QRspec_maximumWords()

int QRspec_maximumWords ( QRencodeMode  mode,
int  version 
)

Return the maximum length for the mode and version.

Parameters
modeencode mode
versionvesion of the symbol
Returns
the maximum length (bytes)

Definition at line 158 of file qrspec.c.

References lengthTableBits, QR_MODE_KANJI, QRinput_isSplittableMode(), and version.

Referenced by QRinput_encodeBitStream(), and QRinput_lengthOfCode().

◆ QRspec_newFrame()

unsigned char * QRspec_newFrame ( int  version)

Frame.

Return a copy of initialized frame.

Parameters
versionversion of the symbol
Returns
Array of unsigned char. You can free it by free().

Definition at line 509 of file qrspec.c.

References QRspec_createFrame(), QRSPEC_VERSION_MAX, and version.

Referenced by QRcode_encodeMask().