-
Vojtěch Moravec authoredVojtěch Moravec authored
MeasurePlaneErrorFunction.java 9.92 KiB
package azgracompress.cli.functions;
import azgracompress.cli.CustomFunctionBase;
import azgracompress.io.InputDataInfo;
import azgracompress.cli.ParsedCliOptions;
import azgracompress.data.ImageU16;
import azgracompress.data.V3i;
import azgracompress.io.loader.RawDataLoader;
import azgracompress.utilities.Utils;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
public class MeasurePlaneErrorFunction extends CustomFunctionBase {
public MeasurePlaneErrorFunction(ParsedCliOptions options) {
super(options);
}
private final String COMP_FILE_ch0 = "D:\\biology\\tiff_data\\benchmark\\fused_tp_10_ch_0_16bit.raw";
private final String COMP_FILE_ch1 = "D:\\biology\\tiff_data\\benchmark\\fused_tp_10_ch_1_16bit.raw";
@Override
public boolean run() {
boolean result = true;
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", "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",
// "D:\\biology\\tiff_data\\quantized",
// "middle_frame",
// 1,
// "sq"),
// String.format("%s\\%s\\plane_diff_ch%d\\%s_cb4_plane_log.data",
// "D:\\biology\\tiff_data\\quantized",
// "middle_frame",
// 1,
// "sq"),
// COMP_FILE_ch1);
return result;
}
public boolean runPlaneDifferenceForAllBits(final int channel,
final String method,
final String type,
final String folder) {
System.out.println(
String.format("runPlaneDifferenceForAllBits\n\tChannel: %d\n\tMethod: %s\n\tType: %s",
channel, type, folder));
// final int channel = 0;
assert (channel == 0 || channel == 1);
final String comp_file = channel == 0 ? COMP_FILE_ch0 : COMP_FILE_ch1;
// final String method = "sq";
// final String type = "plane_codebook";
// final String folder = "D:\\biology\\tiff_data\\quantized";
if (!reportPlaneDifference(
String.format("%s\\%s\\fused_tp_10_ch_%d_16bit_%s_cb256.raw", folder, type, channel, method),
String.format("%s\\%s\\plane_diff_ch%d\\%s_cb256_plane_log.data", folder, type, channel, method),