csync-git
[mirrors/ArchLinux-Packages.git] / optar / optar.300dpi.h
CommitLineData
209feeb0
H
1/* (c) GPL 2007 Karel 'Clock' Kulhavy, Twibright Labs */
2
3#define MIN(x,y) ((x)<(y)?(x):(y))
4#define MAX(x,y) ((x)>(y)?(x):(y))
5
6#define BORDER 2 /* In pixels. Thickness of the border */
7#define CHALF 3 /* Size of the cross half. Size of the cross is CHALF*2 x CHALF*2.
8 */
9#define CPITCH 24 /* Distance between cross centers */
10
11/* XCROSSES A4 65, US Letter 67. */
12#define XCROSSES 32 /* Number of crosses horizontally */
13/* YCROSSES A4 93, US Letter 87. */
14#define YCROSSES 46 /* Number of crosses vertically */
15
16#define DATA_WIDTH (CPITCH*(XCROSSES-1)+2*CHALF) /* The rectangle occupied by
17 the data and crosses */
18#define DATA_HEIGHT (CPITCH*(YCROSSES-1)+2*CHALF)
19#define WIDTH (2*BORDER+DATA_WIDTH) /* In pixels, including the border */
20/* In pixels, including the border and the label */
21
22#define TEXT_WIDTH 13 /* Width of a single letter */
23
24/* Definitions for seq2xy */
25
26/* Properties of the narrow horizontal strip, with crosses */
27#define NARROWHEIGHT (2*CHALF)
28#define GAPWIDTH (CPITCH-2*CHALF)
29#define NARROWWIDTH (GAPWIDTH*(XCROSSES-1)) /* Useful width */
30#define NARROWPIXELS (NARROWHEIGHT*NARROWWIDTH) /* Useful pixels */
31
32/* Properties of the wide horizontal strip, without crosses */
33#define WIDEHEIGHT GAPWIDTH
34#define WIDEWIDTH (WIDTH-2*BORDER)
35#define WIDEPIXELS (WIDEHEIGHT*WIDEWIDTH)
36
37/* Amount of raw payload pixels in one narrow-wide strip pair */
38#define REPHEIGHT (NARROWHEIGHT+WIDEHEIGHT)
39#define REPPIXELS (WIDEPIXELS+NARROWPIXELS)
40
41/* Total bits before hamming including the unused */
42#define TOTALBITS ((long)REPPIXELS*(YCROSSES-1)+NARROWPIXELS)
43
44/* Hamming codes with parity */
45#define FEC_ORDER 1 /* Can be 2 to 5 inclusive.
46 5 is 26/32,
47 4 is 11/16,
48 3 is 4/8,
49 2 is 4/1
50 1 is golay codes */
51#if FEC_ORDER==1
52/* Golay */
53#define FEC_LARGEBITS 24
54#define FEC_SMALLBITS 12
55#else
56/* Hamming */
57#define FEC_LARGEBITS (1<<FEC_ORDER)
58#define FEC_SMALLBITS (FEC_LARGEBITS-1-FEC_ORDER)
59#endif
60
61/* Hamming net channel capacity */
62#define FEC_SYMS (TOTALBITS/FEC_LARGEBITS)
63#define NETBITS (FEC_SYMS*FEC_SMALLBITS) /* Net payload bits */
64#define USEDBITS (FEC_SYMS*FEC_LARGEBITS) /* Used raw bits to store
65 Hamming symbols */
66
67/* Functions from common.c */
68extern unsigned long parity(unsigned long in);
69extern int is_cross(unsigned x, unsigned y);
70extern void seq2xy(int *x, int *y, unsigned seq);
71
72/* Counts number of '1' bits */
73unsigned ones(unsigned long in);
74
75/* Golay codes */
76unsigned long golay(unsigned long in);
77extern unsigned long golay_codes[4096];
This page took 0.167447 seconds and 4 git commands to generate.