Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zint/backend/reedsol.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /* | |
| 2 This is a simple Reed-Solomon encoder | |
| 3 (C) Cliff Hones 2004 | |
| 4 */ | |
| 5 /* | |
| 6 libzint - the open source barcode library | |
| 7 Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com> | |
| 8 | |
| 9 Redistribution and use in source and binary forms, with or without | |
| 10 modification, are permitted provided that the following conditions | |
| 11 are met: | |
| 12 | |
| 13 1. Redistributions of source code must retain the above copyright | |
| 14 notice, this list of conditions and the following disclaimer. | |
| 15 2. Redistributions in binary form must reproduce the above copyright | |
| 16 notice, this list of conditions and the following disclaimer in the | |
| 17 documentation and/or other materials provided with the distribution. | |
| 18 3. Neither the name of the project nor the names of its contributors | |
| 19 may be used to endorse or promote products derived from this software | |
| 20 without specific prior written permission. | |
| 21 | |
| 22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
| 23 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | |
| 26 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 27 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 28 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 29 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 30 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 31 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 32 SUCH DAMAGE. | |
| 33 | |
| 34 */ | |
| 35 /* SPDX-License-Identifier: BSD-3-Clause */ | |
| 36 | |
| 37 #ifndef Z_REEDSOL_H | |
| 38 #define Z_REEDSOL_H | |
| 39 | |
| 40 #ifdef __cplusplus | |
| 41 extern "C" { | |
| 42 #endif /* __cplusplus */ | |
| 43 | |
| 44 typedef struct { | |
| 45 const unsigned char *logt; /* These are static */ | |
| 46 const unsigned char *alog; | |
| 47 unsigned char rspoly[256]; /* Generated poly */ | |
| 48 unsigned char log_rspoly[256]; /* Logs of poly */ | |
| 49 int nsym; /* Degree of poly */ | |
| 50 int zero; /* Set if poly has a zero coeff */ | |
| 51 } rs_t; | |
| 52 | |
| 53 typedef struct { | |
| 54 unsigned int *logt; /* These are malloced */ | |
| 55 unsigned int *alog; | |
| 56 unsigned short rspoly[4096]; /* Generated poly, 12-bit max - needs to be enlarged if > 12-bit used */ | |
| 57 unsigned int log_rspoly[4096]; /* Logs of poly */ | |
| 58 int nsym; /* Degree of poly */ | |
| 59 int zero; /* Set if poly has a zero coeff */ | |
| 60 } rs_uint_t; | |
| 61 | |
| 62 INTERNAL void rs_init_gf(rs_t *rs, const unsigned int prime_poly); | |
| 63 INTERNAL void rs_init_code(rs_t *rs, const int nsym, int index); | |
| 64 INTERNAL void rs_encode(const rs_t *rs, const int datalen, const unsigned char *data, unsigned char *res); | |
| 65 INTERNAL void rs_encode_uint(const rs_t *rs, const int datalen, const unsigned int *data, unsigned int *res); | |
| 66 /* No free needed as log tables static */ | |
| 67 | |
| 68 INTERNAL int rs_uint_init_gf(rs_uint_t *rs_uint, const unsigned int prime_poly, const int logmod); | |
| 69 INTERNAL void rs_uint_init_code(rs_uint_t *rs_uint, const int nsym, int index); | |
| 70 INTERNAL void rs_uint_encode(const rs_uint_t *rs_uint, const int datalen, const unsigned int *data, | |
| 71 unsigned int *res); | |
| 72 INTERNAL void rs_uint_free(rs_uint_t *rs_uint); | |
| 73 | |
| 74 #ifdef __cplusplus | |
| 75 } | |
| 76 #endif /* __cplusplus */ | |
| 77 | |
| 78 /* vim: set ts=4 sw=4 et : */ | |
| 79 #endif /* Z_REEDSOL_H */ |
