Add 3DNow SIMD implementation of computationally intensive routines.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3649 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/jpeg/jsimd.c b/common/jpeg/jsimd.c
index eb1f37b..d8acba5 100644
--- a/common/jpeg/jsimd.c
+++ b/common/jpeg/jsimd.c
@@ -364,6 +364,19 @@
{
init_simd();
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if (sizeof(FAST_FLOAT) != 4)
+ return 0;
+
+ if (simd_support & JSIMD_3DNOW)
+ return 1;
+
return 0;
}
@@ -381,6 +394,10 @@
jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
FAST_FLOAT * workspace)
{
+#ifdef WITH_SIMD
+ if (simd_support & JSIMD_3DNOW)
+ jsimd_convsamp_float_3dnow(sample_data, start_col, workspace);
+#endif
}
GLOBAL(int)
@@ -422,6 +439,15 @@
{
init_simd();
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (sizeof(FAST_FLOAT) != 4)
+ return 0;
+
+ if (simd_support & JSIMD_3DNOW)
+ return 1;
+
return 0;
}
@@ -446,6 +472,10 @@
GLOBAL(void)
jsimd_fdct_float (FAST_FLOAT * data)
{
+#ifdef WITH_SIMD
+ if (simd_support & JSIMD_3DNOW)
+ jsimd_fdct_float_3dnow(data);
+#endif
}
GLOBAL(int)
@@ -472,6 +502,17 @@
{
init_simd();
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (sizeof(JCOEF) != 2)
+ return 0;
+ if (sizeof(FAST_FLOAT) != 4)
+ return 0;
+
+ if (simd_support & JSIMD_3DNOW)
+ return 1;
+
return 0;
}
@@ -489,6 +530,10 @@
jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
FAST_FLOAT * workspace)
{
+#ifdef WITH_SIMD
+ if (simd_support & JSIMD_3DNOW)
+ jsimd_quantize_float_3dnow(coef_block, divisors, workspace);
+#endif
}
GLOBAL(int)
@@ -612,6 +657,22 @@
{
init_simd();
+ if (DCTSIZE != 8)
+ return 0;
+ if (sizeof(JCOEF) != 2)
+ return 0;
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if (sizeof(FAST_FLOAT) != 4)
+ return 0;
+ if (sizeof(FLOAT_MULT_TYPE) != 4)
+ return 0;
+
+ if (simd_support & JSIMD_3DNOW)
+ return 1;
+
return 0;
}
@@ -642,5 +703,10 @@
JCOEFPTR coef_block, JSAMPARRAY output_buf,
JDIMENSION output_col)
{
+#if WITH_SIMD
+ if (simd_support & JSIMD_3DNOW)
+ jsimd_idct_float_3dnow(compptr->dct_table, coef_block,
+ output_buf, output_col);
+#endif
}