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

Fixed bugs with cached codebook.

parent 60fa2eea
Branches
No related tags found
No related merge requests found
...@@ -34,8 +34,8 @@ public class CliConstants { ...@@ -34,8 +34,8 @@ public class CliConstants {
public static final String WORKER_COUNT_SHORT = "wc"; public static final String WORKER_COUNT_SHORT = "wc";
public static final String WORKER_COUNT_LONG = "worker-count"; public static final String WORKER_COUNT_LONG = "worker-count";
public static final String CODEBOOK_CACHE_FOLDER_SHORT = "wc"; public static final String CODEBOOK_CACHE_FOLDER_SHORT = "cbc";
public static final String CODEBOOK_CACHE_FOLDER_LONG = "worker-count"; public static final String CODEBOOK_CACHE_FOLDER_LONG = "codebook-cache";
public static final String SCALAR_QUANTIZATION_SHORT = "sq"; public static final String SCALAR_QUANTIZATION_SHORT = "sq";
public static final String SCALAR_QUANTIZATION_LONG = "scalar-quantization"; public static final String SCALAR_QUANTIZATION_LONG = "scalar-quantization";
......
...@@ -98,9 +98,13 @@ public class ImageCompressor extends CompressorDecompressorBase { ...@@ -98,9 +98,13 @@ public class ImageCompressor extends CompressorDecompressorBase {
private QCMPFileHeader createHeader() { private QCMPFileHeader createHeader() {
QCMPFileHeader header = new QCMPFileHeader(); QCMPFileHeader header = new QCMPFileHeader();
header.setQuantizationType(options.getQuantizationType()); header.setQuantizationType(options.getQuantizationType());
header.setBitsPerPixel((byte) options.getBitsPerPixel()); header.setBitsPerPixel((byte) options.getBitsPerPixel());
header.setCodebookPerPlane(!options.hasReferencePlaneIndex());
// Codebook per plane is used only if reference plane isn't set nor is the cache folder.
final boolean oneCodebook = options.hasReferencePlaneIndex() || options.hasCodebookCacheFolder();
header.setCodebookPerPlane(!oneCodebook);
header.setImageSizeX(options.getImageDimension().getX()); header.setImageSizeX(options.getImageDimension().getX());
header.setImageSizeY(options.getImageDimension().getY()); header.setImageSizeY(options.getImageDimension().getY());
......
...@@ -85,6 +85,7 @@ public class SQImageCompressor extends CompressorDecompressorBase implements IIm ...@@ -85,6 +85,7 @@ public class SQImageCompressor extends CompressorDecompressorBase implements IIm
Log("Loading codebook from cache file."); Log("Loading codebook from cache file.");
quantizer = loadQuantizerFromCache(); quantizer = loadQuantizerFromCache();
Log("Cached quantizer created."); Log("Cached quantizer created.");
writeCodebookToOutputStream(quantizer, compressStream);
} else if (options.hasReferencePlaneIndex()) { } else if (options.hasReferencePlaneIndex()) {
// TODO(Moravec): Reference plane will be deprecated in favor of 'middle' plane. // TODO(Moravec): Reference plane will be deprecated in favor of 'middle' plane.
stopwatch.restart(); stopwatch.restart();
......
...@@ -94,6 +94,7 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm ...@@ -94,6 +94,7 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm
Log("Loading codebook from cache file."); Log("Loading codebook from cache file.");
quantizer = loadQuantizerFromCache(); quantizer = loadQuantizerFromCache();
Log("Cached quantizer created."); Log("Cached quantizer created.");
writeQuantizerToCompressStream(quantizer, compressStream);
} else if (options.hasReferencePlaneIndex()) { } else if (options.hasReferencePlaneIndex()) {
stopwatch.restart(); stopwatch.restart();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment