Changeset 42665
- Timestamp:
- Apr 23, 2024, 5:57:34 PM (2 years ago)
- Location:
- branches/2dbias/ppImage
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/ppImageOptions.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2dbias/ppImage
- Property svn:mergeinfo changed
/branches/eam_branches/ppImage.20240412 (added) merged: 42655-42656,42660
- Property svn:mergeinfo changed
-
branches/2dbias/ppImage/src/ppImageOptions.c
r42382 r42665 187 187 // XXX EAM : we should abort on invalid options. default options? 188 188 if (psMetadataLookupBool(NULL, recipe, "OVERSCAN")) { 189 bool mdok; 190 189 191 options->doOverscan = true; 190 192 191 // Do the overscan as a single value? 192 bool overscanSingle = psMetadataLookupBool(NULL, recipe, "OVERSCAN.SINGLE"); 193 // Fill in the options 194 options->overscan = pmOverscanOptionsAlloc(); 195 196 // these options apply to the overscan regardless of layout 197 options->overscan->single = psMetadataLookupBool(NULL, recipe, "OVERSCAN.SINGLE"); 198 options->overscan->constant = psMetadataLookupBool(NULL, recipe, "OVERSCAN.CONSTANT"); 199 options->overscan->value = psMetadataLookupF32(NULL, recipe, "OVERSCAN.VALUE"); 200 options->overscan->minValid = psMetadataLookupF32(&mdok, recipe, "OVERSCAN.MIN.VALID"); 201 if (!mdok) { options->overscan->minValid = 0.0; } 202 options->overscan->maxValid = psMetadataLookupF32(&mdok, recipe, "OVERSCAN.MAX.VALID"); 203 if (!mdok) { options->overscan->maxValid = (float) 0x10000; } 204 options->overscan->maskVal = 0x0001; 205 206 // statistics for the primary region 207 options->overscan->primary = pmOverscanStatOptionsAlloc(); 193 208 194 209 // How do we fit it? 195 pmFit overscanFit = PM_FIT_NONE; // Fit type for overscan196 int overscanOrder = 0; // Order for overscan fit197 210 psString fit = psMetadataLookupStr(NULL, recipe, "OVERSCAN.FIT"); 198 211 if (! strcasecmp(fit, "POLYNOMIAL")) { 199 overscanFit= PM_FIT_POLY_ORD;200 o verscanOrder= psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER");212 options->overscan->primary->fitType = PM_FIT_POLY_ORD; 213 options->overscan->primary->order = psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER"); 201 214 } else if (! strcasecmp(fit, "CHEBYSHEV")) { 202 overscanFit= PM_FIT_POLY_CHEBY;203 o verscanOrder= psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER");215 options->overscan->primary->fitType = PM_FIT_POLY_CHEBY; 216 options->overscan->primary->order = psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER"); 204 217 } else if (! strcasecmp(fit, "SPLINE")) { 205 overscanFit= PM_FIT_SPLINE;218 options->overscan->primary->fitType = PM_FIT_SPLINE; 206 219 } else if (strcasecmp(fit, "NONE")) { 207 220 psLogMsg(__func__, PS_LOG_WARN, … … 213 226 // What method do we use to measure the overscan statistics? 214 227 // XXX allow user to specify psStats types by name 215 psStats *overscanStats = NULL; // Statistics for overscan216 228 psString stat = psMetadataLookupStr(NULL, recipe, "OVERSCAN.STAT"); 217 229 if (! strcasecmp(stat, "MEAN")) { 218 // overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 219 overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 230 options->overscan->primary->stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 220 231 } else if (! strcasecmp(stat, "MEDIAN")) { 221 o verscanStats= psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);232 options->overscan->primary->stat = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN); 222 233 } else { 223 psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) in recipe %s is not one of MEAN or MEDIAN", 224 stat, RECIPE_NAME); 234 psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) in recipe %s is not one of MEAN or MEDIAN", stat, RECIPE_NAME); 225 235 exit(EXIT_FAILURE); 226 236 } 227 237 228 bool mdok; 229 int boxcar = psMetadataLookupS32(NULL, recipe, "OVERSCAN.BOXCAR"); 230 float gauss = psMetadataLookupF32(NULL, recipe, "OVERSCAN.GAUSS"); 231 float minValid = psMetadataLookupF32(&mdok, recipe, "OVERSCAN.MIN.VALID"); 232 if (!mdok) { minValid = 0.0; } 233 234 float maxValid = psMetadataLookupF32(&mdok, recipe, "OVERSCAN.MAX.VALID"); 235 if (!mdok) { maxValid = (float) 0x10000; } 236 237 // Fill in the options 238 options->overscan = pmOverscanOptionsAlloc(overscanSingle, overscanFit, overscanOrder, 239 overscanStats, boxcar, gauss); 240 241 options->overscan->constant = psMetadataLookupBool(NULL, recipe, "OVERSCAN.CONSTANT"); 242 options->overscan->value = psMetadataLookupF32(NULL, recipe, "OVERSCAN.VALUE"); 243 options->overscan->minValid = minValid; 244 options->overscan->maxValid = maxValid; 245 options->overscan->maskVal = 0x0001; 246 247 psFree(overscanStats); 238 options->overscan->primary->boxcar = psMetadataLookupS32(NULL, recipe, "OVERSCAN.BOXCAR"); 239 options->overscan->primary->gauss = psMetadataLookupF32(NULL, recipe, "OVERSCAN.GAUSS"); 240 241 // Do the overscan as a single value? 242 options->overscan->TwoD = psMetadataLookupBool(NULL, recipe, "OVERSCAN.2D"); 243 if (options->overscan->TwoD) { 244 245 // statistics for the secondary region 246 options->overscan->secondary = pmOverscanStatOptionsAlloc(); 247 248 // How do we fit it? 249 psString fit = psMetadataLookupStr(NULL, recipe, "OVERSCAN.2D.FIT"); 250 if (! strcasecmp(fit, "POLYNOMIAL")) { 251 options->overscan->secondary->fitType = PM_FIT_POLY_ORD; 252 options->overscan->secondary->order = psMetadataLookupS32(NULL, recipe, "OVERSCAN.2D.ORDER"); 253 } else if (! strcasecmp(fit, "CHEBYSHEV")) { 254 options->overscan->secondary->fitType = PM_FIT_POLY_CHEBY; 255 options->overscan->secondary->order = psMetadataLookupS32(NULL, recipe, "OVERSCAN.2D.ORDER"); 256 } else if (! strcasecmp(fit, "SPLINE")) { 257 options->overscan->secondary->fitType = PM_FIT_SPLINE; 258 } else if (strcasecmp(fit, "NONE")) { 259 psLogMsg(__func__, PS_LOG_WARN, 260 "OVERSCAN.2D.FIT (%s) in recipe %s is not one of NONE, POLYNOMIAL, or SPLINE", 261 fit, RECIPE_NAME); 262 exit(EXIT_FAILURE); 263 } 264 265 // What method do we use to measure the overscan statistics? 266 // XXX allow user to specify psStats types by name 267 psString stat = psMetadataLookupStr(NULL, recipe, "OVERSCAN.2D.STAT"); 268 if (! strcasecmp(stat, "MEAN")) { 269 options->overscan->secondary->stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 270 } else if (! strcasecmp(stat, "MEDIAN")) { 271 options->overscan->secondary->stat = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN); 272 } else { 273 psErrorStackPrint(stderr, "OVERSCAN.2D.STAT (%s) in recipe %s is not one of MEAN or MEDIAN", stat, RECIPE_NAME); 274 exit(EXIT_FAILURE); 275 } 276 277 options->overscan->secondary->boxcar = psMetadataLookupS32(NULL, recipe, "OVERSCAN.2D.BOXCAR"); 278 options->overscan->secondary->gauss = psMetadataLookupF32(NULL, recipe, "OVERSCAN.2D.GAUSS"); 279 } 248 280 } 249 281
Note:
See TracChangeset
for help on using the changeset viewer.
