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

Comparing ray/src/px/panim.c (file contents):
Revision 1.2 by greg, Tue Sep 12 13:04:21 1989 UTC vs.
Revision 1.3 by greg, Thu Dec 28 08:18:49 1989 UTC

# Line 75 | Line 75 | char   *file;
75          int     xres, yres;
76          int     xbeg, ybeg;
77          FILE    *fp;
78 <        int     j;
79 <        register int    k, c;
80 <        register BYTE   *in;
81 <        short   *out;
78 >        int     y;
79 >        register int    x;
80                                                  /* open file */
81          if (file == NULL) {
82                  fp = stdin;
# Line 101 | Line 99 | char   *file;
99                                                  /* clear output */
100          bzero(sc_frame_arr, sizeof(sc_frame_arr));
101                                                  /* get frame */
102 <        for (j = yres-1; j >= 0; j--) {
102 >        for (y = yres-1; y >= 0; y--) {
103                  if (freadcolrs(scanin, xres, fp) < 0) {
104                          fputs(file, stderr);
105                          fputs(": read error\n", stderr);
106                          exit(1);
107                  }
108 <                for (in = scanin[0], out = sc_frame_arr[ybeg+j]+xbeg;
109 <                                in < scanin[xres]; in += 4, out++) {
110 <                        k = in[EXP] - COLXS;
111 <                        if (k >= 8) {
112 <                                in[RED] =
113 <                                in[GRN] =
116 <                                in[BLU] = 255;
117 <                        } else if (k <= -8) {
118 <                                in[RED] =
119 <                                in[GRN] =
120 <                                in[BLU] = 0;
121 <                        } else if (k > 0) {
122 <                                c = in[RED] << k;
123 <                                in[RED] = c > 255 ? 255 : c;
124 <                                c = in[GRN] << k;
125 <                                in[GRN] = c > 255 ? 255 : c;
126 <                                c = in[BLU] << k;
127 <                                in[BLU] = c > 255 ? 255 : c;
128 <                        } else if (k < 0) {
129 <                                in[RED] = in[RED] >> -k;
130 <                                in[GRN] = in[GRN] >> -k;
131 <                                in[BLU] = in[BLU] >> -k;
132 <                        }
133 <                        for (k = 0; k < 3; k++)
134 <                                *out = *out<<5 | (gammamap[in[k]]+(random()&0x7))>>3;
135 <                }
108 >                normcolrs(scanin, xres);        /* normalize */
109 >                for (x = 0; x < xres; x++)      /* convert */
110 >                        sc_frame_arr[y+ybeg][x+xbeg] =
111 >                        ((gammamap[scanin[x][RED]]+(random()&7))&0xf8)<<7
112 >                        | ((gammamap[scanin[x][GRN]]+(random()&7))&0xf8)<<2
113 >                        | (gammamap[scanin[x][BLU]]+(random()&7))>>3;
114          }
115                                                  /* send frame */
116          scry_send_frame();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines