/[opencvs]/eyes/half.c
ViewVC logotype

Contents of /eyes/half.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Thu Feb 28 21:26:47 2013 UTC (5 years, 4 months ago) by hib
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
fp_to_txt - allows for level transitions, and also spartain mode
gpu code - now works well, and 60 times faster! yeah for holograms!
half.c - new program to cut a double .fp file in half/half (1 quarter area)
1 #include <stdio.h>
2 #include <malloc.h>
3
4 int main(int argc,char *argv[]) {
5 int xspan = atoi(argv[1]);
6 int yspan = atoi(argv[2]);
7 double *e = (double *)malloc(sizeof(double)*2*yspan*xspan);
8 double *f = (double *)malloc(sizeof(double)*2*yspan*xspan/4);
9 fread(e,sizeof(double)*2*xspan*yspan,1,stdin);
10 int x,y;
11 for (y=0;y<yspan/2;y++) {
12 for (x=0;x<xspan/2;x++) {
13 int index1;
14 int index2;
15 index2 = y*(xspan/2)+x;
16 index1 = (y*2)*(xspan)+(x*2);
17 f[index2*2] =e[index1*2];
18 f[index2*2+1] =e[index1*2+1];
19 }
20 }
21 fwrite(f,sizeof(double)*2*xspan*yspan/4,1,stdout);
22 exit(0);
23 }

  ViewVC Help
Powered by ViewVC 1.1.5