Skip to content
Snippets Groups Projects
Commit 7a06c09a authored by Vojtech Moravec's avatar Vojtech Moravec
Browse files

Modify QCMPFileHeaderV1 header variables.

Make variables protected and rename planeDataSizes array to
chunkDataSizes, with this the getters and setters are renamed also.
parent 434ddb96
Branches
No related tags found
No related merge requests found
......@@ -109,7 +109,7 @@ public class ImageDecompressor extends CompressorDecompressorBase {
if (validFile && options.isVerbose()) {
final String prefix = header.getQuantizationType() != QuantizationType.Vector3D ? "Plane" : "Voxel layer";
final long[] planeDataSizes = header.getPlaneDataSizes();
final long[] planeDataSizes = header.getChunkDataSizes();
long planeIndex = 0;
for (final long planeDataSize : planeDataSizes) {
logBuilder.append(String.format("%s %d: %d Bytes\n", prefix, planeIndex++, planeDataSize));
......@@ -244,7 +244,7 @@ public class ImageDecompressor extends CompressorDecompressorBase {
dis.reset();
header.setPlaneDataSizes(chunkSizes);
header.setChunkDataSizes(chunkSizes);
return cachedDecompressor.decompressStreamMode(dis, header);
......
......@@ -73,7 +73,7 @@ public class SQImageDecompressor extends CompressorDecompressorBase implements I
reportStatusToListeners(String.format("Decompressing plane %d...", planeIndex));
byte[] decompressedPlaneData = null;
final int planeDataSize = (int) header.getPlaneDataSizes()[planeIndex];
final int planeDataSize = (int) header.getChunkDataSizes()[planeIndex];
try (final InBitStream inBitStream = new InBitStream(compressedStream,
header.getBitsPerCodebookIndex(),
planeDataSize)) {
......@@ -140,7 +140,7 @@ public class SQImageDecompressor extends CompressorDecompressorBase implements I
}
assert (codebook != null && huffmanDecoder != null);
final int planeDataSize = (int) header.getPlaneDataSizes()[planeIndex];
final int planeDataSize = (int) header.getChunkDataSizes()[planeIndex];
try (final InBitStream inBitStream = new InBitStream(compressedStream, header.getBitsPerCodebookIndex(), planeDataSize)) {
inBitStream.fillEntireBuffer();
inBitStream.setAllowReadFromUnderlyingStream(false);
......
......@@ -139,7 +139,7 @@ public class VQImageDecompressor extends CompressorDecompressorBase implements I
assert (codebook != null && huffmanDecoder != null);
final int planeDataSize = (int) header.getPlaneDataSizes()[planeIndex];
final int planeDataSize = (int) header.getChunkDataSizes()[planeIndex];
try (final InBitStream inBitStream = new InBitStream(compressedStream,
header.getBitsPerCodebookIndex(),
planeDataSize)) {
......@@ -183,7 +183,7 @@ public class VQImageDecompressor extends CompressorDecompressorBase implements I
for (int planeIndex = 0; planeIndex < planeCountForDecompression; planeIndex++) {
final int planeDataSize = (int) header.getPlaneDataSizes()[planeIndex];
final int planeDataSize = (int) header.getChunkDataSizes()[planeIndex];
try (final InBitStream inBitStream = new InBitStream(compressedStream,
header.getBitsPerCodebookIndex(),
planeDataSize)) {
......@@ -253,7 +253,7 @@ public class VQImageDecompressor extends CompressorDecompressorBase implements I
? header.getImageSizeZ()
: (voxelLayerDepth + (voxelLayerIndex * voxelLayerDepth));
final V3i currentVoxelLayerDims = new V3i(header.getImageSizeX(), header.getImageSizeY(), toZ - fromZ);
final int voxelLayerDataSize = (int) header.getPlaneDataSizes()[voxelLayerIndex];
final int voxelLayerDataSize = (int) header.getChunkDataSizes()[voxelLayerIndex];
final int voxelLayerVoxelCount = Voxel.calculateRequiredVoxelCount(currentVoxelLayerDims, voxelDims);
final int[][] decompressedVoxels = new int[voxelLayerVoxelCount][vectorSize];
......@@ -311,7 +311,7 @@ public class VQImageDecompressor extends CompressorDecompressorBase implements I
? header.getImageSizeZ()
: (voxelLayerDepth + (voxelLayerIndex * voxelLayerDepth));
final V3i currentVoxelLayerDims = new V3i(header.getImageSizeX(), header.getImageSizeY(), toZ - fromZ);
final int voxelLayerDataSize = (int) header.getPlaneDataSizes()[voxelLayerIndex];
final int voxelLayerDataSize = (int) header.getChunkDataSizes()[voxelLayerIndex];
final int voxelLayerVoxelCount = Voxel.calculateRequiredVoxelCount(currentVoxelLayerDims, voxelDims);
final int[][] decompressedVoxels = new int[voxelLayerVoxelCount][vectorSize];
......
......@@ -19,20 +19,20 @@ public class QCMPFileHeaderV1 implements IFileHeader, Cloneable {
//endregion
//region Header fields
private String magicValue = MAGIC_VALUE;
private QuantizationType quantizationType;
private byte bitsPerCodebookIndex;
private boolean codebookPerPlane;
protected String magicValue = MAGIC_VALUE;
protected QuantizationType quantizationType;
protected byte bitsPerCodebookIndex;
protected boolean codebookPerPlane;
private int imageSizeX;
private int imageSizeY;
private int imageSizeZ;
protected int imageSizeX;
protected int imageSizeY;
protected int imageSizeZ;
private int vectorSizeX;
private int vectorSizeY;
private int vectorSizeZ;
protected int vectorSizeX;
protected int vectorSizeY;
protected int vectorSizeZ;
private long[] planeDataSizes;
protected long[] chunkDataSizes;
//endregion
//region IFileHeader implementation
......@@ -121,10 +121,10 @@ public class QCMPFileHeaderV1 implements IFileHeader, Cloneable {
? imageSizeZ
: VQImageCompressor.calculateVoxelLayerCount(imageSizeZ, vectorSizeZ);
planeDataSizes = new long[chunkCount];
chunkDataSizes = new long[chunkCount];
for (int i = 0; i < chunkCount; i++) {
final long readValue = inputStream.readInt();
planeDataSizes[i] = (readValue & 0x00000000FFFFFFFFL);
chunkDataSizes[i] = (readValue & 0x00000000FFFFFFFFL);
}
}
......@@ -211,7 +211,7 @@ public class QCMPFileHeaderV1 implements IFileHeader, Cloneable {
// Indices are encoded using huffman. Plane data size is written in the header.
long totalPlaneDataSize = 0;
for (final long planeDataSize : planeDataSizes) {
for (final long planeDataSize : chunkDataSizes) {
totalPlaneDataSize += planeDataSize;
}
......@@ -231,7 +231,7 @@ public class QCMPFileHeaderV1 implements IFileHeader, Cloneable {
// Indices are encoded using huffman. Plane data size is written in the header.
long totalPlaneDataSize = 0;
for (final long planeDataSize : planeDataSizes) {
for (final long planeDataSize : chunkDataSizes) {
totalPlaneDataSize += planeDataSize;
}
return (codebookDataSize + totalPlaneDataSize);
......@@ -361,12 +361,12 @@ public class QCMPFileHeaderV1 implements IFileHeader, Cloneable {
vectorSizeZ = vectorDims.getZ();
}
public long[] getPlaneDataSizes() {
return planeDataSizes;
public long[] getChunkDataSizes() {
return chunkDataSizes;
}
public void setPlaneDataSizes(final long[] sizes) {
planeDataSizes = sizes;
public void setChunkDataSizes(final long[] sizes) {
chunkDataSizes = sizes;
}
public long getHeaderSize() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment