use of com.revolsys.elevation.cloud.las.pointformat.LasPoint in project com.revolsys.open by revolsys.
the class LazDecompressPoint10V2 method init.
@Override
public void init(final LasPoint point) {
super.init(point);
for (int i = 0; i < 16; i++) {
this.lastXDiffMedian5[i].init();
this.lastYDiffMedian5[i].init();
this.lastIntensity[i] = 0;
this.last_height[i / 2] = 0;
}
ArithmeticModel.initSymbolModel(this.decompressScanAngleRankFalse);
ArithmeticModel.initSymbolModel(this.decompressScanAngleRankTrue);
this.intensity = 0;
}
use of com.revolsys.elevation.cloud.las.pointformat.LasPoint in project com.revolsys.open by revolsys.
the class LazDecompressRgb12V1 method read.
@Override
public void read(final LasPoint point) {
final int sym = this.decoder.decodeSymbol(this.byteUsed);
this.red = decompress(this.red, (sym & 1) != 0, (sym & 1 << 1) != 0);
this.green = decompress(this.green, (sym & 1 << 2) != 0, (sym & 1 << 3) != 0);
this.blue = decompress(this.blue, (sym & 1 << 4) != 0, (sym & 1 << 5) != 0);
super.read(point);
}
use of com.revolsys.elevation.cloud.las.pointformat.LasPoint in project com.revolsys.open by revolsys.
the class LasPointCloud method forEachPointLazChunked.
private void forEachPointLazChunked(final ArithmeticDecoder decoder, final LazDecompress[] pointDecompressors, final Consumer<? super LasPoint> action) {
final ChannelReader reader = this.reader;
final long chunkTableOffset = reader.getLong();
final long chunkSize = getLasZipHeader().getChunkSize();
long chunkReadCount = chunkSize;
final long pointCount = getPointCount();
for (int i = 0; i < pointCount; i++) {
final LasPoint point;
final LasPointFormat pointFormat = getPointFormat();
if (chunkSize == chunkReadCount) {
point = pointFormat.readLasPoint(this, reader);
for (final LazDecompress pointDecompressor : pointDecompressors) {
pointDecompressor.init(point);
}
decoder.reset();
chunkReadCount = 0;
} else {
point = pointFormat.newLasPoint(this);
for (final LazDecompress pointDecompressor : pointDecompressors) {
pointDecompressor.read(point);
}
}
action.accept(point);
chunkReadCount++;
}
}
use of com.revolsys.elevation.cloud.las.pointformat.LasPoint in project com.revolsys.open by revolsys.
the class LasPointCloud method forEachPointLazPointwise.
private void forEachPointLazPointwise(final ArithmeticDecoder decoder, final LazDecompress[] pointDecompressors, final Consumer<? super LasPoint> action) {
final LasPointFormat pointFormat = getPointFormat();
{
final ChannelReader reader = this.reader;
final LasPoint point = pointFormat.readLasPoint(this, reader);
for (final LazDecompress pointDecompressor : pointDecompressors) {
pointDecompressor.init(point);
}
decoder.reset();
action.accept(point);
}
final long pointCount = getPointCount();
for (int i = 1; i < pointCount; i++) {
final LasPoint point = pointFormat.newLasPoint(this);
for (final LazDecompress pointDecompressor : pointDecompressors) {
pointDecompressor.read(point);
}
action.accept(point);
}
}
use of com.revolsys.elevation.cloud.las.pointformat.LasPoint in project com.revolsys.open by revolsys.
the class LazDecompressGpsTime11V2 method read.
@Override
public void read(final LasPoint point) {
int multi;
final int[] lastGpsTimeDiff = this.lastGpsTimeDiff;
final int lastDiff = lastGpsTimeDiff[this.last];
final ArithmeticDecoder decoder = this.decoder;
final long[] lastGpsTime = this.lastGpsTime;
final int[] multiExtremeCounter = this.multiExtremeCounter;
int last = this.last;
int next = this.next;
final IntegerCompressor decompressGpsTime = this.decompressGpsTime;
if (lastDiff == 0) {
// if the last integer difference was zero
multi = decoder.decodeSymbol(this.gpsTime0Diff);
if (multi == 1) {
// the difference can be represented with 32 bits
final int gpsTimeDiff = decompressGpsTime.decompress(0, 0);
lastGpsTimeDiff[last] = gpsTimeDiff;
lastGpsTime[last] += gpsTimeDiff;
multiExtremeCounter[last] = 0;
} else if (multi == 2) {
// the difference is huge
long gpsTime = decompressGpsTime.decompress((int) (lastGpsTime[last] >>> 32), 8);
gpsTime <<= 32;
gpsTime |= Integer.toUnsignedLong(decoder.getInt());
next = this.next + 1;
next &= 3;
this.next = next;
lastGpsTime[next] = gpsTime;
last = next;
this.last = next;
lastGpsTimeDiff[last] = 0;
multiExtremeCounter[last] = 0;
} else if (multi > 2) {
// we switch to another sequence
last = last + multi - 2;
this.last = last & 3;
read(point);
}
} else {
multi = decoder.decodeSymbol(this.gpsTimeMulti);
if (multi == 1) {
final int gpsTimeDiff = lastGpsTimeDiff[last];
lastGpsTime[last] += decompressGpsTime.decompress(gpsTimeDiff, 1);
multiExtremeCounter[last] = 0;
} else if (multi < LASZIP_GPSTIME_MULTI_UNCHANGED) {
int gpsTimeDiff;
if (multi == 0) {
gpsTimeDiff = decompressGpsTime.decompress(0, 7);
multiExtremeCounter[last]++;
if (multiExtremeCounter[last] > 3) {
lastGpsTimeDiff[last] = gpsTimeDiff;
multiExtremeCounter[last] = 0;
}
} else if (multi < LASZIP_GPSTIME_MULTI) {
gpsTimeDiff = lastGpsTimeDiff[last];
if (multi < 10) {
gpsTimeDiff = decompressGpsTime.decompress(multi * gpsTimeDiff, 2);
} else {
gpsTimeDiff = decompressGpsTime.decompress(multi * gpsTimeDiff, 3);
}
} else if (multi == LASZIP_GPSTIME_MULTI) {
gpsTimeDiff = lastGpsTimeDiff[last];
gpsTimeDiff = decompressGpsTime.decompress(LASZIP_GPSTIME_MULTI * gpsTimeDiff, 4);
multiExtremeCounter[last]++;
if (multiExtremeCounter[last] > 3) {
lastGpsTimeDiff[last] = gpsTimeDiff;
multiExtremeCounter[last] = 0;
}
} else {
gpsTimeDiff = lastGpsTimeDiff[last];
multi = LASZIP_GPSTIME_MULTI - multi;
if (multi > LASZIP_GPSTIME_MULTI_MINUS) {
gpsTimeDiff = decompressGpsTime.decompress(multi * gpsTimeDiff, 5);
} else {
gpsTimeDiff = decompressGpsTime.decompress(LASZIP_GPSTIME_MULTI_MINUS * gpsTimeDiff, 6);
multiExtremeCounter[last]++;
if (multiExtremeCounter[last] > 3) {
lastGpsTimeDiff[last] = gpsTimeDiff;
multiExtremeCounter[last] = 0;
}
}
}
lastGpsTime[last] += gpsTimeDiff;
} else if (multi == LASZIP_GPSTIME_MULTI_CODE_FULL) {
next += 1;
next &= 3;
this.next = next;
long gpsTime = lastGpsTime[last];
gpsTime >>= 32;
gpsTime = decompressGpsTime.decompress((int) gpsTime, 8);
gpsTime <<= 32;
gpsTime |= Integer.toUnsignedLong(decoder.getInt());
lastGpsTime[next] = gpsTime;
last = next;
this.last = last;
lastGpsTimeDiff[last] = 0;
multiExtremeCounter[last] = 0;
} else if (multi >= LASZIP_GPSTIME_MULTI_CODE_FULL) {
last += multi - LASZIP_GPSTIME_MULTI_CODE_FULL;
this.last = last & 3;
read(point);
return;
}
}
point.setGpsTime(Double.longBitsToDouble(lastGpsTime[this.last]));
}
Aggregations