private final BitMatrix mappingBitMatrix;\r
private final BitMatrix readMappingMatrix;\r
private Version version;\r
-// private FormatInformation parsedFormatInfo;\r
\r
/**\r
* @param bitMatrix {@link BitMatrix} to parse\r
// Check the four corner cases\r
if ((row == numRows) && (column == 0) && !corner1Read) {\r
result[resultOffset++] = (byte) readCorner1(numRows, numColumns);\r
- row -= 2; column +=2;\r
+ row -= 2;\r
+ column +=2;\r
corner1Read = true;\r
} else if ((row == numRows-2) && (column == 0) && ((numColumns & 0x03) != 0) && !corner2Read) {\r
result[resultOffset++] = (byte) readCorner2(numRows, numColumns);\r
- row -= 2; column +=2;\r
+ row -= 2;\r
+ column +=2;\r
corner2Read = true;\r
} else if ((row == numRows+4) && (column == 2) && ((numColumns & 0x07) == 0) && !corner3Read) {\r
result[resultOffset++] = (byte) readCorner3(numRows, numColumns);\r
- row -= 2; column +=2;\r
+ row -= 2;\r
+ column +=2;\r
corner3Read = true;\r
} else if ((row == numRows-2) && (column == 0) && ((numColumns & 0x07) == 4) && !corner4Read) {\r
result[resultOffset++] = (byte) readCorner4(numRows, numColumns);\r
- row -= 2; column +=2;\r
+ row -= 2;\r
+ column +=2;\r
corner4Read = true;\r
} else {\r
// Sweep upward diagonally to the right\r
if ((row < numRows) && (column >= 0) && !readMappingMatrix.get(row, column)) {\r
result[resultOffset++] = (byte) readUtah(row, column, numRows, numColumns);\r
}\r
- row -= 2; column +=2;\r
+ row -= 2;\r
+ column +=2;\r
} while ((row >= 0) && (column < numColumns));\r
- row += 1; column +=3;\r
+ row += 1;\r
+ column +=3;\r
\r
- // Sweep downward giagonally to the left\r
+ // Sweep downward diagonally to the left\r
do {\r
if ((row >= 0) && (column < numColumns) && !readMappingMatrix.get(row, column)) {\r
result[resultOffset++] = (byte) readUtah(row, column, numRows, numColumns);\r
}\r
- row += 2; column -=2;\r
+ row += 2;\r
+ column -=2;\r
} while ((row < numRows) && (column >= 0));\r
- row += 3; column +=1;\r
+ row += 3;\r
+ column +=1;\r
}\r
} while ((row < numRows) || (column < numColumns));\r
\r
}\r
\r
/**\r
- * <p>Reads a bit of the mapping matrix accounting for boundry wrapping.</p>\r
+ * <p>Reads a bit of the mapping matrix accounting for boundary wrapping.</p>\r
* \r
* @param row Row to read in the mapping matrix\r
* @param column Column to read in the mapping matrix\r
* @return value of the given bit in the mapping matrix\r
*/\r
boolean readModule(int row, int column, int numRows, int numColumns) {\r
- // Adjust the row and column indicies based on boundry wrapping\r
+ // Adjust the row and column indices based on boundary wrapping\r
if (row < 0) {\r
row += numRows;\r
column += 4 - ((numRows + 4) & 0x07);\r
// TODO(bbrown): Make this work with rectangular codes\r
BitMatrix bitMatrixWithoutAlignment = new BitMatrix(sizeDataRegionRow);\r
for (int dataRegionRow = 0; dataRegionRow < numDataRegionsRow; ++dataRegionRow) {\r
+ int dataRegionRowOffset = dataRegionRow * dataRegionSizeRows;\r
for (int dataRegionColumn = 0; dataRegionColumn < numDataRegionsColumn; ++dataRegionColumn) {\r
+ int dataRegionColumnOffset = dataRegionColumn * dataRegionSizeColumns;\r
for (int i = 0; i < dataRegionSizeRows; ++i) {\r
+ int readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;\r
+ int writeRowOffset = dataRegionRowOffset + i;\r
for (int j = 0; j < dataRegionSizeColumns; ++j) {\r
- int readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;\r
int readColumnOffset = dataRegionColumn * (dataRegionSizeColumns + 2) + 1 + j;\r
- int writeRowOffset = dataRegionRow * dataRegionSizeRows + i;\r
- int writeColumnOffset = dataRegionColumn * dataRegionSizeColumns + j;\r
-\r
if (bitMatrix.get(readRowOffset, readColumnOffset)) {\r
+ int writeColumnOffset = dataRegionColumnOffset + j;\r
bitMatrixWithoutAlignment.set(writeRowOffset, writeColumnOffset);\r
}\r
}\r
}\r
}\r
}\r
- \r
return bitMatrixWithoutAlignment;\r
}\r
\r