summaryrefslogtreecommitdiffstats
path: root/common/jpeg/jdsample.c
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2009-03-09 13:15:56 +0000
committerPierre Ossman <ossman@cendio.se>2009-03-09 13:15:56 +0000
commit9ad5234612eb45251f32842b59c2cafcec38e9aa (patch)
treebac49ff9eef925bad900f5be8952c8005188bced /common/jpeg/jdsample.c
parentb85c2f8ae8090c039b40d6f01c004632fbd8be17 (diff)
downloadtigervnc-9ad5234612eb45251f32842b59c2cafcec38e9aa.tar.gz
tigervnc-9ad5234612eb45251f32842b59c2cafcec38e9aa.zip
Framework for supporting SIMD acceleration
Designed to impose minimal changes on the "normal" code. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3645 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/jpeg/jdsample.c')
-rw-r--r--common/jpeg/jdsample.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/common/jpeg/jdsample.c b/common/jpeg/jdsample.c
index 80ffefb2..4e0b8b40 100644
--- a/common/jpeg/jdsample.c
+++ b/common/jpeg/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 */