diff --git a/.classpath b/.classpath index 6c635c0..7bc01d9 100644 --- a/.classpath +++ b/.classpath @@ -3,5 +3,7 @@ + + diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 1984168..3e3726e 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -4,7 +4,7 @@ android:versionCode="1" android:versionName="1.0"> - + diff --git a/project.properties b/project.properties index 05c1419..5a70945 100644 --- a/project.properties +++ b/project.properties @@ -8,4 +8,4 @@ # project structure. # Project target. -target=android-5 +target=android-7 diff --git a/src/com/jwetherell/motion_detection/MotionDetectionActivity.java b/src/com/jwetherell/motion_detection/MotionDetectionActivity.java index 162edaf..50d1f91 100644 --- a/src/com/jwetherell/motion_detection/MotionDetectionActivity.java +++ b/src/com/jwetherell/motion_detection/MotionDetectionActivity.java @@ -239,7 +239,7 @@ public void run() { } Bitmap bitmap = null; - if (Preferences.SAVE_CHANGES && img != null) { + if (Preferences.SAVE_CHANGES) { if (Preferences.USE_RGB) bitmap = ImageProcessing.rgbToBitmap(img, width, height); else bitmap = ImageProcessing.lumaToGreyscale(img, width, height); } diff --git a/src/com/jwetherell/motion_detection/detection/LumaMotionDetection.java b/src/com/jwetherell/motion_detection/detection/LumaMotionDetection.java index 8f9a085..c1c8d3b 100644 --- a/src/com/jwetherell/motion_detection/detection/LumaMotionDetection.java +++ b/src/com/jwetherell/motion_detection/detection/LumaMotionDetection.java @@ -41,8 +41,8 @@ protected static boolean isDifferent(int[] first, int width, int height) { int totDifferentPixels = 0; for (int i = 0, ij = 0; i < height; i++) { for (int j = 0; j < width; j++, ij++) { - int pix = (0xff & ((int) first[ij])); - int otherPix = (0xff & ((int) mPrevious[ij])); + int pix = (0xff & (first[ij])); + int otherPix = (0xff & (mPrevious[ij])); // Catch any pixels that are out of range if (pix < 0) pix = 0; diff --git a/src/com/jwetherell/motion_detection/detection/RgbMotionDetection.java b/src/com/jwetherell/motion_detection/detection/RgbMotionDetection.java index 3a29212..36c9308 100644 --- a/src/com/jwetherell/motion_detection/detection/RgbMotionDetection.java +++ b/src/com/jwetherell/motion_detection/detection/RgbMotionDetection.java @@ -42,8 +42,8 @@ protected static boolean isDifferent(int[] first, int width, int height) { int totDifferentPixels = 0; for (int i = 0, ij = 0; i < height; i++) { for (int j = 0; j < width; j++, ij++) { - int pix = (0xff & ((int) first[ij])); - int otherPix = (0xff & ((int) mPrevious[ij])); + int pix = (0xff & (first[ij])); + int otherPix = (0xff & (mPrevious[ij])); // Catch any pixels that are out of range if (pix < 0) pix = 0; diff --git a/src/com/jwetherell/motion_detection/image/ImageProcessing.java b/src/com/jwetherell/motion_detection/image/ImageProcessing.java index 7c375d5..6e08216 100644 --- a/src/com/jwetherell/motion_detection/image/ImageProcessing.java +++ b/src/com/jwetherell/motion_detection/image/ImageProcessing.java @@ -112,7 +112,7 @@ public static int[] decodeYUV420SPtoLuma(byte[] yuv420sp, int width, int height) for (int j = 0, yp = 0; j < height; j++) { for (int i = 0; i < width; i++, yp++) { - int y = (0xff & ((int) yuv420sp[yp])) - 16; + int y = (0xff & (yuv420sp[yp])) - 16; if (y < 0) y = 0; hsl[yp] = y; } @@ -142,7 +142,7 @@ public static int[] decodeYUV420SPtoRGB(byte[] yuv420sp, int width, int height) for (int j = 0, yp = 0; j < height; j++) { int uvp = frameSize + (j >> 1) * width, u = 0, v = 0; for (int i = 0; i < width; i++, yp++) { - int y = (0xff & ((int) yuv420sp[yp])) - 16; + int y = (0xff & (yuv420sp[yp])) - 16; if (y < 0) y = 0; if ((i & 1) == 0) { v = (0xff & yuv420sp[uvp++]) - 128;