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

Use raw extension for decompressed file.

When decompressing replace the original extension, before QCMP extension, with .raw extension.
parent c714d3aa
Branches
No related tags found
No related merge requests found
......@@ -46,7 +46,16 @@ public class ParsedCliOptions {
parseCLI(cmdInput);
}
private String removeQCMPFileExtension(final String originalPath) {
if (originalPath.toUpperCase().endsWith(CompressorDecompressorBase.EXTENSION)) {
return originalPath.substring(0, originalPath.length() - CompressorDecompressorBase.EXTENSION.length());
}
return originalPath;
}
private String getDefaultOutputFilePath(final String inputPath) {
// No default output file for custom function.
if (method == ProgramMethod.CustomFunction)
return "";
......@@ -54,29 +63,35 @@ public class ParsedCliOptions {
final File outputFile = new File(Paths.get("").toAbsolutePath().toString(), inputFile.getName());
// Default value is current directory with input file name.
String defaultValue = outputFile.getAbsolutePath();
switch (method) {
case Compress: {
// Add compressed file extension.
defaultValue += CompressorDecompressorBase.EXTENSION;
}
break;
case Decompress: {
if (defaultValue.toUpperCase().endsWith(CompressorDecompressorBase.EXTENSION)) {
defaultValue = defaultValue.substring(0,
defaultValue.length() - CompressorDecompressorBase.EXTENSION.length());
}
// If it ends with QCMP file extension remove the extension.
defaultValue = removeQCMPFileExtension(defaultValue);
// Remove the old extension and add RAW extension
defaultValue = defaultValue.replace(FilenameUtils.getExtension(defaultValue),
CompressorDecompressorBase.RAW_EXTENSION_NO_DOT);
}
break;
case Benchmark: {
defaultValue = new File(inputFile.getParent(), "benchmark").getAbsolutePath();
}
break;
case PrintHelp:
break;
case InspectFile:
defaultValue += ".txt";
break;
case TrainCodebook:
case PrintHelp:
case CustomFunction:
break;
}
return defaultValue;
......
......@@ -27,13 +27,13 @@ public class MeasurePlaneErrorFunction extends CustomFunctionBase {
boolean result = true;
result &= runPlaneDifferenceForAllBits(0, "sq", "middle_frame", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(0, "vq3x3", "middle_frame", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(0, "vq9x1", "middle_frame", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(0, "sq", "file_codebook", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(0, "vq3x3", "file_codebook", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(0, "vq9x1", "file_codebook", "D:\\biology\\tiff_data\\quantized");
// result &= runPlaneDifferenceForAllBits(1, "sq", "middle_frame", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(1, "vq3x3", "middle_frame", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(1, "vq9x1", "middle_frame", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(1, "sq", "file_codebook", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(1, "vq3x3", "file_codebook", "D:\\biology\\tiff_data\\quantized");
result &= runPlaneDifferenceForAllBits(1, "vq9x1", "file_codebook", "D:\\biology\\tiff_data\\quantized");
// result &= reportPlaneDifference(
// String.format("%s\\%s\\fused_tp_10_ch_%d_16bit_%s_cb4.raw",
......
......@@ -5,6 +5,7 @@ import azgracompress.cli.ParsedCliOptions;
public abstract class CompressorDecompressorBase {
public static final String EXTENSION = ".QCMP";
public static final String RAW_EXTENSION_NO_DOT = "raw";
protected final ParsedCliOptions options;
protected final int codebookSize;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment