|
|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <tiffio.h>
|
|
|
|
|
#include "dng.h"
|
|
|
|
|
@ -122,7 +123,8 @@ int DNG::writeFile(void * data) {
|
|
|
|
|
time_t abs_ts;
|
|
|
|
|
struct tm tm;
|
|
|
|
|
char timestamp[64];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* get time stamp */
|
|
|
|
|
time (&abs_ts);
|
|
|
|
|
gmtime_r (&abs_ts, &tm);
|
|
|
|
|
sprintf(timestamp, "%04d:%02d:%02d %02d:%02d:%02d",
|
|
|
|
|
@ -147,11 +149,13 @@ int DNG::writeFile(void * data) {
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, SamplesPerPixel);
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
|
|
|
|
|
|
|
|
|
if(ColorID == DNG_COLORID_RAW8 || ColorID == DNG_COLORID_RAW8) {
|
|
|
|
|
|
|
|
|
|
if(ColorID == DNG_COLORID_RAW8 || ColorID == DNG_COLORID_RAW16) {
|
|
|
|
|
static const short CFARepeatPattern[] = { 2,2 }; // 2x2 CFA
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_CFA);
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_CFAREPEATPATTERNDIM, CFARepeatPattern);
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_CFALAYOUT, 1);
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_CFAPLANECOLOR, 3, "\000\001\002"); // RGB
|
|
|
|
|
// 0 = Red, 1 = Green, 2 = Blue
|
|
|
|
|
TIFFSetField(tif, TIFFTAG_CFAPATTERN, "\001\000\002\001"); // GRBG
|
|
|
|
|
}
|
|
|
|
|
|