~ubuntu-branches/ubuntu/vivid/rtfilter/vivid

« back to all changes in this revision

Viewing changes to src/filter-complex-double.c

  • Committer: Package Import Robot
  • Author(s): Nicolas Bourdaud
  • Date: 2011-12-01 12:09:30 UTC
  • Revision ID: package-import@ubuntu.com-20111201120930-lmia8ytlwmif9yta
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (C) 2010-2011 Nicolas Bourdaud <nicolas.bourdaud@epfl.ch>
 
3
 
 
4
    This file is part of the rtfilter library
 
5
 
 
6
    The rtfilter library is free software: you can redistribute it and/or
 
7
    modify it under the terms of the version 3 of the GNU Lesser General
 
8
    Public License as published by the Free Software Foundation.
 
9
  
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
    GNU Lesser General Public License for more details.
 
14
    
 
15
    You should have received a copy of the GNU Lesser General Public License
 
16
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
*/
 
18
#if HAVE_CONFIG_H
 
19
# include <config.h>
 
20
#endif
 
21
 
 
22
#include <string.h>
 
23
#include <stdlib.h>
 
24
#include <math.h>
 
25
#include <complex.h>
 
26
#include <stdint.h>
 
27
#include "rtfilter.h"
 
28
#include "filter-internal.h"
 
29
#include "filter-funcs.h"
 
30
#include "probesimd.h"
 
31
 
 
32
 
 
33
/**************************************************************************
 
34
 *                     Complex double precision version                   *
 
35
 *                            ( complex double )                          *
 
36
 **************************************************************************/
 
37
#define TYPEIN                          cdouble
 
38
#define TYPEOUT                         cdouble
 
39
#define add_dat(d1,d2)                  ((d1)+(d2))
 
40
#define mul_in_dat(d1,d2,part)          ((d1)*(d2))
 
41
#define mul_dat(d1,d2)                  ((d1)*(d2))
 
42
#define zero_dat()                      (0)
 
43
#define set1_dat(data)                  (data)
 
44
#define TYPEIN_LOCAL                    TYPEIN
 
45
#define TYPEOUT_LOCAL                   TYPEOUT
 
46
#define FILTER_DATADEP_FUNC             filter_cd_noop
 
47
#include "filter-func-template.c"
 
48
 
 
49
static HOTSPOT
 
50
unsigned int filtfunc(hfilter filt, const void* x, void* y, unsigned int ns)
 
51
{
 
52
#if SUPPORT_SSE3_SET
 
53
        if ( !(((uintptr_t)x) % (2*sizeof(double)))
 
54
          && !(((uintptr_t)y) % (2*sizeof(double))) )
 
55
                filter_cd_sse3(filt, x, y, ns);
 
56
        else 
 
57
#endif //SUPPORT_SSE3_SET
 
58
        filter_cd_noop(filt, x, y, ns);
 
59
        return ns;
 
60
}
 
61
 
 
62
 
 
63
LOCAL_FN
 
64
void set_filterfn_cd(struct rtf_filter* filt)
 
65
{       
 
66
        filt->filter_fn = filtfunc;
 
67
        filt->dispatch_code = cputest_sse3() ? 1 : 0;
 
68
}
 
69