Changeset 39307
- Timestamp:
- Jan 13, 2016, 6:00:20 AM (11 years ago)
- Location:
- trunk/Ohana/src/delstar
- Files:
-
- 3 edited
-
include/delstar.h (modified) (1 diff)
-
src/args.c (modified) (1 diff)
-
src/delete_duplicate_images.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/delstar/include/delstar.h
r37040 r39307 66 66 int VERBOSE2; 67 67 int UPDATE; 68 int SKIP_DIFF_PAIRS; 68 69 int IMAGE_DETAILS; 69 70 int IMAGE_DUPLICATES_BY_OBSTIME; -
trunk/Ohana/src/delstar/src/args.c
r36833 r39307 79 79 } 80 80 81 SKIP_DIFF_PAIRS = FALSE; 82 if ((N = get_argument (argc, argv, "-skip-diff-pairs"))) { 83 SKIP_DIFF_PAIRS = TRUE; 84 remove_argument (N, &argc, argv); 85 } 86 81 87 // We should generally not delete the images before the measures (or we won't know what 82 88 // to delete). -image-only is for testing, -image-only-force -update WILL delete the images -
trunk/Ohana/src/delstar/src/delete_duplicate_images.c
r38986 r39307 466 466 off_t Ndup = 0; 467 467 468 if (SKIP_DIFF_PAIRS) { 469 int *pair1 = NULL; 470 int *pair2 = NULL; 471 472 // in this case, I need to generate a set of pair maps: 473 ALLOCATE (pair1, int, extID->range); // first image for the extID 474 ALLOCATE (pair2, int, extID->range); // second image for the extID 475 for (i = 0; i < extID->range; i++) { 476 pair1[i] = -1; 477 pair2[i] = -1; 478 } 479 for (i = 0; i < Nimage; i++) { 480 if (image[i].externID == 0) continue; 481 off_t Nx = image[i].externID - extID->minID; 482 myAssert (Nx >= 0, "oops"); 483 myAssert (Nx < extID->range, "oops"); 484 485 // only map the pairs 486 if (extID->value[Nx] != 2) continue; 487 488 if (pair1[Nx] == -1) { 489 pair1[Nx] = i; 490 continue; 491 } 492 if (pair2[Nx] == -1) { 493 pair2[Nx] = i; 494 continue; 495 } 496 } 497 498 for (i = 0; i < extID->range; i++) { 499 // we have only 2 valid cases: 500 // 1) pair1 == pair2 == -1, 501 // 2) pair1 > -1, pair2 > -1 502 503 // this extID does not correspond to a pair, skip it: 504 if ((pair1[i] == -1) && (pair2[i] == -1)) continue; 505 506 myAssert (extID->value[i] == 2, "oops"); 507 508 int valid = ((pair1[i] > -1) && (pair2[i] > -1)); 509 myAssert (valid, "oops"); 510 511 // we think we have a pair, check the names: 512 int length1 = strlen(image[pair1[i]].name); 513 int length2 = strlen(image[pair2[i]].name); 514 515 // names should be of the form: foo.cmf, foo.inv.cmf 516 valid = (length1 == length2 + 4) || (length1 == length2 - 4); 517 if (!valid) continue; 518 519 int baselength = MIN(length1, length2) - 4; 520 valid = !strncmp (image[pair1[i]].name, image[pair2[i]].name, baselength); 521 if (!valid) continue; 522 523 valid = TRUE; 524 if (length1 > length2) { 525 valid = valid && !strcmp (&image[pair1[i]].name[baselength], ".inv.cmf"); 526 valid = valid && !strcmp (&image[pair2[i]].name[baselength], ".cmf"); 527 } else { 528 valid = valid && !strcmp (&image[pair1[i]].name[baselength], ".cmf"); 529 valid = valid && !strcmp (&image[pair2[i]].name[baselength], ".inv.cmf"); 530 } 531 if (!valid) continue; 532 533 // this pair is a valid diff image pair, do not delete: 534 extID->value[i] = 1; 535 } 536 } 537 468 538 // set imageID->value to TRUE for images we want to delete 469 539 for (i = 0; i < Nimage; i++) { … … 472 542 myAssert (Nx >= 0, "oops"); 473 543 myAssert (Nx < extID->range, "oops"); 544 545 // do not delete any extID with only a single image 474 546 if (extID->value[Nx] < 2) continue; 547 548 // do not delete the last image 475 549 if (Ndelete[Nx] == extID->value[Nx] - 1) continue; 476 550
Note:
See TracChangeset
for help on using the changeset viewer.
