From 6e769e0db29715ed6883aa2b1d657ac0777a52d4 Mon Sep 17 00:00:00 2001 From: Michael O'Brien Date: Sun, 30 Sep 2018 21:48:10 -0400 Subject: [PATCH] #6 perf short circuit for duplication processor --- .../obrienscience/radar/DuplicationProcessor.java | 13 +++++++------ .../org/obrienscience/radar/ImageProcessor.java | 5 +++-- .../org/obrienscience/radar/MergeProcessor.java | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/radar.se/src/main/java/org/obrienscience/radar/DuplicationProcessor.java b/radar.se/src/main/java/org/obrienscience/radar/DuplicationProcessor.java index 79defca..82adc09 100755 --- a/radar.se/src/main/java/org/obrienscience/radar/DuplicationProcessor.java +++ b/radar.se/src/main/java/org/obrienscience/radar/DuplicationProcessor.java @@ -17,6 +17,7 @@ public class DuplicationProcessor extends ImageProcessor { + public static final int PIXEL_DIFF_THRESHOLD = 10; @Override public void run() { } @@ -148,14 +149,14 @@ public void process(String site, String anInputDir) {//, String anOutputDir) { prev = input; } else { // need to solve interleaved out of order in ecan_2012_02_16_19_10_1070_100 - int diff = isDifferent(prev, input,10); + int diff = isDifferent(prev, input,PIXEL_DIFF_THRESHOLD); if(diff < 1) { //System.out.println("Removing: " + filename); System.out.print("x"); //deleteImage(outputPath,"jpg"); files[i].delete(); } else { - if(diff < 10) { + if(diff < PIXEL_DIFF_THRESHOLD) { System.out.print("Z"); } else { //writeImage(input, outputPath, "jpg"); @@ -235,7 +236,7 @@ public static void main(String[] args) { DuplicationProcessor processor = new DuplicationProcessor(); //site = "xwl"; - for(int i=0;i pixelDiffThreashold) { + // perf: short circuit + if(pixelsDifferent > pixelDiffThreashold) { return pixelsDifferent; - }*/ + } } } } diff --git a/radar.se/src/main/java/org/obrienscience/radar/MergeProcessor.java b/radar.se/src/main/java/org/obrienscience/radar/MergeProcessor.java index ae9b7cd..0d5cf03 100644 --- a/radar.se/src/main/java/org/obrienscience/radar/MergeProcessor.java +++ b/radar.se/src/main/java/org/obrienscience/radar/MergeProcessor.java @@ -123,7 +123,8 @@ public static void main(String[] args) { // don't use use DuplicationProcessor //processor.process(site,"/_radar_unprocessed_image_to_persist", "/Users/michaelobrien/_filtered_data/"); - processor.process(site,"/Volumes/Untitled/_to_process/biomos14/_radar_unprocessed_image_to_persist/", "/Volumes/8tb/_radar_unprocessed_image_to_persist/"); + processor.process(site,"/Volumes/Untitled/_to_process/biomos14/_radar_unprocessed_image_to_persist/", + "/Volumes/8tb/_radar_unprocessed_image_to_persist/"); }