@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | // So this is the smallest dimension in each axis we can accept. |
| 38 | 38 | private const BLOCK_SIZE_POWER = 3; |
| 39 | 39 | private const BLOCK_SIZE = 8; // ...0100...00 |
| 40 | - private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
| 40 | + private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
| 41 | 41 | private const MINIMUM_DIMENSION = 40; |
| 42 | 42 | private const MIN_DYNAMIC_RANGE = 24; |
| 43 | 43 | |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | if($width >= self::MINIMUM_DIMENSION && $height >= self::MINIMUM_DIMENSION){ |
| 138 | 138 | $subWidth = $width >> self::BLOCK_SIZE_POWER; |
| 139 | 139 | |
| 140 | - if(($width & self::BLOCK_SIZE_MASK) !== 0){ |
|
| 140 | + if(($width&self::BLOCK_SIZE_MASK) !== 0){ |
|
| 141 | 141 | $subWidth++; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $subHeight = $height >> self::BLOCK_SIZE_POWER; |
| 145 | 145 | |
| 146 | - if(($height & self::BLOCK_SIZE_MASK) !== 0){ |
|
| 146 | + if(($height&self::BLOCK_SIZE_MASK) !== 0){ |
|
| 147 | 147 | $subHeight++; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $right = (int)(($width * 4) / 5); |
| 168 | 168 | |
| 169 | 169 | for($x = (int)($width / 5); $x < $right; $x++){ |
| 170 | - $pixel = $localLuminances[(int)$x] & 0xff; |
|
| 170 | + $pixel = $localLuminances[(int)$x]&0xff; |
|
| 171 | 171 | $buckets[$pixel >> self::LUMINANCE_SHIFT]++; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $offset = $y * $width; |
| 184 | 184 | |
| 185 | 185 | for($x = 0; $x < $width; $x++){ |
| 186 | - $pixel = (int)($localLuminances[$offset + $x] & 0xff); |
|
| 186 | + $pixel = (int)($localLuminances[$offset + $x]&0xff); |
|
| 187 | 187 | |
| 188 | 188 | if($pixel < $blackPoint){ |
| 189 | 189 | $matrix->set($x, $y); |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | for($yy = 0, $offset = $yoffset * $width + $xoffset; $yy < self::BLOCK_SIZE; $yy++, $offset += $width){ |
| 231 | 231 | |
| 232 | 232 | for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){ |
| 233 | - $pixel = (int)($luminances[(int)($offset + $xx)]) & 0xff; |
|
| 234 | - $sum += $pixel; |
|
| 233 | + $pixel = (int)($luminances[(int)($offset + $xx)])&0xff; |
|
| 234 | + $sum += $pixel; |
|
| 235 | 235 | // still looking for good contrast |
| 236 | 236 | if($pixel < $min){ |
| 237 | 237 | $min = $pixel; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | // finish the rest of the rows quickly |
| 248 | 248 | for($yy++, $offset += $width; $yy < self::BLOCK_SIZE; $yy++, $offset += $width){ |
| 249 | 249 | for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){ |
| 250 | - $sum += $luminances[$offset + $xx] & 0xff; |
|
| 250 | + $sum += $luminances[$offset + $xx]&0xff; |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | for($z = -2; $z <= 2; $z++){ |
| 327 | 327 | $blackRow = $blackPoints[$top + $z]; |
| 328 | - $sum += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2]; |
|
| 328 | + $sum += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2]; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | $average = (int)($sum / 25); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | for($j = 0, $o = $yoffset * $width + $xoffset; $j < self::BLOCK_SIZE; $j++, $o += $width){ |
| 335 | 335 | for($i = 0; $i < self::BLOCK_SIZE; $i++){ |
| 336 | 336 | // Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0. |
| 337 | - if(($luminances[$o + $i] & 0xff) <= $average){ |
|
| 337 | + if(($luminances[$o + $i]&0xff) <= $average){ |
|
| 338 | 338 | $matrix->set($xoffset + $i, $yoffset + $j); |
| 339 | 339 | } |
| 340 | 340 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $eccLevel = $parser->readFormatInformation()->getErrorCorrectionLevel(); |
| 96 | 96 | |
| 97 | 97 | // Read raw codewords |
| 98 | - $rawCodewords = $parser->readCodewords(); |
|
| 98 | + $rawCodewords = $parser->readCodewords(); |
|
| 99 | 99 | // Separate into data blocks |
| 100 | 100 | $dataBlocks = $this->getDataBlocks($rawCodewords, $version, $eccLevel); |
| 101 | 101 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | [$numEccCodewords, $eccBlocks] = $version->getRSBlocks($eccLevel); |
| 141 | 141 | |
| 142 | 142 | // Now establish DataBlocks of the appropriate size and number of data codewords |
| 143 | - $result = [];//new DataBlock[$totalBlocks]; |
|
| 143 | + $result = []; //new DataBlock[$totalBlocks]; |
|
| 144 | 144 | $numResultBlocks = 0; |
| 145 | 145 | |
| 146 | 146 | foreach($eccBlocks as $blockData){ |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $codewordsInts = []; |
| 207 | 207 | |
| 208 | 208 | foreach($codewordBytes as $i => $codewordByte){ |
| 209 | - $codewordsInts[$i] = $codewordByte & 0xFF; |
|
| 209 | + $codewordsInts[$i] = $codewordByte&0xFF; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | $decoded = (new ReedSolomonDecoder)->decode($codewordsInts, (count($codewordBytes) - $numDataCodewords)); |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $countPixels = count($pixels); |
| 47 | 47 | |
| 48 | 48 | for($i = 0; $i < $countPixels; $i += 3){ |
| 49 | - $this->setLuminancePixel($pixels[$i] & 0xff, $pixels[$i + 1] & 0xff, $pixels[$i + 2] & 0xff); |
|
| 49 | + $this->setLuminancePixel($pixels[$i]&0xff, $pixels[$i + 1]&0xff, $pixels[$i + 2]&0xff); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |