| 31 | #endif |
| 32 | |
| 33 | int main(int ac, char *av[]) |
| 34 | { |
| 35 | if (ac != 2) |
| 36 | return 1; |
| 37 | FILE *in = fopen(av[1], "rb"); |
| 38 | fseek(in, 0, SEEK_END); |
| 39 | unsigned fsz = ftell(in); |
| 40 | unsigned char *buffer = (unsigned char *)malloc(fsz); |
| 41 | if (!buffer) |
| 42 | return 2; |
| 43 | fseek(in, 0, SEEK_SET); |
| 44 | unsigned readb = fread(buffer, 1, fsz, in); |
| 45 | if (readb != fsz) |
| 46 | return 3; |
| 47 | LibRaw rp; |
| 48 | rp.imgdata.params.output_tiff = 1; |
| 49 | int ret = rp.open_bayer(buffer, fsz, 640, 480, 0, 0, 0, 0, 0, |
| 50 | LIBRAW_OPENBAYER_RGGB, 0, 0, 1400); |
| 51 | if (ret != LIBRAW_SUCCESS) |
| 52 | return 4; |
| 53 | if ((ret = rp.unpack()) != LIBRAW_SUCCESS) |
| 54 | printf("Unpack error: %d\n", ret); |
| 55 | |
| 56 | if ((ret = rp.dcraw_process()) != LIBRAW_SUCCESS) |
| 57 | printf("Processing error: %d\n", ret); |
| 58 | |
| 59 | char outfn[256]; |
| 60 | sprintf(outfn, "%s.tif", av[1]); |
| 61 | if (LIBRAW_SUCCESS != (ret = rp.dcraw_ppm_tiff_writer(outfn))) |
| 62 | printf("Cannot write %s: %s\n", outfn, libraw_strerror(ret)); |
| 63 | else |
| 64 | printf("Created %s\n", outfn); |
| 65 | } |
nothing calls this directly
no test coverage detected