Changeset 14884
- Timestamp:
- Sep 18, 2007, 10:23:23 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPACopy.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPACopy.c
r13194 r14884 211 211 if (mdok && trimsec && !psRegionIsNaN(*trimsec)) { 212 212 *trimsec = psImageBinningSetRuffRegion(binning, *trimsec); 213 // force integer pixels : truncate x0, roundup x1:214 trimsec->x0 = (int)trimsec->x0;215 if (trimsec->x1 > (int)trimsec->x1) {216 trimsec->x1 = (int)trimsec->x1 + 1;217 } else {218 trimsec->x1 = (int)trimsec->x1;219 } 220 trimsec->y0 = (int)trimsec->y0;221 if (trimsec->y1 > (int)trimsec->y1) {222 trimsec->y1 = (int)trimsec->y1 + 1;223 } else {224 trimsec->y1 = (int)trimsec->y1;225 } 213 // force integer pixels : truncate x0, roundup x1: 214 trimsec->x0 = (int)trimsec->x0; 215 if (trimsec->x1 > (int)trimsec->x1) { 216 trimsec->x1 = (int)trimsec->x1 + 1; 217 } else { 218 trimsec->x1 = (int)trimsec->x1; 219 } 220 trimsec->y0 = (int)trimsec->y0; 221 if (trimsec->y1 > (int)trimsec->y1) { 222 trimsec->y1 = (int)trimsec->y1 + 1; 223 } else { 224 trimsec->y1 = (int)trimsec->y1; 225 } 226 226 } 227 227 psList *biassecs = psMetadataLookupPtr(&mdok, target->concepts, "CELL.BIASSEC"); // The bias sections … … 232 232 if (!psRegionIsNaN(*biassec)) { 233 233 *biassec = psImageBinningSetRuffRegion(binning, *biassec); 234 // force integer pixels : truncate x0, roundup x1:235 biassec->x0 = (int)biassec->x0;236 if (biassec->x1 > (int)biassec->x1) {237 biassec->x1 = (int)biassec->x1 + 1;238 } else {239 biassec->x1 = (int)biassec->x1;240 } 241 biassec->y0 = (int)biassec->y0;242 if (biassec->y1 > (int)biassec->y1) {243 biassec->y1 = (int)biassec->y1 + 1;244 } else {245 biassec->y1 = (int)biassec->y1;246 } 234 // force integer pixels : truncate x0, roundup x1: 235 biassec->x0 = (int)biassec->x0; 236 if (biassec->x1 > (int)biassec->x1) { 237 biassec->x1 = (int)biassec->x1 + 1; 238 } else { 239 biassec->x1 = (int)biassec->x1; 240 } 241 biassec->y0 = (int)biassec->y0; 242 if (biassec->y1 > (int)biassec->y1) { 243 biassec->y1 = (int)biassec->y1 + 1; 244 } else { 245 biassec->y1 = (int)biassec->y1; 246 } 247 247 } 248 248 } … … 393 393 pmCell *sourceCell = sourceCells->data[i]; // The sources cell 394 394 const char *cellName = psMetadataLookupStr(NULL, sourceCell->concepts, "CELL.NAME"); // Name of cell 395 // XXX are there other concepts I need to copy first?396 pmCell *targetCell = pmCellAlloc (targetChip, cellName);397 int xParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.XPARITY"); // Target x parity398 psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.XPARITY", PS_META_REPLACE, "", xParityTarget);399 int yParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.YPARITY"); // Target y parity400 psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.YPARITY", PS_META_REPLACE, "", yParityTarget);401 if (!cellCopy(targetCell, sourceCell, true, 1, 1)) {402 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "failed to duplicate chip\n");403 return NULL;404 }405 // update the attributes406 targetCell->file_exists = sourceCell->file_exists;407 targetCell->data_exists = sourceCell->data_exists;408 targetCell->process = sourceCell->process;395 // XXX are there other concepts I need to copy first? 396 pmCell *targetCell = pmCellAlloc (targetChip, cellName); 397 int xParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.XPARITY"); // Target x parity 398 psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.XPARITY", PS_META_REPLACE, "", xParityTarget); 399 int yParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.YPARITY"); // Target y parity 400 psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.YPARITY", PS_META_REPLACE, "", yParityTarget); 401 if (!cellCopy(targetCell, sourceCell, true, 1, 1)) { 402 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "failed to duplicate chip\n"); 403 return NULL; 404 } 405 // update the attributes 406 targetCell->file_exists = sourceCell->file_exists; 407 targetCell->data_exists = sourceCell->data_exists; 408 targetCell->process = sourceCell->process; 409 409 } 410 410 … … 467 467 PS_ASSERT_PTR_NON_NULL(target, false); 468 468 PS_ASSERT_PTR_NON_NULL(source, false); 469 if (target == source) { 470 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy FPA onto itself."); 471 return false; 472 } 469 473 return fpaCopy(target, source, true, 1, 1); 470 474 } … … 474 478 PS_ASSERT_PTR_NON_NULL(target, false); 475 479 PS_ASSERT_PTR_NON_NULL(source, false); 480 if (target == source) { 481 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy chip onto itself."); 482 return false; 483 } 476 484 return chipCopy(target, source, true, 1, 1); 477 485 } … … 481 489 PS_ASSERT_PTR_NON_NULL(target, false); 482 490 PS_ASSERT_PTR_NON_NULL(source, false); 491 if (target == source) { 492 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy cell onto itself."); 493 return false; 494 } 483 495 return cellCopy(target, source, true, 1, 1); 484 496 } … … 491 503 PS_ASSERT_INT_POSITIVE(xBin, false); 492 504 PS_ASSERT_INT_POSITIVE(yBin, false); 505 if (target == source) { 506 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy FPA onto itself."); 507 return false; 508 } 493 509 return fpaCopy(target, source, false, xBin, yBin); 494 510 } … … 500 516 PS_ASSERT_INT_POSITIVE(xBin, false); 501 517 PS_ASSERT_INT_POSITIVE(yBin, false); 518 if (target == source) { 519 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy chip onto itself."); 520 return false; 521 } 502 522 return chipCopy(target, source, false, xBin, yBin); 503 523 } … … 509 529 PS_ASSERT_INT_POSITIVE(xBin, false); 510 530 PS_ASSERT_INT_POSITIVE(yBin, false); 531 if (target == source) { 532 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy cell onto itself."); 533 return false; 534 } 511 535 return cellCopy(target, source, false, xBin, yBin); 512 536 }
Note:
See TracChangeset
for help on using the changeset viewer.
