- Timestamp:
- Jan 29, 2009, 3:01:24 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_20090128/pswarp/src/pswarpSetMaskBits.c
r18558 r21225 8 8 // updated in the config metadata. 9 9 10 bool pswarpSetMaskBits (pmConfig *config) {11 12 ps MaskType maskIn = 0x00;// mask for the input image13 ps MaskType markIn = 0x00;// mark for the input image14 ps MaskType maskOut = 0x00;// mask for the output image15 ps MaskType markOut = 0x00;// mark for the output image10 bool pswarpSetMaskBits (pmConfig *config) 11 { 12 psImageMaskType maskIn = 0x00; // mask for the input image 13 psImageMaskType markIn = 0x00; // mark for the input image 14 psImageMaskType maskOut = 0x00; // mask for the output image 15 psImageMaskType markOut = 0x00; // mark for the output image 16 16 17 17 // this function sets the required single-image mask bits 18 18 if (!pmConfigMaskSetBits (&maskIn, &markIn, config)) { 19 psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");20 return false;19 psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values"); 20 return false; 21 21 } 22 22 23 23 // mask for non-linear flat regions (default to DETECTOR if not defined) 24 psMaskType badMask = pmConfigMaskGet("BAD.WARP", config); 24 psMaskType badMask = pmConfigMaskGet("BAD.WARP", config); 25 25 if (!badMask) { 26 badMask = 0x01;27 pmConfigMaskSet (config, "BAD.WARP", badMask);26 badMask = 0x01; 27 pmConfigMaskSet (config, "BAD.WARP", badMask); 28 28 } 29 29 maskOut |= badMask; 30 30 31 31 // mask for non-linear flat regions (default to DETECTOR if not defined) 32 psMaskType poorMask = pmConfigMaskGet("POOR.WARP", config); 32 psMaskType poorMask = pmConfigMaskGet("POOR.WARP", config); 33 33 if (!poorMask) { 34 poorMask = 0x02;35 pmConfigMaskSet (config, "POOR.WARP", poorMask);34 poorMask = 0x02; 35 pmConfigMaskSet (config, "POOR.WARP", poorMask); 36 36 } 37 37 maskOut |= poorMask; … … 42 42 int nBits = sizeof(psMaskType) * 8; 43 43 for (int i = 0; !markOut && (i < nBits); i++) { 44 if (maskOut & markOut) {45 markOut >>= 1;46 } else {47 markOut = markOut;48 }44 if (maskOut & markOut) { 45 markOut >>= 1; 46 } else { 47 markOut = markOut; 48 } 49 49 } 50 50 51 51 if (!markOut) { 52 psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!");53 return false;52 psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!"); 53 return false; 54 54 } 55 55
Note:
See TracChangeset
for help on using the changeset viewer.
