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

Comparing ray/src/px/ra_ps.c (file contents):
Revision 2.31 by greg, Sat Dec 28 18:05:14 2019 UTC vs.
Revision 2.34 by greg, Fri Jun 6 19:11:21 2025 UTC

# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9   #include  <ctype.h>
10  
11   #include  "platform.h"
12 + #include  "paths.h"
13   #include  "rtio.h"
14   #include  "color.h"
15   #include  "resolu.h"
# Line 50 | Line 51 | int  docolor = 1;                      /* produce color image? */
51   int  bradj = 0;                         /* brightness adjustment */
52   int  ncopies = 1;                       /* number of copies */
53  
53 char  *progname;
54   int  xmax, ymax;                        /* input image dimensions */
55  
56   typedef void putprimf_t(COLR *scn, int pri);
# Line 58 | Line 58 | typedef void putprimf_t(COLR *scn, int pri);
58   static gethfunc headline;
59   static putprimf_t Aputprim, Bputprim, Cputprim;
60  
61 < static double unit2inch(register char *s);
61 > static double unit2inch(char *s);
62   static int matchid(char *name, char *id);
63   static void parsepaper(char *ps);
64   static void quiterr(char *err);
# Line 80 | Line 80 | headline(              /* check header line */
80   {
81          char  fmt[MAXFMTLEN];
82  
83 <        if (isformat(s)) {
84 <                formatval(fmt, s);
85 <                wrongformat = strcmp(fmt, COLRFMT);
86 <        } else if (isaspect(s))
83 >        if (formatval(fmt, s))
84 >                wrongformat = strcmp(fmt, COLRFMT) && strcmp(fmt, SPECFMT);
85 >        else if (isaspect(s))
86                  pixaspect *= aspectval(s);
87 +        else if (isncomp(s))
88 +                NCSAMP = ncompval(s);
89 +        else if (iswlsplit(s))
90 +                wlsplitval(WLPART, s);
91          return(0);
92   }
93  
# Line 94 | Line 97 | main(int  argc, char  *argv[])
97          int  i;
98          double  d;
99          
100 <        progname = argv[0];
100 >        fixargv0(argv[0]);              /* assigns progname */
101  
102          for (i = 1; i < argc; i++)
103                  if (argv[i][0] == '-')
# Line 196 | Line 199 | userr:
199  
200   static double
201   unit2inch(              /* determine unit */
202 <        register char   *s
202 >        char    *s
203   )
204   {
205          static struct unit {char n; float f;} u[] = {
# Line 204 | Line 207 | unit2inch(             /* determine unit */
207                  {'m', 1./25.4},
208                  {'c', 1./2.54},
209                  {'\0',0} };
210 <        register struct unit    *up;
210 >        struct unit     *up;
211  
212          while (*s && !isalpha(*s))
213                  s++;
# Line 218 | Line 221 | unit2inch(             /* determine unit */
221   static int
222   matchid(        /* see if name matches id (case insensitive) */
223          char    *name,
224 <        register char   *id
224 >        char    *id
225   )
226   {
227 <        register char   *s = name;
227 >        char    *s = name;
228  
229          while (*s) {
230                  if (isalpha(*s)) {
# Line 261 | Line 264 | parsepaper(            /* determine paper size from name */
264                  {"DL", 4.33, 8.66},
265                  {"hagaki", 3.94, 5.83},
266                  {"",0.0,0.0} };
267 <        register struct psize   *pp;
268 <        register char   *s = ps;
267 >        struct psize    *pp;
268 >        char    *s = ps;
269          double  d;
270  
271          if (isdigit(*s)) {              /* check for WWxHH specification */
# Line 425 | Line 428 | PSprocdef(                     /* define PS procedure to read image */
428   )
429   {
430          short  itab[128];
431 <        register int  i;
431 >        int  i;
432                                  /* assign code values */
433          for (i = 0; i < 128; i++)       /* clear */
434                  itab[i] = -1;
# Line 464 | Line 467 | PSprocdef(                     /* define PS procedure to read image */
467   static void
468   ra2ps(void)                             /* convert Radiance scanlines to 6-bit */
469   {
470 <        register COLR   *scanin;
470 >        COLR    *scanin;
471          int     y;
472                                                  /* allocate scanline */
473          scanin = (COLR *)malloc(xmax*sizeof(COLR));
# Line 472 | Line 475 | ra2ps(void)                            /* convert Radiance scanlines to 6-bit
475                  quiterr("out of memory in ra2ps");
476                                                  /* convert image */
477          for (y = ymax-1; y >= 0; y--) {
478 <                if (freadcolrs(scanin, xmax, stdin) < 0)
478 >                if (fread2colrs(scanin, xmax, stdin, NCSAMP, WLPART) < 0)
479                          quiterr("error reading Radiance picture");
480 <                if (putprim == Cputprim || devgam != 1.) {
480 >                if ((putprim == Cputprim) | (devgam != 1.)) {
481                          if (bradj)                      /* adjust exposure */
482                                  shiftcolrs(scanin, xmax, bradj);
483                          colrs_gambs(scanin, xmax);      /* gamma compression */
# Line 503 | Line 506 | Aputprim(              /* put out hex ASCII primary from scanline
506   {
507          static char     hexdigit[] = "0123456789ABCDEF";
508          static int      col = 0;
509 <        register int    x, c;
509 >        int     x, c;
510  
511          for (x = 0; x < xmax; x++) {
512                  if (pri == GRY)
# Line 527 | Line 530 | Bputprim(              /* put out binary primary from scanline */
530          int     pri
531   )
532   {
533 <        register int    x, c;
533 >        int     x, c;
534  
535          for (x = 0; x < xmax; x++) {
536                  if (pri == GRY)
# Line 546 | Line 549 | Cputprim(              /* put out compressed primary from scanline
549          int     pri
550   )
551   {
552 <        register int    c;
553 <        register int    x;
552 >        int     c;
553 >        int     x;
554          int     lastc, cnt;
555  
556          lastc = -1; cnt = 0;
# Line 572 | Line 575 | Cputprim(              /* put out compressed primary from scanline
575  
576   static void
577   putrle(         /* put out cnt of cod */
578 <        register int    cnt,
579 <        register int    cod
578 >        int     cnt,
579 >        int     cod
580   )
581   {
582          static int      col = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines