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

Fixed cache file naming.

parent 8030f87f
No related branches found
No related tags found
No related merge requests found
...@@ -228,7 +228,7 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm ...@@ -228,7 +228,7 @@ public class VQImageCompressor extends CompressorDecompressorBase implements IIm
Log("Saving cache file to %s", options.getOutputFile()); Log("Saving cache file to %s", options.getOutputFile());
QuantizationValueCache cache = new QuantizationValueCache(options.getOutputFile()); QuantizationValueCache cache = new QuantizationValueCache(options.getOutputFile());
try { try {
cache.saveQuantizationValues(options.getInputFile(), lbgResult.getCodebook()); cache.saveQuantizationValues(options.getInputFile(), lbgResult.getCodebook(), options.getVectorDimension());
} catch (IOException e) { } catch (IOException e) {
throw new ImageCompressionException("Unable to write cache.", e); throw new ImageCompressionException("Unable to write cache.", e);
} }
......
package azgracompress.quantization; package azgracompress.quantization;
import azgracompress.data.V2i;
import azgracompress.quantization.vector.CodebookEntry; import azgracompress.quantization.vector.CodebookEntry;
import java.io.*; import java.io.*;
...@@ -50,10 +51,12 @@ public class QuantizationValueCache { ...@@ -50,10 +51,12 @@ public class QuantizationValueCache {
} }
} }
public void saveQuantizationValues(final String trainFile, final CodebookEntry[] entries) throws IOException { public void saveQuantizationValues(final String trainFile,
final CodebookEntry[] entries,
final V2i qVecDims) throws IOException {
final int codebookSize = entries.length; final int codebookSize = entries.length;
final int entryWidth = entries[0].getWidth(); final int entryWidth = qVecDims.getX();
final int entryHeight = entries[0].getHeight(); final int entryHeight = qVecDims.getY();
final String cacheFile = getCacheFileForVectorValues(trainFile, final String cacheFile = getCacheFileForVectorValues(trainFile,
codebookSize, codebookSize,
entryWidth, entryWidth,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment