Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AZTEC Code encoder #79

Merged
merged 67 commits into from
Oct 20, 2023
Merged
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
2ec6729
Raise minimum PH version to 5.6 and use const arrays.
nicolaasuni Oct 13, 2023
f22cbbe
Use const array.
nicolaasuni Oct 13, 2023
6072177
Add Atzec code draft.
nicolaasuni Oct 13, 2023
50e43c6
Add aztec latch map
nicolaasuni Oct 13, 2023
7b7d347
Aztec code draft 2
nicolaasuni Oct 13, 2023
d86be3f
Aztec draft 3
nicolaasuni Oct 13, 2023
d1776ce
Aztec draft 4
nicolaasuni Oct 15, 2023
1c01afe
process punct pairs
nicolaasuni Oct 15, 2023
f903b5d
draft encoding
nicolaasuni Oct 15, 2023
2d730ad
high-level encoder
nicolaasuni Oct 16, 2023
50d5944
Split Encode class
nicolaasuni Oct 16, 2023
6e2762b
Add size tables
nicolaasuni Oct 16, 2023
1232ade
Format size tables
nicolaasuni Oct 16, 2023
ac190b7
Add layers size
nicolaasuni Oct 16, 2023
141a52f
Refactor layers
nicolaasuni Oct 16, 2023
bc6d9a8
Draft bit stuffing
nicolaasuni Oct 16, 2023
f1c1685
bit stuffing
nicolaasuni Oct 16, 2023
7683c86
Split classes
nicolaasuni Oct 16, 2023
5b78482
draft error correction
nicolaasuni Oct 17, 2023
a04cd9f
draft check codeword
nicolaasuni Oct 17, 2023
d640f4f
cleanup
nicolaasuni Oct 17, 2023
9927328
checkword
nicolaasuni Oct 17, 2023
36974fb
Fix mixed table
nicolaasuni Oct 18, 2023
098550d
add comments
nicolaasuni Oct 18, 2023
993e483
fixes
nicolaasuni Oct 18, 2023
2171aa3
Draw bulls eye
nicolaasuni Oct 18, 2023
fef6f83
Set reference grid
nicolaasuni Oct 18, 2023
9788e89
add mode messages
nicolaasuni Oct 18, 2023
839e194
draw compact data
nicolaasuni Oct 19, 2023
cc0b885
draft full data draw
nicolaasuni Oct 19, 2023
0072d2c
simplify
nicolaasuni Oct 19, 2023
36fb9cf
fixes
nicolaasuni Oct 19, 2023
2341a0e
fixes
nicolaasuni Oct 19, 2023
8be594a
simplify mode
nicolaasuni Oct 20, 2023
f381662
Add mode option
nicolaasuni Oct 20, 2023
2b30efb
Set params
nicolaasuni Oct 20, 2023
1b07928
call encoder
nicolaasuni Oct 20, 2023
55e319e
fixes
nicolaasuni Oct 20, 2023
d1cad65
fix highLevelEncoding
nicolaasuni Oct 20, 2023
3e3403d
convert bitstream to array of words
nicolaasuni Oct 20, 2023
f223f49
fix confition
nicolaasuni Oct 20, 2023
cc5ff2b
fix mode draw
nicolaasuni Oct 20, 2023
871b702
Fix data drawing
nicolaasuni Oct 20, 2023
4bab4b2
cleanup
nicolaasuni Oct 20, 2023
b376113
Fix condition
nicolaasuni Oct 20, 2023
834e069
fix del code
nicolaasuni Oct 20, 2023
e52a2c7
fix mode in full
nicolaasuni Oct 20, 2023
1c45982
remove debug lines
nicolaasuni Oct 20, 2023
968da48
fix layer side len
nicolaasuni Oct 20, 2023
950ba6b
skip reference grid
nicolaasuni Oct 20, 2023
5118dec
Add aztec tests
nicolaasuni Oct 20, 2023
4113f40
more tests
nicolaasuni Oct 20, 2023
882beb2
more tests
nicolaasuni Oct 20, 2023
103e27b
code cleanup
nicolaasuni Oct 20, 2023
9ff1440
code cleanup
nicolaasuni Oct 20, 2023
8528c8b
fix binary processor
nicolaasuni Oct 20, 2023
5b4ccda
fix condition
nicolaasuni Oct 20, 2023
2c4abc4
Add special cases
nicolaasuni Oct 20, 2023
677b6d7
more tests
nicolaasuni Oct 20, 2023
474a968
optimize code
nicolaasuni Oct 20, 2023
e9a527a
fixes
nicolaasuni Oct 20, 2023
14edf94
commemt
nicolaasuni Oct 20, 2023
c5ec9a0
Change for PHP 5.6 compatibility
nicolaasuni Oct 20, 2023
882b634
Changes for PHP 5.6 compatibility
nicolaasuni Oct 20, 2023
6bce590
Changes for PHP 5.6 compatibility
nicolaasuni Oct 20, 2023
0ca30ed
Changes for PHP 5.6 compatibility
nicolaasuni Oct 20, 2023
6d7cb18
Changes for PHP 5.6 compatibility
nicolaasuni Oct 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
code cleanup
nicolaasuni committed Oct 20, 2023
commit 103e27b692dd2621b74c61a3560ba601fd55fdb8
3 changes: 0 additions & 3 deletions src/Type/Square/Aztec/Codeword.php
Original file line number Diff line number Diff line change
@@ -220,9 +220,6 @@ protected function addCdw($mode, $value)
*/
protected function addLatch($mode)
{
if ($this->encmode == $mode) {
return;
}
$latch = Data::LATCH_MAP[$this->encmode][$mode];
foreach ($latch as $cdw) {
$this->addRawCwd($cdw[0], $cdw[1]);
9 changes: 0 additions & 9 deletions src/Type/Square/Aztec/Encode.php
Original file line number Diff line number Diff line change
@@ -61,9 +61,6 @@ class Encode extends \Com\Tecnick\Barcode\Type\Square\Aztec\Bitstream
public function __construct($code, $ecc = 33, $eci = 0, $hint = 'A', $mode = 'A')
{
$this->highLevelEncoding($code, $eci, $hint);
if ($this->totbits == 0) {
throw new BarcodeException('No input data');
}
if (!$this->sizeAndBitStuffing($ecc, $mode)) {
throw new BarcodeException('Data too long');
}
@@ -107,12 +104,6 @@ protected function addCheckWords(array &$bitstream, &$totbits, $nbits, $wsize)
foreach ($checkwords as $val) {
$this->appendWordToBitstream($bitstream, $totbits, $wsize, $val);
}
// insert padding at the beginning of the codewords and bitstream
$pad = intval($nbits % $wsize);
if ($pad > 0) {
array_unshift($bitstream, array_fill(0, $pad, 0));
$totbits = count($bitstream);
}
return $numcdw;
}

11 changes: 5 additions & 6 deletions src/Type/Square/Aztec/Layers.php
Original file line number Diff line number Diff line change
@@ -65,12 +65,11 @@ abstract class Layers extends \Com\Tecnick\Barcode\Type\Square\Aztec\Codeword
*/
protected function getMinLayers($data, $numbits)
{
if ($numbits > $data[count($data)][3]) {
return 0;
}
foreach ($data as $numlayers => $size) {
if ($numbits <= $size[3]) {
return $numlayers;
if ($numbits <= $data[count($data)][3]) {
foreach ($data as $numlayers => $size) {
if ($numbits <= $size[3]) {
return $numlayers;
}
}
}
return 0;