libdng.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef LIBDNG_LIBRARY_H
  2. #define LIBDNG_LIBRARY_H
  3. #include <limits.h>
  4. #include <time.h>
  5. #include <stdint.h>
  6. #define EXPORT __attribute__((__visibility__("default")))
  7. typedef struct {
  8. char *camera_make;
  9. char *camera_model;
  10. char *unique_camera_model;
  11. char *software;
  12. uint16_t orientation;
  13. struct tm datetime;
  14. // Raw image data
  15. uint16_t bayer_pattern_dimensions[2];
  16. float neutral[3];
  17. uint8_t cfapattern[4];
  18. // Calibration data
  19. float color_matrix_1[9];
  20. float color_matrix_2[9];
  21. float forward_matrix_1[9];
  22. float forward_matrix_2[9];
  23. unsigned short illuminant_1;
  24. unsigned short illuminant_2;
  25. unsigned int hue_sat_map_dims[3];
  26. size_t tone_curve_length;
  27. float *tone_curve;
  28. float *hue_sat_map_data_1;
  29. float *hue_sat_map_data_2;
  30. uint16_t bit_depth;
  31. bool needs_repack;
  32. } libdng_info;
  33. #define LIBDNG_ORIENTATION_TOPLEFT 1
  34. #define LIBDNG_ORIENTATION_TOPRIGHT 2
  35. #define LIBDNG_ORIENTATION_BOTRIGHT 3
  36. #define LIBDNG_ORIENTATION_BOTLEFT 4
  37. #define LIBDNG_ORIENTATION_LEFTTOP 5
  38. #define LIBDNG_ORIENTATION_RIGHTTOP 6
  39. #define LIBDNG_ORIENTATION_RIGHTBOT 7
  40. #define LIBDNG_ORIENTATION_LEFTBOT 8
  41. EXPORT int
  42. libdng_init();
  43. EXPORT void
  44. libdng_new(libdng_info *dng);
  45. EXPORT void
  46. libdng_free(libdng_info *dng);
  47. EXPORT int
  48. libdng_set_mode_from_name(libdng_info *dng, const char *name);
  49. EXPORT int
  50. libdng_set_mode_from_pixfmt(libdng_info *dng, uint32_t pixfmt);
  51. EXPORT int
  52. libdng_set_make_model(libdng_info *dng, const char *make, const char *model);
  53. EXPORT int
  54. libdng_set_software(libdng_info *dng, const char *software);
  55. EXPORT int
  56. libdng_set_datetime(libdng_info *dng, struct tm time);
  57. EXPORT int
  58. libdng_set_datetime_now(libdng_info *dng);
  59. EXPORT int
  60. libdng_set_orientation(libdng_info *dng, uint16_t orientation);
  61. EXPORT int
  62. libdng_load_calibration_file(libdng_info *dng, const char *path);
  63. EXPORT int
  64. libdng_write(libdng_info *dng, const char *path, unsigned int width, unsigned int height, const uint8_t *data,
  65. size_t length);
  66. #endif //LIBDNG_LIBRARY_H