ZBar bar code reader . http://zbar.sourceforge.net/ ZBar is licensed under the GNU LGPL 2.1 to enable development of both open source and commercial projects.

Dependents:   GR-PEACH_Camera_in_barcode levkov_ov7670

LICENSE

The ZBar Bar Code Reader is Copyright (C) 2007-2009 Jeff Brown <spadix@users.sourceforge.net> The QR Code reader is Copyright (C) 1999-2009 Timothy B. Terriberry <tterribe@xiph.org>

You can redistribute this library and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

ISAAC is based on the public domain implementation by Robert J. Jenkins Jr., and is itself public domain.

Portions of the bit stream reader are copyright (C) The Xiph.Org Foundation 1994-2008, and are licensed under a BSD-style license.

The Reed-Solomon decoder is derived from an implementation (C) 1991-1995 Henry Minsky (hqm@ua.com, hqm@ai.mit.edu), and is licensed under the LGPL with permission.

Committer:
RyoheiHagimoto
Date:
Tue Apr 19 02:19:39 2016 +0000
Revision:
1:500d42699c34
Parent:
0:56c5742b9e2b
Add copying.txt and license.txt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RyoheiHagimoto 0:56c5742b9e2b 1 /*------------------------------------------------------------------------
RyoheiHagimoto 0:56c5742b9e2b 2 * Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
RyoheiHagimoto 0:56c5742b9e2b 3 *
RyoheiHagimoto 0:56c5742b9e2b 4 * This file is part of the ZBar Bar Code Reader.
RyoheiHagimoto 0:56c5742b9e2b 5 *
RyoheiHagimoto 0:56c5742b9e2b 6 * The ZBar Bar Code Reader is free software; you can redistribute it
RyoheiHagimoto 0:56c5742b9e2b 7 * and/or modify it under the terms of the GNU Lesser Public License as
RyoheiHagimoto 0:56c5742b9e2b 8 * published by the Free Software Foundation; either version 2.1 of
RyoheiHagimoto 0:56c5742b9e2b 9 * the License, or (at your option) any later version.
RyoheiHagimoto 0:56c5742b9e2b 10 *
RyoheiHagimoto 0:56c5742b9e2b 11 * The ZBar Bar Code Reader is distributed in the hope that it will be
RyoheiHagimoto 0:56c5742b9e2b 12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
RyoheiHagimoto 0:56c5742b9e2b 13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
RyoheiHagimoto 0:56c5742b9e2b 14 * GNU Lesser Public License for more details.
RyoheiHagimoto 0:56c5742b9e2b 15 *
RyoheiHagimoto 0:56c5742b9e2b 16 * You should have received a copy of the GNU Lesser Public License
RyoheiHagimoto 0:56c5742b9e2b 17 * along with the ZBar Bar Code Reader; if not, write to the Free
RyoheiHagimoto 0:56c5742b9e2b 18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor,
RyoheiHagimoto 0:56c5742b9e2b 19 * Boston, MA 02110-1301 USA
RyoheiHagimoto 0:56c5742b9e2b 20 *
RyoheiHagimoto 0:56c5742b9e2b 21 * http://sourceforge.net/projects/zbar
RyoheiHagimoto 0:56c5742b9e2b 22 *------------------------------------------------------------------------*/
RyoheiHagimoto 0:56c5742b9e2b 23 #ifndef _EAN_H_
RyoheiHagimoto 0:56c5742b9e2b 24 #define _EAN_H_
RyoheiHagimoto 0:56c5742b9e2b 25
RyoheiHagimoto 0:56c5742b9e2b 26 /* state of each parallel decode attempt */
RyoheiHagimoto 0:56c5742b9e2b 27 typedef struct ean_pass_s {
RyoheiHagimoto 0:56c5742b9e2b 28 signed char state; /* module position of w[idx] in symbol */
RyoheiHagimoto 0:56c5742b9e2b 29 #define STATE_ADDON 0x40 /* scanning add-on */
RyoheiHagimoto 0:56c5742b9e2b 30 #define STATE_IDX 0x1f /* element offset into symbol */
RyoheiHagimoto 0:56c5742b9e2b 31 unsigned char raw[7]; /* decode in process */
RyoheiHagimoto 0:56c5742b9e2b 32 } ean_pass_t;
RyoheiHagimoto 0:56c5742b9e2b 33
RyoheiHagimoto 0:56c5742b9e2b 34 /* EAN/UPC specific decode state */
RyoheiHagimoto 0:56c5742b9e2b 35 typedef struct ean_decoder_s {
RyoheiHagimoto 0:56c5742b9e2b 36 ean_pass_t pass[4]; /* state of each parallel decode attempt */
RyoheiHagimoto 0:56c5742b9e2b 37 zbar_symbol_type_t left; /* current holding buffer contents */
RyoheiHagimoto 0:56c5742b9e2b 38 zbar_symbol_type_t right;
RyoheiHagimoto 0:56c5742b9e2b 39 zbar_symbol_type_t addon;
RyoheiHagimoto 0:56c5742b9e2b 40 unsigned s4; /* character width */
RyoheiHagimoto 0:56c5742b9e2b 41 signed char buf[18]; /* holding buffer */
RyoheiHagimoto 0:56c5742b9e2b 42
RyoheiHagimoto 0:56c5742b9e2b 43 signed char enable;
RyoheiHagimoto 0:56c5742b9e2b 44 unsigned ean13_config;
RyoheiHagimoto 0:56c5742b9e2b 45 unsigned ean8_config;
RyoheiHagimoto 0:56c5742b9e2b 46 unsigned upca_config;
RyoheiHagimoto 0:56c5742b9e2b 47 unsigned upce_config;
RyoheiHagimoto 0:56c5742b9e2b 48 unsigned isbn10_config;
RyoheiHagimoto 0:56c5742b9e2b 49 unsigned isbn13_config;
RyoheiHagimoto 0:56c5742b9e2b 50 } ean_decoder_t;
RyoheiHagimoto 0:56c5742b9e2b 51
RyoheiHagimoto 0:56c5742b9e2b 52 /* reset EAN/UPC pass specific state */
RyoheiHagimoto 0:56c5742b9e2b 53 static inline void ean_new_scan (ean_decoder_t *ean)
RyoheiHagimoto 0:56c5742b9e2b 54 {
RyoheiHagimoto 0:56c5742b9e2b 55 ean->pass[0].state = ean->pass[1].state = -1;
RyoheiHagimoto 0:56c5742b9e2b 56 ean->pass[2].state = ean->pass[3].state = -1;
RyoheiHagimoto 0:56c5742b9e2b 57 ean->s4 = 0;
RyoheiHagimoto 0:56c5742b9e2b 58 }
RyoheiHagimoto 0:56c5742b9e2b 59
RyoheiHagimoto 0:56c5742b9e2b 60 /* reset all EAN/UPC state */
RyoheiHagimoto 0:56c5742b9e2b 61 static inline void ean_reset (ean_decoder_t *ean)
RyoheiHagimoto 0:56c5742b9e2b 62 {
RyoheiHagimoto 0:56c5742b9e2b 63 ean_new_scan(ean);
RyoheiHagimoto 0:56c5742b9e2b 64 ean->left = ean->right = ean->addon = ZBAR_NONE;
RyoheiHagimoto 0:56c5742b9e2b 65 }
RyoheiHagimoto 0:56c5742b9e2b 66
RyoheiHagimoto 0:56c5742b9e2b 67 static inline unsigned ean_get_config (ean_decoder_t *ean,
RyoheiHagimoto 0:56c5742b9e2b 68 zbar_symbol_type_t sym)
RyoheiHagimoto 0:56c5742b9e2b 69 {
RyoheiHagimoto 0:56c5742b9e2b 70 switch(sym & ZBAR_SYMBOL) {
RyoheiHagimoto 0:56c5742b9e2b 71 case ZBAR_EAN13: return(ean->ean13_config);
RyoheiHagimoto 0:56c5742b9e2b 72 case ZBAR_EAN8: return(ean->ean8_config);
RyoheiHagimoto 0:56c5742b9e2b 73 case ZBAR_UPCA: return(ean->upca_config);
RyoheiHagimoto 0:56c5742b9e2b 74 case ZBAR_UPCE: return(ean->upce_config);
RyoheiHagimoto 0:56c5742b9e2b 75 case ZBAR_ISBN10: return(ean->isbn10_config);
RyoheiHagimoto 0:56c5742b9e2b 76 case ZBAR_ISBN13: return(ean->isbn13_config);
RyoheiHagimoto 0:56c5742b9e2b 77 default: return(0);
RyoheiHagimoto 0:56c5742b9e2b 78 }
RyoheiHagimoto 0:56c5742b9e2b 79 }
RyoheiHagimoto 0:56c5742b9e2b 80
RyoheiHagimoto 0:56c5742b9e2b 81 /* decode EAN/UPC symbols */
RyoheiHagimoto 0:56c5742b9e2b 82 zbar_symbol_type_t _zbar_decode_ean(zbar_decoder_t *dcode);
RyoheiHagimoto 0:56c5742b9e2b 83
RyoheiHagimoto 0:56c5742b9e2b 84 #endif
RyoheiHagimoto 0:56c5742b9e2b 85