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

SCM Repository

[diderot] Annotation of /branches/pure-cfg/src/include/Diderot/inline-image.h
 [diderot] / branches / pure-cfg / src / include / Diderot / inline-image.h

Annotation of /branches/pure-cfg/src/include/Diderot/inline-image.h

Revision 710 - (view) (download) (as text)

 1 : jhr 710 /*! \file inline-image.h 2 : * 3 : * \author John Reppy 4 : */ 5 : 6 : /* 7 : * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu) 8 : * All rights reserved. 9 : */ 10 : 11 : #ifndef _DIDEROT_INLINE_IMAGE_H_ 12 : #define _DIDEROT_INLINE_IMAGE_H_ 13 : 14 : #ifndef _DIDEROT_TYPES_H_ 15 : #include "types.h" 16 : #endif 17 : 18 : // check if pos is inside the img, assuming that we have a border of width s. 19 : // 20 : STATIC_INLINE bool Diderot_Inside2f (vec2f_t posArg, Diderot_image3D_t *img, int s) 21 : { 22 : // NOTE: there might be a vectorized way to do this compare! 23 : // cvtps2pi -- converts vector of floats to vector of int32_t values 24 : 25 : union2f_t pos; 26 : pos.v = posArg; 27 : return ((s-1 < pos.r[0]) && (pos.r[0] < (img->size[0] - s)) 28 : && (s-1 < pos.r[1]) && (pos.r[1] < (img->size[1] - s))); 29 : } 30 : 31 : // check if pos is inside the img, assuming that we have a border of width s. 32 : // 33 : STATIC_INLINE bool Diderot_Inside3f (vec3f_t posArg, Diderot_image3D_t *img, int s) 34 : { 35 : // NOTE: there might be a vectorized way to do this compare! 36 : // cvtps2pi -- converts vector of floats to vector of int32_t values 37 : 38 : union3f_t pos; 39 : pos.v = posArg; 40 : return ((s-1 < pos.r[0]) && (pos.r[0] < (img->size[0] - s)) 41 : && (s-1 < pos.r[1]) && (pos.r[1] < (img->size[1] - s)) 42 : && (s-1 < pos.r[2]) && (pos.r[2] < (img->size[2] - s))); 43 : } 44 : 45 : STATIC_INLINE vec3f_t Diderot_ToImageSpace3f (Diderot_image3D_t *img, vec3f_t posArg) 46 : { 47 : vec4f_t p = __extension__ vec4f( 48 : ((union3f_t)posArg).r[0], 49 : ((union3f_t)posArg).r[1], 50 : ((union3f_t)posArg).r[2], 51 : 1.0f); 52 : 53 : // return vec3f( 54 : // dot4f(vec4f(m->m[0], m->m[1], m->m[2], m->m[3]), p), 55 : // dot4f(vec4f(m->m[4], m->m[5], m->m[6], m->m[7]), p), 56 : // dot4f(vec4f(m->m[8], m->m[9], m->m[10], m->m[11]), p)); 57 : return vec3f( 58 : dot4f(img->mInv[0].v, p), 59 : dot4f(img->mInv[1].v, p), 60 : dot4f(img->mInv[2].v, p)); 61 : } 62 : 63 : 64 : #endif /* !_DIDEROT_INLINE_IMAGE_H_ */

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