SVN commit 530066 by cgilles:
digikam from trunk : reverse RAW file generator source code about thumbnail rotation. I suspect a problem in this code witch broke CR2 file thumbs and don't rotate properly thumbs (certainly some camera tags orientation flags without respect TIFF/EP spec). Alternative solutions for the future : 1 / using future libopenraw library from freedesktop.org (http://www.freedesktop.org/wiki/Software_2flibopenraw) 2 / using Exiv2 thumbs extractor when TIFF/EP will be finalized (my prefered way (:=))) CCMAIL: [hidden email] M +1 -25 kioslave/digikamthumbnail.cpp M +1 -17 libs/dcraw/dcraw_parse.cpp M +1 -6 libs/dcraw/dcraw_parse.h M +1 -25 utilities/cameragui/umscamera.cpp --- trunk/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp #530065:530066 @@ -623,39 +623,15 @@ KTempFile thumbFile(QString::null, "rawthumb"); thumbFile.setAutoDelete(true); Digikam::DcrawParse rawFileParser; - int orientation = 0; if (thumbFile.status() == 0) { if (rawFileParser.getThumbnail(QFile::encodeName(path), - QFile::encodeName(thumbFile.name()), - &orientation) == 0) + QFile::encodeName(thumbFile.name())) == 0) { image.load(thumbFile.name()); if (!image.isNull()) - { - if(orientation) - { - QWMatrix M; - QWMatrix flip = QWMatrix(-1, 0, 0, 1, 0, 0); - - switch(orientation+1) - { // notice intentional fallthroughs - case 2: M = flip; break; - case 4: M = flip; - case 3: M.rotate(180); break; - case 5: M = flip; - case 6: M.rotate(90); break; - case 7: M = flip; - case 8: M.rotate(270); break; - default: break; // should never happen - } - - image = image.xForm(M); - } - return true; - } } } --- trunk/extragear/graphics/digikam/libs/dcraw/dcraw_parse.cpp #530065:530066 @@ -56,7 +56,6 @@ DcrawParse::DcrawParse() { order = 0; - flip = 0; } DcrawParse::~DcrawParse() @@ -402,9 +401,6 @@ case 0x111: /* StripOffset */ if (!offset || is_dng) offset = val; break; - case 0x112: /* Orientation */ - flip = flip_map[(val-1) & 7]; // From KFile-Plugins:parse.c to get thumb orientation. - break; case 0x117: /* StripByteCounts */ if (!length || is_dng) length = val; if (offset > val && !strncmp(make,"KODAK",5) && !is_dng) @@ -1210,7 +1206,7 @@ Get embedded thumbnail in RAW file. Return nonzero if the file cannot be decoded. */ -int DcrawParse::getThumbnail(const char* infile, const char* outfile, int* orientation) +int DcrawParse::getThumbnail(const char* infile, const char* outfile) { char head[32], *thumb, *rgb, *cp; unsigned hlen, fsize, toff, tlen, lsize, i; @@ -1318,18 +1314,6 @@ free (thumb); done: fclose (tfp); - - // From KFile-Plugins:parse.c to get thumb orientation. - - /* Coffin's code has different meaning for orientation - values than TIFF, so we map them to TIFF values */ - switch ((flip+3600) % 360) { - case 270: flip = 5; break; - case 180: flip = 3; break; - case 90: flip = 6; - } - if( orientation ) *orientation = flip_map[flip%7]; - return 0; } --- trunk/extragear/graphics/digikam/libs/dcraw/dcraw_parse.h #530065:530066 @@ -28,17 +28,14 @@ namespace Digikam { -static const int flip_map[] = { 0,1,3,2,4,7,5,6 }; - class DIGIKAM_EXPORT DcrawParse { - public: DcrawParse(); ~DcrawParse(); - int getThumbnail(const char* infile, const char* outfile, int* orientation); + int getThumbnail(const char* infile, const char* outfile); int getCameraModel(const char* infile, char* cameraConstructor, char* cameraModel); private: @@ -60,8 +57,6 @@ int width, height, offset, length, bps, is_dng; int thumb_offset, thumb_length, thumb_layers; - int flip; // From KFile-Plugins:parse.c to get thumb orientation. - private: ushort sget2 (uchar *s); --- trunk/extragear/graphics/digikam/utilities/cameragui/umscamera.cpp #530065:530066 @@ -194,39 +194,15 @@ KTempFile thumbFile(QString::null, "camerarawthumb"); thumbFile.setAutoDelete(true); DcrawParse rawFileParser; - int orientation = 0; if (thumbFile.status() == 0) { if (rawFileParser.getThumbnail(QFile::encodeName(folder + "/" + itemName), - QFile::encodeName(thumbFile.name()), - &orientation) == 0) + QFile::encodeName(thumbFile.name())) == 0) { thumbnail.load(thumbFile.name()); if (!thumbnail.isNull()) - { - if(orientation) - { - QWMatrix M; - QWMatrix flip = QWMatrix(-1, 0, 0, 1, 0, 0); - - switch(orientation+1) - { // notice intentional fallthroughs - case 2: M = flip; break; - case 4: M = flip; - case 3: M.rotate(180); break; - case 5: M = flip; - case 6: M.rotate(90); break; - case 7: M = flip; - case 8: M.rotate(270); break; - default: break; // should never happen - } - - thumbnail = thumbnail.xForm(M); - } - return true; - } } } _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |