1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/liboil/src/dct/dct12_f32.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,240 @@
1.4 +/*
1.5 + * LIBOIL - Library of Optimized Inner Loops
1.6 + * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
1.7 + * All rights reserved.
1.8 + *
1.9 + * Redistribution and use in source and binary forms, with or without
1.10 + * modification, are permitted provided that the following conditions
1.11 + * are met:
1.12 + * 1. Redistributions of source code must retain the above copyright
1.13 + * notice, this list of conditions and the following disclaimer.
1.14 + * 2. Redistributions in binary form must reproduce the above copyright
1.15 + * notice, this list of conditions and the following disclaimer in the
1.16 + * documentation and/or other materials provided with the distribution.
1.17 + *
1.18 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1.19 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1.20 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.21 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
1.22 + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1.23 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1.24 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.25 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1.26 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
1.27 + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1.28 + * POSSIBILITY OF SUCH DAMAGE.
1.29 + */
1.30 +//Portions Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.31 +
1.32 +#ifdef HAVE_CONFIG_H
1.33 +#include "config.h"
1.34 +#endif
1.35 +
1.36 +#include <liboil/liboilfunction.h>
1.37 +#include "liboil/dct/dct.h"
1.38 +#include <math.h>
1.39 +
1.40 +
1.41 +/**
1.42 + * oil_mdct12_f64:
1.43 + * @d_6:
1.44 + * @s_12:
1.45 + *
1.46 + * Performs a Modified Discrete Cosine Transform (MDCT)
1.47 + * on the source array @s_12 and places the result in @d_6.
1.48 + */
1.49 +OIL_DEFINE_CLASS (mdct12_f64, "double *d_6, double *s_12");
1.50 +/**
1.51 + * oil_imdct12_f64:
1.52 + * @d_12:
1.53 + * @s_6:
1.54 + *
1.55 + * Performs a Inverse Modified Discrete Cosine Transform (IMDCT)
1.56 + * on the source array @s_6 and places the result in @d_12.
1.57 + */
1.58 +OIL_DEFINE_CLASS (imdct12_f64, "double *d_12, double *s_6");
1.59 +/**
1.60 + * oil_mdct36_f64:
1.61 + * @d_18:
1.62 + * @s_36:
1.63 + *
1.64 + * Performs a Modified Discrete Cosine Transform (MDCT)
1.65 + * on the source array @s_36 and places the result in @d_18.
1.66 + */
1.67 +OIL_DEFINE_CLASS (mdct36_f64, "double *d_18, double *s_36");
1.68 +/**
1.69 + * oil_imdct36_f64:
1.70 + * @d_36:
1.71 + * @s_18:
1.72 + *
1.73 + * Performs a Inverse Modified Discrete Cosine Transform (IMDCT)
1.74 + * on the source array @s_18 and places the result in @d_36.
1.75 + */
1.76 +OIL_DEFINE_CLASS (imdct36_f64, "double *d_36, double *s_18");
1.77 +
1.78 +static void
1.79 +mdct12_f64_ref(double *dest, const double *src)
1.80 +{
1.81 + int j, k;
1.82 + double x;
1.83 + int N = 6;
1.84 +
1.85 + for(j=0;j<N;j++){
1.86 + x = 0;
1.87 + for(k=0;k<2*N;k++){
1.88 + x += src[k] * cos (M_PI/N * (j+0.5) * (k + 0.5 * (N+1)));
1.89 + }
1.90 + dest[j] = x;
1.91 + }
1.92 +}
1.93 +OIL_DEFINE_IMPL_REF (mdct12_f64_ref, mdct12_f64);
1.94 +
1.95 +
1.96 +static void
1.97 +imdct12_f64_ref(double *dest, const double *src)
1.98 +{
1.99 + int j,k;
1.100 + double x;
1.101 + int N = 6;
1.102 +
1.103 + for(k=0;k<2*N;k++){
1.104 + x = 0;
1.105 + for(j=0;j<N;j++){
1.106 + x += src[j] * cos (M_PI/N * (j+0.5) * (k+0.5*(N + 1)));
1.107 + }
1.108 + dest[k] = x;
1.109 + }
1.110 +}
1.111 +OIL_DEFINE_IMPL_REF (imdct12_f64_ref, imdct12_f64);
1.112 +
1.113 +static void
1.114 +mdct36_f64_ref(double *dest, const double *src)
1.115 +{
1.116 + int j, k;
1.117 + double x;
1.118 + int N = 18;
1.119 +
1.120 + for(j=0;j<N;j++){
1.121 + x = 0;
1.122 + for(k=0;k<2*N;k++){
1.123 + x += src[k] * cos (M_PI/N * (j+0.5) * (k + 0.5 * (N+1)));
1.124 + }
1.125 + dest[j] = x;
1.126 + }
1.127 +}
1.128 +OIL_DEFINE_IMPL_REF (mdct36_f64_ref, mdct36_f64);
1.129 +
1.130 +
1.131 +static void
1.132 +imdct36_f64_ref(double *dest, const double *src)
1.133 +{
1.134 + int j,k;
1.135 + double x;
1.136 + int N = 18;
1.137 +
1.138 + for(k=0;k<2*N;k++){
1.139 + x = 0;
1.140 + for(j=0;j<N;j++){
1.141 + x += src[j] * cos (M_PI/N * (j+0.5) * (k+0.5*(N + 1)));
1.142 + }
1.143 + dest[k] = x;
1.144 + }
1.145 +}
1.146 +OIL_DEFINE_IMPL_REF (imdct36_f64_ref, imdct36_f64);
1.147 +
1.148 +
1.149 +
1.150 +
1.151 +
1.152 +#ifdef __SYMBIAN32__
1.153 +
1.154 +OilFunctionClass* __oil_function_class_mdct12_f64() {
1.155 + return &_oil_function_class_mdct12_f64;
1.156 +}
1.157 +#endif
1.158 +
1.159 +#ifdef __SYMBIAN32__
1.160 +
1.161 +OilFunctionClass* __oil_function_class_imdct12_f64() {
1.162 + return &_oil_function_class_imdct12_f64;
1.163 +}
1.164 +#endif
1.165 +
1.166 +#ifdef __SYMBIAN32__
1.167 +
1.168 +OilFunctionClass* __oil_function_class_mdct36_f64() {
1.169 + return &_oil_function_class_mdct36_f64;
1.170 +}
1.171 +#endif
1.172 +
1.173 +#ifdef __SYMBIAN32__
1.174 +
1.175 +OilFunctionClass* __oil_function_class_imdct36_f64() {
1.176 + return &_oil_function_class_imdct36_f64;
1.177 +}
1.178 +#endif
1.179 +
1.180 +
1.181 +
1.182 +#ifdef __SYMBIAN32__
1.183 +
1.184 +OilFunctionImpl* __oil_function_impl_mdct12_f64_ref() {
1.185 + return &_oil_function_impl_mdct12_f64_ref;
1.186 +}
1.187 +#endif
1.188 +
1.189 +#ifdef __SYMBIAN32__
1.190 +
1.191 +OilFunctionImpl* __oil_function_impl_imdct12_f64_ref() {
1.192 + return &_oil_function_impl_imdct12_f64_ref;
1.193 +}
1.194 +#endif
1.195 +
1.196 +#ifdef __SYMBIAN32__
1.197 +
1.198 +OilFunctionImpl* __oil_function_impl_mdct36_f64_ref() {
1.199 + return &_oil_function_impl_mdct36_f64_ref;
1.200 +}
1.201 +#endif
1.202 +
1.203 +#ifdef __SYMBIAN32__
1.204 +
1.205 +OilFunctionImpl* __oil_function_impl_imdct36_f64_ref() {
1.206 + return &_oil_function_impl_imdct36_f64_ref;
1.207 +}
1.208 +#endif
1.209 +
1.210 +
1.211 +
1.212 +#ifdef __SYMBIAN32__
1.213 +
1.214 +EXPORT_C void** _oil_function_class_ptr_mdct12_f64 () {
1.215 + oil_function_class_ptr_mdct12_f64 = __oil_function_class_mdct12_f64();
1.216 + return &oil_function_class_ptr_mdct12_f64->func;
1.217 + }
1.218 +#endif
1.219 +
1.220 +#ifdef __SYMBIAN32__
1.221 +
1.222 +EXPORT_C void** _oil_function_class_ptr_imdct12_f64 () {
1.223 + oil_function_class_ptr_imdct12_f64 = __oil_function_class_imdct12_f64();
1.224 + return &oil_function_class_ptr_imdct12_f64->func;
1.225 + }
1.226 +#endif
1.227 +
1.228 +#ifdef __SYMBIAN32__
1.229 +
1.230 +EXPORT_C void** _oil_function_class_ptr_mdct36_f64 () {
1.231 + oil_function_class_ptr_mdct36_f64 = __oil_function_class_mdct36_f64();
1.232 + return &oil_function_class_ptr_mdct36_f64->func;
1.233 + }
1.234 +#endif
1.235 +
1.236 +#ifdef __SYMBIAN32__
1.237 +
1.238 +EXPORT_C void** _oil_function_class_ptr_imdct36_f64 () {
1.239 + oil_function_class_ptr_imdct36_f64 = __oil_function_class_imdct36_f64();
1.240 + return &oil_function_class_ptr_imdct36_f64->func;
1.241 + }
1.242 +#endif
1.243 +