42 for(i = 0; i < 8; i++) {
43 v = 0x84 | (format & 1);
44 frame[width * (i + 1) + 8] = v;
47 for(i = 0; i < 7; i++) {
48 v = 0x84 | (format & 1);
49 frame[width * 8 + 7 - i] = v;
54#define MASKMAKER(__exp__) \
57 for(y = 0; y < width; y++) {\
58 for(x = 0; x < width; x++) {\
62 *d = *s ^ ((__exp__) == 0);\
68static void Mask_mask0(
int width,
const unsigned char *s,
unsigned char *d)
73static void Mask_mask1(
int width,
const unsigned char *s,
unsigned char *d)
78static void Mask_mask2(
int width,
const unsigned char *s,
unsigned char *d)
83static void Mask_mask3(
int width,
const unsigned char *s,
unsigned char *d)
89typedef void MaskMaker(
int,
const unsigned char *,
unsigned char *);
95unsigned char *MMask_makeMaskedFrame(
int width,
unsigned char *frame,
int mask)
97 unsigned char *masked;
99 masked = (
unsigned char *)malloc((
size_t)(width * width));
100 if(masked == NULL)
return NULL;
110 unsigned char *masked;
113 if(mask < 0 || mask >=
maskNum) {
119 masked = (
unsigned char *)malloc((
size_t)(width * width));
120 if(masked == NULL)
return NULL;
132 int sum1 = 0, sum2 = 0;
134 p = frame + width * (width - 1);
135 for(x = 1; x < width; x++) {
139 p = frame + width * 2 - 1;
140 for(y = 1; y < width; y++) {
145 return (sum1 <= sum2)?(sum1 * 16 + sum2):(sum2 * 16 + sum1);
151 unsigned char *mask, *bestMask;
158 mask = (
unsigned char *)malloc((
size_t)(width * width));
159 if(mask == NULL)
return NULL;
167 if(score > maxScore) {
171 mask = (
unsigned char *)malloc((
size_t)(width * width));
172 if(mask == NULL)
break;
static void Mask_mask3(int width, const unsigned char *s, unsigned char *d)
#define MASKMAKER(__exp__)
static void Mask_mask2(int width, const unsigned char *s, unsigned char *d)
void MaskMaker(int, const unsigned char *, unsigned char *)
unsigned char * MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level)
static void Mask_mask1(int width, const unsigned char *s, unsigned char *d)
STATIC_IN_RELEASE int MMask_evaluateSymbol(int width, unsigned char *frame)
static MaskMaker * maskMakers[(4)]
unsigned char * MMask_mask(int version, unsigned char *frame, QRecLevel level)
STATIC_IN_RELEASE void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level)
static void Mask_mask0(int width, const unsigned char *s, unsigned char *d)
unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level)
Format information.
int MQRspec_getWidth(int version)
Return the width of the symbol for the version.
QRecLevel
Level of error correction.