]> granicus.if.org Git - libjpeg-turbo/commitdiff
Fix build on Windows
authorDRC <dcommander@users.sourceforge.net>
Tue, 24 May 2011 17:03:51 +0000 (17:03 +0000)
committerDRC <dcommander@users.sourceforge.net>
Tue, 24 May 2011 17:03:51 +0000 (17:03 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@636 632fc199-4ca6-4c93-a231-07263d6284db

CMakeLists.txt
bmp.c
jpegut.c
tjutil.c

index c8cd0904304770ddb319f127ab285cb39af6b7e4..2634c420bd9026a74f0fcfb2e433bfaa25e76b5b 100644 (file)
@@ -193,17 +193,23 @@ if(WITH_SIMD)
   add_dependencies(turbojpeg-static simd)
 endif()
 
-add_executable(jpegut jpegut.c)
+add_executable(jpegut jpegut.c tjutil.c)
 target_link_libraries(jpegut turbojpeg)
 
-add_executable(jpegut-static jpegut.c)
+add_executable(jpegut-static jpegut.c tjutil.c)
 target_link_libraries(jpegut-static turbojpeg-static)
 
-add_executable(jpgtest jpgtest.c bmp.c)
-target_link_libraries(jpgtest turbojpeg)
+add_executable(jpgtest jpgtest.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c
+  wrppm.c)
+target_link_libraries(jpgtest turbojpeg jpeg)
+set_property(TARGET jpgtest PROPERTY COMPILE_FLAGS
+  "-DBMP_SUPPORTED -DPPM_SUPPORTED")
 
-add_executable(jpgtest-static jpgtest.c bmp.c)
-target_link_libraries(jpgtest-static turbojpeg-static)
+add_executable(jpgtest-static jpgtest.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c
+  wrppm.c)
+target_link_libraries(jpgtest-static turbojpeg-static jpeg-static)
+set_property(TARGET jpgtest-static PROPERTY COMPILE_FLAGS
+  "-DBMP_SUPPORTED -DPPM_SUPPORTED")
 
 add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c
   rdtarga.c)
@@ -243,6 +249,7 @@ add_test(TJUnitTest-bi ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.li
 add_test(TJUnitTest-bi-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv)
 endif()
 add_test(jpegut jpegut)
+add_test(jpegut-alloc jpegut -alloc)
 add_test(jpegut-yuv jpegut -yuv)
 add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
 add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
@@ -302,6 +309,7 @@ add_test(jpegtran-crop sharedlib/jpegtran -crop 120x90+20+50 -transpose -perfect
 add_test(jpegtran-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg)
 
 add_test(jpegut-static jpegut-static)
+add_test(jpegut-static-alloc jpegut-static -alloc)
 add_test(jpegut-static-yuv jpegut-static -yuv)
 add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
 add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
diff --git a/bmp.c b/bmp.c
index 01353c72ff670901194e89ef59b6af80baa76260..5d4c58ff578ce34bc25fcb4391ddb73a59457723 100644 (file)
--- a/bmp.c
+++ b/bmp.c
@@ -33,6 +33,7 @@
 #include <jpeglib.h>
 #include <jpegint.h>
 #include "cdjpeg.h"
+#include "tjutil.h"
 #include "bmp.h"
 
 
index 115d0cb198f77a6e98e6c1a4c0a8d21342952a8f..c7a6611a73023337771ff98315d95ba5c58fb675 100644 (file)
--- a/jpegut.c
+++ b/jpegut.c
@@ -174,11 +174,12 @@ int checkBuf(unsigned char *buf, int w, int h, int pf, int subsamp,
        {
                for(col=0; col<w; col++)
                {
+                       unsigned char r, g, b;
                        if(flags&TJFLAG_BOTTOMUP) index=(h-row-1)*w+col;
                        else index=row*w+col;
-                       unsigned char r=buf[index*ps+roffset];
-                       unsigned char g=buf[index*ps+goffset];
-                       unsigned char b=buf[index*ps+boffset];
+                       r=buf[index*ps+roffset];
+                       g=buf[index*ps+goffset];
+                       b=buf[index*ps+boffset];
                        if(((row/blocksize)+(col/blocksize))%2==0)
                        {
                                if(row<halfway)
@@ -452,7 +453,7 @@ void _decompTest(tjhandle handle, unsigned char *jpegBuf,
        if(yuv==YUVDECODE)
        {
                if(checkBufYUV(dstBuf, w, h, subsamp)) printf("Passed.");
-               printf("FAILED!");
+               else printf("FAILED!");
        }
        else
        {
index 5e22feefec48df048d023e8fc6c84b53549a7d32..6618d158cf72965886fca304b337a068aa339e83 100644 (file)
--- a/tjutil.c
+++ b/tjutil.c
@@ -37,11 +37,12 @@ static double getfreq(void)
        return (double)freq.QuadPart;
 }
 
-static double f=getfreq();
+static double f=-1.0;
 
 double gettime(void)
 {
        LARGE_INTEGER t;
+       if(f<0.0) f=getfreq();
        if(f==0.0) return (double)GetTickCount()/1000.;
        else
        {