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

Comparing ray/src/common/normcodec.c (file contents):
Revision 2.4 by greg, Mon Aug 26 23:33:24 2019 UTC vs.
Revision 2.6 by greg, Thu Mar 3 16:09:31 2022 UTC

# Line 20 | Line 20 | set_nc_defaults(NORMCODEC *ncp)
20          ncp->finp = stdin;
21          ncp->inpname = "<stdin>";
22          ncp->format = 'a';
23        ncp->swapped = 0;
23          ncp->res.rt = PIXSTANDARD;
24          if (!progname) progname = "norm_codec";
25   }
# Line 58 | Line 57 | process_nc_header(NORMCODEC *ncp, int ac, char *av[])
57                  }
58                  return 0;
59          }
60 +                                        /* get resolution string? */
61 +        if (ncp->hdrflags & HF_RESIN && !fgetsresolu(&ncp->res, ncp->finp)) {
62 +                if (ncp->hdrflags & HF_STDERR) {
63 +                        fputs(ncp->inpname, stderr);
64 +                        fputs(": bad resolution string\n", stderr);
65 +                }
66 +                return 0;
67 +        }
68          if (ncp->hdrflags & HF_HEADOUT) {       /* finish header */
69                  if (!(ncp->hdrflags & HF_HEADIN))
70                          newheader("RADIANCE", stdout);
# Line 65 | Line 72 | process_nc_header(NORMCODEC *ncp, int ac, char *av[])
72                          printargs(ac, av, stdout);
73                  if (ncp->hdrflags & HF_ENCODE) {
74                          fputformat(NORMAL32FMT, stdout);
75 <                } else
75 >                } else {
76 >                        fputs("NCOMP=3\n", stdout);
77 >                        if ((ncp->hdrflags & (HF_RESIN|HF_RESOUT)) == HF_RESIN)
78 >                                printf("NCOLS=%d\nNROWS=%d\n",
79 >                                                scanlen(&ncp->res),
80 >                                                numscans(&ncp->res));
81                          switch (ncp->format) {
82                          case 'a':
83                                  fputformat("ascii", stdout);
# Line 79 | Line 91 | process_nc_header(NORMCODEC *ncp, int ac, char *av[])
91                                  fputformat("double", stdout);
92                                  break;
93                          }
94 +                }
95                  fputc('\n', stdout);
96          }
97 <                                        /* get/put resolution string */
85 <        if (ncp->hdrflags & HF_RESIN && !fgetsresolu(&ncp->res, ncp->finp)) {
86 <                if (ncp->hdrflags & HF_STDERR) {
87 <                        fputs(ncp->inpname, stderr);
88 <                        fputs(": bad resolution string\n", stderr);
89 <                }
90 <                return 0;
91 <        }
92 <        if (ncp->hdrflags & HF_RESOUT)
97 >        if (ncp->hdrflags & HF_RESOUT)  /* put resolution string? */
98                  fputsresolu(&ncp->res, stdout);
99  
100          ncp->dstart = ncp->curpos = ftell(ncp->finp);
# Line 125 | Line 130 | check_decode_normals(NORMCODEC *ncp)
130   int
131   decode_normal_next(FVECT nrm, NORMCODEC *ncp)
132   {
133 <        int32   lastc;
134 <        FVECT   lastv;
135 <        int32   c = getint(4, ncp->finp);
133 >        static int32    lastc;
134 >        static FVECT    lastv;
135 >        int32           c = getint(4, ncp->finp);
136  
137          if (c == EOF && feof(ncp->finp))
138                  return -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines