Added some comments about DNG file endianess

master
Stefan Jahn 3 years ago
parent b115537323
commit 209cbf9b43

@ -7,7 +7,7 @@ APP = simpleskycam
OBJECTS := $(OBJECTS) gui.oo main.oo \
video.oo videoframe.oo \
videodev.oo videodev-v4l2.oo videodev-dumpfile.oo \
convert.oo filter.oo detect.oo json.oo configuration.oo ser.oo
convert.oo filter.oo detect.oo json.oo configuration.oo ser.oo dng.oo
DISTNAME=simpleskycam-$(VERSION)
DEPENDFILE=.depend

@ -26,11 +26,25 @@ DNG::~DNG() {
}
}
/*
Run-time detection if we are little- or big-endian.
*/
int DNG::IsBigEndian(void) {
int i = 1;
return ! *((char *)&i);
}
/*
Sets the file name of the DNG file to be written. Returns -1 on
failure, 0 on success.
*/
int DNG::setFile(char * file) {
/*
w = write
l = little endian
b = big endian
-> if neither l or b is given, data is written in native CPU format
*/
if (!(tif = TIFFOpen(file, "w"))) {
return -1;
}
@ -139,7 +153,7 @@ int DNG::writeFile(void * data) {
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_CFA);
TIFFSetField(tif, TIFFTAG_CFAREPEATPATTERNDIM, CFARepeatPattern);
// 0 = Red, 1 = Green, 2 = Blue
TIFFSetField(tif, TIFFTAG_CFAPATTERN, "\001\000\002\001"); // GRGB
TIFFSetField(tif, TIFFTAG_CFAPATTERN, "\001\000\002\001"); // GRBG
}
else if(ColorID == DNG_COLORID_RGB) {
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);

@ -48,6 +48,7 @@ class DNG {
int BitsPerSample;
int SamplesPerPixel;
int ColorID;
int IsBigEndian(void);
public:
DNG();

Loading…
Cancel
Save