Merge branch 'dev' into 32b-tiff-output-cli

This commit is contained in:
Hombre
2018-05-07 09:59:25 +02:00
10 changed files with 107 additions and 44 deletions

View File

@@ -76,7 +76,7 @@ void Image16::getScanline (int row, unsigned char* buffer, int bps)
/*
* void Image16::setScanline (int row, unsigned char* buffer, int bps, int minValue[3], int maxValue[3]);
* has not been implemented yet, because as of now, this method is called for IIOSF_FLOAT sample format only
* has not been implemented yet, because as of now, this method is called for IIOSF_FLOATxx sample format only
*/
void Image16::setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples, float *minValue, float *maxValue)
{

View File

@@ -483,7 +483,7 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
if (mnote && (!make.compare (0, 6, "PENTAX") || (!make.compare (0, 5, "RICOH") && !model.compare (0, 6, "PENTAX")))) {
const rtexif::Tag* const hdr = mnote->findTag("HDR");
if (hdr) {
if (hdr->toInt() > 0 && hdr->toInt(2) > 0) {
if (hdr->toInt() > 0) {
isHDR = true;
#if PRINT_HDR_PS_DETECTION
printf("HDR detected ! -> \"HDR\" tag found\n");
@@ -558,28 +558,51 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
sampleFormat = IIOSF_UNSIGNED_SHORT;
}
} else if (sampleformat == SAMPLEFORMAT_IEEEFP) {
/*
* Not yet supported
*
if (bitspersample==16) {
sampleFormat = IIOSF_HALF;
isHDR = true;
}*/
if (bitspersample == 32) {
sampleFormat = IIOSF_FLOAT;
if (bitspersample==16) {
sampleFormat = IIOSF_FLOAT16;
isHDR = true;
#if PRINT_HDR_PS_DETECTION
printf("HDR detected ! -> sampleFormat = %d\n", sampleFormat);
printf("HDR detected ! -> sampleFormat = %d (16-bit)\n", sampleFormat);
#endif
}
else if (bitspersample == 24) {
sampleFormat = IIOSF_FLOAT24;
isHDR = true;
#if PRINT_HDR_PS_DETECTION
printf("HDR detected ! -> sampleFormat = %d (24-bit)\n", sampleFormat);
#endif
}
else if (bitspersample == 32) {
sampleFormat = IIOSF_FLOAT32;
isHDR = true;
#if PRINT_HDR_PS_DETECTION
printf("HDR detected ! -> sampleFormat = %d (32-bit)\n", sampleFormat);
#endif
}
}
} else if (photometric == PHOTOMETRIC_CFA) {
if (sampleformat == SAMPLEFORMAT_IEEEFP) {
sampleFormat = IIOSF_FLOAT;
isHDR = true;
if (bitspersample == 16) {
sampleFormat = IIOSF_FLOAT16;
isHDR = true;
#if PRINT_HDR_PS_DETECTION
printf("HDR detected ! -> sampleFormat = %d\n", sampleFormat);
printf("HDR detected ! -> sampleFormat = %d (16-bit)\n", sampleFormat);
#endif
}
else if (bitspersample == 24) {
sampleFormat = IIOSF_FLOAT24;
isHDR = true;
#if PRINT_HDR_PS_DETECTION
printf("HDR detected ! -> sampleFormat = %d (24-bit)\n", sampleFormat);
#endif
}
else if (bitspersample == 32) {
sampleFormat = IIOSF_FLOAT32;
isHDR = true;
#if PRINT_HDR_PS_DETECTION
printf("HDR detected ! -> sampleFormat = %d (32-bit)\n", sampleFormat);
#endif
}
} else if (sampleformat == SAMPLEFORMAT_INT || sampleformat == SAMPLEFORMAT_UINT) {
if (bitspersample == 8) { // shouldn't occur...
sampleFormat = IIOSF_UNSIGNED_CHAR;
@@ -589,7 +612,7 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
}
} else if (photometric == 34892 || photometric == 32892 /* Linear RAW (see DNG spec ; 32892 seem to be a flaw from Sony's ARQ files) */) {
if (sampleformat == SAMPLEFORMAT_IEEEFP) {
sampleFormat = IIOSF_FLOAT;
sampleFormat = IIOSF_FLOAT32;
isHDR = true;
#if PRINT_HDR_PS_DETECTION
printf("HDR detected ! -> sampleFormat = %d\n", sampleFormat);

View File

@@ -51,8 +51,13 @@ void Imagefloat::setScanline (int row, unsigned char* buffer, int bps, unsigned
return;
}
// The DNG decoder convert to 32 bits float data even if the file contains 16 or 24 bits data.
// DNG_HalfToFloat and DNG_FP24ToFloat from dcraw.cc can be used to manually convert
// from 16 and 24 bits to 32 bits float respectively
switch (sampleFormat) {
case (IIOSF_FLOAT): {
case (IIOSF_FLOAT16):
case (IIOSF_FLOAT24):
case (IIOSF_FLOAT32): {
int ix = 0;
float* sbuffer = (float*) buffer;

View File

@@ -32,7 +32,9 @@ typedef enum IIO_Sample_Format {
//IIOSF_HALF , // OpenEXR & NVidia's Half Float, not yet supported
IIOSF_LOGLUV24 = 1 << 2,
IIOSF_LOGLUV32 = 1 << 3,
IIOSF_FLOAT = 1 << 4
IIOSF_FLOAT16 = 1 << 4,
IIOSF_FLOAT24 = 1 << 5,
IIOSF_FLOAT32 = 1 << 6
} IIOSampleFormat;
typedef enum IIO_Sample_Arrangement {

View File

@@ -705,15 +705,16 @@ int ImageIO::getTIFFSampleFormat (Glib::ustring fname, IIOSampleFormat &sFormat,
return IMIO_SUCCESS;
}
} else if (samplesperpixel == 3 && sampleformat == SAMPLEFORMAT_IEEEFP) {
/*
* Not yet supported
*
if (bitspersample==16) {
sFormat = IIOSF_HALF;
if (bitspersample==16) {
sFormat = IIOSF_FLOAT16;
return IMIO_SUCCESS;
}*/
}
if (bitspersample == 24) {
sFormat = IIOSF_FLOAT24;
return IMIO_SUCCESS;
}
if (bitspersample == 32) {
sFormat = IIOSF_FLOAT;
sFormat = IIOSF_FLOAT32;
return IMIO_SUCCESS;
}
}

View File

@@ -128,7 +128,9 @@ int StdImageSource::load (const Glib::ustring &fname)
case (IIOSF_LOGLUV24):
case (IIOSF_LOGLUV32):
case (IIOSF_FLOAT): {
case (IIOSF_FLOAT16):
case (IIOSF_FLOAT24):
case (IIOSF_FLOAT32): {
img = new Imagefloat;
break;
}
@@ -224,7 +226,7 @@ void StdImageSource::colorSpaceConversion (Imagefloat* im, const ColorManagement
if (embedded) {
in = embedded;
} else {
if (sampleFormat & (IIOSF_LOGLUV24 | IIOSF_LOGLUV32 | IIOSF_FLOAT)) {
if (sampleFormat & (IIOSF_LOGLUV24 | IIOSF_LOGLUV32 | IIOSF_FLOAT16 | IIOSF_FLOAT24 | IIOSF_FLOAT32)) {
skipTransform = true;
} else {
in = ICCStore::getInstance()->getsRGBProfile ();
@@ -237,7 +239,7 @@ void StdImageSource::colorSpaceConversion (Imagefloat* im, const ColorManagement
if (in == nullptr && embedded) {
in = embedded;
} else if (in == nullptr) {
if (sampleFormat & (IIOSF_LOGLUV24 | IIOSF_LOGLUV32 | IIOSF_FLOAT)) {
if (sampleFormat & (IIOSF_LOGLUV24 | IIOSF_LOGLUV32 | IIOSF_FLOAT16 | IIOSF_FLOAT24 | IIOSF_FLOAT32)) {
skipTransform = true;
} else {
in = ICCStore::getInstance()->getsRGBProfile ();