TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Macros | Typedefs | Functions | Variables
mask.c File Reference
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include "qrencode.h"
#include "qrspec.h"
#include "mask.h"

Go to the source code of this file.

Macros

#define N1   (3)
 Demerit coefficients. More...
 
#define N2   (3)
 
#define N3   (40)
 
#define N4   (10)
 
#define MASKMAKER(__exp__)
 
#define maskNum   (8)
 

Typedefs

typedef int MaskMaker(int, const unsigned char *, unsigned char *)
 

Functions

STATIC_IN_RELEASE int Mask_writeFormatInformation (int width, unsigned char *frame, int mask, QRecLevel level)
 
static int Mask_mask0 (int width, const unsigned char *s, unsigned char *d)
 
static int Mask_mask1 (int width, const unsigned char *s, unsigned char *d)
 
static int Mask_mask2 (int width, const unsigned char *s, unsigned char *d)
 
static int Mask_mask3 (int width, const unsigned char *s, unsigned char *d)
 
static int Mask_mask4 (int width, const unsigned char *s, unsigned char *d)
 
static int Mask_mask5 (int width, const unsigned char *s, unsigned char *d)
 
static int Mask_mask6 (int width, const unsigned char *s, unsigned char *d)
 
static int Mask_mask7 (int width, const unsigned char *s, unsigned char *d)
 
unsigned char * Mask_makeMask (int width, unsigned char *frame, int mask, QRecLevel level)
 
STATIC_IN_RELEASE int Mask_calcN1N3 (int length, int *runLength)
 
STATIC_IN_RELEASE int Mask_calcN2 (int width, unsigned char *frame)
 
STATIC_IN_RELEASE int Mask_calcRunLengthH (int width, unsigned char *frame, int *runLength)
 
STATIC_IN_RELEASE int Mask_calcRunLengthV (int width, unsigned char *frame, int *runLength)
 
STATIC_IN_RELEASE int Mask_evaluateSymbol (int width, unsigned char *frame)
 
unsigned char * Mask_mask (int width, unsigned char *frame, QRecLevel level)
 

Variables

static MaskMakermaskMakers [maskNum]
 

Macro Definition Documentation

#define MASKMAKER (   __exp__)
Value:
int x, y;\
int b = 0;\
\
for(y = 0; y < width; y++) {\
for(x = 0; x < width; x++) {\
if(*s & 0x80) {\
*d = *s;\
} else {\
*d = *s ^ ((__exp__) == 0);\
}\
b += (int)(*d & 1);\
s++; d++;\
}\
}\
return b;
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

Definition at line 84 of file mask.c.

Referenced by Mask_mask0(), Mask_mask1(), Mask_mask2(), Mask_mask3(), Mask_mask4(), Mask_mask5(), Mask_mask6(), and Mask_mask7().

#define maskNum   (8)

Definition at line 141 of file mask.c.

Referenced by Mask_makeMask(), and Mask_mask().

#define N1   (3)

Demerit coefficients.

See Section 8.8.2, pp.45, JIS X0510:2004.

Definition at line 79 of file mask.c.

Referenced by Mask_calcN1N3().

#define N2   (3)

Definition at line 80 of file mask.c.

Referenced by Mask_calcN2().

#define N3   (40)

Definition at line 81 of file mask.c.

Referenced by Mask_calcN1N3().

#define N4   (10)

Definition at line 82 of file mask.c.

Referenced by Mask_mask().

Typedef Documentation

typedef int MaskMaker(int, const unsigned char *, unsigned char *)

Definition at line 142 of file mask.c.

Function Documentation

STATIC_IN_RELEASE int Mask_calcN1N3 ( int  length,
int runLength 
)

Definition at line 186 of file mask.c.

References N1, and N3.

Referenced by Mask_evaluateSymbol().

STATIC_IN_RELEASE int Mask_calcN2 ( int  width,
unsigned char *  frame 
)

Definition at line 219 of file mask.c.

References N2.

Referenced by Mask_evaluateSymbol().

STATIC_IN_RELEASE int Mask_calcRunLengthH ( int  width,
unsigned char *  frame,
int runLength 
)

