changeset 533:91e2d0d74e2f

Adjust packed Amica paint format probe function to return less false positives.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 22 Nov 2012 17:56:25 +0200
parents 128a50feff07
children fbfdc9e4fe2b
files lib64gfx.c
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lib64gfx.c	Thu Nov 22 17:44:45 2012 +0200
+++ b/lib64gfx.c	Thu Nov 22 17:56:25 2012 +0200
@@ -212,7 +212,7 @@
 }
 
 
-#define AMICA_DM_PROBE_SIZE 1024
+#define AMICA_DM_PROBE_SIZE 2048
 static int fmtProbeAmicaPaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
 {
     int i, n;
@@ -223,15 +223,16 @@
     if (len == 9002)
         return DM_PROBE_SCORE_FALSE;
     
-    for (n = 0, i = 2; i < AMICA_DM_PROBE_SIZE; i++)
+    for (n = 0, i = 2; i < len; i++)
         if (buf[i] == 0xC2) n++;
     
-    if (n > 5)
+    if (n > 50)
         return DM_PROBE_SCORE_GOOD;
-    if (n > 3)
+    if (n > 25)
         return DM_PROBE_SCORE_AVG;
-
-    return DM_PROBE_SCORE_MAYBE;
+    if (n > 10)
+        return DM_PROBE_SCORE_MAYBE;
+    return DM_PROBE_SCORE_FALSE;
 }