summaryrefslogtreecommitdiff
path: root/trunk/jcsample.c
diff options
context:
space:
mode:
authorossman_ <ossman_@3789f03b-4d11-0410-bbf8-ca57d06f2519>2009-03-09 13:15:56 +0000
committerossman_ <ossman_@3789f03b-4d11-0410-bbf8-ca57d06f2519>2009-03-09 13:15:56 +0000
commitcf212133545c94fc1b0d2ea3c42e2b95e2273804 (patch)
tree457ff0fccf073930f5cbcc4481f6824839530dd0 /trunk/jcsample.c
parent6acb0825a1004f4f4123093bf3234956e998735c (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/jcsample.c')
-rw-r--r--trunk/jcsample.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/trunk/jcsample.c b/trunk/jcsample.c
index 212ec87..eea376f 100644
--- a/trunk/jcsample.c
+++ b/trunk/jcsample.c
@@ -2,6 +2,7 @@
* jcsample.c
*
* Copyright (C) 1991-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.
*
@@ -48,6 +49,7 @@
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
+#include "jsimd.h"
/* Pointer to routine to downsample a single component */
@@ -494,7 +496,10 @@ jinit_downsampler (j_compress_ptr cinfo)
} else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
compptr->v_samp_factor == cinfo->max_v_samp_factor) {
smoothok = FALSE;
- downsample->methods[ci] = h2v1_downsample;
+ if (jsimd_can_h2v1_downsample())
+ downsample->methods[ci] = jsimd_h2v1_downsample;
+ else
+ downsample->methods[ci] = h2v1_downsample;
} else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {
#ifdef INPUT_SMOOTHING_SUPPORTED
@@ -503,7 +508,10 @@ jinit_downsampler (j_compress_ptr cinfo)
downsample->pub.need_context_rows = TRUE;
} else
#endif
- downsample->methods[ci] = h2v2_downsample;
+ if (jsimd_can_h2v2_downsample())
+ downsample->methods[ci] = jsimd_h2v2_downsample;
+ else
+ downsample->methods[ci] = h2v2_downsample;
} else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
(cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {
smoothok = FALSE;