~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/vision/improc/im_sin.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #include <math.h>
  2 #include <tina/sys.h>
  3 #include <tina/sysfuncs.h>
  4 #include <tina/math.h>
  5 #include <tina/mathfuncs.h>
  6 #include <tina/vision.h>
  7 #include <tina/visionfuncs.h>
  8 
  9 Imrect *imf_sin(Imrect * im1)
 10 {
 11     Imrect *im2;
 12     Imregion *roi;
 13     float  *row1, *row2;
 14     int     lx, ux, ly, uy;
 15     int     i, j;
 16 
 17     if (im1 == NULL)
 18         return (NULL);
 19 
 20     roi = im1->region;
 21     if (roi == NULL)
 22         return (NULL);
 23     lx = roi->lx;
 24     ux = roi->ux;
 25     ly = roi->ly;
 26     uy = roi->uy;
 27 
 28     im2 = im_alloc(im1->height, im1->width, roi, float_v);
 29     row1 = fvector_alloc(lx, ux);
 30     row2 = fvector_alloc(lx, ux);
 31 
 32     for (i = ly; i < uy; ++i)
 33     {
 34         im_get_rowf(row1, im1, i, lx, ux);
 35         for (j = lx; j < ux; ++j)
 36             row2[j] = (float)sin(row1[j]);
 37         im_put_rowf(row2, im2, i, lx, ux);
 38     }
 39 
 40     fvector_free((void *) row1, lx);
 41     fvector_free((void *) row2, lx);
 42     return (im2);
 43 }
 44 
 45 Imrect *imz_sin(Imrect * im1)
 46 {
 47     Imrect *im2;
 48     Imregion *roi;
 49     Complex *row1;
 50     Complex *row2;
 51     int     lx, ux, ly, uy;
 52     int     i, j;
 53 
 54     if (im1 == NULL)
 55         return (NULL);
 56 
 57     roi = im1->region;
 58     if (roi == NULL)
 59         return (NULL);
 60     lx = roi->lx;
 61     ux = roi->ux;
 62     ly = roi->ly;
 63     uy = roi->uy;
 64 
 65     im2 = im_alloc(im1->height, im1->width, roi, complex_v);
 66     row1 = zvector_alloc(lx, ux);
 67     row2 = zvector_alloc(lx, ux);
 68 
 69     for (i = ly; i < uy; ++i)
 70     {
 71         im_get_rowz(row1, im1, i, lx, ux);
 72         for (j = lx; j < ux; ++j)
 73             row2[j] = cmplx_sin(row1[j]);
 74         im_put_rowz(row2, im2, i, lx, ux);
 75     }
 76 
 77     zvector_free((void *) row1, lx);
 78     zvector_free((void *) row2, lx);
 79     return (im2);
 80 }
 81 
 82 Imrect *im_sin(Imrect * im)
 83 {
 84     switch (im->vtype)
 85     {
 86         case complex_v:
 87         return (imz_sin(im));
 88     default:
 89         return (imf_sin(im));
 90     }
 91 }
 92 
 93 Imrect *imf_asin(Imrect * im1)
 94 {
 95     Imrect *im2;
 96     Imregion *roi;
 97     float  *row1, *row2;
 98     int     lx, ux, ly, uy;
 99     int     i, j;
100 
101     if (im1 == NULL)
102         return (NULL);
103 
104     roi = im1->region;
105     if (roi == NULL)
106         return (NULL);
107     lx = roi->lx;
108     ux = roi->ux;
109     ly = roi->ly;
110     uy = roi->uy;
111 
112     im2 = im_alloc(im1->height, im1->width, roi, float_v);
113     row1 = fvector_alloc(lx, ux);
114     row2 = fvector_alloc(lx, ux);
115 
116     for (i = ly; i < uy; ++i)
117     {
118         im_get_rowf(row1, im1, i, lx, ux);
119         for (j = lx; j < ux; ++j)
120             row2[j] = (float)asin(row1[j]);
121         im_put_rowf(row2, im2, i, lx, ux);
122     }
123 
124     fvector_free((void *) row1, lx);
125     fvector_free((void *) row2, lx);
126     return (im2);
127 }
128 
129 Imrect *imz_asin(Imrect * im1)
130 {
131     Imrect *im2;
132     Imregion *roi;
133     Complex *row1;
134     Complex *row2;
135     int     lx, ux, ly, uy;
136     int     i, j;
137 
138     if (im1 == NULL)
139         return (NULL);
140 
141     roi = im1->region;
142     if (roi == NULL)
143         return (NULL);
144     lx = roi->lx;
145     ux = roi->ux;
146     ly = roi->ly;
147     uy = roi->uy;
148 
149     im2 = im_alloc(im1->height, im1->width, roi, complex_v);
150     row1 = zvector_alloc(lx, ux);
151     row2 = zvector_alloc(lx, ux);
152 
153     for (i = ly; i < uy; ++i)
154     {
155         im_get_rowz(row1, im1, i, lx, ux);
156         for (j = lx; j < ux; ++j)
157             row2[j] = cmplx_asin(row1[j]);
158         im_put_rowz(row2, im2, i, lx, ux);
159     }
160 
161     zvector_free((void *) row1, lx);
162     zvector_free((void *) row2, lx);
163     return (im2);
164 }
165 
166 Imrect *im_asin(Imrect * im)
167 {
168     switch (im->vtype)
169     {
170         case complex_v:
171         return (imz_asin(im));
172     default:
173         return (imf_asin(im));
174     }
175 }
176 
177 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.