aboutsummaryrefslogtreecommitdiff
path: root/jddctmgr.c
diff options
context:
space:
mode:
authorossman_ <ossman_@632fc199-4ca6-4c93-a231-07263d6284db>2009-03-09 13:15:56 +0000
committerossman_ <ossman_@632fc199-4ca6-4c93-a231-07263d6284db>2009-03-09 13:15:56 +0000
commit0c228e147dda7909cc905e5742737ac4121b5af5 (patch)
treeb3161bf8ffded04581c050b7670544eeed3c1c7b /jddctmgr.c
parent93736b192df8f7ab045602aad46617fa43ee8d00 (diff)
Framework for supporting SIMD acceleration
Designed to impose minimal changes on the "normal" code. git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@14 632fc199-4ca6-4c93-a231-07263d6284db
Diffstat (limited to 'jddctmgr.c')
-rw-r--r--jddctmgr.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/jddctmgr.c b/jddctmgr.c
index bbf8d0e..52f5090 100644
--- a/jddctmgr.c
+++ b/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