95 FILE *fp, uint32_t xs, uint32_t ys,
float Tv,
float Av,
96 float f,
float iso, uint32_t filter,
97 const uint8_t xtrans[6][6],
98 const float whitelevel,
100 const float adobe_XYZ_to_CAM[4][3])
102 const uint32_t channels = 1;
109 int m[9] = { 3240454, -1537138, -498531, -969266, 1876010, 41556, 55643, -204025, 1057225 };
112 memset(buf, 0,
sizeof(buf));
148 uint32_t cfapattern = 0;
152 cfapattern = (0 << 24) | (1 << 16) | (1 << 8) | 2;
155 cfapattern = (1 << 24) | (2 << 16) | (0 << 8) | 1;
158 cfapattern = (1 << 24) | (0 << 16) | (2 << 8) | 1;
161 cfapattern = (2 << 24) | (1 << 16) | (1 << 8) | 0;
178 white.f = whitelevel;
191 memcpy(buf+400, xtrans,
sizeof(uint8_t)*36);
194 if(!isnan(adobe_XYZ_to_CAM[0][0]))
196 for(
int k= 0;
k < 3;
k++)
197 for(
int i= 0;
i < 3;
i++)
202 for(
int k = 0;
k < 9;
k++)
210 for(
int k = 0;
k < 3;
k++)
212 const float coeff = roundf(((
float)den * wb_coeffs[1]) / wb_coeffs[
k]);
218 const int written = fwrite(buf, 1, 584, fp);
219 if(written != 584) fprintf(stderr,
"[dng_write_header] failed to write image header!\n");
223 const char *filename,
const float *
const pixel,
const int wd,
224 const int ht,
void *exif,
const int exif_len,
const uint32_t filter,
225 const uint8_t xtrans[6][6],
226 const float whitelevel,
228 const float adobe_XYZ_to_CAM[4][3])
230 FILE *
f = g_fopen(filename,
"wb");
234 filter, xtrans, whitelevel, wb_coeffs, adobe_XYZ_to_CAM);
235 const int k = fwrite(pixel,
sizeof(
float), (
size_t)wd * ht,
f);
236 if(
k != wd * ht) fprintf(stderr,
"[dng_write] Error writing image data to %s\n", filename);
static uint8_t * dt_imageio_dng_make_tag(uint16_t tag, uint16_t type, uint32_t lng, uint32_t fld, uint8_t *b, uint8_t *cnt)
static void dt_imageio_write_dng(const char *filename, const float *const pixel, const int wd, const int ht, void *exif, const int exif_len, const uint32_t filter, const uint8_t xtrans[6][6], const float whitelevel, const dt_aligned_pixel_t wb_coeffs, const float adobe_XYZ_to_CAM[4][3])
static void dt_imageio_dng_write_tiff_header(FILE *fp, uint32_t xs, uint32_t ys, float Tv, float Av, float f, float iso, uint32_t filter, const uint8_t xtrans[6][6], const float whitelevel, const dt_aligned_pixel_t wb_coeffs, const float adobe_XYZ_to_CAM[4][3])