Decoder
in package
<p>The main class which implements QR Code decoding -- as opposed to locating and extracting the QR Code from an image.</p>
Tags
Table of Contents
- decode() : DecoderResult
- <p>Decodes a QR Code represented as a {@link \chillerlan\QRCode\Decoder\BitMatrix}.
- correctErrors() : array<string|int, mixed>
- <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place using Reed-Solomon error correction.</p>
- decodeBitStream() : DecoderResult
- decodeParser() : DecoderResult
- getDataBlocks() : array<string|int, mixed>
- <p>When QR Codes use multiple data blocks, they are actually interleaved.
Methods
decode()
<p>Decodes a QR Code represented as a {@link \chillerlan\QRCode\Decoder\BitMatrix}.
public
decode(LuminanceSourceInterface $source) : DecoderResult
A 1 or "true" is taken to mean a black module.
Parameters
- $source : LuminanceSourceInterface
Tags
Return values
DecoderResult —text and bytes encoded within the QR Code
correctErrors()
<p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place using Reed-Solomon error correction.</p>
private
correctErrors(array<string|int, mixed> $codewordBytes, int $numDataCodewords) : array<string|int, mixed>
Parameters
- $codewordBytes : array<string|int, mixed>
- $numDataCodewords : int
Return values
array<string|int, mixed> —decodeBitStream()
private
decodeBitStream(array<string|int, mixed> $bytes, Version $version, EccLevel $ecLevel) : DecoderResult
Parameters
Tags
Return values
DecoderResult —decodeParser()
private
decodeParser(BitMatrixParser $parser) : DecoderResult
Parameters
- $parser : BitMatrixParser
Return values
DecoderResult —getDataBlocks()
<p>When QR Codes use multiple data blocks, they are actually interleaved.
private
getDataBlocks(array<string|int, mixed> $rawCodewords, Version $version, EccLevel $eccLevel) : array<string|int, mixed>
That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This method will separate the data into original blocks.
Parameters
- $rawCodewords : array<string|int, mixed>
-
bytes as read directly from the QR Code
- $version : Version
-
version of the QR Code
- $eccLevel : EccLevel
-
error-correction level of the QR Code
Tags
Return values
array<string|int, mixed> —DataBlocks containing original bytes, "de-interleaved" from representation in the QR Code