libdng.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef LIBDNG_LIBRARY_H
  2. #define LIBDNG_LIBRARY_H
  3. #include <limits.h>
  4. #include <time.h>
  5. #include <stdint.h>
  6. #include <stdbool.h>
  7. #define EXPORT __attribute__((__visibility__("default")))
  8. typedef struct {
  9. char *camera_make;
  10. char *camera_model;
  11. char *unique_camera_model;
  12. char *software;
  13. uint16_t orientation;
  14. struct tm datetime;
  15. uint16_t exposure_program;
  16. // Raw image data
  17. uint16_t bayer_pattern_dimensions[2];
  18. float neutral[3];
  19. float analogbalance[3];
  20. uint8_t cfapattern[4];
  21. uint32_t whitelevel;
  22. // Calibration data
  23. float color_matrix_1[9];
  24. float color_matrix_2[9];
  25. float forward_matrix_1[9];
  26. float forward_matrix_2[9];
  27. unsigned short illuminant_1;
  28. unsigned short illuminant_2;
  29. unsigned int hue_sat_map_dims[3];
  30. size_t tone_curve_length;
  31. float *tone_curve;
  32. float *hue_sat_map_data_1;
  33. float *hue_sat_map_data_2;
  34. uint16_t bit_depth;
  35. bool needs_repack;
  36. } libdng_info;
  37. #define LIBDNG_ORIENTATION_TOPLEFT 1
  38. #define LIBDNG_ORIENTATION_TOPRIGHT 2
  39. #define LIBDNG_ORIENTATION_BOTRIGHT 3
  40. #define LIBDNG_ORIENTATION_BOTLEFT 4
  41. #define LIBDNG_ORIENTATION_LEFTTOP 5
  42. #define LIBDNG_ORIENTATION_RIGHTTOP 6
  43. #define LIBDNG_ORIENTATION_RIGHTBOT 7
  44. #define LIBDNG_ORIENTATION_LEFTBOT 8
  45. #define LIBDNG_EXPOSUREPROGRAM_UNDEFINED 0
  46. #define LIBDNG_EXPOSUREPROGRAM_MANUAL 1
  47. #define LIBDNG_EXPOSUREPROGRAM_NORMAL 2
  48. #define LIBDNG_EXPOSUREPROGRAM_APERTURE_PRIORITY 3
  49. #define LIBDNG_EXPOSUREPROGRAM_SHUTTER_PRIORITY 4
  50. #define LIBDNG_EXPOSUREPROGRAM_CREATIVE 5
  51. #define LIBDNG_EXPOSUREPROGRAM_ACTION 6
  52. #define LIBDNG_EXPOSUREPROGRAM_PORTRAIT 7
  53. #define LIBDNG_EXPOSUREPROGRAM_LANDSCAPE 8
  54. EXPORT int
  55. libdng_init();
  56. EXPORT void
  57. libdng_new(libdng_info *dng);
  58. EXPORT void
  59. libdng_free(libdng_info *dng);
  60. EXPORT int
  61. libdng_set_mode_from_name(libdng_info *dng, const char *name);
  62. EXPORT int
  63. libdng_set_mode_from_pixfmt(libdng_info *dng, uint32_t pixfmt);
  64. EXPORT int
  65. libdng_set_make_model(libdng_info *dng, const char *make, const char *model);
  66. EXPORT int
  67. libdng_set_software(libdng_info *dng, const char *software);
  68. EXPORT int
  69. libdng_set_datetime(libdng_info *dng, struct tm time);
  70. EXPORT int
  71. libdng_set_datetime_now(libdng_info *dng);
  72. EXPORT int
  73. libdng_set_orientation(libdng_info *dng, uint16_t orientation);
  74. EXPORT int
  75. libdng_set_neutral(libdng_info *dng, float red, float green, float blue);
  76. EXPORT int
  77. libdng_set_analog_balance(libdng_info *dng, float red, float green, float blue);
  78. EXPORT int
  79. libdng_load_calibration_file(libdng_info *dng, const char *path);
  80. EXPORT int
  81. libdng_set_exposure_program(libdng_info *dng, uint16_t mode);
  82. EXPORT int
  83. libdng_write(libdng_info *dng, const char *path, unsigned int width, unsigned int height, const uint8_t *data,
  84. size_t length);
  85. #endif //LIBDNG_LIBRARY_H