~ubuntu-branches/ubuntu/utopic/rtfilter/utopic

« back to all changes in this revision

Viewing changes to src/filter-inreal-outcomplex-single.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 output real input single precision version            *
 
35
 *                      ( complex float out float in)                     *
 
36
 **************************************************************************/
 
37
#define TYPEIN                          float
 
38
#define TYPEOUT                         cfloat
 
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_fcf_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 ( (filt->dispatch_code == 1)
 
54
          && !(((uintptr_t)x) % (4*sizeof(float)))
 
55
          && !(((uintptr_t)y) % (4*sizeof(float))) )
 
56
                filter_fcf_sse3(filt, x, y, ns);
 
57
        else 
 
58
#endif //SUPPORT_SSE3_SET
 
59
        filter_fcf_noop(filt, x, y, ns);
 
60
        return ns;
 
61
}
 
62
 
 
63
 
 
64
LOCAL_FN
 
65
void set_filterfn_fcf(struct rtf_filter* filt)
 
66
{
 
67
        filt->filter_fn = filtfunc;
 
68
 
 
69
#if SUPPORT_SSE3_SET
 
70
        // Check that sample can be aligned on 16 byte boundaries
 
71
        if (cputest_sse3() && !(filt->num_chann%4))
 
72
                filt->dispatch_code = 1;
 
73
#endif //SUPPORT_SSE3_SET
 
74
}
 
75