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/jdsample.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/jdsample.c')
-rw-r--r-- | trunk/jdsample.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/trunk/jdsample.c b/trunk/jdsample.c index 80ffefb..4e0b8b4 100644 --- a/trunk/jdsample.c +++ b/trunk/jdsample.c @@ -2,6 +2,7 @@ * jdsample.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. * @@ -21,6 +22,7 @@ #define JPEG_INTERNALS #include "jinclude.h" #include "jpeglib.h" +#include "jsimd.h" /* Pointer to routine to upsample a single component */ @@ -447,18 +449,32 @@ jinit_upsampler (j_decompress_ptr cinfo) } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) { /* Special cases for 2h1v upsampling */ - if (do_fancy && compptr->downsampled_width > 2) - upsample->methods[ci] = h2v1_fancy_upsample; - else - upsample->methods[ci] = h2v1_upsample; + if (do_fancy && compptr->downsampled_width > 2) { + if (jsimd_can_h2v1_fancy_upsample()) + upsample->methods[ci] = jsimd_h2v1_fancy_upsample; + else + upsample->methods[ci] = h2v1_fancy_upsample; + } else { + if (jsimd_can_h2v1_upsample()) + upsample->methods[ci] = jsimd_h2v1_upsample; + else + upsample->methods[ci] = h2v1_upsample; + } } else if (h_in_group * 2 == h_out_group && v_in_group * 2 == v_out_group) { /* Special cases for 2h2v upsampling */ if (do_fancy && compptr->downsampled_width > 2) { - upsample->methods[ci] = h2v2_fancy_upsample; + if (jsimd_can_h2v2_fancy_upsample()) + upsample->methods[ci] = jsimd_h2v2_fancy_upsample; + else + upsample->methods[ci] = h2v2_fancy_upsample; upsample->pub.need_context_rows = TRUE; - } else - upsample->methods[ci] = h2v2_upsample; + } else { + if (jsimd_can_h2v2_upsample()) + upsample->methods[ci] = jsimd_h2v2_upsample; + else + upsample->methods[ci] = h2v2_upsample; + } } else if ((h_out_group % h_in_group) == 0 && (v_out_group % v_in_group) == 0) { /* Generic integral-factors upsampling method */ |