diff options
author | ossman_ <ossman_@3789f03b-4d11-0410-bbf8-ca57d06f2519> | 2009-03-09 13:15:56 +0000 |
---|---|---|
committer | ossman_ <ossman_@3789f03b-4d11-0410-bbf8-ca57d06f2519> | 2009-03-09 13:15:56 +0000 |
commit | cf212133545c94fc1b0d2ea3c42e2b95e2273804 (patch) | |
tree | 457ff0fccf073930f5cbcc4481f6824839530dd0 /trunk/jddctmgr.c | |
parent | 6acb0825a1004f4f4123093bf3234956e998735c (diff) |
Framework for supporting SIMD acceleration
Designed to impose minimal changes on the "normal" code.
git-svn-id: https://libjpeg-turbo.svn.sourceforge.net/svnroot/libjpeg-turbo@14 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'trunk/jddctmgr.c')
-rw-r--r-- | trunk/jddctmgr.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/trunk/jddctmgr.c b/trunk/jddctmgr.c index bbf8d0e..52f5090 100644 --- a/trunk/jddctmgr.c +++ b/trunk/jddctmgr.c @@ -2,6 +2,7 @@ * jddctmgr.c * * Copyright (C) 1994-1996, Thomas G. Lane. + * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -19,6 +20,7 @@ #include "jinclude.h" #include "jpeglib.h" #include "jdct.h" /* Private declarations for DCT subsystem */ +#include "jsimddct.h" /* @@ -105,11 +107,17 @@ start_pass (j_decompress_ptr cinfo) method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; case 2: - method_ptr = jpeg_idct_2x2; + if (jsimd_can_idct_2x2()) + method_ptr = jsimd_idct_2x2; + else + method_ptr = jpeg_idct_2x2; method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; case 4: - method_ptr = jpeg_idct_4x4; + if (jsimd_can_idct_4x4()) + method_ptr = jsimd_idct_4x4; + else + method_ptr = jpeg_idct_4x4; method = JDCT_ISLOW; /* jidctred uses islow-style table */ break; #endif @@ -117,19 +125,28 @@ start_pass (j_decompress_ptr cinfo) switch (cinfo->dct_method) { #ifdef DCT_ISLOW_SUPPORTED case JDCT_ISLOW: - method_ptr = jpeg_idct_islow; + if (jsimd_can_idct_islow()) + method_ptr = jsimd_idct_islow; + else + method_ptr = jpeg_idct_islow; method = JDCT_ISLOW; break; #endif #ifdef DCT_IFAST_SUPPORTED case JDCT_IFAST: - method_ptr = jpeg_idct_ifast; + if (jsimd_can_idct_ifast()) + method_ptr = jsimd_idct_ifast; + else + method_ptr = jpeg_idct_ifast; method = JDCT_IFAST; break; #endif #ifdef DCT_FLOAT_SUPPORTED case JDCT_FLOAT: - method_ptr = jpeg_idct_float; + if (jsimd_can_idct_float()) + method_ptr = jsimd_idct_float; + else + method_ptr = jpeg_idct_float; method = JDCT_FLOAT; break; #endif |