What exactly does this JB code do? $ Ln & nbsp; $ this-& gt; lengthIndicator ($ this-& gt; QR_MODE_NM, & nbsp; $ this-& gt; version ); $ dif & nbsp; $ this-& gt; estimateBitsModeNum ($ run) & nbsp; + & nbsp; 4 & nbsp; + & nbsp; what exactly does this JB code do?
$ln = $this->lengthIndicator($this->QR_MODE_NM, $this->version);
$dif = $this->estimateBitsModeNum($run) + 4 + $ln
+ $this->estimateBitsMode8(1) // + 4 + l8
- $this->estimateBitsMode8($run + 1); // - 4 - l8
if ($dif > 0) {
return $this->eat8();
}
function estimateBitsModeNum($size) {
$w = (int)$size / 3;
$bits = $w * 10;
switch($size - $w * 3) {
case 1: {
$bits += 4;
break;
}
case 2: {
$bits += 7;
break;
}
default: {
break;
}
}
return $bits;
}
function estimateBitsMode8($size) {
return $size * 8;
}
function lengthIndicator($mode, $version) {
if ($mode == $this->QR_MODE_ST) {
return 0;
}
if ($version <= 9) {
$l = 0;
} elseif ($version <= 26) {
$l = 1;
} else {
$l = 2;
}
return $this->lengthTableBits[$mode][$l];
}
$lengthTableBits = array(
array(10, 12, 14),
array( 9, 11, 13),
array( 8, 16, 16),
array( 8, 10, 12)
);
------ Solution --------------------
I don't know how the QR code works. can I understand the code?
Numeric mode Numeric encoding, from 0 to 9. If the number of numbers to be encoded is not a multiple of 3, the remaining 1 or 2 digits will be converted to 4 or 7 bits, the other three digits are compiled into 10, 12, and 14 bits corresponding to your estimateBitsModeNum.
Number of digits encoded in different versions:
Corresponding to your lengthIndicator
I do not understand, help you find the information: http://coolshell.cn/articles/10590.html#jtss-tsina