Definition at line 242 of file mask.c.

Referenced by Mask_evaluateSymbol().

STATIC_IN_RELEASE int Mask_calcRunLengthV ( int  width,
unsigned char *  frame,
int runLength 
)

Definition at line 270 of file mask.c.

Referenced by Mask_evaluateSymbol().

STATIC_IN_RELEASE int Mask_evaluateSymbol ( int  width,
unsigned char *  frame 
)

Definition at line 298 of file mask.c.

References Mask_calcN1N3(), Mask_calcN2(), Mask_calcRunLengthH(), Mask_calcRunLengthV(), and QRSPEC_WIDTH_MAX.

Referenced by Mask_mask().

unsigned char* Mask_makeMask ( int  width,
unsigned char *  frame,
int  mask,
QRecLevel  level 
)

Definition at line 162 of file mask.c.

References malloc(), Mask_writeFormatInformation(), maskMakers, and maskNum.

Referenced by QRcode_encodeMask().

unsigned char* Mask_mask ( int  width,
unsigned char *  frame,
QRecLevel  level 
)

Definition at line 320 of file mask.c.

References free(), malloc(), Mask_evaluateSymbol(), Mask_writeFormatInformation(), maskMakers, maskNum, and N4.

Referenced by QRcode_encodeMask().

static int Mask_mask0 ( int  width,
const unsigned char *  s,
unsigned char *  d 
)
static

Definition at line 101 of file mask.c.

References MASKMAKER.

static int Mask_mask1 ( int  width,
const unsigned char *  s,
unsigned char *  d 
)
static

Definition at line 106 of file mask.c.

References MASKMAKER.

static int Mask_mask2 ( int  width,
const unsigned char *  s,
unsigned char *  d 
)
static

Definition at line 111 of file mask.c.

References MASKMAKER.

static int Mask_mask3 ( int  width,
const unsigned char *  s,
unsigned char *  d 
)
static

Definition at line 116 of file mask.c.

References MASKMAKER.

static int Mask_mask4 ( int  width,
const unsigned char *  s,
unsigned char *  d 
)
static

Definition at line 121 of file mask.c.

References MASKMAKER.

static int Mask_mask5 ( int  width,
const unsigned char *  s,
unsigned char *  d 
)
static

Definition at line 126 of file mask.c.

References MASKMAKER.

static int Mask_mask6 ( int  width,
const unsigned char *  s,
unsigned char *  d 
)
static

Definition at line 131 of file mask.c.

References MASKMAKER.

static int Mask_mask7 ( int  width,
const unsigned char *  s,
unsigned char *  d 
)
static

Definition at line 136 of file mask.c.

References MASKMAKER.

STATIC_IN_RELEASE int Mask_writeFormatInformation ( int  width,
unsigned char *  frame,
int  mask,
QRecLevel  level 
)

Definition at line 32 of file mask.c.

References QRspec_getFormatInfo().

Referenced by Mask_makeMask(), and Mask_mask().

Variable Documentation

MaskMaker* maskMakers[maskNum]
static
Initial value:
= {
}
static int Mask_mask3(int width, const unsigned char *s, unsigned char *d)
Definition: mask.c:116
static int Mask_mask2(int width, const unsigned char *s, unsigned char *d)
Definition: mask.c:111
static int Mask_mask1(int width, const unsigned char *s, unsigned char *d)
Definition: mask.c:106
static int Mask_mask6(int width, const unsigned char *s, unsigned char *d)
Definition: mask.c:131
static int Mask_mask5(int width, const unsigned char *s, unsigned char *d)
Definition: mask.c:126
static int Mask_mask0(int width, const unsigned char *s, unsigned char *d)
Definition: mask.c:101
static int Mask_mask4(int width, const unsigned char *s, unsigned char *d)
Definition: mask.c:121
static int Mask_mask7(int width, const unsigned char *s, unsigned char *d)
Definition: mask.c:136

Definition at line 143 of file mask.c.

Referenced by Mask_makeMask(), and Mask_mask().