]> granicus.if.org Git - libjpeg-turbo/commitdiff
Make TJ_FORCE* options work correctly
authorDRC <dcommander@users.sourceforge.net>
Mon, 22 Feb 2010 08:34:44 +0000 (08:34 +0000)
committerDRC <dcommander@users.sourceforge.net>
Mon, 22 Feb 2010 08:34:44 +0000 (08:34 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@138 632fc199-4ca6-4c93-a231-07263d6284db

jpgtest.cxx
simd/jsimd_i386.c
turbojpegl.c

index da0ef93fb1b30ee3e2be8c6b8f4b5cbb91119055..b1c5e1a07aa981d686438fe84265efec6d4ff28e 100644 (file)
@@ -322,22 +322,22 @@ int main(int argc, char *argv[])
                        if(!stricmp(argv[i], "-tile")) dotile=1;
                        if(!stricmp(argv[i], "-forcesse3"))
                        {
-                               printf("Using SSE3 code in Intel compressor\n");
+                               printf("Using SSE3 code\n");
                                forcesse3=1;
                        }
                        if(!stricmp(argv[i], "-forcesse2"))
                        {
-                               printf("Using SSE2 code in Intel compressor\n");
+                               printf("Using SSE2 code\n");
                                forcesse2=1;
                        }
                        if(!stricmp(argv[i], "-forcesse"))
                        {
-                               printf("Using SSE code in Intel compressor\n");
+                               printf("Using SSE code\n");
                                forcesse=1;
                        }
                        if(!stricmp(argv[i], "-forcemmx"))
                        {
-                               printf("Using MMX code in Intel compressor\n");
+                               printf("Using MMX code\n");
                                forcemmx=1;
                        }
                        if(!stricmp(argv[i], "-fastupsample"))
index f5aec18b8c57bee22e73ba82c5c7f87654b3b7d1..ed1339b2291296be4d769e0e028118b2b4638fd7 100644 (file)
@@ -48,16 +48,16 @@ init_simd (void)
   /* Force different settings through environment variables */
   env = getenv("JSIMD_FORCEMMX");
   if ((env != NULL) && (strcmp(env, "1") == 0))
-    simd_support &= JSIMD_MMX;
+    simd_support = JSIMD_MMX;
   env = getenv("JSIMD_FORCE3DNOW");
   if ((env != NULL) && (strcmp(env, "1") == 0))
-    simd_support &= JSIMD_3DNOW;
+    simd_support = JSIMD_3DNOW|JSIMD_MMX;
   env = getenv("JSIMD_FORCESSE");
   if ((env != NULL) && (strcmp(env, "1") == 0))
-    simd_support &= JSIMD_SSE;
+    simd_support = JSIMD_SSE|JSIMD_MMX;
   env = getenv("JSIMD_FORCESSE2");
   if ((env != NULL) && (strcmp(env, "1") == 0))
-    simd_support &= JSIMD_SSE2;
+    simd_support = JSIMD_SSE2;
 }
 
 GLOBAL(int)
index 82acf23dc1a490e5e5323b49d5c57ba0a508e2ef..f5f0db117bfc3be7d01d42c024fdd1807f28cb8e 100644 (file)
@@ -149,6 +149,10 @@ DLLEXPORT int DLLCALL tjCompress(tjhandle h,
        #error "TurboJPEG requires JPEG colorspace extensions"
        #endif
 
+       if(flags&TJ_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+       else if(flags&TJ_FORCESSE) putenv("JSIMD_FORCESSE=1");
+       else if(flags&TJ_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+
        if(setjmp(j->jerr.jb))
        {  // this will execute if LIBJPEG has an error
                if(row_pointer) free(row_pointer);
@@ -287,6 +291,10 @@ DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
 
        if(pitch==0) pitch=width*ps;
 
+       if(flags&TJ_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+       else if(flags&TJ_FORCESSE) putenv("JSIMD_FORCESSE=1");
+       else if(flags&TJ_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+
        if(setjmp(j->jerr.jb))
        {  // this will execute if LIBJPEG has an error
                if(row_pointer) free(row_pointer);