summaryrefslogtreecommitdiffstats
path: root/tksao/frame
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-03-14 20:15:34 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-03-14 20:15:34 (GMT)
commitc571963e83bbc75781b1885b0ef7ca6860ea4fa7 (patch)
treeb343920aedc8771a8627297647f82066e77efcba /tksao/frame
parentf11ec933aa77ef7b53e584b4878438cd30a73bc4 (diff)
downloadblt-c571963e83bbc75781b1885b0ef7ca6860ea4fa7.zip
blt-c571963e83bbc75781b1885b0ef7ca6860ea4fa7.tar.gz
blt-c571963e83bbc75781b1885b0ef7ca6860ea4fa7.tar.bz2
thread contour
Diffstat (limited to 'tksao/frame')
-rw-r--r--tksao/frame/fitsanalysis.C43
1 files changed, 8 insertions, 35 deletions
diff --git a/tksao/frame/fitsanalysis.C b/tksao/frame/fitsanalysis.C
index eb823b4..cad6cb7 100644
--- a/tksao/frame/fitsanalysis.C
+++ b/tksao/frame/fitsanalysis.C
@@ -9,8 +9,6 @@
#include "context.h"
#include "convolve.h"
-static void* convolve(void* tt);
-
void FitsImage::analysis(int which, pthread_t* thread, t_smooth_arg* targ)
{
if (DebugPerf)
@@ -51,6 +49,13 @@ void FitsImage::analysis(int which, pthread_t* thread, t_smooth_arg* targ)
data_ = analysisdata_;
}
+void* convolveThread(void* vv)
+{
+ t_smooth_arg* tt = (t_smooth_arg*)vv;
+ convolve(tt->kernel, tt->src, tt->dest, tt->width, tt->height, tt->k);
+ return NULL;
+}
+
void FitsImage::smooth(pthread_t* thread, t_smooth_arg* targ)
{
int rr = context_->smoothRadius();
@@ -101,40 +106,8 @@ void FitsImage::smooth(pthread_t* thread, t_smooth_arg* targ)
targ->height = hh;
targ->k = rr;
- int result = pthread_create(thread, NULL, convolve, targ);
+ int result = pthread_create(thread, NULL, convolveThread, targ);
if (result)
internalError("Unable to Create Thread");
}
-void* convolve(void* tt)
-{
- t_smooth_arg* targ = (t_smooth_arg*)tt;
- double* kernel = targ->kernel;
- double* src = targ->src;
- double* dest = targ->dest;
- int width = targ->width;
- int height = targ->height;
- int k = targ->k;
-
- int kk = 2*k+1;
-
- double* dptr = dest;
- for (int jj=0; jj<height; jj++) {
- for (int ii=0; ii<width; ii++, dptr++) {
-
- for (int nn=jj-k, qq=0; nn<=jj+k; nn++, qq++) {
- if (nn>=0 && nn<height) {
- register int nd = nn*width;
- register int qd = qq*kk;
- for (int mm=ii-k, pp=0; mm<=ii+k; mm++, pp++) {
- if (mm>=0 && mm<width)
- *dptr += src[nd+mm]*kernel[qd+pp];
- }
- }
- }
- }
- }
-
- return NULL;
-}
-