- Timestamp:
- May 3, 2010, 8:45:22 AM (16 years ago)
- Location:
- branches/simmosaic_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/simmosaic_branches
- Property svn:mergeinfo changed
-
branches/simmosaic_branches/Ohana
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/Ohana merged eligible /branches/eam_branches/Ohana.20100407 27635-27772 /branches/pap_delete/Ohana 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/simmosaic_branches/Ohana/src/kapa2/src/Remap16.c
r18324 r27839 1 1 # include "Ximage.h" 2 # define OUT_TYPE unsigned short 2 3 3 4 # define MY_SWAP_BYTE(W) { \ … … 10 11 int i, j, ii, jj; 11 12 int i_start, i_end, j_start, j_end; 12 int dropback; 13 int I_start, J_start; 14 int dropback, inDX, inDY; 13 15 int dx, dy, DX, DY; 14 16 double expand, Ix, Iy; 15 17 int expand_in, expand_out; 16 unsigned short*out_pix, *out_pix2, *data;18 OUT_TYPE *out_pix, *out_pix2, *data; 17 19 unsigned short *in_pix, *in_pix2; 18 unsigned short*pixel, pixvalue;19 unsigned shortback;20 OUT_TYPE *pixel, pixvalue; 21 OUT_TYPE back; 20 22 int swap_client, swap_server, swap_bytes; 21 23 22 ALLOCATE (pixel, unsigned short, graphic[0].Npixels); 24 // just skip if there is no data 25 if (matrix[0].Naxes == 0) return; 26 if (matrix[0].Naxis[0] == 0) return; 27 if (matrix[0].Naxis[1] == 0) return; 28 29 ALLOCATE (pixel, OUT_TYPE, graphic[0].Npixels); 23 30 24 31 # ifdef BYTE_SWAP … … 38 45 back = 0xffff & graphic[0].back; 39 46 if (swap_bytes) MY_SWAP_BYTE (back); 40 // XXX not certain this is the correct solution...41 47 42 48 // set up expansions 49 if (picture[0].expand == -1) picture[0].expand = 1; 43 50 assert ((picture[0].expand >= 1) || (picture[0].expand <= -2)); 44 51 expand = expand_in = expand_out = 1.0; … … 60 67 DY = matrix[0].Naxis[1]; 61 68 62 // x, y are the closest lit screen pixel to 0,0 63 Picture_Lower (&i_start, &j_start, matrix, picture); 69 // i_start, j_start are the closest lit screen pixel to 0,0 70 // I_start, J_start are the image pixel corresponding to i_start, j_start 71 Picture_Lower (&i_start, &j_start, &I_start, &J_start, matrix, picture); 64 72 65 // x, y are the closest lit screen pixel to dx, dy 66 Picture_Upper (&i_end, &j_end, matrix, picture); 73 // i_end, j_end are the closest lit screen pixel to dx, dy 74 // I_end, J_end are the image pixel corresponding to i_end, j_end 75 Picture_Upper (&i_end, &j_end, i_start, j_start, matrix, picture); 67 76 68 // Ix,Iy are the first displayed image pixel 69 Picture_to_Image (&Ix, &Iy, i_start, j_start, picture); 77 assert (i_start <= i_end); 78 assert (j_start <= j_end); 79 80 Ix = picture[0].flipx ? I_start - 1 : I_start; 81 Iy = picture[0].flipy ? J_start - 1 : J_start; 82 83 inDX = picture[0].flipx ? -1 : +1; 84 inDY = picture[0].flipy ? -1 : +1; 70 85 71 86 dropback = expand_out - (i_end - i_start) % expand_out; 72 87 if ((i_end - i_start) % expand_out == 0) dropback = 0; 73 88 74 data = out_pix = (unsigned short*) picture[0].data;89 out_pix = data = (OUT_TYPE *) picture[0].data; 75 90 in_pix = &image[0].pixmap[DX*(int)MAX(Iy,0) + (int)MAX(Ix,0)]; 76 91 … … 82 97 } 83 98 84 for (j = j_start; j < j_end; j+= expand_out, in_pix += expand_in*DX) {99 for (j = j_start; j < j_end; j+= expand_out, in_pix += inDY*expand_in*DX) { 85 100 out_pix = &data[j*dx]; 86 101 … … 97 112 in_pix2 = in_pix; 98 113 if (expand_out == 1) { 99 for (i = i_start; i < i_end; i++, in_pix2 +=expand_in, out_pix++) {114 for (i = i_start; i < i_end; i++, in_pix2 += inDX*expand_in, out_pix++) { 100 115 *out_pix = pixel[*in_pix2]; 101 116 } 102 117 } else { 103 for (i = i_start; i < i_end; i+= expand_out, in_pix2 ++, out_pix+= expand_out) {118 for (i = i_start; i < i_end; i+= expand_out, in_pix2 += inDX, out_pix+= expand_out) { 104 119 pixvalue = pixel[*in_pix2]; 105 120 out_pix2 = out_pix; … … 124 139 /**** fill in top area ****/ 125 140 out_pix = &data[j_end*dx]; 126 for (j = 0; j < (dy - j_end); j++) {141 for (j = 0; j < dy - j_end; j++) { 127 142 for (i = 0; i < dx; i++, out_pix++) { 128 143 *out_pix = back;
Note:
See TracChangeset
for help on using the changeset viewer.
