Path: blob/master/3rdparty/quirc/include/quirc_internal.h
16337 views
/* quirc -- QR-code recognition library1* Copyright (C) 2010-2012 Daniel Beer <[email protected]>2*3* Permission to use, copy, modify, and/or distribute this software for any4* purpose with or without fee is hereby granted, provided that the above5* copyright notice and this permission notice appear in all copies.6*7* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES8* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF9* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR10* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES11* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN12* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF13* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14*/1516#ifndef QUIRC_INTERNAL_H_17#define QUIRC_INTERNAL_H_1819#include <quirc.h>2021#define QUIRC_PIXEL_WHITE 022#define QUIRC_PIXEL_BLACK 123#define QUIRC_PIXEL_REGION 22425#ifndef QUIRC_MAX_REGIONS26#define QUIRC_MAX_REGIONS 25427#endif28#define QUIRC_MAX_CAPSTONES 3229#define QUIRC_MAX_GRIDS 83031#define QUIRC_PERSPECTIVE_PARAMS 83233#if QUIRC_MAX_REGIONS < UINT8_MAX34typedef uint8_t quirc_pixel_t;35#elif QUIRC_MAX_REGIONS < UINT16_MAX36typedef uint16_t quirc_pixel_t;37#else38#error "QUIRC_MAX_REGIONS > 65534 is not supported"39#endif4041struct quirc_region {42struct quirc_point seed;43int count;44int capstone;45};4647struct quirc_capstone {48int ring;49int stone;5051struct quirc_point corners[4];52struct quirc_point center;53double c[QUIRC_PERSPECTIVE_PARAMS];5455int qr_grid;56};5758struct quirc_grid {59/* Capstone indices */60int caps[3];6162/* Alignment pattern region and corner */63int align_region;64struct quirc_point align;6566/* Timing pattern endpoints */67struct quirc_point tpep[3];68int hscan;69int vscan;7071/* Grid size and perspective transform */72int grid_size;73double c[QUIRC_PERSPECTIVE_PARAMS];74};7576struct quirc {77uint8_t *image;78quirc_pixel_t *pixels;79int *row_average; /* used by threshold() */80int w;81int h;8283int num_regions;84struct quirc_region regions[QUIRC_MAX_REGIONS];8586int num_capstones;87struct quirc_capstone capstones[QUIRC_MAX_CAPSTONES];8889int num_grids;90struct quirc_grid grids[QUIRC_MAX_GRIDS];91};9293/************************************************************************94* QR-code version information database95*/9697#define QUIRC_MAX_VERSION 4098#define QUIRC_MAX_ALIGNMENT 799100struct quirc_rs_params {101int bs; /* Small block size */102int dw; /* Small data words */103int ns; /* Number of small blocks */104};105106struct quirc_version_info {107int data_bytes;108int apat[QUIRC_MAX_ALIGNMENT];109struct quirc_rs_params ecc[4];110};111112extern const struct quirc_version_info quirc_version_db[QUIRC_MAX_VERSION + 1];113114#endif115116117