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.3 by greg, Wed Aug 14 21:00:14 2019 UTC vs.
Revision 2.5 by greg, Thu Nov 7 23:20:28 2019 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 125 | Line 124 | check_decode_normals(NORMCODEC *ncp)
124   int
125   decode_normal_next(FVECT nrm, NORMCODEC *ncp)
126   {
127 <        int32   c = getint(4, ncp->finp);
127 >        static int32    lastc;
128 >        static FVECT    lastv;
129 >        int32           c = getint(4, ncp->finp);
130  
131          if (c == EOF && feof(ncp->finp))
132                  return -1;
133  
134          ncp->curpos += 4;
135  
136 <        decodedir(nrm, c);
137 <
136 >        if (c == lastc) {                       /* optimization */
137 >                VCOPY(nrm, lastv);
138 >        } else {
139 >                decodedir(nrm, c);
140 >                if (c) {
141 >                        lastc = c;
142 >                        VCOPY(lastv, nrm);
143 >                }
144 >        }
145          return (c != 0);
146   }
147  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines