| 15 | #include "../../internal/libraw_cxx_defs.h" |
| 16 | |
| 17 | int LibRaw::dcraw_process(void) |
| 18 | { |
| 19 | int quality, i; |
| 20 | |
| 21 | int iterations = -1, dcb_enhance = 1, noiserd = 0; |
| 22 | float preser = 0; |
| 23 | float expos = 1.0; |
| 24 | |
| 25 | CHECK_ORDER_LOW(LIBRAW_PROGRESS_LOAD_RAW); |
| 26 | // CHECK_ORDER_HIGH(LIBRAW_PROGRESS_PRE_INTERPOLATE); |
| 27 | |
| 28 | try |
| 29 | { |
| 30 | |
| 31 | int no_crop = 1; |
| 32 | |
| 33 | if (~O.cropbox[2] && ~O.cropbox[3]) |
| 34 | no_crop = 0; |
| 35 | |
| 36 | for(int c = 0; c < 4; c++) |
| 37 | if (O.aber[c]< 0.001 || O.aber[c] > 1000.f) |
| 38 | O.aber[c] = 1.0; |
| 39 | |
| 40 | libraw_decoder_info_t di; |
| 41 | get_decoder_info(&di); |
| 42 | |
| 43 | bool is_bayer = (imgdata.idata.filters || P1.colors == 1); |
| 44 | int subtract_inline = |
| 45 | !O.bad_pixels && !O.dark_frame && is_bayer && !IO.zero_is_bad; |
| 46 | |
| 47 | int rc = raw2image_ex(subtract_inline); // allocate imgdata.image and copy data! |
| 48 | if (rc != LIBRAW_SUCCESS) |
| 49 | return rc; |
| 50 | |
| 51 | // Adjust sizes |
| 52 | |
| 53 | int save_4color = O.four_color_rgb; |
| 54 | |
| 55 | if (IO.zero_is_bad) |
| 56 | { |
| 57 | remove_zeroes(); |
| 58 | SET_PROC_FLAG(LIBRAW_PROGRESS_REMOVE_ZEROES); |
| 59 | } |
| 60 | |
| 61 | if (O.bad_pixels && no_crop) |
| 62 | { |
| 63 | bad_pixels(O.bad_pixels); |
| 64 | SET_PROC_FLAG(LIBRAW_PROGRESS_BAD_PIXELS); |
| 65 | } |
| 66 | |
| 67 | if (O.dark_frame && no_crop) |
| 68 | { |
| 69 | subtract(O.dark_frame); |
| 70 | SET_PROC_FLAG(LIBRAW_PROGRESS_DARK_FRAME); |
| 71 | } |
| 72 | /* pre subtract black callback: check for it above to disable subtract |
| 73 | * inline */ |
| 74 | |