Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/include/Diderot/diderot.h
ViewVC logotype

Diff of /branches/pure-cfg/src/include/Diderot/diderot.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 440, Wed Oct 20 03:20:16 2010 UTC revision 441, Wed Oct 20 19:21:32 2010 UTC
# Line 1  Line 1 
1  /*! \file diderot.h  /*! \file diderot.h
2   *   *
3   * \author John Reppy   * \author John Reppy
4     *
5     * This is the interface to the Diderot runtime for the C target.  For now,
6     * we are targetting single-precision computations.
7   */   */
8    
9  /*  /*
# Line 20  Line 23 
23  typedef enum { DIDEROT_OK = 0, DIDEROT_FAIL = -1 } Status_t;  typedef enum { DIDEROT_OK = 0, DIDEROT_FAIL = -1 } Status_t;
24    
25  /* SSE vector types */  /* SSE vector types */
26    typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
27  typedef float float4 __attribute__ ((__vector_size__ (16)));  typedef float float4 __attribute__ ((__vector_size__ (16)));
28  typedef double double2 __attribute__ ((__vector_size__ (16)));  //typedef double double2 __attribute__ ((__vector_size__ (16)));
29    
30  /* union types for converting extracting vector data */  /* union types for converting extracting vector data */
31  typedef union {  typedef union {
# Line 72  Line 76 
76  extern Status_t Diderot_InputVec3 (const char *, Diderot_vec3_t *v);  extern Status_t Diderot_InputVec3 (const char *, Diderot_vec3_t *v);
77    
78  /* inline vector arithmetic functions */  /* inline vector arithmetic functions */
79  STATIC_INLINE void Diderot_ScaleV3 (Diderot_vec3_t dstV, Diderot_real_t s, Diderot_vec3_t v)  STATIC_INLINE float4 Diderot_Vec3 (Diderot_real_t a, Diderot_real_t b, Diderot_real_t c)
80  {  {
81        return __extension__ (float4){ a, b, c, 0.0f };
82    }
83    
84    STATIC_INLINE float4 Diderot_Vec4 (Diderot_real_t a, Diderot_real_t b, Diderot_real_t c, Diderot_real_t d)
85    {
86        return __extension__ (float4){ a, b, c, d };
87    }
88    
89    STATIC_INLINE float4 Diderot_ScaleV3 (float4 dstV, Diderot_real_t s, float4 v)
90    {
91        return Diderot_Vec3(s, s, s) * v;
92    }
93    
94    STATIC_INLINE float4 Diderot_AddV3 (float4 a, float4 b)
95    {
96        return a + b;
97  }  }
98    
99  STATIC_INLINE void Diderot_CopyV3 (&pos, &(glob->pos))  STATIC_INLINE float4 Diderot_MulV3 (float4 a, float4 b)
100  {  {
101        return a + b;
102  }  }
103    
104  STATIC_INLINE void Diderot_AddV3 (&pos, &pos, &_t)  // check if pos is inside the img, assuming that we have a border of width s.
105    //
106    STATIC_INLINE bool Diderot_Inside3D (Diderot_vec3_t pos, Diderot_image3D_t *img, int s)
107  {  {
108    // NOTE: there might be a vectorized way to do this compare!
109        return ((s <= pos.f[0]) && (pos.f[0] < (img->size[0] - s))
110            &&  (s <= pos.f[1]) && (pos.f[1] < (img->size[1] - s))
111            &&  (s <= pos.f[2]) && (pos.f[2] < (img->size[2] - s)));
112  }  }
113    
114  #endif /* !_DIDEROT_H_ */  #endif /* !_DIDEROT_H_ */

Legend:
Removed from v.440  
changed lines
  Added in v.441

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0