aboutsummaryrefslogtreecommitdiff
path: root/source/codes/Aztec.mc
diff options
context:
space:
mode:
Diffstat (limited to 'source/codes/Aztec.mc')
-rw-r--r--source/codes/Aztec.mc21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/codes/Aztec.mc b/source/codes/Aztec.mc
index 495abbf..0d4a856 100644
--- a/source/codes/Aztec.mc
+++ b/source/codes/Aztec.mc
@@ -44,6 +44,8 @@ module Aztec {
const FIELD_ENTRIES_PER_STEP = 500; // GF(1024) / GF(4096) tables
const GENERATOR_WORK_PER_STEP = 500; // generator coefficient updates
const ECC_WORK_PER_STEP = 400; // data symbols x EC symbols
+ // Cumulative percent at the end of each phase 0-5 (see AztecJob.percent).
+ const PHASE_ENDS = [8, 14, 20, 64, 72, 100];
const GRID_LINES_PER_STEP = 4; // reference grid
const WORDS_PER_STEP = 50; // codewords into bits
const PAIRS_PER_STEP = 250; // spiral bit pairs
@@ -314,8 +316,25 @@ module Aztec {
_ec = EC_PERCENT[option] as Number;
}
+ // Progress 0-100: the share of each phase (simulator timings; the
+ // Reed-Solomon codewords and the spiral take the most).
function percent() as Number {
- return _phase * 100 / 6;
+ var done = 0;
+ var total = 0;
+ var e = _encoder;
+ if (_phase == 3 && e != null) { // data symbols done
+ done = e.percent();
+ total = 100;
+ } else if (_phase == 5) { // bits placed
+ done = _at;
+ total = _bits.size();
+ }
+ return Codes.phased(PHASE_ENDS, _phase, done, total);
+ }
+
+ // Packing and runs: about 86 / 3 / 11 % of a whole display job.
+ function stageEnds() as Array<Number> {
+ return [86, 89];
}
function matrix() as Codes.Matrix? {