function Enc($aData, $aDebug = false) { if ($this->iTilde) { $r = tilde_process($aData); if ($r === false) { $this->iError = -9; return false; } $aData = $r; } $data = str_split($aData); $ndata = count($data); $symbols = array(); if ($this->iEncodation->Encode($data, $symbols, $this->iShapeIdx) === false) { $this->iError = $this->iEncodation->iError; return false; } $this->iEncodation->AddErrorCoding(); if ($this->iDebug) { $this->iEncodation->_printDebugInfo(); } $outputMatrix = array(); $databits = array(); ByteArray2Bits($this->iEncodation->iSymbols, $databits); $res = $this->iBitPlacement->Set($this->iEncodation->iSymbolShapeIdx, $databits, $outputMatrix); if ($res === false) { $this->iError = $this->iBitPlacement->iError; return false; } $pspec = new PrintSpecification(DM_TYPE_200, $data, $outputMatrix, $this->iEncodation->iSelectSchema); return $pspec; }
function MasterRandom() { $n = count($this->iMasterStream); $s = implode('', $this->iMasterStream); $crc32 = crc32($s); if ($crc32 != $this->iChkCRC32 || $n != $this->iLen) { return false; } ByteArray2Bits($this->iMasterStream, $this->iBitStream); }
function MasterRandom() { // Check integrity of table so it hasn't been corrupted // This is done by calculating the CRC32 $n = count($this->iMasterStream); $s = implode('', $this->iMasterStream); $crc32 = crc32($s); if ($crc32 != $this->iChkCRC32 || $n != $this->iLen) { return false; } // Create the real master bit table ByteArray2Bits($this->iMasterStream, $this->iBitStream); }
function Enc($aData, $aDebug = false) { if ($this->iTilde) { $r = tilde_process($aData); if ($r === false) { $this->iError = -9; return false; } $aData = $r; } $data = str_split($aData); $ndata = count($data); $symbols = array(); if ($this->iEncodation->Encode($data, $symbols, $this->iShapeIdx) === false) { $this->iError = $this->iEncodation->iError; return false; } /* if( $aDebug ) { $n = count($this->iEncodation->iSymbols); echo "Encoded symbols (len=$n)\n"; echo "=========================\n"; for($i=0; $i < $n; ++$i ) { printf("%3d:%3d,",$i,$this->iEncodation->iSymbols[$i]); if( ($i+1) % 15 == 0 ) echo "\n"; } echo "\n"; } */ // Calculate error codes and add them ot the end of the codeword data stream $this->iEncodation->AddErrorCoding(); if ($this->iDebug) { $this->iEncodation->_printDebugInfo(); } $outputMatrix = array(); $databits = array(); ByteArray2Bits($this->iEncodation->iSymbols, $databits); $res = $this->iBitPlacement->Set($this->iEncodation->iSymbolShapeIdx, $databits, $outputMatrix); if ($res === false) { $this->iError = $this->iBitPlacement->iError; return false; } $pspec = new PrintSpecification(DM_TYPE_200, $data, $outputMatrix, $this->iEncodation->iSelectSchema); return $pspec; }
function Get($aData) { $bits = array(); ByteArray2Bits($aData, $bits); return $bits; }