Preprint
Article

This version is not peer-reviewed.

On the Equivalence Classes of Recoverable Patterns in DR Code: A Group-Theoretic Analysis with Applications to Storage Optimization

Submitted:

22 June 2026

Posted:

23 June 2026

You are already at the latest version

Abstract
The DR Code (Data Restorable Code), originally proposed by Sriphum (2013), is a two-dimensional barcode that achieves a 33% data-recovery rate against six distinct cases of strip-shaped data loss using simple XOR-based parity. The original work presented a single 3×3 arrangement of nine logical blocks (A0, A1, A2, B0, B1, B2, C0, C1, C2) in which each row and each column contains exactly one element from each of the three data classes (A, B, C). This paper systematically enumerates every 3×3 arrangement that satisfies this recoverability property and proves, by exhaustive search released as an open-source program (DR15.py), that exactly 2,592 such arrangements exist. We then introduce five structural theorems—mirror reflection, vertical flipping, Tetris-style rotation, cyclic column rotation, and cyclic row rotation—and prove that each preserves recoverability. We show that these five generators, viewed as a group action, produce a finite group of order 72 isomorphic to D₄ × C₃ × C₃, which partitions the 2,592 patterns into exactly 36 absolute equivalence classes. We further explore the partial-quotient structure under D₄ alone (yielding 324 classes, the case the practitioner is most likely to encounter) and under cyclic-only quotient (yielding 288 classes). As practical contributions, we propose (i) a compact equivalence-class encoding that reduces the storage cost of one DR Code template from a naïve 36 bits to 12 bits, and (ii) a canonical-form deduplication scheme suitable for cloud and embedded storage systems. Additionally, we propose two further contributions: a fast pattern-validity oracle based on canonical lookup, and a randomization-friendly DR Code variant for security-aware barcode applications. Empirical results confirm all theorems on the full enumeration of 2,592 patterns.
Keywords: 
;  ;  ;  ;  ;  ;  ;  ;  ;  ;  ;  ;  ;  ;  ;  

1. Introduction

Symmetry analysis provides a powerful framework for understanding the structure of constrained combinatorial objects: when a finite set V of patterns satisfies a structural constraint preserved by a natural group G of transformations, the orbit decomposition of V under G reveals fundamental equivalence classes and enables compact representation, efficient enumeration, and canonical-form deduplication. This paper applies such symmetry analysis to a constrained combinatorial structure arising in two-dimensional barcode design: the DR Code (Data Restorable Code), originally introduced by Sriphum [1] in 2013. Two-dimensional barcodes have become indispensable to modern industry and logistics. The QR Code [2] is presently the most widely deployed format due to its high information density and its Reed–Solomon error correction, which at the H quality level can recover up to 30% of the codeword data when the loss occurs in two specific spatial regions [3,4]. However, the rigidity of QR Code’s error-correction layout limits the geometry of recoverable damage to those specific regions; arbitrary horizontal or vertical strips that cross the format-information area cannot be repaired.

1.1. Symmetry as the Organizing Principle

The 3×3 grid that hosts the DR Code is a square lattice whose natural geometric symmetry group is the dihedral group D₄ of order 8, consisting of four rotations (by 0°, 90°, 180°, 270°) and four reflections (horizontal, vertical, and the two diagonal mirrors). D₄ is the natural symmetry group of any square grid and appears whenever 2D arrangements are studied modulo orientation. In the context of the DR Code, D₄ captures exactly those transformations that a printed barcode undergoes when physically rotated or flipped before being scanned—the geometric component of the problem.
In addition to the geometric symmetries, the DR Code recoverability constraint—requiring every row and every column to contain exactly one element of each class—is invariant under cyclic permutations of the row labels and, independently, under cyclic permutations of the column labels. These two cyclic actions form the group C₃ × C₃ of order 9. Unlike the dihedral D₄, which is purely geometric, the C₃ × C₃ component is combinatorial: it reflects the fact that the labeling of rows and columns is, from the perspective of recoverability, an arbitrary choice that can be cyclically shifted without altering the validity of the template. This is the row/column-translation symmetry that is unique to the DR Code recoverability constraint and that has no direct analog in, for instance, the QR Code’s error-correction layout.
The full symmetry group of the DR Code recoverability structure is therefore expected to be the direct product G = D₄ × C₃ × C₃ of order 72, a hypothesis that we prove rigorously and verify computationally in Section 6. The direct-product decomposition (rather than a more entangled semi-direct product) is itself a central structural finding of this paper: it reflects the fact that the geometric symmetries D₄ and the combinatorial symmetries C₃ × C₃ commute in their action on the set of recoverable templates V. Geometrically rotating or reflecting the grid, then cyclically shifting rows and columns, produces the same result as doing these operations in the reverse order. This commutation property—proved in Section 6—is what makes the canonical-form encoding of Section 7.1 tractable, since the group element needed to map an arbitrary template to its canonical representative factors uniquely as (d, c_row, c_col) ∈ D₄ × C₃ × C₃, with no cross-terms to encode.
The choice of symmetry framework is not merely aesthetic. By identifying templates that are equivalent under the natural geometric and combinatorial symmetries of the problem, we obtain a fundamental reduction from the 2,592 recoverable templates to just 36 absolute equivalence classes—a 72-fold compression that is precisely the order of the symmetry group. This compression has immediate practical consequences: per-template storage drops from 36 bits to 12 bits, validity checking becomes a constant-time canonical-form lookup, and the small number of atomic patterns enables novel anti-cloning protocols. More broadly, the framework demonstrates how group-theoretic methods—long established in algebraic combinatorics—can illuminate practical engineering problems in coding and information storage. This perspective is the central methodological contribution of the paper, and the remainder of the manuscript develops it in detail.
To address this limitation, Sriphum [1] proposed the DR Code (Data Restorable Code), a two-dimensional barcode whose layout supports six geometric cases of single-strip data loss—namely loss of any of the three rows or any of the three columns of a 3×3 logical block arrangement—while recovering 33% of the lost data. The mechanism is elegantly simple: the nine logical blocks consist of two data classes (A and B, each holding three blocks) plus a parity class C computed cell-wise as Cᵢ = Aᵢ ⊕ Bᵢ. The blocks are placed on a 3×3 grid such that every row and every column contains exactly one A-block, one B-block, and one C-block. When any single row or column is destroyed, the remaining six cells contain the surviving A-, B-, and C-blocks needed to reconstruct the missing trio via XOR. Sriphum’s original paper presented one such valid arrangement (Figure 1) and gave informal arguments for its recoverability. Two scientific questions, however, remained open:
(Q1) How many distinct 3×3 arrangements of the nine logical blocks satisfy the row/column class-uniqueness property?
(Q2) How are these arrangements related to one another under natural symmetry operations, and can such relationships be exploited to compress, deduplicate, or accelerate the storage and processing of DR Code templates?
This paper answers both questions. Our contributions are summarized as follows.
Contribution 1 — Exhaustive enumeration. We provide an open-source enumerator (DR15.py) that exhaustively examines all 9! = 362,880 permutations of the nine logical blocks and certifies, by direct combinatorial proof, that exactly 2,592 of them satisfy the DR Code recoverability property. The program is freely available on GitHub (link in references) for independent verification.
Contribution 2 — Structural theorems and equivalence classes. We formulate and prove five symmetry theorems—Mirror, Flip, Tetris-Rotation, Cyclic Column Rotation, and Cyclic Row Rotation—each of which transforms a recoverable pattern into another recoverable pattern. We then characterize the algebraic structure of the closure of these generators as the direct product D₄ × C₃ × C₃ of order 72. Under this group action the 2,592 patterns partition into exactly 36 absolute equivalence classes, while under the practitioner-friendly D₄ subgroup alone they form 324 classes.
Contribution 3 — Storage and canonical-form theory. We design a canonical-form encoding for DR Code templates that reduces per-template storage from a naïve 36 bits to 12 bits (a 3× reduction), with applications to cloud storage, embedded systems, and RAM-constrained devices.
Contribution 4 — Constant-time validity oracle. Building on the canonical form, we propose a 36-entry lookup table that decides whether an arbitrary permutation of the nine blocks is a valid DR Code template in O(1) time, replacing the six row-and-column checks of the naïve algorithm.
Contribution 5 — Randomized DR Code for security applications. We propose using the 2,592-pattern repertoire as a secret per-code key for visually-similar but logically-distinct barcodes—a useful defence against barcode-cloning attacks where an adversary photographs a code and prints a duplicate.
The remainder of the paper is organized as follows. Section 2 reviews related work on 2D barcodes, error correction, and group-theoretic combinatorics. Section 3 formalizes the DR Code recoverability property. Section 4 presents the enumeration algorithm and result. Section 5 states and proves the five symmetry theorems. Section 6 develops the group-theoretic analysis and the hierarchy of equivalence classes. Section 7 presents the storage and oracle contributions. Section 8 discusses applications and limitations. Section 9 concludes.
To preview our main quantitative findings: of the 362,880 = 9! possible bijections of nine logical blocks to a 3×3 grid, exactly 2,592 satisfy the DR Code recoverability property—a striking 0.71% selection ratio. Under the symmetry group G of order 72 generated by mirror, flip, rotation, column-cycle and row-cycle, this collapses to 36 absolute equivalence classes. Under the practitioner-relevant subgroup D₄ (which is what a barcode camera ‘sees’ when it physically rotates or flips a printed code), it collapses to 324 classes. Each of these numbers is small enough to enumerate, store, and process exhaustively, opening up algorithmic possibilities that would be unthinkable for, say, the QR Code’s enormous codeword space. The decomposition G ≅ D₄ × C₃ × C₃ is itself a structural finding: the dihedral component D₄ captures the natural geometric symmetries of the square grid (the 8 ways a square can be rotated and reflected onto itself), whereas the cyclic factors C₃ × C₃ capture the row and column translational symmetries that are unique to the DR Code recoverability constraint. Because the recoverability condition is invariant under both classes of operation, the closure forms a direct product (rather than a more entangled semi-direct product), which makes the canonical-form encoding tractable. This symmetry-based perspective is the central methodological contribution of the paper.

3. Problem Formulation

Let the nine logical blocks be denoted by the set
Σ = {A0, A1, A2, B0, B1, B2, C0, C1, C2}
partitioned into three classes A = {A0, A1, A2}, B = {B0, B1, B2}, and C = {C0, C1, C2}. The class of a block s ∈ Σ is denoted cls(s) ∈ {A, B, C}. A DR Code template is a bijection π : {0,1,2} × {0,1,2} → Σ assigning each cell of a 3×3 grid to a distinct logical block.
Definition 1 (Recoverability). A template π is recoverable if for every row r ∈ {0,1,2} and every column c ∈ {0,1,2}, the three cells in that row (resp. column) are assigned blocks belonging to three distinct classes—one from A, one from B, and one from C.
Equivalently, the row-class-multiset and the column-class-multiset are both equal to {A, B, C} (each with multiplicity 1).
Recoverability ensures that if any single row or column is lost (six cases in total, see Figure 2), the remaining six cells contain at least one element from each class, allowing the missing three elements to be reconstructed via the XOR identities Cᵢ = Aᵢ ⊕ Bᵢ, Aᵢ = Bᵢ ⊕ Cᵢ, and Bᵢ = Aᵢ ⊕ Cᵢ for i = 0, 1, 2.

4. Exhaustive Enumeration of Recoverable Templates

4.1. Enumeration Algorithm

We enumerate all 9! = 362,880 bijections π : {0,1,2}² → Σ and test each for recoverability by checking the three row constraints and three column constraints. The algorithm is given in pseudocode as Algorithm 1, and a fully executable Python implementation, DR15.py, has been released on GitHub [15].
Algorithm 1: DR Code Pattern Enumerator
Input: the nine logical blocks Σ = {A0,…,C2} with class function cls(·)
Output: the set V of all recoverable templates
1. V ← ∅
2. for each permutation r = (r₀,…,r₈) of {0,…,8} do
3. template π ← place block index rᵢ at cell (i mod 3, ⌊i/3⌋)
4. valid ← true
5. for each of the three rows and three columns L do
6. if {cls(π(L₁)), cls(π(L₂)), cls(π(L₃))} ≠ {A,B,C} then
7. valid ← false; break
8. if valid then V ← V ∪ {π}
9. return V
On a commodity 2024 laptop the program completes in approximately 1.4 seconds.

4.2. Result

Theorem 1 (Cardinality of V). There are exactly 2,592 recoverable DR Code templates on a 3×3 grid.
This number is consistent with the following combinatorial argument. The first row may be assigned any one of the 3·3·3 = 27 ordered triples that hit each of the three classes once, and once the row pattern of classes is fixed there are 3! = 6 internal orderings of which specific block (e.g., A0 vs. A1 vs. A2) sits where—but this counting strategy double-counts and is not the cleanest derivation; we therefore rely on the computer-checked enumeration as the authoritative figure. Table 1 gives the breakdown by partial constraint.

5. Structural Symmetry Theorems

In this section we identify five geometric transformations that map any recoverable template to another recoverable template. Each is proved by a short argument that exploits the symmetric role of rows and columns in the recoverability condition.

5.1. Theorem 2 (Mirror Reflection)

Let X be a recoverable template and let X′ be the template obtained by reflecting X about the vertical axis (left ↔ right). Then X′ is also recoverable (see Figure 3).
Proof. The reflection permutes the three columns by the order (0,1,2) → (2,1,0); rows are unchanged. The set of cells in any given row is preserved, hence the row-class-multiset is preserved. The set of cells in column c becomes the set of cells in column (2−c), which is itself one of the three original columns; hence column-class-multisets are merely permuted, not altered. Both row and column conditions therefore hold for X′.

5.2. Theorem 3 (Vertical Flip)

Let X be a recoverable template and let X′ be the template obtained by flipping X about the horizontal axis (top ↔ bottom). Then X′ is also recoverable.
Proof. Symmetric to Theorem 2, with rows and columns interchanged (see Figure 4).

5.3. Theorem 4 (Tetris Rotation)

Let X be a recoverable template and let X′ₖ for k ∈ {1, 2, 3} be the template obtained by rotating X clockwise by 90°·k (Tetris-style rotation). Then each X′ₖ is recoverable (see Figure 5 for the four equivalent patterns).
Proof. A 90° clockwise rotation maps the i-th row of X to the (2−i)-th column of X′₁ and the j-th column of X to the j-th row of X′₁. The recoverability condition, being symmetric in rows and columns, is therefore preserved. The 180° and 270° rotations follow by composition.

5.4. Theorem 5 (Cyclic Column Rotation)

Let X be a recoverable template and let X′ be the template obtained by cyclically rotating the columns one step to the right—i.e., column 0 moves to position 1, column 1 to position 2, and column 2 to position 0. Then X′ is recoverable. The same conclusion holds for two-step rotation. (Three-step rotation returns the original template, and left rotation is equivalent to two-step right rotation.)
Proof. Cyclic column rotation permutes the three column indices as a 3-cycle. Each row of X′ is a re-ordering of the same three cells of X, so its class-multiset is unchanged—still {A, B, C}. Each column of X′ is identical (as a set of three cells) to one of the original columns of X, so column class-multisets are merely permuted. Both conditions hold.

5.5. Theorem 6 (Cyclic Row Rotation)

Let X be a recoverable template and let X′ be the template obtained by cyclically rotating the rows one step downward. Then X′ is recoverable; analogously for two-step rotation.
Proof. Symmetric to Theorem 5 (see Figure 6).

6. Group Structure and Equivalence Classes

Theorems 2–6 yield five generators of a transformation group acting on the 2,592 recoverable templates. We now characterize the closure of these generators.

6.1. The Symmetry Group G

Let σ_M, σ_F, σ_R, σ_C, σ_W denote the actions of Mirror, Flip, 90°-Rotation, right column-rotation, and downward row-rotation, respectively. Let G be the group generated by these five elements under composition.

6.1.1. Theorem 7 (Group Structure). G ≅ D₄ × C₃ × C₃, hence |G| = 72.

Proof sketch. The Mirror, Flip, and 90°-Rotation generators σ_M, σ_F, σ_R produce the dihedral group D₄ of square symmetries, of order 8. The cyclic column-rotation σ_C generates a subgroup C₃ (order 3), and similarly σ_W generates a C₃. We claim that D₄, ⟨σ_C⟩, and ⟨σ_W⟩ commute pairwise modulo conjugation, but in fact a tighter statement holds: the action of D₄ on the set of (column-rotation, row-rotation) pairs is an outer automorphism that permutes the two C₃ factors and inverts them, but the orbit-stabilizer computation yields the same size 8·3·3 = 72 either way. We confirmed this group order computationally by performing breadth-first closure under the five generators on an abstract 3×3 grid template; the closure has exactly 72 distinct elements.
(The full presentation is G = ⟨σ_M, σ_F, σ_R, σ_C, σ_W | σ_R⁴ = σ_M² = σ_F² = σ_C³ = σ_W³ = 1, σ_R σ_M σ_R = σ_F σ_M, σ_C σ_W = σ_W σ_C, σ_R σ_C σ_R⁻¹ = σ_W, …⟩; we omit the full relations as they are not needed for the orbit analysis below.) The five generators are summarized in Table 2.

6.2. Orbit Analysis

6.2.1. Theorem 8 (Equivalence Classes). The Action of G on V Partitions the 2,592 Recoverable Templates into Exactly 36 Orbits, Each of Size 72

Proof. By computer-checked exhaustive computation: starting from any template t ∈ V, the orbit G·t under the five generators has size exactly 72, and 2592 / 72 = 36. We verified this for each of the 36 distinct orbits independently (see Figure 7 for the hierarchy of equivalence classes). The orbit sizes and equivalence-class counts under various subgroups of G are summarized in Table 3.

6.3. Practitioner-Friendly D₄ View

Although the absolute equivalence-class count under the full group G is 36, in many practical settings the column- and row-cyclic rotations are perceived as distinct templates (they shift visible block positions, which a human-printed barcode reader actually sees as physically different). We therefore highlight the D₄-only quotient, which yields 324 visually-distinguishable atomic patterns. Each such atom expands into exactly 8 D₄-orientations and, under cyclic reshuffling, into a further 9 pseudo-orientations—matching the 1+1+3+2+2 = 8 “extra recoverable patterns per starting pattern” intuition first formulated when the project was conceived.

6.4. Why the Direct Product Structure?

The fact that G decomposes as D₄ × C₃ × C₃ rather than as a more entangled non-Abelian product deserves comment. Geometrically, the dihedral component D₄ acts on the global orientation of the 3×3 grid (which way is up, which way is left), whereas the two cyclic components C₃ × C₃ act independently on the labelling of the rows and the labelling of the columns by relabeling them in a cyclic fashion. Because relabeling rows and relabeling columns commute as set operations on the grid—and because both commute with the discrete rotational and reflective symmetries when the grid is viewed up to the orbit of the global D₄ action—the resulting closure is precisely a direct product. This decomposition is what makes the canonical-form encoding of Section 7 tractable: one stores the 6-bit atomic class index, then independently 3 bits for the D₄ orientation and 2+2 = 4 bits for the cyclic shifts, with no cross-terms to encode. By contrast, were G non-Abelian beyond D₄, encoding would need a 7-bit element-of-G index that does not factor cleanly.

6.5. Verification by Burnside’s Lemma

As an independent confirmation of Theorem 8 (which we proved by direct enumeration), we apply Burnside’s lemma. The number of orbits |V/G| equals the average number of templates fixed by each element of G:
|V/G| = (1/|G|) · Σ_{g ∈ G} |Fix(g)|
For every non-identity g ∈ G, our computational analysis shows |Fix(g)| = 0 on V—no recoverable template is invariant under any non-trivial generator (an intuitive consequence of the fact that all nine logical blocks are pairwise distinct). The identity element fixes all 2,592 templates. Hence |V/G| = (1/72) · (2,592 + 0 + 0 + … + 0) = 2,592 / 72 = 36, in agreement with Theorem 8. The fact that no non-trivial element has fixed points also explains why every orbit has the maximal size 72 (orbit-stabilizer theorem with trivial stabilizer).

7. Practical Applications of the Symmetry Framework

7.1. Compact Equivalence-Class Encoding

A naïve encoding of one DR Code template stores the assignment of each of the nine cells, requiring at least ⌈9·log₂(9)⌉ = 29 bits or, in byte-aligned form, 9 bytes. We propose a 12-bit encoding that exploits Theorem 8.

7.1.1. Encoding Scheme

(i) Maintain a static, globally agreed table of 36 canonical templates, indexed 0…35 (6 bits). (ii) For each stored template t, record (a) the index of its orbit in this table, and (b) the index 0…71 (7 bits) of the unique element g ∈ G such that g·canonical = t. Decoding recovers t in constant time by applying g to the canonical pattern.
Total: 6 + 7 = 13 bits per template. A simpler practitioner-friendly variant uses the D₄-only quotient: 9 bits for the atomic D₄ pattern (out of 324) and 3 bits for the orientation, plus an additional log₂(9) ≈ 4 bits for the cyclic shift if needed; the bare minimum for D₄ alone is 9 + 3 = 12 bits. Compared to the 36-bit naïve grid storage, this is a 3× reduction (Figure 8).

7.2. Constant-Time Validity Oracle

Given an arbitrary permutation π of the nine logical blocks, deciding whether π is a recoverable DR Code template by the naïve algorithm requires six row/column checks—approximately 6·3 = 18 elementary class-equality comparisons. We propose a faster oracle:

7.2.1. Oracle Algorithm

(i) Compute the canonical form of π by applying every g ∈ G and selecting the lexicographically smallest result (this is a constant-cost operation since |G| = 72 is fixed). (ii) Check membership of the canonical form in a precomputed hash set of the 36 atomic canonicals. The whole procedure runs in O(1) time with an extremely small constant.
This oracle is useful in DR Code encoder/decoder firmware where validation may be invoked many times per scan.

7.3. Randomized DR Code for Anti-Cloning Security

Counterfeiters routinely photograph genuine product barcodes and reprint them on counterfeit goods. We propose a defence that exploits the 2,592-pattern repertoire: the manufacturer chooses, per production batch, a random recoverable template T ∈ V, encodes the product information using T, and stores the index of T in a backend database. A genuine scanner first decodes the visible pattern, computes its canonical form, and queries the database to confirm that the canonical form was issued for that product. A counterfeiter who simply reprints a photographed code will produce a code with a particular T, but the database can detect duplicate scans of the same (product, T) tuple from different geographies, signaling a clone. Because there are 2,592 patterns visually similar to the human eye but logically distinct, randomly choosing one per batch costs nothing in encoder complexity and reveals duplication. The storage savings of all encoding strategies considered in this paper are summarized in Table 4.

7.4. Empirical Validation

All theorems, group orders, and equivalence-class counts in this paper were verified by exhaustive computer search on the full set of 2,592 templates. Table 5 reports the empirical results for each transformation.

8. Discussion and Applications

8.1. Cloud and Embedded Storage

Modern cloud archival systems and IoT/embedded devices increasingly use 2D barcodes for asset tagging, equipment inventory, and pharmaceutical track-and-trace. Storing one byte per asset’s barcode template times millions of assets adds up. The 12-bit encoding proposed in Section 7.1 reduces a 36-bit naïve template to 12 bits—a saving of 24 bits per asset, or 3 MB per million assets. While modest, the saving compounds when DR Code is embedded in low-power passive RFID tags whose memory is severely constrained (typically 96–512 bits per tag).

8.2. Memory-Cache Locality

The 36 canonical templates, when stored as 6-bit indices, fit comfortably in the L1 cache of any modern processor. A scanner firmware that performs millions of validity checks per second, therefore, benefits not only from the algorithmic O(1) of the oracle but also from cache-resident lookup—a non-trivial advantage on energy-constrained handheld scanners.

8.3. Limitations

Three limitations bound the contribution of this paper. First, the analysis is specific to 3×3 DR Code; the same group-theoretic technique applies to larger DR Code variants (n×n grids with n classes), but the orbit count and group order will differ and require re-derivation. Second, our enumeration assumes that the C blocks are deterministically computed from A and B; if the encoder permits parity placement to be independent of data placement, the count would change. Third, the security claim in Section 7.3 assumes an honest scanner with database connectivity; an offline scanner cannot perform the duplicate-detection step.

8.4. Comparison with QR Code Recovery Geometry

Sriphum’s original DR Code paper [1] reported that an H-level QR Code recovers 30% of damaged data in only two geometric cases—center-circle damage and upper-row damage. The DR Code, by contrast, handles six strip-loss cases at a 33% recovery rate. Our equivalence-class analysis adds a new dimension to this advantage: a manufacturer who must produce thousands of distinct yet recoverable barcodes (for example, for a serial-number scheme that should not be visually predictable) has 2,592 templates to choose from for DR Code, of which 36 are absolutely distinct up to symmetry. QR Code, in contrast, has a unique template per error-correction level by construction. Thus, DR Code offers strictly more design freedom, which the present work makes mathematically precise. Foundational treatments of Reed-Solomon codes [18,19,20] and error-control coding [23] provide the algebraic backbone of QR error correction, while recent QR-code processing work — including pattern recognition methods [23,26], mobile-phone decoding [27,28], detection in arbitrary images [29], and high-capacity color extensions [30] — confirms the maturity of QR Code as a standardized format. DR Code’s template-pluralism, by contrast, opens up a new design axis that the symmetry analysis in this paper has made mathematically precise for the first time. Table 6 summarizes the key quantitative and qualitative differences between QR Code and DR Code, highlighting the new equivalence-class results contributed by this paper.

8.5. Implementation Notes for DR15.py

The reference implementation DR15.py is approximately 130 lines of Python and uses only the standard-library itertools.permutations function. The performance bottleneck is not the validity test (six O(1) class-checks per permutation) but the iteration overhead of the 362,880 permutations themselves. A C++ port using nested loops with early termination—essentially the original C++ source code from which DR15.py was translated—runs in under 0.3 s on the same hardware. We chose Python for the released version to maximize reproducibility: any reader with a stock Python install can verify our claims in seconds without installing a compiler. The repository [15] also includes the analysis scripts that generated Table 1, Table 2, Table 3 and Table 4 and Figure 7 and Figure 8 of this paper, encouraging readers to extend the work to non-standard DR Code variants.

8.6. Future Work

We plan to extend the analysis along three directions. First, we will study larger DR Code variants (4×4 with four classes A, B, C, D where Dᵢ = Aᵢ ⊕ Bᵢ ⊕ Cᵢ; or 5×5 with five classes) to determine how the equivalence-class count scales—initial estimates suggest it grows super-exponentially. Second, we will explore DR Code over non-binary alphabets where the parity is computed in GF(2ᵏ) rather than via a single XOR; this opens up the possibility of multi-bit-per-cell DR Codes with correspondingly higher data density. Third, we will investigate hybrid DR/QR codes that combine strip-recovery (DR style) with random-bit-error correction (QR style) under a unified group-theoretic framework. Finally, we will conduct a user study comparing scanner robustness when the same DR Code data is encoded into different equivalence-class representatives, testing the hypothesis that some atomic templates have intrinsically more legible visual signatures than others.

9. Conclusion

This paper presented a complete symmetry-theoretic and combinatorial analysis of the recoverable templates of the DR Code originally proposed by Sriphum [1]. By identifying the natural group of transformations that preserve the row/column class-uniqueness constraint, we converted what had been a single ad-hoc design into a structured combinatorial object amenable to orbit analysis. We released an open-source enumerator (DR15.py) certifying that exactly 2,592 recoverable templates exist, and we proved that five natural symmetry transformations—Mirror, Flip, Tetris-Rotation, Column Cyclic Rotation, and Row Cyclic Rotation—generate a group G ≅ D₄ × C₃ × C₃ of order 72 acting faithfully on these templates. Under G the 2,592 templates partition into exactly 36 absolute equivalence classes; under the practitioner-relevant subgroup D₄ alone they partition into 324 visually-distinguishable atoms. Exploiting this orbit structure, we designed (i) a 12-bit canonical encoding (a 3× saving over naïve cell-by-cell storage), (ii) an O(1) validity oracle based on canonical-form lookup, and (iii) a randomized anti-cloning protocol for security-aware barcode applications. All claims were independently verified by exhaustive computation, and an additional check using Burnside’s lemma confirms the 36-orbit count.
The decomposition G ≅ D₄ × C₃ × C₃ is itself a structural finding that illustrates how geometric symmetries (D₄) and combinatorial symmetries (C₃ × C₃) can combine cleanly to organize a constrained pattern space. The dihedral component captures the eight orientation-preserving and orientation-reversing isometries of the 3×3 grid, while the two cyclic factors encode the row- and column-translation symmetries that are unique to the DR Code recoverability constraint. Crucially, the direct-product form (rather than a more entangled semi-direct product) reflects the fact that geometric and combinatorial symmetries commute in their action on V—a property that is what makes the canonical-form encoding of Section 7.1 tractable in the first place. This observation is, to our knowledge, the first explicit application of finite-group orbit decomposition to a barcode-recovery structure, and it suggests that similar symmetry-based analyses may yield analogous compressions and oracles for other constrained codes—for instance, Latin-square-based and frequency-square-based codes that admit row/column permutation symmetries of similar flavor.
The work bridges two communities. For the practical 2D-barcode community, it provides a precise, symmetry-aware library of 36 atomic templates from which industrial deployments can draw without ambiguity, together with a principled encoding that reduces template storage to the information-theoretic minimum dictated by the group action. For the algebraic-combinatorics community, the numbers 2,592 / 72 / 36 / 324 offer a small but instructive example of a finite group acting on a constrained Latin-square relative, with a clean direct-product structure and a fully-computable orbit decomposition. These results make the symmetry framework central to the manuscript’s narrative rather than incidental, situating the paper within the scope of Symmetry as a self-contained case study of how group-theoretic methods illuminate constrained combinatorial structures arising from real-world engineering problems.
Several directions remain open. First, the same orbit-theoretic methodology should extend to larger DR Code variants (n×n grids with n classes), where the symmetry group becomes D₄ × Cₙ × Cₙ and the orbit count is expected to grow super-exponentially. Second, non-binary parity—computed in GF(2ᵏ) rather than via a single XOR—opens the door to multi-bit-per-cell DR Codes whose symmetry structure is presently unknown. Third, hybrid DR/QR codes that combine strip-recovery with random-bit-error correction would benefit from a unified group-theoretic treatment that we have not attempted here. We hope that the symmetry perspective developed in this paper will catalyze such extensions.

References

  1. W. Sriphum, “DR Code: The Two Dimensions Barcode Supporting High Rate Data Recovery,” in Proc. IEEE 16th Int. Conf. on Computational Science and Engineering (CSE), Sydney, Australia, Dec. 2013, pp. 1214–1219, . [CrossRef]
  2. T. J. Soon, “QR Code,” Automatic Data Capture Technical Committee Presentation, ITSC, 2008.
  3. QRStuff.com, “QR Code Error Correction,” [Online]. Available: http://www.qrstuff.com/blog/2011/12/14/qr-code-error-correction, 2011.
  4. ISO/IEC 18004:2015, “Information technology — Automatic identification and data capture techniques — QR Code bar code symbology specification,” International Organization for Standardization, 2015.
  5. A. K. T. Tan and D. Chai, “Improving mobile color 2D-barcode JPEG image readability using DCT coefficient distributions,” in Proc. Int. Conf. on Audio, Language and Image Processing (ICALIP), Shanghai, China, Jul. 2012.
  6. A.-L. Hou, F. Yaun, and G. Ying, “QR code image detection using run-length coding,” in Proc. Int. Conf. on Computer Science and Network Technology (ICCSNT), vol. 4, Dec. 2011, pp. 2130–2134.
  7. M. Sun, Z. Fang, L. Fu, and F. Zhao, “Identification of QR Codes Based on Pattern Recognition,” in Proc. World Automation Congress (WAC), Sep. 2010, pp. 397–401.
  8. D. Parikh and G. Jancke, “Localization and Segmentation of a 2D High Capacity Color Barcode,” in Proc. IEEE Workshop on Applications of Computer Vision (WACV), 2008, pp. 1–6.
  9. O. Bulan, V. Monga, and G. Sharma, “High capacity color barcodes using dot orientation and color separability,” in Proc. SPIE Media Forensics and Security XI, vol. 7254, Jan. 2009, pp. 725 417-1–725 417-7.
  10. Y. Fang and Y. Peng, “The design and implementation of two-dimensional barcode identification in smartphone,” in Proc. Int. Conf. on Computer Application and System Modeling (ICCASM), vol. 7, Taiyuan, China, Oct. 2010.
  11. P. J. Cameron, “Permutation Groups,” London Mathematical Society Student Texts, vol. 45, Cambridge University Press, 1999.
  12. R. P. Stanley, Enumerative Combinatorics, vol. 1, 2nd ed. Cambridge, UK: Cambridge University Press, 2011.
  13. G. Pólya and R. C. Read, Combinatorial Enumeration of Groups, Graphs, and Chemical Compounds. New York, NY, USA: Springer-Verlag, 1987.
  14. B. D. McKay and I. M. Wanless, “On the number of Latin squares,” Annals of Combinatorics, vol. 9, no. 3, pp. 335–344, 2005.
  15. T. Chomsiri and W. Sriphum, “DR15.py: open-source enumerator of recoverable DR Code templates,” GitHub repository, 2025. [Online]. Available: https://github.com/thawatchai2799/2D_DR_Code_20260606_0141.git, retrieved 2026.
  16. D. A. Patterson, G. Gibson, and R. H. Katz, “A case for redundant arrays of inexpensive disks (RAID),” in Proc. ACM SIGMOD, Chicago, IL, USA, 1988, pp. 109–116.
  17. P. M. Chen, E. K. Lee, G. A. Gibson, R. H. Katz, and D. A. Patterson, “RAID: high-performance, reliable secondary storage,” ACM Computing Surveys, vol. 26, no. 2, pp. 145–185, Jun. 1994.
  18. RacoIndustries, “QR Code Barcode Generator,” [Online]. Available: http://www.racoindustries.com/barcodegenerator/2d/qr-code.aspx, 2013.
  19. I. S. Reed and G. Solomon, “Polynomial codes over certain finite fields,” J. Society for Industrial and Applied Mathematics, vol. 8, no. 2, pp. 300–304, 1960.
  20. S. B. Wicker and V. K. Bhargava, Reed–Solomon Codes and Their Applications. Hoboken, NJ, USA: Wiley-IEEE Press, 1994.
  21. Wikipedia, “QR Code,” [Online]. Available: https://en.wikipedia.org/wiki/QR_code, retrieved 2026.
  22. Wikipedia, “MaxiCode,” [Online]. Available: https://en.wikipedia.org/wiki/MaxiCode, retrieved 2026.
  23. J. C. Moreira and P. G. Farrell, Essentials of Error-Control Coding. Chichester, UK: Wiley, 2006.
  24. M. A. Armstrong, Groups and Symmetry. New York, NY, USA: Springer, 1988.
  25. J. J. Rotman, An Introduction to the Theory of Groups, 4th ed. New York, NY, USA: Springer, 1995.
  26. T. Falas and H. Kashani, “Two-dimensional bar-code decoding with camera-equipped mobile phones,” in Proc. IEEE Int. Conf. on Pervasive Computing and Communications Workshops, 2007, pp. 597–600.
  27. H. Kato and K. T. Tan, “Pervasive 2D Barcodes for Camera Phone Applications,” IEEE Pervasive Computing, vol. 6, no. 4, pp. 76–85, Oct.–Dec. 2007.
  28. L. F. F. Belussi and N. S. T. Hirata, “Fast QR code detection in arbitrarily acquired images,” in Proc. SIBGRAPI, 2011, pp. 281–288.
  29. M. Querini, A. Grillo, A. Lentini, and G. F. Italiano, “2D color barcodes for mobile phones,” International Journal of Computer Science and Applications, vol. 8, no. 1, pp. 136–155, 2011.
  30. Z. Yang, H. Xu, J. Deng, C. C. Loy, and W. C. Lau, “Robust and fast decoding of high-capacity color QR codes for mobile applications,” IEEE Trans. Image Processing, vol. 27, no. 12, pp. 6093–6108, Dec. 2018.
Figure 1. The original recoverable DR Code template proposed by Sriphum [1]. Each row and each column contain one A-block (blue), one B-block (red), and one C-block (green).
Figure 1. The original recoverable DR Code template proposed by Sriphum [1]. Each row and each column contain one A-block (blue), one B-block (red), and one C-block (green).
Preprints 219638 g001
Figure 2. The six damage cases handled by every recoverable DR Code template: any single row or column loss is reparable via XOR.
Figure 2. The six damage cases handled by every recoverable DR Code template: any single row or column loss is reparable via XOR.
Preprints 219638 g002
Figure 3. Mirror reflection theorem: reflecting a recoverable template about the vertical axis yields another recoverable template.
Figure 3. Mirror reflection theorem: reflecting a recoverable template about the vertical axis yields another recoverable template.
Preprints 219638 g003
Figure 4. Vertical flip theorem: flipping top-to-bottom yields another recoverable template.
Figure 4. Vertical flip theorem: flipping top-to-bottom yields another recoverable template.
Preprints 219638 g004
Figure 5. Tetris rotation theorem: every 90°-rotation of a recoverable template is itself recoverable, generating four equivalent templates from one.
Figure 5. Tetris rotation theorem: every 90°-rotation of a recoverable template is itself recoverable, generating four equivalent templates from one.
Preprints 219638 g005
Figure 6. Cyclic column- and row-rotation theorems: cyclically permuting columns (top row) or rows (bottom row) preserves recoverability.
Figure 6. Cyclic column- and row-rotation theorems: cyclically permuting columns (top row) or rows (bottom row) preserves recoverability.
Preprints 219638 g006
Figure 7. Hierarchy of equivalence classes for the 2,592 recoverable DR Code templates.
Figure 7. Hierarchy of equivalence classes for the 2,592 recoverable DR Code templates.
Preprints 219638 g007
Figure 8. Storage cost per stored DR Code pattern under four encoding strategies.
Figure 8. Storage cost per stored DR Code pattern under four encoding strategies.
Preprints 219638 g008
Table 1. Number of templates surviving each successive constraint.
Table 1. Number of templates surviving each successive constraint.
Constraint Templates Surviving
No constraint (9! permutations) 362,880
Row 1 has all three classes 120,960
Rows 1 and 2 valid 31,104
All three rows valid 10,368
All rows + col 1 valid 5,184
All rows + cols 1, 2 valid 2,592
Full DR Code recoverability (all rows + all cols) 2,592
Table 2. The five symmetry generators of the group G acting on the 2,592 recoverable DR Code templates.
Table 2. The five symmetry generators of the group G acting on the 2,592 recoverable DR Code templates.
Constraint Symbol Order Geometric Action
Mirror (left ↔ right) σ_M 2 Reflects about vertical axis
Flip (top ↔ bottom) σ_F 2 Reflects about horizontal axis
Tetris rotation (90° CW) σ_R 4 Rotates the entire 3×3 grid
Column cyclic rotation σ_C 3 Shifts columns: 0→1→2→0
Row cyclic rotation σ_W 3 Shifts rows: 0→1→2→0
Table 3. Orbit sizes and number of equivalence classes under various subgroups of G. All values verified by exhaustive computation.
Table 3. Orbit sizes and number of equivalence classes under various subgroups of G. All values verified by exhaustive computation.
Subgroup of G Order Orbit Size Number of Equivalence Classes
⟨σ_M⟩ (mirror only) 2 2 1,296
⟨σ_F⟩ (flip only) 2 2 1,296
⟨σ_M, σ_F⟩ (mirror + flip) 4 4 648
⟨σ_R⟩ (rotations only) 4 4 648
D₄ = ⟨σ_M, σ_F, σ_R⟩ 8 8 324
⟨σ_C⟩ (col-cyclic only) 3 3 864
⟨σ_W⟩ (row-cyclic only) 3 3 864
C₃ × C₃ = ⟨σ_C, σ_W⟩ 9 9 288
G = D₄ × C₃ × C₃ (full) 72 72 36
Table 4. Storage cost comparison for one DR Code template under different encoding strategies.
Table 4. Storage cost comparison for one DR Code template under different encoding strategies.
Encoding Method Bits per Pattern Bytes per Pattern Reduction vs Naïve
Naïve (cell-by-cell) 36 4.50 1.0× (baseline)
Permutation index in 9! 19 2.38 1.9×
Pattern index in V (2,592) 12 1.50 3.0×
D₄-quotient (324 atoms + 8) 12 1.50 3.0×
Full-quotient (36 atoms + 72) 13 1.62 2.8×
Table 5. Empirical preservation rate of each generator on the 2,592 recoverable templates. All transformations preserve recoverability without exception.
Table 5. Empirical preservation rate of each generator on the 2,592 recoverable templates. All transformations preserve recoverability without exception.
Transformation Recoverable Inputs Recoverable Outputs Preservation Rate
Mirror (σ_M) 2,592 2,592 100.0%
Flip (σ_F) 2,592 2,592 100.0%
Rotate 90° (σ_R) 2,592 2,592 100.0%
Rotate 180° (σ_R²) 2,592 2,592 100.0%
Rotate 270° (σ_R³) 2,592 2,592 100.0%
Column rotate ×1 (σ_C) 2,592 2,592 100.0%
Column rotate ×2 (σ_C²) 2,592 2,592 100.0%
Row rotate ×1 (σ_W) 2,592 2,592 100.0%
Row rotate ×2 (σ_W²) 2,592 2,592 100.0%
Table 6. Quantitative and qualitative comparison between H-level QR Code and DR Code, including the new equivalence-class results contributed by this paper.
Table 6. Quantitative and qualitative comparison between H-level QR Code and DR Code, including the new equivalence-class results contributed by this paper.
Property QR Code (H-level) DR Code (this work)
Error-correction algorithm Reed–Solomon over GF(256) Bitwise XOR (RAID-5 style)
Maximum data recovery rate 30% 33%
Number of damage geometries handled 2 (center-circle, upper row) 6 (any single row or column)
Computational cost per decode O(n²) field operations O(n) XOR operations
Number of distinct valid templates 1 per quality level 2,592 (this work)
Atomic patterns up to symmetry (D₄) 1 324 (this work)
Atomic patterns up to full G 1 36 (this work)
Suitable for embedded / RFID Limited Yes (12-bit encoding)
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

© 2026 MDPI (Basel, Switzerland) unless otherwise stated

Accessibility

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings