ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pvalue.c
(Generate patch)

Comparing ray/src/px/pvalue.c (file contents):
Revision 2.11 by greg, Wed Jan 8 08:00:23 1997 UTC vs.
Revision 2.22 by schorsch, Mon Jul 21 22:30:19 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  pvalue.c - program to print pixel values.
6   *
7   *     4/23/86
8   */
9  
10 < #include  "standard.h"
10 > #include  <time.h>
11  
12 + #include  "standard.h"
13 + #include  "platform.h"
14   #include  "color.h"
16
15   #include  "resolu.h"
16  
17   #define  min(a,b)               ((a)<(b)?(a):(b))
# Line 22 | Line 20 | static char SCCSid[] = "$SunId$ LBL";
20   #define  ALL            3
21   #define  BRIGHT         4
22  
25 #define  brightonly     (putprim==BRIGHT)
26
23   RESOLU  picres;                 /* resolution of picture */
24  
25   int  uniq = 0;                  /* print only unique values? */
# Line 43 | Line 39 | int  header = 1;               /* do header? */
39  
40   long  skipbytes = 0;            /* skip bytes in input? */
41  
42 + int  swapbytes = 0;             /* swap bytes in 16-bit words? */
43 +
44 + int  interleave = 1;            /* file is interleaved? */
45 +
46   int  resolution = 1;            /* put/get resolution string? */
47  
48   int  original = 0;              /* convert to original values? */
# Line 63 | Line 63 | FILE  *fin2 = NULL, *fin3 = NULL;      /* for other color c
63  
64   int  (*getval)(), (*putval)();
65  
66 + double
67 + rgb_bright(clr)
68 + COLOR  clr;
69 + {
70 +        return(bright(clr));
71 + }
72  
73 + double
74 + xyz_bright(clr)
75 + COLOR  clr;
76 + {
77 +        return(clr[CIEY]);
78 + }
79 +
80 + double  (*mybright)() = &rgb_bright;
81 +
82 +
83   main(argc, argv)
84   int  argc;
85   char  **argv;
# Line 119 | Line 135 | char  **argv;
135                          case 'r':               /* reverse conversion */
136                                  reverse = argv[i][0] == '-';
137                                  break;
138 +                        case 'n':               /* non-interleaved RGB */
139 +                                interleave = argv[i][0] == '+';
140 +                                break;
141                          case 'b':               /* brightness values */
142                                  putprim = argv[i][0] == '-' ? BRIGHT : ALL;
143                                  break;
# Line 147 | Line 166 | char  **argv;
166                                          format = 'b';
167                                          fmtid = "byte";
168                                          break;
169 +                                case 'W':               /* 16-bit swapped */
170 +                                        swapbytes = 1;
171 +                                case 'w':               /* 16-bit */
172 +                                        dataonly = 1;
173 +                                        format = 'w';
174 +                                        fmtid = "16-bit";
175 +                                        break;
176                                  case 'f':               /* float */
177                                          dataonly = 1;
178                                          format = 'f';
# Line 165 | Line 191 | char  **argv;
191                          case 'X':               /* x resolution */
192                                  resolution = 0;
193                                  if (argv[i][0] == '-')
194 <                                        picres.or |= XDECR;
194 >                                        picres.rt |= XDECR;
195                                  picres.xr = atoi(argv[++i]);
196                                  break;
197                          case 'y':               /* y resolution */
198                          case 'Y':               /* y resolution */
199                                  resolution = 0;
200                                  if (argv[i][0] == '-')
201 <                                        picres.or |= YDECR;
201 >                                        picres.rt |= YDECR;
202                                  if (picres.xr == 0)
203 <                                        picres.or |= YMAJOR;
203 >                                        picres.rt |= YMAJOR;
204                                  picres.yr = atoi(argv[++i]);
205                                  break;
206                          default:
# Line 187 | Line 213 | unkopt:
213                  else
214                          break;
215                                          /* recognize special formats */
216 <        if (dataonly && format == 'b')
217 <                if (brightonly)
216 >        if (dataonly && format == 'b') {
217 >                if (putprim == ALL)
218 >                        fmtid = "24-bit_rgb";
219 >                else
220                          fmtid = "8-bit_grey";
221 +        }
222 +        if (dataonly && format == 'w') {
223 +                if (putprim == ALL)
224 +                        fmtid = "48-bit_rgb";
225                  else
226 <                        fmtid = "24-bit_rgb";
226 >                        fmtid = "16-bit_grey";
227 >        }
228                                          /* assign reverse ordering */
229          rord[ord[0]] = 0;
230          rord[ord[1]] = 1;
# Line 205 | Line 238 | unkopt:
238                                                  progname, argv[i]);
239                          quit(1);
240                  }
241 <                if (skipbytes && fseek(fin, skipbytes, 0))
209 <                        goto seekerr;
210 <                if (reverse && !brightonly && i == argc-3) {
241 >                if (reverse && putprim != BRIGHT && i == argc-3) {
242                          if ((fin2 = fopen(argv[i+1], "r")) == NULL) {
243                                  fprintf(stderr, "%s: can't open file \"%s\"\n",
244                                                  progname, argv[i+1]);
# Line 218 | Line 249 | unkopt:
249                                                  progname, argv[i+2]);
250                                  quit(1);
251                          }
252 <                        if (skipbytes && (fseek(fin2, skipbytes, 0) ||
222 <                                        fseek(fin3, skipbytes, 0)))
223 <                                goto seekerr;
252 >                        interleave = -1;
253                  } else if (i != argc-1)
254                          fin = NULL;
255 +                if (reverse && putprim != BRIGHT && !interleave) {
256 +                        fin2 = fopen(argv[i], "r");
257 +                        fin3 = fopen(argv[i], "r");
258 +                }
259 +                if (skipbytes && (fseek(fin, skipbytes, 0) || (fin2 != NULL &&
260 +                                (fseek(fin2, skipbytes, 0) ||
261 +                                fseek(fin3, skipbytes, 0))))) {
262 +                        fprintf(stderr, "%s: cannot skip %ld bytes on input\n",
263 +                                        progname, skipbytes);
264 +                        quit(1);
265 +                }
266          }
267          if (fin == NULL) {
268                  fprintf(stderr, "%s: bad # file arguments\n", progname);
269                  quit(1);
270          }
271  
232        set_io();
233
272          if (reverse) {
273 < #ifdef MSDOS
274 <                setmode(fileno(stdout), O_BINARY);
273 > #ifdef _WIN32
274 >                SET_FILE_BINARY(stdout);
275                  if (format != 'a' && format != 'i')
276 <                        setmode(fileno(fin), O_BINARY);
276 >                        SET_FILE_BINARY(fin);
277   #endif
278                                          /* get header */
279                  if (header) {
# Line 259 | Line 297 | unkopt:
297                  if (resolution && fin2 != NULL) {
298                          RESOLU  pres2;
299                          if (!fgetsresolu(&pres2, fin2) ||
300 <                                        pres2.or != picres.or ||
300 >                                        pres2.rt != picres.rt ||
301                                          pres2.xr != picres.xr ||
302                                          pres2.yr != picres.yr ||
303                                          !fgetsresolu(&pres2, fin3) ||
304 <                                        pres2.or != picres.or ||
304 >                                        pres2.rt != picres.rt ||
305                                          pres2.xr != picres.xr ||
306                                          pres2.yr != picres.yr) {
307                                  fprintf(stderr, "%s: resolution mismatch\n",
# Line 280 | Line 318 | unkopt:
318                  fputsresolu(&picres, stdout);   /* always put resolution */
319                  valtopix();
320          } else {
321 < #ifdef MSDOS
322 <                setmode(fileno(fin), O_BINARY);
321 > #ifdef _WIN32
322 >                SET_FILE_BINARY(fin);
323                  if (format != 'a' && format != 'i')
324 <                        setmode(fileno(stdout), O_BINARY);
324 >                        SET_FILE_BINARY(stdout);
325   #endif
326                                                  /* get header */
327                  getheader(fin, checkhead, NULL);
328                  if (wrongformat) {
329 <                        fprintf(stderr, "%s: input not a Radiance picture\n",
329 >                        fprintf(stderr,
330 >                                "%s: input not a Radiance RGBE picture\n",
331                                          progname);
332                          quit(1);
333                  }
# Line 309 | Line 348 | unkopt:
348          }
349  
350          quit(0);
312 seekerr:
313        fprintf(stderr, "%s: cannot skip %ld bytes on input\n",
314                        progname, skipbytes);
315        quit(1);
351   }
352  
353  
354 + int
355   checkhead(line)                         /* deal with line from header */
356   char  *line;
357   {
# Line 323 | Line 359 | char  *line;
359          double  d;
360          COLOR   ctmp;
361  
362 <        if (formatval(fmt, line))
363 <                wrongformat = strcmp(fmt, COLRFMT);
364 <        else if (original && isexpos(line)) {
362 >        if (formatval(fmt, line)) {
363 >                if (!strcmp(fmt, CIEFMT)) {
364 >                        mybright = &xyz_bright;
365 >                        if (original) {
366 >                                scalecolor(exposure, 1./WHTEFFICACY);
367 >                                doexposure++;
368 >                        }
369 >                } else if (!strcmp(fmt, COLRFMT))
370 >                        mybright = &rgb_bright;
371 >                else
372 >                        wrongformat++;
373 >        } else if (original && isexpos(line)) {
374                  d = 1.0/exposval(line);
375                  scalecolor(exposure, d);
376                  doexposure++;
# Line 337 | Line 382 | char  *line;
382                  doexposure++;
383          } else if (header)
384                  fputs(line, stdout);
385 +        return(0);
386   }
387  
388  
# Line 345 | Line 391 | pixtoval()                             /* convert picture to values */
391          register COLOR  *scanln;
392          int  dogamma;
393          COLOR  lastc;
394 <        FLOAT  hv[2];
394 >        RREAL  hv[2];
395 >        int  startprim, endprim;
396 >        long  startpos;
397          int  y;
398          register int  x;
399  
# Line 355 | Line 403 | pixtoval()                             /* convert picture to values */
403                  quit(1);
404          }
405          dogamma = gamcor < .95 || gamcor > 1.05;
406 <        setcolor(lastc, 0.0, 0.0, 0.0);
407 <        for (y = 0; y < numscans(&picres); y++) {
408 <                if (freadscan(scanln, scanlen(&picres), fin) < 0) {
409 <                        fprintf(stderr, "%s: read error\n", progname);
406 >        if (putprim == ALL && !interleave) {
407 >                startprim = RED; endprim = BLU;
408 >                startpos = ftell(fin);
409 >        } else {
410 >                startprim = putprim; endprim = putprim;
411 >        }
412 >        for (putprim = startprim; putprim <= endprim; putprim++) {
413 >                if (putprim != startprim && fseek(fin, startpos, 0)) {
414 >                        fprintf(stderr, "%s: seek error on input file\n",
415 >                                        progname);
416                          quit(1);
417                  }
418 <                for (x = 0; x < scanlen(&picres); x++) {
419 <                        if (uniq)
420 <                                if (    colval(scanln[x],RED) ==
421 <                                                colval(lastc,RED) &&
422 <                                        colval(scanln[x],GRN) ==
369 <                                                colval(lastc,GRN) &&
370 <                                        colval(scanln[x],BLU) ==
371 <                                                colval(lastc,BLU)       )
372 <                                        continue;
373 <                                else
374 <                                        copycolor(lastc, scanln[x]);
375 <                        if (doexposure)
376 <                                multcolor(scanln[x], exposure);
377 <                        if (dogamma)
378 <                                setcolor(scanln[x],
379 <                                pow(colval(scanln[x],RED), 1.0/gamcor),
380 <                                pow(colval(scanln[x],GRN), 1.0/gamcor),
381 <                                pow(colval(scanln[x],BLU), 1.0/gamcor));
382 <                        if (!dataonly) {
383 <                                pix2loc(hv, &picres, x, y);
384 <                                printf("%7d %7d ", (int)(hv[0]*picres.xr),
385 <                                                (int)(hv[1]*picres.yr));
386 <                        }
387 <                        if ((*putval)(scanln[x]) < 0) {
388 <                                fprintf(stderr, "%s: write error\n", progname);
418 >                set_io();
419 >                setcolor(lastc, 0.0, 0.0, 0.0);
420 >                for (y = 0; y < numscans(&picres); y++) {
421 >                        if (freadscan(scanln, scanlen(&picres), fin) < 0) {
422 >                                fprintf(stderr, "%s: read error\n", progname);
423                                  quit(1);
424                          }
425 +                        for (x = 0; x < scanlen(&picres); x++) {
426 +                                if (uniq) {
427 +                                        if (    colval(scanln[x],RED) ==
428 +                                                        colval(lastc,RED) &&
429 +                                                colval(scanln[x],GRN) ==
430 +                                                        colval(lastc,GRN) &&
431 +                                                colval(scanln[x],BLU) ==
432 +                                                        colval(lastc,BLU)       )
433 +                                                continue;
434 +                                        else
435 +                                                copycolor(lastc, scanln[x]);
436 +                                }
437 +                                if (doexposure)
438 +                                        multcolor(scanln[x], exposure);
439 +                                if (dogamma)
440 +                                        setcolor(scanln[x],
441 +                                        pow(colval(scanln[x],RED), 1.0/gamcor),
442 +                                        pow(colval(scanln[x],GRN), 1.0/gamcor),
443 +                                        pow(colval(scanln[x],BLU), 1.0/gamcor));
444 +                                if (!dataonly) {
445 +                                        pix2loc(hv, &picres, x, y);
446 +                                        printf("%7d %7d ",
447 +                                                        (int)(hv[0]*picres.xr),
448 +                                                        (int)(hv[1]*picres.yr));
449 +                                }
450 +                                if ((*putval)(scanln[x]) < 0) {
451 +                                        fprintf(stderr, "%s: write error\n",
452 +                                                        progname);
453 +                                        quit(1);
454 +                                }
455 +                        }
456                  }
457          }
458 <        free((char *)scanln);
458 >        free((void *)scanln);
459   }
460  
461  
# Line 407 | Line 472 | valtopix()                     /* convert values to a pixel file */
472                  quit(1);
473          }
474          dogamma = gamcor < .95 || gamcor > 1.05;
475 +        set_io();
476          for (y = 0; y < numscans(&picres); y++) {
477                  for (x = 0; x < scanlen(&picres); x++) {
478                          if (!dataonly) {
# Line 433 | Line 499 | valtopix()                     /* convert values to a pixel file */
499                          quit(1);
500                  }
501          }
502 <        free((char *)scanln);
502 >        free((void *)scanln);
503   }
504  
505  
506 + void
507   quit(code)
508   int  code;
509   {
# Line 444 | Line 511 | int  code;
511   }
512  
513  
514 + swap16(wp, n)           /* swap n 16-bit words */
515 + register uint16  *wp;
516 + int  n;
517 + {
518 +        while (n-- > 0) {
519 +                *wp = *wp << 8 | ((*wp >> 8) & 0xff);
520 +                wp++;
521 +        }
522 + }
523 +
524   getcascii(col)          /* get an ascii color value from stream(s) */
525   COLOR  col;
526   {
# Line 541 | Line 618 | COLOR  col;
618   }
619  
620  
621 + getcword(col)           /* get a 16-bit color value from stream(s) */
622 + COLOR  col;
623 + {
624 +        uint16  vw[3];
625 +
626 +        if (fin2 == NULL) {
627 +                if (fread((char *)vw, sizeof(uint16), 3, fin) != 3)
628 +                        return(-1);
629 +        } else {
630 +                if (fread((char *)vw, sizeof(uint16), 1, fin) != 1 ||
631 +                        fread((char *)(vw+1), sizeof(uint16), 1, fin2) != 1 ||
632 +                        fread((char *)(vw+2), sizeof(uint16), 1, fin3) != 1)
633 +                        return(-1);
634 +        }
635 +        if (swapbytes)
636 +                swap16(vw, 3);
637 +        setcolor(col, (vw[rord[RED]]+.5)/65536.,
638 +                        (vw[rord[GRN]]+.5)/65536., (vw[rord[BLU]]+.5)/65536.);
639 +        return(0);
640 + }
641 +
642 +
643   getbascii(col)          /* get an ascii brightness value from fin */
644   COLOR  col;
645   {
# Line 605 | Line 704 | COLOR  col;
704   }
705  
706  
707 + getbword(col)           /* get a 16-bit brightness value from fin */
708 + COLOR  col;
709 + {
710 +        uint16  vw;
711 +        double  d;
712 +
713 +        if (fread((char *)&vw, sizeof(uint16), 1, fin) != 1)
714 +                return(-1);
715 +        if (swapbytes)
716 +                swap16(&vw, 1);
717 +        d = (vw+.5)/65536.;
718 +        setcolor(col, d, d, d);
719 +        return(0);
720 + }
721 +
722 +
723   putcascii(col)                  /* put an ascii color to stdout */
724   COLOR  col;
725   {
# Line 660 | Line 775 | COLOR  col;
775   putcbyte(col)                   /* put a byte color to stdout */
776   COLOR  col;
777   {
778 <        register int  i;
778 >        long  i;
779          BYTE  vb[3];
780  
781          i = colval(col,ord[0])*256.;
# Line 675 | Line 790 | COLOR  col;
790   }
791  
792  
793 + putcword(col)                   /* put a 16-bit color to stdout */
794 + COLOR  col;
795 + {
796 +        long  i;
797 +        uint16  vw[3];
798 +
799 +        i = colval(col,ord[0])*65536.;
800 +        vw[0] = min(i,65535);
801 +        i = colval(col,ord[1])*65536.;
802 +        vw[1] = min(i,65535);
803 +        i = colval(col,ord[2])*65536.;
804 +        vw[2] = min(i,65535);
805 +        if (swapbytes)
806 +                swap16(vw, 3);
807 +        fwrite((char *)vw, sizeof(uint16), 3, stdout);
808 +
809 +        return(ferror(stdout) ? -1 : 0);
810 + }
811 +
812 +
813   putbascii(col)                  /* put an ascii brightness to stdout */
814   COLOR  col;
815   {
816 <        fprintf(stdout, "%15.3e\n", bright(col));
816 >        fprintf(stdout, "%15.3e\n", (*mybright)(col));
817  
818          return(ferror(stdout) ? -1 : 0);
819   }
# Line 689 | Line 824 | COLOR  col;
824   {
825          float  vf;
826  
827 <        vf = bright(col);
827 >        vf = (*mybright)(col);
828          fwrite((char *)&vf, sizeof(float), 1, stdout);
829  
830          return(ferror(stdout) ? -1 : 0);
# Line 701 | Line 836 | COLOR  col;
836   {
837          double  vd;
838  
839 <        vd = bright(col);
839 >        vd = (*mybright)(col);
840          fwrite((char *)&vd, sizeof(double), 1, stdout);
841  
842          return(ferror(stdout) ? -1 : 0);
# Line 711 | Line 846 | COLOR  col;
846   putbint(col)                    /* put an int brightness to stdout */
847   COLOR  col;
848   {
849 <        fprintf(stdout, "%d\n", (int)(bright(col)*256.));
849 >        fprintf(stdout, "%d\n", (int)((*mybright)(col)*256.));
850  
851          return(ferror(stdout) ? -1 : 0);
852   }
# Line 723 | Line 858 | COLOR  col;
858          register int  i;
859          BYTE  vb;
860  
861 <        i = bright(col)*256.;
861 >        i = (*mybright)(col)*256.;
862          vb = min(i,255);
863          fwrite((char *)&vb, sizeof(BYTE), 1, stdout);
864  
# Line 731 | Line 866 | COLOR  col;
866   }
867  
868  
869 + putbword(col)                   /* put a 16-bit brightness to stdout */
870 + COLOR  col;
871 + {
872 +        long  i;
873 +        uint16  vw;
874 +
875 +        i = (*mybright)(col)*65536.;
876 +        vw = min(i,65535);
877 +        if (swapbytes)
878 +                swap16(&vw, 1);
879 +        fwrite((char *)&vw, sizeof(uint16), 1, stdout);
880 +
881 +        return(ferror(stdout) ? -1 : 0);
882 + }
883 +
884 +
885   putpascii(col)                  /* put an ascii primary to stdout */
886   COLOR  col;
887   {
# Line 776 | Line 927 | COLOR  col;
927   putpbyte(col)                   /* put a byte primary to stdout */
928   COLOR  col;
929   {
930 <        register int  i;
930 >        long  i;
931          BYTE  vb;
932  
933          i = colval(col,putprim)*256.;
# Line 787 | Line 938 | COLOR  col;
938   }
939  
940  
941 + putpword(col)                   /* put a 16-bit primary to stdout */
942 + COLOR  col;
943 + {
944 +        long  i;
945 +        uint16  vw;
946 +
947 +        i = colval(col,putprim)*65536.;
948 +        vw = min(i,65535);
949 +        if (swapbytes)
950 +                swap16(&vw, 1);
951 +        fwrite((char *)&vw, sizeof(uint16), 1, stdout);
952 +
953 +        return(ferror(stdout) ? -1 : 0);
954 + }
955 +
956 +
957   set_io()                        /* set put and get functions */
958   {
959          switch (format) {
# Line 800 | Line 967 | set_io()                       /* set put and get functions */
967                  } else {
968                          getval = getcascii;
969                          putval = putcascii;
970 +                        if (reverse && !interleave) {
971 +                                fprintf(stderr,
972 +                                "%s: ASCII input files must be interleaved\n",
973 +                                                progname);
974 +                                quit(1);
975 +                        }
976                  }
977                  return;
978          case 'f':                                       /* binary float */
# Line 812 | Line 985 | set_io()                       /* set put and get functions */
985                  } else {
986                          getval = getcfloat;
987                          putval = putcfloat;
988 +                        if (reverse && !interleave) {
989 +                                if (fin2 == NULL)
990 +                                        goto namerr;
991 +                                if (fseek(fin2,
992 +                                (long)sizeof(float)*picres.xr*picres.yr, 1))
993 +                                        goto seekerr;
994 +                                if (fseek(fin3,
995 +                                (long)sizeof(float)*2*picres.xr*picres.yr, 1))
996 +                                        goto seekerr;
997 +                        }
998                  }
999                  return;
1000          case 'd':                                       /* binary double */
# Line 824 | Line 1007 | set_io()                       /* set put and get functions */
1007                  } else {
1008                          getval = getcdouble;
1009                          putval = putcdouble;
1010 +                        if (reverse && !interleave) {
1011 +                                if (fin2 == NULL)
1012 +                                        goto namerr;
1013 +                                if (fseek(fin2,
1014 +                                (long)sizeof(double)*picres.xr*picres.yr, 1))
1015 +                                        goto seekerr;
1016 +                                if (fseek(fin3,
1017 +                                (long)sizeof(double)*2*picres.xr*picres.yr, 1))
1018 +                                        goto seekerr;
1019 +                        }
1020                  }
1021                  return;
1022          case 'i':                                       /* integer */
# Line 836 | Line 1029 | set_io()                       /* set put and get functions */
1029                  } else {
1030                          getval = getcint;
1031                          putval = putcint;
1032 +                        if (reverse && !interleave) {
1033 +                                fprintf(stderr,
1034 +                                "%s: integer input files must be interleaved\n",
1035 +                                                progname);
1036 +                                quit(1);
1037 +                        }
1038                  }
1039                  return;
1040          case 'b':                                       /* byte */
# Line 848 | Line 1047 | set_io()                       /* set put and get functions */
1047                  } else {
1048                          getval = getcbyte;
1049                          putval = putcbyte;
1050 +                        if (reverse && !interleave) {
1051 +                                if (fin2 == NULL)
1052 +                                        goto namerr;
1053 +                                if (fseek(fin2,
1054 +                                (long)sizeof(BYTE)*picres.xr*picres.yr, 1))
1055 +                                        goto seekerr;
1056 +                                if (fseek(fin3,
1057 +                                (long)sizeof(BYTE)*2*picres.xr*picres.yr, 1))
1058 +                                        goto seekerr;
1059 +                        }
1060                  }
1061                  return;
1062 +        case 'w':                                       /* 16-bit */
1063 +                if (putprim == BRIGHT) {
1064 +                        getval = getbword;
1065 +                        putval = putbword;
1066 +                } else if (putprim != ALL) {
1067 +                        getval = getbword;
1068 +                        putval = putpword;
1069 +                } else {
1070 +                        getval = getcword;
1071 +                        putval = putcword;
1072 +                        if (reverse && !interleave) {
1073 +                                if (fin2 == NULL)
1074 +                                        goto namerr;
1075 +                                if (fseek(fin2,
1076 +                                (long)sizeof(uint16)*picres.xr*picres.yr, 1))
1077 +                                        goto seekerr;
1078 +                                if (fseek(fin3,
1079 +                                (long)sizeof(uint16)*2*picres.xr*picres.yr, 1))
1080 +                                        goto seekerr;
1081 +                        }
1082 +                }
1083 +                return;
1084          }
1085 + badopt:
1086 +        fprintf(stderr, "%s: botched file type\n", progname);
1087 +        quit(1);
1088 + namerr:
1089 +        fprintf(stderr, "%s: non-interleaved file(s) must be named\n",
1090 +                        progname);
1091 +        quit(1);
1092 + seekerr:
1093 +        fprintf(stderr, "%s: cannot seek on interleaved input file\n",
1094 +                        progname);
1095 +        quit(1);
1096   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines