Browse Source

[Fix]图片分割bug

zhipeng 1 year ago
parent
commit
b79388aaba

+ 11 - 5
app/src/main/java/com/datarecovery/master/utils/ImageDeepDetector.java

@@ -180,6 +180,12 @@ public class ImageDeepDetector {
             if (path.contains("tencent/MobileQQ/doodle_template") || path.contains("tencent%2FMobileQQ%2Fdoodle_template")) {
             if (path.contains("tencent/MobileQQ/doodle_template") || path.contains("tencent%2FMobileQQ%2Fdoodle_template")) {
                 return true;
                 return true;
             }
             }
+            if (path.contains(".mob_ad/.material") || path.contains("mob_ad%2F.material")) {
+                return true;
+            }
+            if (path.contains("bddownload/common") || path.contains("bddownload%2Fcommon")) {
+                return true;
+            }
         } catch (Exception ignore) {
         } catch (Exception ignore) {
         }
         }
         return false;
         return false;
@@ -286,7 +292,7 @@ public class ImageDeepDetector {
                 return true;
                 return true;
             }
             }
 
 
-            boolean hasHeaderMagic = bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xD8; // jpg header
+            boolean hasHeaderMagic = bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xD8 && bytes[2] == (byte) 0xFF; // jpg header
             if (!hasHeaderMagic) {
             if (!hasHeaderMagic) {
                 return false;
                 return false;
             }
             }
@@ -1101,11 +1107,11 @@ public class ImageDeepDetector {
                     for (int i = 0; i < read; i++) {
                     for (int i = 0; i < read; i++) {
                         byte b = buffer[i];
                         byte b = buffer[i];
                         imageBytes.add(b);
                         imageBytes.add(b);
-                        if (imageBytes.size() < 2) {
+                        if (imageBytes.size() < 3) {
                             continue;
                             continue;
                         }
                         }
-                        if (imageBytes.size() == 2) {
-                            if (imageBytes.get(0) != (byte) 0xFF || imageBytes.get(1) != (byte) 0xD8) {
+                        if (imageBytes.size() == 3) {
+                            if (imageBytes.get(0) != (byte) 0xFF || imageBytes.get(1) != (byte) 0xD8 || imageBytes.get(2) != (byte) 0xFF) {
                                 imageBytes.remove(0);
                                 imageBytes.remove(0);
                             }
                             }
                             continue;
                             continue;
@@ -1118,7 +1124,7 @@ public class ImageDeepDetector {
                                 }
                                 }
                             }
                             }
                             imageBytes.clear();
                             imageBytes.clear();
-                        } else if (imageBytes.size() >= 4) {
+                        } else if (imageBytes.size() >= 5) {
                             if (imageBytes.get(imageBytes.size() - 1) == (byte) 0xD9
                             if (imageBytes.get(imageBytes.size() - 1) == (byte) 0xD9
                                     && imageBytes.get(imageBytes.size() - 2) == (byte) 0xFF
                                     && imageBytes.get(imageBytes.size() - 2) == (byte) 0xFF
                             ) {
                             ) {