Update contrib.
2 * LIBOIL - Library of Optimized Inner Loops
3 * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
27 //Portions Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
33 #include <liboil/liboilfunction.h>
34 #include <liboil/liboilfuncs.h>
35 #include "liboil/dct/dct.h"
46 * Performs a 2-D Forward Discrete Cosine Transform on @s_8x8 and places
47 * the result in @d_8x8.
49 OIL_DEFINE_CLASS(fdct8x8_f64,
50 "double *d_8x8, int dstr, double *s_8x8, int sstr");
54 fdct8x8_f64_ref(double *dest, int dstr, const double *src, int sstr)
56 static double fdct_coeff[8][8];
57 static int fdct_coeff_init = 0;
65 scale = (i==0) ? sqrt(0.125) : 0.5;
67 fdct_coeff[j][i] = scale *
68 cos((M_PI/8)*i*(j+0.5));
80 tmp2 += fdct_coeff[l][j] *
81 OIL_GET (src, sstr*k + l * sizeof(double),
84 tmp1 += fdct_coeff[k][i] * tmp2;
86 OIL_GET (dest, dstr*i + j*sizeof(double), double) =
92 OIL_DEFINE_IMPL_REF (fdct8x8_f64_ref, fdct8x8_f64);
95 fdct8x8_f64_ref2(double *dest, int dstr, const double *src, int sstr)
97 static double fdct_coeff[8][8];
98 static int fdct_coeff_init = 0;
103 if(!fdct_coeff_init){
107 scale = (i==0) ? sqrt(0.125) : 0.5;
109 fdct_coeff[j][i] = scale *
110 cos((M_PI/8)*i*(j+0.5));
120 x += fdct_coeff[k][j] *
121 OIL_GET (src, sstr*i + k * sizeof(double), double);
131 x += fdct_coeff[k][i] * tmp[8*k + j];
133 OIL_GET (dest,dstr*i+j*sizeof(double), double) = x;
138 OIL_DEFINE_IMPL (fdct8x8_f64_ref2, fdct8x8_f64);
142 fdct8x8_f64_1d (double *dest, int dstr, const double *src, int sstr)
148 oil_fdct8_f64(tmp + i*8, OIL_OFFSET(src,sstr*i),
149 sizeof (double), sizeof(double));
153 oil_fdct8_f64(dest + i, tmp + i,
154 dstr, 8*sizeof(double));
157 OIL_DEFINE_IMPL (fdct8x8_f64_1d, fdct8x8_f64);
165 OilFunctionClass* __oil_function_class_fdct8x8_f64() {
166 return &_oil_function_class_fdct8x8_f64;
174 OilFunctionImpl* __oil_function_impl_fdct8x8_f64_ref() {
175 return &_oil_function_impl_fdct8x8_f64_ref;
181 OilFunctionImpl* __oil_function_impl_fdct8x8_f64_ref2() {
182 return &_oil_function_impl_fdct8x8_f64_ref2;
188 OilFunctionImpl* __oil_function_impl_fdct8x8_f64_1d() {
189 return &_oil_function_impl_fdct8x8_f64_1d;
197 EXPORT_C void** _oil_function_class_ptr_fdct8x8_f64 () {
198 oil_function_class_ptr_fdct8x8_f64 = __oil_function_class_fdct8x8_f64();
199 return &oil_function_class_ptr_fdct8x8_f64->func;