From 0d5c091f69645ffce81f565cb596d8e3fb4a3f8f Mon Sep 17 00:00:00 2001 From: Guido Ranzuglia granzuglia Date: Fri, 27 Apr 2012 13:14:44 +0000 Subject: [PATCH] - updated all the pros adding an EXTERNAL_BASE_PATH variable and a common pri with the lib destination folder --- src/external/OpenCTM-1.0.3/openctm.pro | 11 +- src/external/bzip2-1.0.5/bzip2-1.0.5.pro | 15 +- src/external/ext_common.pri | 8 + src/external/jhead-2.95/jhead-2.95.pro | 33 +- src/external/jhead-2.95/jpgfile.c | 1496 +++++++++---------- src/external/levmar-2.3/levmar-2.3.pro | 10 +- src/external/lib3ds-1.3.0/lib3ds/lib3ds.pro | 12 +- src/external/muparser_v132/src/src.pro | 10 +- 8 files changed, 778 insertions(+), 817 deletions(-) create mode 100644 src/external/ext_common.pri diff --git a/src/external/OpenCTM-1.0.3/openctm.pro b/src/external/OpenCTM-1.0.3/openctm.pro index e268201b5..e6737986b 100644 --- a/src/external/OpenCTM-1.0.3/openctm.pro +++ b/src/external/OpenCTM-1.0.3/openctm.pro @@ -1,3 +1,5 @@ +EXTERNAL_BASE_PATH = ../ +include($$EXTERNAL_BASE_PATH/ext_common.pri) TEMPLATE = lib TARGET = openctm CONFIG += staticlib @@ -6,6 +8,7 @@ INCLUDEPATH += ./lib ./lib/liblzma win32-msvc2005:QMAKE_CXXFLAGS += /nologo /Ox /W3 /c /DOPENCTM_STATIC /D_CRT_SECURE_NO_WARNINGS win32-msvc2008:QMAKE_CXXFLAGS += /nologo /Ox /W3 /c /DOPENCTM_STATIC /D_CRT_SECURE_NO_WARNINGS +win32-msvc2010:QMAKE_CXXFLAGS += /nologo /Ox /W3 /c /DOPENCTM_STATIC /D_CRT_SECURE_NO_WARNINGS win32-g++:QMAKE_CXXFLAGS += -O3 -W -Wall -c -std=c99 -pedantic win32-g++:DEFINES += OPENCTM_STATIC linux-g++:QMAKE_CXXFLAGS += -O3 -W -Wall -c -std=c99 -pedantic @@ -15,14 +18,6 @@ linux-g++-32:DEFINES += OPENCTM_STATIC linux-g++-64:QMAKE_CXXFLAGS += -O3 -W -Wall -c -std=c99 -pedantic linux-g++-64:DEFINES += OPENCTM_STATIC -macx:DESTDIR += ../lib/macx -win32-g++:DESTDIR += ../lib/win32-gcc -win32-msvc2005:DESTDIR += ../lib/win32-msvc2005 -win32-msvc2008:DESTDIR += ../lib/win32-msvc2008 -linux-g++:DESTDIR += ../lib/linux-g++ -linux-g++-32:DESTDIR += ../lib/linux-g++-32 -linux-g++-64:DESTDIR += ../lib/linux-g++-64 - # Input SOURCES += ./lib/openctm.c \ ./lib/stream.c \ diff --git a/src/external/bzip2-1.0.5/bzip2-1.0.5.pro b/src/external/bzip2-1.0.5/bzip2-1.0.5.pro index 854ebc1d3..3996b6390 100644 --- a/src/external/bzip2-1.0.5/bzip2-1.0.5.pro +++ b/src/external/bzip2-1.0.5/bzip2-1.0.5.pro @@ -1,25 +1,14 @@ ###################################################################### # Automatically generated by qmake (2.01a) Wed Mar 4 01:10:02 2009 ###################################################################### - +EXTERNAL_BASE_PATH = ../ +include($$EXTERNAL_BASE_PATH/ext_common.pri) TEMPLATE = lib TARGET = bz2 CONFIG += staticlib DEPENDPATH += . INCLUDEPATH += . - -macx:DESTDIR = ../lib/macx -win32-g++:DESTDIR = ../lib/win32-gcc -win32-msvc2005:DESTDIR = ../lib/win32-msvc2005 -win32-msvc2008:DESTDIR = ../lib/win32-msvc2008 -linux-g++:DESTDIR = ../lib/linux-g++ -linux-g++-32:DESTDIR = ../lib/linux-g++-32 -linux-g++-64:DESTDIR = ../lib/linux-g++-64 - - - - # Input HEADERS += bzlib.h bzlib_private.h SOURCES += blocksort.c \ diff --git a/src/external/ext_common.pri b/src/external/ext_common.pri new file mode 100644 index 000000000..8795b82c1 --- /dev/null +++ b/src/external/ext_common.pri @@ -0,0 +1,8 @@ +macx:DESTDIR = $$EXTERNAL_BASE_PATH/lib/macx +win32-g++:DESTDIR = $$EXTERNAL_BASE_PATH/lib/win32-gcc +win32-msvc2005:DESTDIR = $$EXTERNAL_BASE_PATH/lib/win32-msvc2005 +win32-msvc2008:DESTDIR = $$EXTERNAL_BASE_PATH/lib/win32-msvc2008 +win32-msvc2010:DESTDIR = $$EXTERNAL_BASE_PATH/lib/win32-msvc2010 +linux-g++:DESTDIR = $$EXTERNAL_BASE_PATH/lib/linux-g++ +linux-g++-32:DESTDIR = $$EXTERNAL_BASE_PATH/lib/linux-g++-32 +linux-g++-64:DESTDIR = $$EXTERNAL_BASE_PATH/lib/linux-g++-64 \ No newline at end of file diff --git a/src/external/jhead-2.95/jhead-2.95.pro b/src/external/jhead-2.95/jhead-2.95.pro index aeadbc068..34f8546d2 100755 --- a/src/external/jhead-2.95/jhead-2.95.pro +++ b/src/external/jhead-2.95/jhead-2.95.pro @@ -1,30 +1,19 @@ +EXTERNAL_BASE_PATH = ../ +include($$EXTERNAL_BASE_PATH/ext_common.pri) TEMPLATE = lib TARGET = jhead CONFIG += staticlib DEPENDPATH += . INCLUDEPATH += . - -macx:DESTDIR = ../lib/macx -macx32:DESTDIR = ../lib/macx32 -macx64:DESTDIR = ../lib/macx64 -win32-g++:DESTDIR = ../lib/win32-gcc -win32-msvc2005:DESTDIR = ../lib/win32-msvc2005 -win32-msvc2008:DESTDIR = ../lib/win32-msvc2008 -linux-g++:DESTDIR = ../lib/linux-g++ -linux-g++-32:DESTDIR = ../lib/linux-g++-32 -linux-g++-64:DESTDIR = ../lib/linux-g++-64 - - - - # Input HEADERS += jhead.h -win32:SOURCES += myglob.c -SOURCES += jpgfile.c \ - jhead.c \ - paths.c \ - exif.c \ - iptc.c \ - gpsinfo.c \ - makernote.c + +SOURCES += jpgfile.c \ + jhead.c \ + myglob.c \ + paths.c \ + exif.c \ + iptc.c \ + gpsinfo.c \ + makernote.c diff --git a/src/external/jhead-2.95/jpgfile.c b/src/external/jhead-2.95/jpgfile.c index 2e5db9bed..2877d6776 100644 --- a/src/external/jhead-2.95/jpgfile.c +++ b/src/external/jhead-2.95/jpgfile.c @@ -1,749 +1,749 @@ -//-------------------------------------------------------------------------- -// Program to pull the information out of various types of EXIF digital -// camera files and show it in a reasonably consistent way -// -// This module handles basic Jpeg file handling -// -// Matthias Wandel -//-------------------------------------------------------------------------- -#include "jhead.h" - -// Storage for simplified info extracted from file. -ImageInfo_t ImageInfo; - - -static Section_t * Sections = NULL; -static int SectionsAllocated; -static int SectionsRead; -static int HaveAll; - - - -#define PSEUDO_IMAGE_MARKER 0x123; // Extra value. -//-------------------------------------------------------------------------- -// Get 16 bits motorola order (always) for jpeg header stuff. -//-------------------------------------------------------------------------- -static int Get16m(const void * Short) -{ - return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1]; -} - - -//-------------------------------------------------------------------------- -// Process a COM marker. -// We want to print out the marker contents as legible text; -// we must guard against random junk and varying newline representations. -//-------------------------------------------------------------------------- -static void process_COM (const uchar * Data, int length) -{ - int ch; - char Comment[MAX_COMMENT_SIZE+1]; - int nch; - int a; - - nch = 0; - - if (length > MAX_COMMENT_SIZE) length = MAX_COMMENT_SIZE; // Truncate if it won't fit in our structure. - - for (a=2;a= 32 || ch == '\n' || ch == '\t'){ - Comment[nch++] = (char)ch; - }else{ - Comment[nch++] = '?'; - } - } - - Comment[nch] = '\0'; // Null terminate - - if (ShowTags){ - printf("COM marker comment: %s\n",Comment); - } - - strcpy(ImageInfo.Comments,Comment); - ImageInfo.CommentWidthchars = 0; -} - - -//-------------------------------------------------------------------------- -// Process a SOFn marker. This is useful for the image dimensions -//-------------------------------------------------------------------------- -static void process_SOFn (const uchar * Data, int marker) -{ - int data_precision, num_components; - - data_precision = Data[2]; - ImageInfo.Height = Get16m(Data+3); - ImageInfo.Width = Get16m(Data+5); - num_components = Data[7]; - - if (num_components == 3){ - ImageInfo.IsColor = 1; - }else{ - ImageInfo.IsColor = 0; - } - - ImageInfo.Process = marker; - - if (ShowTags){ - printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n", - ImageInfo.Width, ImageInfo.Height, num_components, data_precision); - } -} - - -//-------------------------------------------------------------------------- -// Check sections array to see if it needs to be increased in size. -//-------------------------------------------------------------------------- -void CheckSectionsAllocated(void) -{ - if (SectionsRead > SectionsAllocated){ - ErrFatal("allocation screwup"); - } - if (SectionsRead >= SectionsAllocated){ - SectionsAllocated += SectionsAllocated/2; - Sections = (Section_t *)realloc(Sections, sizeof(Section_t)*SectionsAllocated); - if (Sections == NULL){ - ErrFatal("could not allocate data for entire image"); - } - } -} - - -//-------------------------------------------------------------------------- -// Parse the marker stream until SOS or EOI is seen; -//-------------------------------------------------------------------------- -int ReadJpegSections (FILE * infile, ReadMode_t ReadMode) -{ - int a; - int HaveCom = FALSE; - - a = fgetc(infile); - - if (a != 0xff || fgetc(infile) != M_SOI){ - return FALSE; - } - - ImageInfo.JfifHeader.XDensity = ImageInfo.JfifHeader.YDensity = 300; - ImageInfo.JfifHeader.ResolutionUnits = 1; - - for(;;){ - int itemlen; - int prev; - int marker = 0; - int ll,lh, got; - uchar * Data; - - CheckSectionsAllocated(); - - prev = 0; - for (a=0;;a++){ - marker = fgetc(infile); - if (marker != 0xff && prev == 0xff) break; - prev = marker; - } - - if (a > 10){ - ErrNonfatal("Extraneous %d padding bytes before section %02X",a-1,marker); - } - - Sections[SectionsRead].Type = marker; - - // Read the length of the section. - lh = fgetc(infile); - ll = fgetc(infile); - - itemlen = (lh << 8) | ll; - - if (itemlen < 2){ - ErrFatal("invalid marker"); - } - - Sections[SectionsRead].Size = itemlen; - - Data = (uchar *)malloc(itemlen); - if (Data == NULL){ - ErrFatal("Could not allocate memory"); - } - Sections[SectionsRead].Data = Data; - - // Store first two pre-read bytes. - Data[0] = (uchar)lh; - Data[1] = (uchar)ll; - - got = fread(Data+2, 1, itemlen-2, infile); // Read the whole section. - if (got != itemlen-2){ - ErrFatal("Premature end of file?"); - } - SectionsRead += 1; - - switch(marker){ - - case M_SOS: // stop before hitting compressed data - // If reading entire image is requested, read the rest of the data. - if (ReadMode & READ_IMAGE){ - int cp, ep, size; - // Determine how much file is left. - cp = ftell(infile); - fseek(infile, 0, SEEK_END); - ep = ftell(infile); - fseek(infile, cp, SEEK_SET); - - size = ep-cp; - Data = (uchar *)malloc(size); - if (Data == NULL){ - ErrFatal("could not allocate data for entire image"); - } - - got = fread(Data, 1, size, infile); - if (got != size){ - ErrFatal("could not read the rest of the image"); - } - - CheckSectionsAllocated(); - Sections[SectionsRead].Data = Data; - Sections[SectionsRead].Size = size; - Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER; - SectionsRead ++; - HaveAll = 1; - } - return TRUE; - - case M_EOI: // in case it's a tables-only JPEG stream - fprintf(stderr,"No image in jpeg!\n"); - return FALSE; - - case M_COM: // Comment section - if (HaveCom || ((ReadMode & READ_METADATA) == 0)){ - // Discard this section. - free(Sections[--SectionsRead].Data); - }else{ - process_COM(Data, itemlen); - HaveCom = TRUE; - } - break; - - case M_JFIF: - // Regular jpegs always have this tag, exif images have the exif - // marker instead, althogh ACDsee will write images with both markers. - // this program will re-create this marker on absence of exif marker. - // hence no need to keep the copy from the file. - if (memcmp(Data+2, "JFIF\0",5)){ - fprintf(stderr,"Header missing JFIF marker\n"); - } - if (itemlen < 16){ - fprintf(stderr,"Jfif header too short\n"); - goto ignore; - } - - ImageInfo.JfifHeader.Present = TRUE; - ImageInfo.JfifHeader.ResolutionUnits = Data[9]; - ImageInfo.JfifHeader.XDensity = (Data[10]<<8) | Data[11]; - ImageInfo.JfifHeader.YDensity = (Data[12]<<8) | Data[13]; - if (ShowTags){ - printf("JFIF SOI marker: Units: %d ",ImageInfo.JfifHeader.ResolutionUnits); - switch(ImageInfo.JfifHeader.ResolutionUnits){ - case 0: printf("(aspect ratio)"); break; - case 1: printf("(dots per inch)"); break; - case 2: printf("(dots per cm)"); break; - default: printf("(unknown)"); break; - } - printf(" X-density=%d Y-density=%d\n",ImageInfo.JfifHeader.XDensity, ImageInfo.JfifHeader.YDensity); - - if (Data[14] || Data[15]){ - fprintf(stderr,"Ignoring jfif header thumbnail\n"); - } - } - - ignore: - - free(Sections[--SectionsRead].Data); - break; - - case M_EXIF: - // There can be different section using the same marker. - if (ReadMode & READ_METADATA){ - if (memcmp(Data+2, "Exif", 4) == 0){ - process_EXIF(Data, itemlen); - break; - }else if (memcmp(Data+2, "http:", 5) == 0){ - Sections[SectionsRead-1].Type = M_XMP; // Change tag for internal purposes. - if (ShowTags){ - printf("Image cotains XMP section, %d bytes long\n", itemlen); - if (ShowTags){ - ShowXmp(Sections[SectionsRead-1]); - } - } - break; - } - } - // Oterwise, discard this section. - free(Sections[--SectionsRead].Data); - break; - - case M_IPTC: - if (ReadMode & READ_METADATA){ - if (ShowTags){ - printf("Image cotains IPTC section, %d bytes long\n", itemlen); - } - // Note: We just store the IPTC section. Its relatively straightforward - // and we don't act on any part of it, so just display it at parse time. - }else{ - free(Sections[--SectionsRead].Data); - } - break; - - case M_SOF0: - case M_SOF1: - case M_SOF2: - case M_SOF3: - case M_SOF5: - case M_SOF6: - case M_SOF7: - case M_SOF9: - case M_SOF10: - case M_SOF11: - case M_SOF13: - case M_SOF14: - case M_SOF15: - process_SOFn(Data, marker); - break; - default: - // Skip any other sections. - if (ShowTags){ - printf("Jpeg section marker 0x%02x size %d\n",marker, itemlen); - } - break; - } - } - return TRUE; -} - -//-------------------------------------------------------------------------- -// Discard read data. -//-------------------------------------------------------------------------- -void DiscardData(void) -{ - int a; - - for (a=0;aData+ImageInfo.ThumbnailOffset+8; - - fwrite(ThumbnailPointer, ImageInfo.ThumbnailSize ,1, ThumbnailFile); - fclose(ThumbnailFile); - return TRUE; - }else{ - ErrFatal("Could not write thumbnail file"); - return FALSE; - } -} - -//-------------------------------------------------------------------------- -// Replace or remove exif thumbnail -//-------------------------------------------------------------------------- -int ReplaceThumbnail(const char * ThumbFileName) -{ - FILE * ThumbnailFile; - int ThumbLen, NewExifSize; - Section_t * ExifSection; - uchar * ThumbnailPointer; - - if (ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailAtEnd == FALSE){ - if (ThumbFileName == NULL){ - // Delete of nonexistent thumbnail (not even pointers present) - // No action, no error. - return FALSE; - } - - // Adding or removing of thumbnail is not possible - that would require rearranging - // of the exif header, which is risky, and jhad doesn't know how to do. - fprintf(stderr,"Image contains no thumbnail to replace - add is not possible\n"); - return FALSE; - } - - if (ThumbFileName){ - ThumbnailFile = fopen(ThumbFileName,"rb"); - - if (ThumbnailFile == NULL){ - ErrFatal("Could not read thumbnail file"); - return FALSE; - } - - // get length - fseek(ThumbnailFile, 0, SEEK_END); - - ThumbLen = ftell(ThumbnailFile); - fseek(ThumbnailFile, 0, SEEK_SET); - - if (ThumbLen + ImageInfo.ThumbnailOffset > 0x10000-20){ - ErrFatal("Thumbnail is too large to insert into exif header"); - } - }else{ - if (ImageInfo.ThumbnailSize == 0){ - return FALSE; - } - +//-------------------------------------------------------------------------- +// Program to pull the information out of various types of EXIF digital +// camera files and show it in a reasonably consistent way +// +// This module handles basic Jpeg file handling +// +// Matthias Wandel +//-------------------------------------------------------------------------- +#include "jhead.h" + +// Storage for simplified info extracted from file. +ImageInfo_t ImageInfo; + + +static Section_t * Sections = NULL; +static int SectionsAllocated; +static int SectionsRead; +static int HaveAll; + + + +#define PSEUDO_IMAGE_MARKER 0x123; // Extra value. +//-------------------------------------------------------------------------- +// Get 16 bits motorola order (always) for jpeg header stuff. +//-------------------------------------------------------------------------- +static int Get16m(const void * Short) +{ + return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1]; +} + + +//-------------------------------------------------------------------------- +// Process a COM marker. +// We want to print out the marker contents as legible text; +// we must guard against random junk and varying newline representations. +//-------------------------------------------------------------------------- +static void process_COM (const uchar * Data, int length) +{ + int ch; + char Comment[MAX_COMMENT_SIZE+1]; + int nch; + int a; + + nch = 0; + + if (length > MAX_COMMENT_SIZE) length = MAX_COMMENT_SIZE; // Truncate if it won't fit in our structure. + + for (a=2;a= 32 || ch == '\n' || ch == '\t'){ + Comment[nch++] = (char)ch; + }else{ + Comment[nch++] = '?'; + } + } + + Comment[nch] = '\0'; // Null terminate + + if (ShowTags){ + printf("COM marker comment: %s\n",Comment); + } + + strcpy(ImageInfo.Comments,Comment); + ImageInfo.CommentWidthchars = 0; +} + + +//-------------------------------------------------------------------------- +// Process a SOFn marker. This is useful for the image dimensions +//-------------------------------------------------------------------------- +static void process_SOFn (const uchar * Data, int marker) +{ + int data_precision, num_components; + + data_precision = Data[2]; + ImageInfo.Height = Get16m(Data+3); + ImageInfo.Width = Get16m(Data+5); + num_components = Data[7]; + + if (num_components == 3){ + ImageInfo.IsColor = 1; + }else{ + ImageInfo.IsColor = 0; + } + + ImageInfo.Process = marker; + + if (ShowTags){ + printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n", + ImageInfo.Width, ImageInfo.Height, num_components, data_precision); + } +} + + +//-------------------------------------------------------------------------- +// Check sections array to see if it needs to be increased in size. +//-------------------------------------------------------------------------- +void CheckSectionsAllocated(void) +{ + if (SectionsRead > SectionsAllocated){ + ErrFatal("allocation screwup"); + } + if (SectionsRead >= SectionsAllocated){ + SectionsAllocated += SectionsAllocated/2; + Sections = (Section_t *)realloc(Sections, sizeof(Section_t)*SectionsAllocated); + if (Sections == NULL){ + ErrFatal("could not allocate data for entire image"); + } + } +} + + +//-------------------------------------------------------------------------- +// Parse the marker stream until SOS or EOI is seen; +//-------------------------------------------------------------------------- +int ReadJpegSections (FILE * infile, ReadMode_t ReadMode) +{ + int a; + int HaveCom = FALSE; + + a = fgetc(infile); + + if (a != 0xff || fgetc(infile) != M_SOI){ + return FALSE; + } + + ImageInfo.JfifHeader.XDensity = ImageInfo.JfifHeader.YDensity = 300; + ImageInfo.JfifHeader.ResolutionUnits = 1; + + for(;;){ + int itemlen; + int prev; + int marker = 0; + int ll,lh, got; + uchar * Data; + + CheckSectionsAllocated(); + + prev = 0; + for (a=0;;a++){ + marker = fgetc(infile); + if (marker != 0xff && prev == 0xff) break; + prev = marker; + } + + if (a > 10){ + ErrNonfatal("Extraneous %d padding bytes before section %02X",a-1,marker); + } + + Sections[SectionsRead].Type = marker; + + // Read the length of the section. + lh = fgetc(infile); + ll = fgetc(infile); + + itemlen = (lh << 8) | ll; + + if (itemlen < 2){ + ErrFatal("invalid marker"); + } + + Sections[SectionsRead].Size = itemlen; + + Data = (uchar *)malloc(itemlen); + if (Data == NULL){ + ErrFatal("Could not allocate memory"); + } + Sections[SectionsRead].Data = Data; + + // Store first two pre-read bytes. + Data[0] = (uchar)lh; + Data[1] = (uchar)ll; + + got = fread(Data+2, 1, itemlen-2, infile); // Read the whole section. + if (got != itemlen-2){ + ErrFatal("Premature end of file?"); + } + SectionsRead += 1; + + switch(marker){ + + case M_SOS: // stop before hitting compressed data + // If reading entire image is requested, read the rest of the data. + if (ReadMode & READ_IMAGE){ + int cp, ep, size; + // Determine how much file is left. + cp = ftell(infile); + fseek(infile, 0, SEEK_END); + ep = ftell(infile); + fseek(infile, cp, SEEK_SET); + + size = ep-cp; + Data = (uchar *)malloc(size); + if (Data == NULL){ + ErrFatal("could not allocate data for entire image"); + } + + got = fread(Data, 1, size, infile); + if (got != size){ + ErrFatal("could not read the rest of the image"); + } + + CheckSectionsAllocated(); + Sections[SectionsRead].Data = Data; + Sections[SectionsRead].Size = size; + Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER; + SectionsRead ++; + HaveAll = 1; + } + return TRUE; + + case M_EOI: // in case it's a tables-only JPEG stream + fprintf(stderr,"No image in jpeg!\n"); + return FALSE; + + case M_COM: // Comment section + if (HaveCom || ((ReadMode & READ_METADATA) == 0)){ + // Discard this section. + free(Sections[--SectionsRead].Data); + }else{ + process_COM(Data, itemlen); + HaveCom = TRUE; + } + break; + + case M_JFIF: + // Regular jpegs always have this tag, exif images have the exif + // marker instead, althogh ACDsee will write images with both markers. + // this program will re-create this marker on absence of exif marker. + // hence no need to keep the copy from the file. + if (memcmp(Data+2, "JFIF\0",5)){ + fprintf(stderr,"Header missing JFIF marker\n"); + } + if (itemlen < 16){ + fprintf(stderr,"Jfif header too short\n"); + goto ignore; + } + + ImageInfo.JfifHeader.Present = TRUE; + ImageInfo.JfifHeader.ResolutionUnits = Data[9]; + ImageInfo.JfifHeader.XDensity = (Data[10]<<8) | Data[11]; + ImageInfo.JfifHeader.YDensity = (Data[12]<<8) | Data[13]; + if (ShowTags){ + printf("JFIF SOI marker: Units: %d ",ImageInfo.JfifHeader.ResolutionUnits); + switch(ImageInfo.JfifHeader.ResolutionUnits){ + case 0: printf("(aspect ratio)"); break; + case 1: printf("(dots per inch)"); break; + case 2: printf("(dots per cm)"); break; + default: printf("(unknown)"); break; + } + printf(" X-density=%d Y-density=%d\n",ImageInfo.JfifHeader.XDensity, ImageInfo.JfifHeader.YDensity); + + if (Data[14] || Data[15]){ + fprintf(stderr,"Ignoring jfif header thumbnail\n"); + } + } + + ignore: + + free(Sections[--SectionsRead].Data); + break; + + case M_EXIF: + // There can be different section using the same marker. + if (ReadMode & READ_METADATA){ + if (memcmp(Data+2, "Exif", 4) == 0){ + process_EXIF(Data, itemlen); + break; + }else if (memcmp(Data+2, "http:", 5) == 0){ + Sections[SectionsRead-1].Type = M_XMP; // Change tag for internal purposes. + if (ShowTags){ + printf("Image cotains XMP section, %d bytes long\n", itemlen); + if (ShowTags){ + ShowXmp(Sections[SectionsRead-1]); + } + } + break; + } + } + // Oterwise, discard this section. + free(Sections[--SectionsRead].Data); + break; + + case M_IPTC: + if (ReadMode & READ_METADATA){ + if (ShowTags){ + printf("Image cotains IPTC section, %d bytes long\n", itemlen); + } + // Note: We just store the IPTC section. Its relatively straightforward + // and we don't act on any part of it, so just display it at parse time. + }else{ + free(Sections[--SectionsRead].Data); + } + break; + + case M_SOF0: + case M_SOF1: + case M_SOF2: + case M_SOF3: + case M_SOF5: + case M_SOF6: + case M_SOF7: + case M_SOF9: + case M_SOF10: + case M_SOF11: + case M_SOF13: + case M_SOF14: + case M_SOF15: + process_SOFn(Data, marker); + break; + default: + // Skip any other sections. + if (ShowTags){ + printf("Jpeg section marker 0x%02x size %d\n",marker, itemlen); + } + break; + } + } + return TRUE; +} + +//-------------------------------------------------------------------------- +// Discard read data. +//-------------------------------------------------------------------------- +void DiscardData(void) +{ + int a; + + for (a=0;aData+ImageInfo.ThumbnailOffset+8; + + fwrite(ThumbnailPointer, ImageInfo.ThumbnailSize ,1, ThumbnailFile); + fclose(ThumbnailFile); + return TRUE; + }else{ + ErrFatal("Could not write thumbnail file"); + return FALSE; + } +} + +//-------------------------------------------------------------------------- +// Replace or remove exif thumbnail +//-------------------------------------------------------------------------- +int ReplaceThumbnail(const char * ThumbFileName) +{ + FILE * ThumbnailFile; + int ThumbLen, NewExifSize; + Section_t * ExifSection; + uchar * ThumbnailPointer; + + if (ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailAtEnd == FALSE){ + if (ThumbFileName == NULL){ + // Delete of nonexistent thumbnail (not even pointers present) + // No action, no error. + return FALSE; + } + + // Adding or removing of thumbnail is not possible - that would require rearranging + // of the exif header, which is risky, and jhad doesn't know how to do. + fprintf(stderr,"Image contains no thumbnail to replace - add is not possible\n"); + return FALSE; + } + + if (ThumbFileName){ + ThumbnailFile = fopen(ThumbFileName,"rb"); + + if (ThumbnailFile == NULL){ + ErrFatal("Could not read thumbnail file"); + return FALSE; + } + + // get length + fseek(ThumbnailFile, 0, SEEK_END); + + ThumbLen = ftell(ThumbnailFile); + fseek(ThumbnailFile, 0, SEEK_SET); + + if (ThumbLen + ImageInfo.ThumbnailOffset > 0x10000-20){ + ErrFatal("Thumbnail is too large to insert into exif header"); + } + }else{ + if (ImageInfo.ThumbnailSize == 0){ + return FALSE; + } + ThumbLen = 0; - ThumbnailFile = NULL; - } - - ExifSection = FindSection(M_EXIF); - - NewExifSize = ImageInfo.ThumbnailOffset+8+ThumbLen; - ExifSection->Data = (uchar *)realloc(ExifSection->Data, NewExifSize); - - ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8; - - if (ThumbnailFile){ - fread(ThumbnailPointer, ThumbLen, 1, ThumbnailFile); - fclose(ThumbnailFile); - } - - ImageInfo.ThumbnailSize = ThumbLen; - - Put32u(ExifSection->Data+ImageInfo.ThumbnailSizeOffset+8, ThumbLen); - - ExifSection->Data[0] = (uchar)(NewExifSize >> 8); - ExifSection->Data[1] = (uchar)NewExifSize; - ExifSection->Size = NewExifSize; - - return TRUE; -} - - -//-------------------------------------------------------------------------- -// Discard everything but the exif and comment sections. -//-------------------------------------------------------------------------- -void DiscardAllButExif(void) -{ - Section_t ExifKeeper; - Section_t CommentKeeper; - Section_t IptcKeeper; - Section_t XmpKeeper; - int a; - - memset(&ExifKeeper, 0, sizeof(ExifKeeper)); - memset(&CommentKeeper, 0, sizeof(CommentKeeper)); - memset(&IptcKeeper, 0, sizeof(IptcKeeper)); - memset(&XmpKeeper, 0, sizeof(IptcKeeper)); - - for (a=0;a> 8); - JfifHead[13] = (uchar)ImageInfo.JfifHeader.XDensity; - JfifHead[14] = (uchar)(ImageInfo.JfifHeader.YDensity >> 8); - JfifHead[15] = (uchar)ImageInfo.JfifHeader.YDensity; - - - fwrite(JfifHead, 18, 1, outfile); - - // use the values from the exif data for the jfif header, if we have found values - if (ImageInfo.ResolutionUnit != 0) { - // JFIF.ResolutionUnit is {1,2}, EXIF.ResolutionUnit is {2,3} - JfifHead[11] = (uchar)ImageInfo.ResolutionUnit - 1; - } - if (ImageInfo.xResolution > 0.0 && ImageInfo.yResolution > 0.0) { - JfifHead[12] = (uchar)((int)ImageInfo.xResolution>>8); - JfifHead[13] = (uchar)((int)ImageInfo.xResolution); - - JfifHead[14] = (uchar)((int)ImageInfo.yResolution>>8); - JfifHead[15] = (uchar)((int)ImageInfo.yResolution); - } - } - - - // Write all the misc sections - for (a=0;aNewIndex;a--){ - Sections[a] = Sections[a-1]; - } - SectionsRead += 1; - - NewSection = Sections+NewIndex; - - NewSection->Type = SectionType; - NewSection->Size = Size; - NewSection->Data = Data; - - return NewSection; -} - - -//-------------------------------------------------------------------------- -// Initialisation. -//-------------------------------------------------------------------------- -void ResetJpgfile(void) -{ - if (Sections == NULL){ - Sections = (Section_t *)malloc(sizeof(Section_t)*5); - SectionsAllocated = 5; - } - - SectionsRead = 0; - HaveAll = 0; -} + ThumbnailFile = NULL; + } + + ExifSection = FindSection(M_EXIF); + + NewExifSize = ImageInfo.ThumbnailOffset+8+ThumbLen; + ExifSection->Data = (uchar *)realloc(ExifSection->Data, NewExifSize); + + ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8; + + if (ThumbnailFile){ + fread(ThumbnailPointer, ThumbLen, 1, ThumbnailFile); + fclose(ThumbnailFile); + } + + ImageInfo.ThumbnailSize = ThumbLen; + + Put32u(ExifSection->Data+ImageInfo.ThumbnailSizeOffset+8, ThumbLen); + + ExifSection->Data[0] = (uchar)(NewExifSize >> 8); + ExifSection->Data[1] = (uchar)NewExifSize; + ExifSection->Size = NewExifSize; + + return TRUE; +} + + +//-------------------------------------------------------------------------- +// Discard everything but the exif and comment sections. +//-------------------------------------------------------------------------- +void DiscardAllButExif(void) +{ + Section_t ExifKeeper; + Section_t CommentKeeper; + Section_t IptcKeeper; + Section_t XmpKeeper; + int a; + + memset(&ExifKeeper, 0, sizeof(ExifKeeper)); + memset(&CommentKeeper, 0, sizeof(CommentKeeper)); + memset(&IptcKeeper, 0, sizeof(IptcKeeper)); + memset(&XmpKeeper, 0, sizeof(IptcKeeper)); + + for (a=0;a> 8); + JfifHead[13] = (uchar)ImageInfo.JfifHeader.XDensity; + JfifHead[14] = (uchar)(ImageInfo.JfifHeader.YDensity >> 8); + JfifHead[15] = (uchar)ImageInfo.JfifHeader.YDensity; + + + fwrite(JfifHead, 18, 1, outfile); + + // use the values from the exif data for the jfif header, if we have found values + if (ImageInfo.ResolutionUnit != 0) { + // JFIF.ResolutionUnit is {1,2}, EXIF.ResolutionUnit is {2,3} + JfifHead[11] = (uchar)ImageInfo.ResolutionUnit - 1; + } + if (ImageInfo.xResolution > 0.0 && ImageInfo.yResolution > 0.0) { + JfifHead[12] = (uchar)((int)ImageInfo.xResolution>>8); + JfifHead[13] = (uchar)((int)ImageInfo.xResolution); + + JfifHead[14] = (uchar)((int)ImageInfo.yResolution>>8); + JfifHead[15] = (uchar)((int)ImageInfo.yResolution); + } + } + + + // Write all the misc sections + for (a=0;aNewIndex;a--){ + Sections[a] = Sections[a-1]; + } + SectionsRead += 1; + + NewSection = Sections+NewIndex; + + NewSection->Type = SectionType; + NewSection->Size = Size; + NewSection->Data = Data; + + return NewSection; +} + + +//-------------------------------------------------------------------------- +// Initialisation. +//-------------------------------------------------------------------------- +void ResetJpgfile(void) +{ + if (Sections == NULL){ + Sections = (Section_t *)malloc(sizeof(Section_t)*5); + SectionsAllocated = 5; + } + + SectionsRead = 0; + HaveAll = 0; +} diff --git a/src/external/levmar-2.3/levmar-2.3.pro b/src/external/levmar-2.3/levmar-2.3.pro index b75adc148..a0032e820 100644 --- a/src/external/levmar-2.3/levmar-2.3.pro +++ b/src/external/levmar-2.3/levmar-2.3.pro @@ -1,17 +1,11 @@ +EXTERNAL_BASE_PATH = ../ +include($$EXTERNAL_BASE_PATH/ext_common.pri) TEMPLATE = lib TARGET = levmar CONFIG += staticlib DEPENDPATH += . INCLUDEPATH += . -macx:DESTDIR = ../lib/macx -win32-g++:DESTDIR = ../lib/win32-gcc -win32-msvc2005:DESTDIR = ../lib/win32-msvc2005 -win32-msvc2008:DESTDIR = ../lib/win32-msvc2008 -linux-g++:DESTDIR = ../lib/linux-g++ -linux-g++-32:DESTDIR = ../lib/linux-g++-32 -linux-g++-64:DESTDIR = ../lib/linux-g++-64 - # Input HEADERS += compiler.h \ lm.h\ diff --git a/src/external/lib3ds-1.3.0/lib3ds/lib3ds.pro b/src/external/lib3ds-1.3.0/lib3ds/lib3ds.pro index f60406005..ef7f2baf2 100644 --- a/src/external/lib3ds-1.3.0/lib3ds/lib3ds.pro +++ b/src/external/lib3ds-1.3.0/lib3ds/lib3ds.pro @@ -1,7 +1,8 @@ ###################################################################### # Automatically generated by qmake (2.01a) Mon Feb 9 23:28:06 2009 ###################################################################### - +EXTERNAL_BASE_PATH = ../../ +include($$EXTERNAL_BASE_PATH/ext_common.pri) TEMPLATE = lib TARGET = 3ds CONFIG += staticlib @@ -9,15 +10,6 @@ DEPENDPATH += . INCLUDEPATH += .. -macx:DESTDIR = ../../lib/macx -win32-g++:DESTDIR = ../../lib/win32-gcc -win32-msvc2005:DESTDIR = ../../lib/win32-msvc2005 -win32-msvc2008:DESTDIR = ../../lib/win32-msvc2008 -linux-g++:DESTDIR = ../../lib/linux-g++ -linux-g++-32:DESTDIR = ../../lib/linux-g++-32 -linux-g++-64:DESTDIR = ../../lib/linux-g++-64 - - # Input HEADERS += atmosphere.h \ background.h \ diff --git a/src/external/muparser_v132/src/src.pro b/src/external/muparser_v132/src/src.pro index 2814e75ce..7ad66d600 100644 --- a/src/external/muparser_v132/src/src.pro +++ b/src/external/muparser_v132/src/src.pro @@ -1,20 +1,14 @@ ###################################################################### # Automatically generated by qmake (2.01a) Wed Mar 4 01:57:13 2009 ###################################################################### - +EXTERNAL_BASE_PATH = ../../ +include($$EXTERNAL_BASE_PATH/ext_common.pri) TEMPLATE = lib TARGET = muparser CONFIG += staticlib DEPENDPATH += . INCLUDEPATH += ../include -macx:DESTDIR = ../../lib/macx -win32-g++:DESTDIR = ../../lib/win32-gcc -win32-msvc2005:DESTDIR = ../../lib/win32-msvc2005 -win32-msvc2008:DESTDIR = ../../lib/win32-msvc2008 -linux-g++:DESTDIR = ../../lib/linux-g++ -linux-g++-32:DESTDIR = ../../lib/linux-g++-32 -linux-g++-64:DESTDIR = ../../lib/linux-g++-64 # Input SOURCES += muParser.cpp \