qrencode
4.1.1
About: libqrencode is a fast and compact library and command-line utility for encoding data in a QR Code symbol.
![]() ![]() |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "qrspec.h"
#include "qrinput.h"
Go to the source code of this file.
Data Structures | |
struct | QRspec_Capacity |
Version and capacity. More... | |
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... | |
static void | QRspec_putAlignmentMarker (unsigned char *frame, int width, int ox, int oy) |
Put an alignment marker. More... | |
static void | QRspec_putAlignmentPattern (int version, unsigned char *frame, int width) |
unsigned int | QRspec_getVersionPattern (int version) |
Version information pattern. More... | |
unsigned int | QRspec_getFormatInfo (int mask, QRecLevel level) |
Format information. More... | |
static void | putFinderPattern (unsigned char *frame, int width, int ox, int oy) |
Frame. More... | |
static unsigned char * | QRspec_createFrame (int version) |
unsigned char * | QRspec_newFrame (int version) |
Frame. More... | |
Variables | |
static const QRspec_Capacity | qrspecCapacity [40+1] |
Table of the capacity of symbols See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004. More... | |
static const int | lengthTableBits [4][3] |
Length indicator. More... | |
static const int | eccTable [40+1][4][2] |
Error correction code. More... | |
static const int | alignmentPattern [40+1][2] |
Alignment pattern. More... | |
static const unsigned int | versionPattern [40 - 6] |
Version information pattern. More... | |
static const unsigned int | formatInfo [4][8] |
Format information. More... | |
|
static |
Frame.
Put a finder pattern.
frame | |
width | |
ox,oy | upper-left coordinate of the pattern |
Definition at line 400 of file qrspec.c.
Referenced by QRspec_createFrame().
|
static |
Definition at line 426 of file qrspec.c.
References putFinderPattern(), QRspec_getVersionPattern(), QRspec_putAlignmentPattern(), qrspecCapacity, version, and QRspec_Capacity::width.
Referenced by QRspec_newFrame().
int QRspec_getDataLength | ( | int | version, |
QRecLevel | level | ||
) |
Return maximum data code length (bytes) for the version.
version | version of the symbol |
level | error correction level |
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().
int QRspec_getECCLength | ( | int | version, |
QRecLevel | level | ||
) |
Return maximum error correction code length (bytes) for the version.
version | version of the symbol |
level | error correction level |
Definition at line 103 of file qrspec.c.
References QRspec_Capacity::ec, level, qrspecCapacity, and version.
Referenced by QRspec_getEccSpec().
void QRspec_getEccSpec | ( | int | version, |
QRecLevel | level, | ||
int | spec[5] | ||
) |
Error correction code.
Return an array of ECC specification.
version | version of the symbol |
level | error correction level |
spec | an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, |
Definition at line 234 of file qrspec.c.
References eccTable, level, QRspec_getDataLength(), QRspec_getECCLength(), and version.
Referenced by QRraw_new().
unsigned int QRspec_getFormatInfo | ( | int | mask, |
QRecLevel | level | ||
) |
Format information.
Return BCH encoded format information pattern.
mask | mask number |
level | error correction level |
Definition at line 383 of file qrspec.c.
References formatInfo, and level.
Referenced by Mask_writeFormatInformation().
int QRspec_getMinimumVersion | ( | int | size, |
QRecLevel | level | ||
) |
Return a version number that satisfies the input code length.
size | input code length (byte) |
level | error correction level |
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().
int QRspec_getRemainder | ( | int | version | ) |
Return the numer of remainder bits.
version | vesion of the symbol |
Definition at line 126 of file qrspec.c.
References qrspecCapacity, QRspec_Capacity::remainder, and version.
Referenced by QRcode_encodeMask().
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.
version | version of the symbol |
Definition at line 364 of file qrspec.c.
References QRSPEC_VERSION_MAX, version, and versionPattern.
Referenced by QRspec_createFrame().
int QRspec_getWidth | ( | int | version | ) |
Return the width of the symbol for the version.
version | vesion of the symbol |
Definition at line 121 of file qrspec.c.
References qrspecCapacity, version, and QRspec_Capacity::width.
Referenced by QRcode_encodeMask().
int QRspec_lengthIndicator | ( | QRencodeMode | mode, |
int | version | ||
) |
Length indicator.
Return the size of length indicator for the mode and version.
mode | encode mode |
version | vesion of the symbol |
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().
int QRspec_maximumWords | ( | QRencodeMode | mode, |
int | version | ||
) |
Return the maximum length for the mode and version.
mode | encode mode |
version | vesion of the symbol |
Definition at line 158 of file qrspec.c.
References lengthTableBits, QR_MODE_KANJI, QRinput_isSplittableMode(), and version.
Referenced by QRinput_encodeBitStream(), and QRinput_lengthOfCode().
unsigned char * QRspec_newFrame | ( | int | version | ) |
Frame.
Return a copy of initialized frame.
version | version of the symbol |
Definition at line 509 of file qrspec.c.
References QRspec_createFrame(), QRSPEC_VERSION_MAX, and version.
Referenced by QRcode_encodeMask().
|
static |
Put an alignment marker.
frame | |
width | |
ox,oy | center coordinate of the pattern |
Definition at line 287 of file qrspec.c.
Referenced by QRspec_putAlignmentPattern().
|
static |
Definition at line 310 of file qrspec.c.
References alignmentPattern, QRspec_putAlignmentMarker(), and version.
Referenced by QRspec_createFrame().
|
static |
Alignment pattern.
Positions of alignment patterns. This array includes only the second and the third position of the alignment patterns. Rest of them can be calculated from the distance between them.
See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
Definition at line 269 of file qrspec.c.
Referenced by QRspec_putAlignmentPattern().
|
static |
Error correction code.
Table of the error correction code (Reed-Solomon block) See Table 12-16 (pp.30-36), JIS X0510:2004.
Definition at line 190 of file qrspec.c.
Referenced by QRspec_getEccSpec().
|
static |
Format information.
Definition at line 376 of file qrspec.c.
Referenced by QRspec_getFormatInfo().
|
static |
Length indicator.
Definition at line 135 of file qrspec.c.
Referenced by QRspec_lengthIndicator(), and QRspec_maximumWords().
|
static |
Table of the capacity of symbols See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004.
Definition at line 54 of file qrspec.c.
Referenced by QRspec_createFrame(), QRspec_getDataLength(), QRspec_getECCLength(), QRspec_getMinimumVersion(), QRspec_getRemainder(), and QRspec_getWidth().
|
static |
Version information pattern.
Version information pattern (BCH coded). See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
Definition at line 356 of file qrspec.c.
Referenced by QRspec_getVersionPattern().