w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

hpcdtoppm.c
Go to the documentation of this file.
1 /* hpcdtoppm (Hadmut's pcdtoppm) v0.3
2 * Copyright (c) 1992 by Hadmut Danisch (danisch@ira.uka.de).
3 * Permission to use and distribute this software and its
4 * documentation for noncommercial use and without fee is hereby granted,
5 * provided that the above copyright notice appear in all copies and that
6 * both that copyright notice and this permission notice appear in
7 * supporting documentation. It is not allowed to sell this software in
8 * any way. This software is not public domain.
9 */
10 
11 
12 /* define OWN_WRITE either here or by compiler-option if you don't want to use
13  the pbmplus-routines for writing */
14 #define xOWN_WRITE
15 
16 
17 /* define DEBUG for some debugging informations, just remove the x from xDEBUG */
18 #define xDEBUG
19 
20 /* define MELDUNG if you want to see what is happening and what takes time,
21  just remove the x from xMeldung */
22 #define xMELDUNG
23 
24 
25 
26 
27 
28 #ifndef OWN_WRITE
29 
30 #include <string.h>
31 #include "ppm.h"
32 
33 #else
34 
35 /* If the own routines are used, this is the size of the buffer in bytes.
36  You can shrink if needed. */
37 #define own_BUsize 50000
38 #include <stdio.h>
39 
40 
41 /* The header for the ppm-files */
42 #define PPM_Header "P6\n%d %d\n255\n"
43 
44 
45 #endif
46 
47 
48 /*
49 ** Important: sBYTE must be a signed byte type !!!
50 **
51 */
52 
53 #ifndef sBYTE
54 #ifndef VMS
55 typedef signed char sBYTE;
56 #else
57 typedef char sBYTE;
58 #endif
59 #endif
60 
61 typedef unsigned char uBYTE;
62 typedef unsigned long dim;
63 
64 #define BaseW ((dim)768)
65 #define BaseH ((dim)512)
66 
67 #define SECSIZE 0x800
68 
69 
70 
71 #define SeHead 2
72 #define L_Head (1+SeHead)
73 
74 #define SeBase16 18
75 #define L_Base16 (1+SeBase16)
76 
77 #define SeBase4 72
78 #define L_Base4 (1+SeBase4)
79 
80 #define SeBase 288
81 #define L_Base (1+SeBase)
82 
83 
84 
85 
86 
87 
91 
93 
95 
96 /* Default taken when no size parameter given */
97 #define S_DEFAULT S_Base16
98 
99 
100 
101 
102 
103 struct _implane
107  };
108 typedef struct _implane implane;
109 
110 #define nullplane ((implane *) 0)
111 
113 struct pcdhqt { uBYTE entries; struct pcdquad entry[256];};
114 struct myhqt { unsigned long seq,mask,len; uBYTE key; };
115 
116 
117 static void error ARGS((enum ERRORS e));
119 static enum ERRORS readplain ARGS((dim w, dim h, implane *l, implane *c1, implane *c2));
120 static void interpolate ARGS((implane *p));
121 static void halve ARGS((implane *p));
122 static void ycctorgb ARGS((dim w, dim h, implane *l, implane *c1, implane *c2));
123 static void writepicture ARGS((dim w, dim h, implane *r, implane *g, implane *b, enum TURNS t));
124 static void druckeid ARGS((void));
125 static void clear ARGS((implane *l, int n));
126 static long Skip4Base ARGS((void));
127 static void readhqt ARGS((dim w, dim h, int n));
128 static void decode ARGS((dim w, dim h, implane *f, implane *f1, implane *f2, int autosync));
129 static void sharpit ARGS((implane *l));
130 static void readhqtsub ARGS((struct pcdhqt *source, struct myhqt *ziel, int *anzahl));
131 static int testbegin ARGS((void));
132 
133 static FILE *fin=0,*fout=0;
134 static char *pcdname=0,*ppmname=0;
135 static char nbuf[100];
137 static int do_sharp,keep_ycc;
138 
139 
140 
141 
142 /* Using preprocessor for inline-procs */
143 #ifdef DEBUG
144 
145 static long bufpos;
146 
147 #define SEEK(x) { if (fseek(fin,((x) * SECSIZE),0)) error(E_READ);\
148  fprintf(stderr,"S-Position %x\n",ftell(fin)); }
149 #define RPRINT {fprintf(stderr,"R-Position %x\n",ftell(fin));}
150 
151 #define READBUF (bufpos=ftell(fin),fread(sbuffer,sizeof(sbuffer),1,fin))
152 
153 
154 #else
155 
156 #define SEEK(x) { if (fseek(fin,((x) * SECSIZE),0)) error(E_READ);}
157 #define RPRINT
158 #define READBUF fread(sbuffer,sizeof(sbuffer),1,fin)
159 
160 #endif
161 
162 
163 #ifdef MELDUNG
164 #define melde(x) fprintf(stderr,x)
165 #else
166 #define melde(x)
167 #endif
168 
169 
170 
171 
172 
173 
174 
175 
176 #define EREADBUF {if(READBUF < 1) error(E_READ);}
177 
178 #define SKIP(n) { if (fseek(fin,(n),1)) error(E_READ);}
179 #define SKIPr(n) { if (fseek(fin,(n),1)) return(E_READ);}
180 
181 
182 #define xTRIF(x,u,o,a,b,c) ((x)<(u)? (a) : ( (x)>(o)?(c):(b) ))
183 #define xNORM(x) x=TRIF(x,0,255,0,x,255)
184 #define NORM(x) { if(x<0) x=0; else if (x>255) x=255;}
185 
186 
187 
188 
189 
190 static void error(e)
191  enum ERRORS e;
192  {
193 
194  switch(e)
195  {case E_NONE: return;
196  case E_IMP: fprintf(stderr,"Sorry, Not yet implemented.\n"); break;
197  case E_READ: fprintf(stderr,"Error while reading.\n"); break;
198  case E_WRITE: fprintf(stderr,"Error while writing.\n"); break;
199  case E_INTERN: fprintf(stderr,"Internal error.\n"); break;
200  case E_ARG: fprintf(stderr,"Error in Arguments !\n\n");
201  fprintf(stderr,"Usage: hpcdtoppm [options] pcd-file [ppm-file]\n\n");
202  fprintf(stderr,"Opts:\n");
203  fprintf(stderr," -x Overskip mode (tries to improve color quality.)\n");
204  fprintf(stderr," -i Give some (buggy) informations from fileheader\n");
205  fprintf(stderr," -s Apply simple sharpness-operator on the Luma-channel\n");
206  fprintf(stderr," -d Show differential picture only \n\n");
207  fprintf(stderr," -r Rotate clockwise for portraits\n");
208  fprintf(stderr," -l Rotate counter-clockwise for portraits\n");
209  fprintf(stderr," -a Try to find out orientation automatically.\n");
210  fprintf(stderr," (Experimentally, please report if it doesn't work.)\n\n");
211  fprintf(stderr," -ycc suppress ycc to rgb conversion \n");
212  fprintf(stderr," (Experimentally, doesn't have deeper sense)\n\n");
213  fprintf(stderr," -0 Extract thumbnails from Overview file\n");
214  fprintf(stderr," -1 Extract 128x192 from Image file\n");
215  fprintf(stderr," -2 Extract 256x384 from Image file\n");
216  fprintf(stderr," -3 Extract 512x768 from Image file\n");
217  fprintf(stderr," -4 Extract 1024x1536 from Image file\n");
218  fprintf(stderr," -5 Extract 2048x3072 from Image file\n");
219  fprintf(stderr,"\n");
220  break;
221  case E_OPT: fprintf(stderr,"These Options are not allowed together.\n");break;
222  case E_MEM: fprintf(stderr,"Not enough memory !\n"); break;
223  case E_HUFF: fprintf(stderr,"Error in Huffman-Code-Table\n"); break;
224  case E_SEQ: fprintf(stderr,"Error in Huffman-Sequence\n"); break;
225  case E_SEQ1: fprintf(stderr,"Error1 in Huffman-Sequence\n"); break;
226  case E_SEQ2: fprintf(stderr,"Error2 in Huffman-Sequence\n"); break;
227  case E_SEQ3: fprintf(stderr,"Error3 in Huffman-Sequence\n"); break;
228  case E_SEQ4: fprintf(stderr,"Error4 in Huffman-Sequence\n"); break;
229  case E_SEQ5: fprintf(stderr,"Error5 in Huffman-Sequence\n"); break;
230  case E_SEQ6: fprintf(stderr,"Error6 in Huffman-Sequence\n"); break;
231  case E_SEQ7: fprintf(stderr,"Error7 in Huffman-Sequence\n"); break;
232  case E_POS: fprintf(stderr,"Error in file-position\n"); break;
233  case E_OVSKIP: fprintf(stderr,"Can't read this resolution in overskip-mode\n"); break;
234  case E_TAUTO: fprintf(stderr,"Can't determine the orientation in overview mode\n");break;
235  case E_TCANT: fprintf(stderr,"Sorry, can't determine orientation for this file.\n");
236  fprintf(stderr,"Please give orientation parameters. \n");break;
237  default: fprintf(stderr,"Unknown error %d ???\n",e);break;
238  }
239  if(fin) fclose(fin);
240  if(fout && ppmname) fclose(fout);
241  exit(9);
242  }
243 
244 
245 
246 
247 
248 
249 
250 
251 
252 static void planealloc(p,width,height)
253  implane *p;
254  dim width,height;
255  {
256  p->iwidth=p->iheight=0;
257  p->mwidth=width;
258  p->mheight=height;
259 
260  p->im = ( uBYTE * ) malloc (width*height*sizeof(uBYTE));
261  if(!(p->im)) error(E_MEM);
262  }
263 
264 
265 
266 
267 
268 int
270  int argc;
271  char **argv;
272 #define ASKIP { argc--; argv ++;}
273 {int bildnr;
274  char *opt;
275  dim w,h;
276  long cd_offset,cd_offhelp;
277  int do_info,do_diff,do_overskip;
278 
279  enum TURNS turn=T_NONE;
280  enum SIZES size=S_UNSPEC;
281  enum ERRORS eret;
282  implane Luma, Chroma1,Chroma2;
283 
284  ppm_init(&argc, argv);
285 
286  do_info=do_diff=do_overskip=do_sharp=keep_ycc=0;
287 
288  ASKIP;
289 
290  while((argc>0) && **argv=='-')
291  {
292  opt= (*argv)+1;
293  ASKIP;
294 
295  if(!strcmp(opt,"r"))
296  {if (turn == T_NONE) turn=T_RIGHT;
297  else error(E_ARG);
298  continue;
299  }
300 
301  if(!strcmp(opt,"l"))
302  {if (turn == T_NONE) turn=T_LEFT;
303  else error(E_ARG);
304  continue;
305  }
306 
307  if(!strcmp(opt,"a"))
308  {if (turn == T_NONE) turn=T_AUTO;
309  else error(E_ARG);
310  continue;
311  }
312 
313  if(!strcmp(opt,"i"))
314  { if (!do_info) do_info=1;
315  else error(E_ARG);
316  continue;
317  }
318 
319 
320  if(!strcmp(opt,"d"))
321  { if (!do_diff) do_diff=1;
322  else error(E_ARG);
323  continue;
324  }
325 
326  if(!strcmp(opt,"s"))
327  { if (!do_sharp) do_sharp=1;
328  else error(E_ARG);
329  continue;
330  }
331 
332 
333  if(!strcmp(opt,"x"))
334  { if (!do_overskip) do_overskip=1;
335  else error(E_ARG);
336  continue;
337  }
338 
339 
340  if(!strcmp(opt,"ycc"))
341  { if (!keep_ycc) keep_ycc=1;
342  else error(E_ARG);
343  continue;
344  }
345 
346 
347 
348 
349  if((!strcmp(opt,"Base/16")) || (!strcmp(opt,"1")) || (!strcmp(opt,"128x192")))
350  { if (size == S_UNSPEC) size = S_Base16;
351  else error(E_ARG);
352  continue;
353  }
354  if((!strcmp(opt,"Base/4" )) || (!strcmp(opt,"2")) || (!strcmp(opt,"256x384")))
355  { if (size == S_UNSPEC) size = S_Base4;
356  else error(E_ARG);
357  continue;
358  }
359  if((!strcmp(opt,"Base" )) || (!strcmp(opt,"3")) || (!strcmp(opt,"512x768")))
360  { if (size == S_UNSPEC) size = S_Base;
361  else error(E_ARG);
362  continue;
363  }
364  if((!strcmp(opt,"4Base" )) || (!strcmp(opt,"4")) || (!strcmp(opt,"1024x1536")))
365  { if (size == S_UNSPEC) size = S_4Base;
366  else error(E_ARG);
367  continue;
368  }
369  if((!strcmp(opt,"16Base" )) || (!strcmp(opt,"5")) || (!strcmp(opt,"2048x3072")))
370  { if (size == S_UNSPEC) size = S_16Base;
371  else error(E_ARG);
372  continue;
373  }
374 
375  if((!strcmp(opt,"Overview" )) || (!strcmp(opt,"0")) || (!strcmp(opt,"O")))
376  { if (size == S_UNSPEC) size = S_Over;
377  else error(E_ARG);
378  continue;
379  }
380 
381  fprintf(stderr,"Unknown option: -%s\n",opt);
382  error(E_ARG);
383  }
384 
385 
386 
387 
389 
390  if(argc<1) error(E_ARG);
391  pcdname= *argv;
392  ASKIP;
393 
394  if(argc>0)
395  {ppmname= *argv;
396  ASKIP;
397  }
398 
399  if(argc>0) error(E_ARG);
400  if((size==S_Over) && (!ppmname)) error(E_ARG);
401  if(do_info && (size==S_Over)) error(E_OPT);
402  if(do_overskip && do_diff) error(E_OPT);
403  if(do_diff && (size != S_4Base) && (size != S_16Base)) error(E_OPT);
404  if(do_overskip && (size != S_Base16) && (size != S_Base4) && (size != S_Base) && (size != S_4Base) ) error(E_OVSKIP);
405  if((turn==T_AUTO)&&(size==S_Over)) error(E_TAUTO);
406 
407 
408 
409 
410 
411  if(!(fin=fopen(pcdname,"rb"))) error(E_READ);
412 
413  if(do_info || (turn==T_AUTO))
414  { SEEK(1);
415  EREADBUF;
416  }
417 
418  if(turn==T_AUTO)
419  {
420  switch(sbuffer[0xe02 & 0x7ff]&0x03)
421  {case 0x00: turn=T_NONE; break;
422  case 0x01: turn=T_LEFT; break;
423  case 0x03: turn=T_RIGHT; break;
424  default: error(E_TCANT);
425  }
426  }
427 
428  if(do_info) druckeid();
429 
430 
431 
432 
433 
434  switch(size)
435  {
436  case S_Base16: w=BaseW/4;
437  h=BaseH/4;
438  planealloc(&Luma ,w,h);
439  planealloc(&Chroma1,w,h);
440  planealloc(&Chroma2,w,h);
441 
442  if(!do_overskip)
443  { SEEK(L_Head+1);
444  error(readplain(w,h,&Luma,&Chroma1,&Chroma2));
445  interpolate(&Chroma1);
446  interpolate(&Chroma2);
447  }
448  else
449  { SEEK(L_Head+1);
451  SEEK(L_Head+L_Base16+1);
452  error(readplain(2*w,2*h,nullplane,&Chroma1,&Chroma2));
453  }
454 
455 
456  ycctorgb(w,h,&Luma,&Chroma1,&Chroma2);
457  /* Now Luma holds red, Chroma1 hold green, Chroma2 holds blue */
458 
459  if(!ppmname) fout=stdout;
460  else
461  {if (!(fout=fopen(ppmname,"wb"))) error(E_WRITE);
462  }
463  writepicture(w,h,&Luma,&Chroma1,&Chroma2,turn);
464 
465  break;
466 
467  case S_Base4: w=BaseW/2;
468  h=BaseH/2;
469  planealloc(&Luma ,w,h);
470  planealloc(&Chroma1,w,h);
471  planealloc(&Chroma2,w,h);
472 
473 
474 
475  if(!do_overskip)
476  { SEEK(L_Head+L_Base16+1);
477  error(readplain(w,h,&Luma,&Chroma1,&Chroma2));
478  interpolate(&Chroma1);
479  interpolate(&Chroma2);
480  }
481  else
482  { SEEK(L_Head+L_Base16+1);
485  error(readplain(2*w,2*h,nullplane,&Chroma1,&Chroma2));
486  }
487  ycctorgb(w,h,&Luma,&Chroma1,&Chroma2);
488  /* Now Luma holds red, Chroma1 hold green, Chroma2 holds blue */
489 
490  if(!ppmname) fout=stdout;
491  else
492  {if (!(fout=fopen(ppmname,"wb"))) error(E_WRITE);
493  }
494  writepicture(w,h,&Luma,&Chroma1,&Chroma2,turn);
495 
496  break;
497 
498  case S_Base: w=BaseW;
499  h=BaseH;
500 
501  if(!do_overskip)
502  { planealloc(&Luma ,w,h);
503  planealloc(&Chroma1,w,h);
504  planealloc(&Chroma2,w,h);
506  error(readplain(w,h,&Luma,&Chroma1,&Chroma2));
507  interpolate(&Chroma1);
508  interpolate(&Chroma2);
509  }
510  else
511  { planealloc(&Luma , w, h);
512  planealloc(&Chroma1,2*w,2*h);
513  planealloc(&Chroma2,2*w,2*h);
515  error(readplain(w,h,&Luma,&Chroma1,&Chroma2));
516  interpolate(&Chroma1);
517  interpolate(&Chroma2);
518  interpolate(&Chroma1);
519  interpolate(&Chroma2);
520 
521  cd_offset=Skip4Base();
522  SEEK(cd_offset+10); EREADBUF; cd_offhelp=(((long)sbuffer[2])<<8)|sbuffer[3];
523  SEEK(cd_offset+12); readhqt(w,h,3);
524  SEEK(cd_offset+cd_offhelp); decode(4*w,4*h,nullplane,&Chroma1,&Chroma2,1);
525 
526  halve(&Chroma1);
527  halve(&Chroma2);
528  }
529  ycctorgb(w,h,&Luma,&Chroma1,&Chroma2);
530  /* Now Luma holds red, Chroma1 hold green, Chroma2 holds blue */
531 
532  if(!ppmname) fout=stdout;
533  else
534  {if (!(fout=fopen(ppmname,"wb"))) error(E_WRITE);
535  }
536  writepicture(w,h,&Luma,&Chroma1,&Chroma2,turn);
537 
538  break;
539 
540  case S_4Base: w=BaseW*2;
541  h=BaseH*2;
542  planealloc(&Luma,w,h);
543  planealloc(&Chroma1,w,h);
544  planealloc(&Chroma2,w,h);
545 
546  if(!do_overskip)
548  error(readplain(w/2,h/2,&Luma,&Chroma1,&Chroma2));
549  interpolate(&Luma);
550  interpolate(&Chroma1);
551  interpolate(&Chroma1);
552  interpolate(&Chroma2);
553  interpolate(&Chroma2);
554 
555  if(do_diff) {clear(&Luma,128);clear(&Chroma1,156);clear(&Chroma2,137);}
556 
557  cd_offset = L_Head + L_Base16 + L_Base4 + L_Base ;
558  SEEK(cd_offset + 4); readhqt(w,h,1);
559  SEEK(cd_offset + 5); decode(w,h,&Luma,nullplane,nullplane,0);
560  }
561  else
563  error(readplain(w/2,h/2,&Luma,&Chroma1,&Chroma2));
564  interpolate(&Luma);
565  interpolate(&Chroma1);
566  interpolate(&Chroma1);
567  interpolate(&Chroma2);
568  interpolate(&Chroma2);
569 
570  cd_offset = L_Head + L_Base16 + L_Base4 + L_Base ;
571  SEEK(cd_offset + 4); readhqt(w,h,1);
572  SEEK(cd_offset + 5); decode(w,h,&Luma,nullplane,nullplane,0);
573 
574  cd_offset=ftell(fin);if(cd_offset % SECSIZE) error(E_POS);cd_offset/=SECSIZE;
575  SEEK(cd_offset+10); EREADBUF; cd_offhelp=(((long)sbuffer[2])<<8)|sbuffer[3];
576  SEEK(cd_offset+12); readhqt(w,h,3);
577  SEEK(cd_offset+cd_offhelp); decode(2*w,2*h,nullplane,&Chroma1,&Chroma2,1);
578 
579  }
580  ycctorgb(w,h,&Luma,&Chroma1,&Chroma2);
581  /* Now Luma holds red, Chroma1 hold green, Chroma2 holds blue */
582 
583  if(!ppmname) fout=stdout;
584  else
585  {if (!(fout=fopen(ppmname,"wb"))) error(E_WRITE);
586  }
587  writepicture(w,h,&Luma,&Chroma1,&Chroma2,turn);
588 
589  break;
590 
591  case S_16Base: w=BaseW*4;
592  h=BaseH*4;
593  planealloc(&Luma,w,h);
594  planealloc(&Chroma1,w,h);
595  planealloc(&Chroma2,w,h);
596 
598  error(readplain(w/4,h/4,&Luma,&Chroma1,&Chroma2));
599  interpolate(&Luma);
600  interpolate(&Chroma1);
601  interpolate(&Chroma1);
602  interpolate(&Chroma2);
603  interpolate(&Chroma2);
604 
605  cd_offset = L_Head + L_Base16 + L_Base4 + L_Base ;
606  SEEK(cd_offset + 4); readhqt(w/2,h/2,1);
607  SEEK(cd_offset + 5); decode(w/2,h/2,&Luma,nullplane,nullplane,0);
608  interpolate(&Luma);
609 
610  if(do_diff) {clear(&Luma,128);clear(&Chroma1,156);clear(&Chroma2,137);}
611 
612  cd_offset=ftell(fin);if(cd_offset % SECSIZE) error(E_POS);cd_offset/=SECSIZE;
613 
614  SEEK(cd_offset+12); readhqt(w,h,3);
615  SEEK(cd_offset+14); decode(w,h,&Luma,&Chroma1,&Chroma2,0);
616 
617  interpolate(&Chroma1);
618  interpolate(&Chroma2);
619 
620  ycctorgb(w,h,&Luma,&Chroma1,&Chroma2);
621  /* Now Luma holds red, Chroma1 hold green, Chroma2 holds blue */
622 
623  if(!ppmname) fout=stdout;
624  else
625  {if (!(fout=fopen(ppmname,"wb"))) error(E_WRITE);
626  }
627  writepicture(w,h,&Luma,&Chroma1,&Chroma2,turn);
628 
629  break;
630 
631  case S_Over: w=BaseW/4;
632  h=BaseH/4;
633 
634  planealloc(&Luma ,w,h);
635  planealloc(&Chroma1,w,h);
636  planealloc(&Chroma2,w,h);
637 
638  for(bildnr=0;!feof(fin);bildnr++)
639  {
640  SEEK(5+SeBase16*bildnr);
641 
642  eret=readplain(w,h,&Luma,&Chroma1,&Chroma2);
643  if(eret==E_READ) break;
644  error(eret);
645 
646  interpolate(&Chroma1);
647  interpolate(&Chroma2);
648 
649  ycctorgb(w,h,&Luma,&Chroma1,&Chroma2);
650  /* Now Luma holds red, Chroma1 hold green, Chroma2 holds blue */
651 
652  sprintf(nbuf,"%s%04d",ppmname,bildnr+1);
653  if (!(fout=fopen(nbuf,"wb"))) error(E_WRITE);
654  writepicture(w,h,&Luma,&Chroma1,&Chroma2,turn);
655  }
656  break;
657 
658  default: error(E_INTERN);
659  }
660 
661 
662 
663 
664 exit(0);
665 
666 
667 
668 }
669 #undef ASKIP
670 
671 
672 
673 
674 
675 
676 static enum ERRORS readplain(w,h,l,c1,c2)
677  dim w,h;
678  implane *l,*c1,*c2;
679  {dim i;
680  uBYTE *pl=0,*pc1=0,*pc2=0;
681  melde("readplain\n");
682 
683  if(l)
684  { if ((l->mwidth<w) || (l->mheight<h) || (!l->im)) error(E_INTERN);
685  l->iwidth=w;
686  l->iheight=h;
687  pl=l->im;
688  }
689 
690  if(c1)
691  { if ((c1->mwidth<w/2) || (c1->mheight<h/2) || (!c1->im)) error(E_INTERN);
692  c1->iwidth=w/2;
693  c1->iheight=h/2;
694  pc1=c1->im;
695  }
696 
697  if(c2)
698  { if ((c2->mwidth<w/2) || (c2->mheight<h/2) || (!c2->im)) error(E_INTERN);
699  c2->iwidth=w/2;
700  c2->iheight=h/2;
701  pc2=c2->im;
702  }
703 
704  for(i=0;i<h/2;i++)
705  {
706  if(pl)
707  {
708  if(fread(pl,w,1,fin)<1) return(E_READ);
709  pl+= l->mwidth;
710 
711  if(fread(pl,w,1,fin)<1) return(E_READ);
712  pl+= l->mwidth;
713  }
714  else SKIPr(2*w);
715 
716  if(pc1)
717  { if(fread(pc1,w/2,1,fin)<1) return(E_READ);
718  pc1+= c1->mwidth;
719  }
720  else SKIPr(w/2);
721 
722  if(pc2)
723  { if(fread(pc2,w/2,1,fin)<1) return(E_READ);
724  pc2+= c2->mwidth;
725  }
726  else SKIPr(w/2);
727 
728 
729  }
730  RPRINT;
731  return E_NONE;
732  }
733 
734 
735 
736 
737 
738 
739 
740 
741 
742 
743 
744 static void interpolate(p)
745  implane *p;
746  {dim w,h,x,y,yi;
747  uBYTE *optr,*nptr,*uptr;
748 
749  melde("interpolate\n");
750  if ((!p) || (!p->im)) error(E_INTERN);
751 
752  w=p->iwidth;
753  h=p->iheight;
754 
755  if(p->mwidth < 2*w ) error(E_INTERN);
756  if(p->mheight < 2*h ) error(E_INTERN);
757 
758 
759  p->iwidth=2*w;
760  p->iheight=2*h;
761 
762 
763  for(y=0;y<h;y++)
764  {yi=h-1-y;
765  optr=p->im+ yi*p->mwidth + (w-1);
766  nptr=p->im+2*yi*p->mwidth + (2*w - 2);
767 
768  nptr[0]=nptr[1]=optr[0];
769 
770  for(x=1;x<w;x++)
771  { optr--; nptr-=2;
772  nptr[0]=optr[0];
773  nptr[1]=(((int)optr[0])+((int)optr[1])+1)>>1;
774  }
775  }
776 
777  for(y=0;y<h-1;y++)
778  {optr=p->im + 2*y*p->mwidth;
779  nptr=optr+p->mwidth;
780  uptr=nptr+p->mwidth;
781 
782  for(x=0;x<w-1;x++)
783  {
784  nptr[0]=(((int)optr[0])+((int)uptr[0])+1)>>1;
785  nptr[1]=(((int)optr[0])+((int)optr[2])+((int)uptr[0])+((int)uptr[2])+2)>>2;
786  nptr+=2; optr+=2; uptr+=2;
787  }
788  *(nptr++)=(((int)*(optr++))+((int)*(uptr++))+1)>>1;
789  *(nptr++)=(((int)*(optr++))+((int)*(uptr++))+1)>>1;
790  }
791 
792 
793  optr=p->im + (2*h-2)*p->mwidth;
794  nptr=p->im + (2*h-1)*p->mwidth;
795  for(x=0;x<w;x++)
796  { *(nptr++) = *(optr++); *(nptr++) = *(optr++); }
797 
798  }
799 
800 
801 
802 
803 
804 
805 
806 
807 
808 
809 static void halve(p)
810  implane *p;
811  {dim w,h,x,y;
812  uBYTE *optr,*nptr;
813 
814  melde("halve\n");
815  if ((!p) || (!p->im)) error(E_INTERN);
816 
817  w=p->iwidth/=2;
818  h=p->iheight/=2;
819 
820 
821  for(y=0;y<h;y++)
822  {
823  nptr=(p->im) + y*(p->mwidth);
824  optr=(p->im) + 2*y*(p->mwidth);
825 
826  for(x=0;x<w;x++,nptr++,optr+=2)
827  { *nptr = *optr;
828  }
829 
830  }
831 
832  }
833 
834 
835 
836 
837 
838 
839 
840 
841 
842 
843 
844 #define BitShift 12
845 
846 static void ycctorgb(w,h,l,c1,c2)
847  dim w,h;
848  implane *l,*c1,*c2;
849  {dim x,y;
850  uBYTE *pl,*pc1,*pc2;
851  long red,green,blue,i;
852  long L;
853  static int init=0;
854  static long XL[256],XC1[256],XC2[256],XC1g[256],XC2g[256];
855 
856  melde("ycctorgb\n");
857  if((!l ) || ( l->iwidth != w ) || ( l->iheight != h) || (! l->im)) error(E_INTERN);
858  if((!c1) || (c1->iwidth != w ) || (c1->iheight != h) || (!c1->im)) error(E_INTERN);
859  if((!c2) || (c2->iwidth != w ) || (c2->iheight != h) || (!c2->im)) error(E_INTERN);
860 
861  if(do_sharp) sharpit(l);
862  if(keep_ycc) return;
863 
864  if(!init)
865  {init=1;
866  for(i=0;i<256;i++)
867  { XL[i]= 5564 * i + 2048;
868  XC1[i]= 9085 * i - 1417185;
869  XC2[i]= 7461 * i - 1022138;
870  XC1g[i]= 274934 - 1762 * i;
871  XC2g[i]= 520268 - 3798 * i;
872  }
873  }
874 
875  for(y=0;y<h;y++)
876  {
877  pl = l->im + y * l->mwidth;
878  pc1= c1->im + y * c1->mwidth;
879  pc2= c2->im + y * c2->mwidth;
880 
881  for(x=0;x<w;x++)
882  {
883  L = XL[*pl];
884  red =(L + XC2[*pc2] )>>BitShift;
885  green=(L + XC1g[*pc1] + XC2g[*pc2] )>>BitShift;
886  blue =(L + XC1[*pc1] )>>BitShift;
887 
888  NORM(red);
889  NORM(green);
890  NORM(blue);
891 
892  *(pl++ )=red;
893  *(pc1++)=green;
894  *(pc2++)=blue;
895  }
896  }
897  }
898 #undef BitShift
899 
900 
901 
902 
903 
904 
905 static void writepicture(w,h,r,g,b,t)
906  dim w,h;
907  implane *r,*g,*b;
908  enum TURNS t;
909  {dim x,y;
910  register uBYTE *pr,*pg,*pb;
911 #ifndef OWN_WRITE
912  pixel *pixrow;
913  register pixel* pP;
914 #else
915  static uBYTE BUF[own_BUsize],*BUptr;
916  int BUcount;
917 
918 #define BUinit {BUcount=0;BUptr=BUF;}
919 #define BUflush {fwrite(BUF,BUcount*3,1,fout);BUinit; }
920 #define BUwrite(r,g,b) {if(BUcount>=own_BUsize/3) BUflush; *BUptr++ = r ; *BUptr++ = g ; *BUptr++ = b ; BUcount++;}
921 
922 #endif
923 
924  melde("writepicture\n");
925  if((!r) || (r->iwidth != w ) || (r->iheight != h) || (!r->im)) error(E_INTERN);
926  if((!g) || (g->iwidth != w ) || (g->iheight != h) || (!g->im)) error(E_INTERN);
927  if((!b) || (b->iwidth != w ) || (b->iheight != h) || (!b->im)) error(E_INTERN);
928 
929  switch (t)
930  { case T_NONE:
931 #ifndef OWN_WRITE
932  ppm_writeppminit(fout,w,h,(pixval) 255, 0);
933  pixrow = ppm_allocrow( w );
934  for(y=0;y<h;y++)
935  {
936  pr= r->im + y * r->mwidth;
937  pg= g->im + y * g->mwidth;
938  pb= b->im + y * b->mwidth;
939 
940  for(pP= pixrow,x=0;x<w;x++)
941  {
942  PPM_ASSIGN(*pP,((int)*pr),((int)*pg),((int)*pb));
943  pP++; pr++; pg++; pb++;
944  }
945  ppm_writeppmrow( fout, pixrow, w, (pixval) 255, 0 );
946 
947  }
948  pm_close(fout);
949 #else
950  fprintf(fout,PPM_Header,w,h);
951  BUinit;
952  for(y=0;y<h;y++)
953  {
954  pr= r->im + y * r->mwidth;
955  pg= g->im + y * g->mwidth;
956  pb= b->im + y * b->mwidth;
957 
958  for(x=0;x<w;x++) BUwrite(*pr++,*pg++,*pb++);
959  }
960  BUflush;
961  if(ppmname) fclose(fout);
962 #endif
963  break;
964  case T_RIGHT:
965 #ifndef OWN_WRITE
966  ppm_writeppminit(fout,h,w,(pixval) 255, 0);
967  pixrow = ppm_allocrow( h );
968 
969  for(y=0;y<w;y++)
970  {
971  pr= r->im + r->mwidth * ( r->iheight - 1) + y;
972  pg= g->im + g->mwidth * ( g->iheight - 1) + y;
973  pb= b->im + b->mwidth * ( b->iheight - 1) + y;
974 
975  for(pP= pixrow,x=0;x<h;x++)
976  {
977  PPM_ASSIGN(*pP,((int)*pr),((int)*pg),((int)*pb));
978  pP++; pr-= r->mwidth; pg-= g->mwidth; pb-= b->mwidth;
979  }
980  ppm_writeppmrow( fout, pixrow, h, (pixval) 255, 0 );
981 
982  }
983  pm_close(fout);
984 #else
985  fprintf(fout,PPM_Header,h,w);
986  BUinit;
987  for(y=0;y<w;y++)
988  {
989  pr= r->im + r->mwidth * ( r->iheight - 1) + y;
990  pg= g->im + g->mwidth * ( g->iheight - 1) + y;
991  pb= b->im + b->mwidth * ( b->iheight - 1) + y;
992 
993  for(x=0;x<h;x++)
994  {BUwrite(*pr,*pg,*pb);
995  pr-= r->mwidth; pg-= g->mwidth; pb-= b->mwidth;
996  }
997  }
998  BUflush;
999  if(ppmname) fclose(fout);
1000 #endif
1001  break;
1002 
1003  case T_LEFT:
1004 #ifndef OWN_WRITE
1005  ppm_writeppminit(fout,h,w,(pixval) 255, 0);
1006  pixrow = ppm_allocrow( h );
1007 
1008  for(y=0;y<w;y++)
1009  {
1010  pr= r->im + r->iwidth - 1 - y;
1011  pg= g->im + g->iwidth - 1 - y;
1012  pb= b->im + b->iwidth - 1 - y;
1013 
1014 
1015 
1016  for(pP= pixrow,x=0;x<h;x++)
1017  {
1018  PPM_ASSIGN(*pP,((int)*pr),((int)*pg),((int)*pb));
1019  pP++; pr+= r->mwidth; pg+= g->mwidth; pb+= b->mwidth;
1020  }
1021  ppm_writeppmrow( fout, pixrow, h, (pixval) 255, 0 );
1022 
1023  }
1024  pm_close(fout);
1025 #else
1026  fprintf(fout,PPM_Header,h,w);
1027  BUinit;
1028  for(y=0;y<w;y++)
1029  {
1030  pr= r->im + r->iwidth - 1 - y;
1031  pg= g->im + g->iwidth - 1 - y;
1032  pb= b->im + b->iwidth - 1 - y;
1033 
1034  for(x=0;x<h;x++)
1035  {BUwrite(*pr,*pg,*pb);
1036  pr+= r->mwidth; pg+= g->mwidth; pb+= b->mwidth;
1037  }
1038  }
1039  BUflush;
1040  if(ppmname) fclose(fout);
1041 
1042 #endif
1043  break;
1044  default: error(E_INTERN);
1045  }
1046  }
1047 
1048 
1049 
1050 
1051 
1052 
1053 
1054 
1055 
1056 
1057 
1058 
1059 
1060 
1061 
1062 
1063 
1064 
1065 
1066 
1067 struct ph1
1068  {char id1[8];
1069  uBYTE ww1[14];
1070  char id2[20];
1071  char id3[4*16+4];
1072  short ww2;
1073  char id4[20];
1074  uBYTE ww3[2*16+1];
1075  char id5[4*16];
1076  uBYTE idx[11*16];
1077  } ;
1078 
1079 
1080 static void druckeid()
1081 {
1082  struct ph1 *d;
1083  char ss[100];
1084 
1085  d=(struct ph1 *)sbuffer;
1086 
1087 #define dr(feld,kennung) \
1088  strncpy(ss,feld,sizeof(feld));\
1089  ss[sizeof(feld)]=0;\
1090  fprintf(stderr,"%s: %s \n",kennung,ss);
1091 
1092 #define db(feld) fprintf(stderr,"--%d\n",sizeof(feld)); for(i=0;i<sizeof(feld);i+=2) \
1093  fprintf(stderr,"%4d %6d\n",i,(signed int)((((unsigned int)feld[i])<<8)|feld[i+1]));\
1094  fprintf(stderr,"\n");
1095 
1096 dr(d->id1,"Id1")
1097 dr(d->id2,"Id2")
1098 dr(d->id3,"Id3")
1099 dr(d->id4,"Id4")
1100 dr(d->id5,"Id5")
1101 
1102 /*
1103 db(d->ww1)
1104 db(d->ww3)
1105 db(d->idx)
1106 */
1107 
1108 #undef dr
1109 #undef db
1110 
1111 }
1112 
1113 
1114 
1115 struct pcdword
1117  };
1118 
1119 #define E ((unsigned long) 1)
1120 
1121 
1122 static void readhqtsub(source,ziel,anzahl)
1123  struct pcdhqt *source;
1124  struct myhqt *ziel;
1125  int *anzahl;
1126  {int i;
1127  struct pcdquad *sub;
1128  struct myhqt *help;
1129  *anzahl=(source->entries)+1;
1130 
1131  for(i=0;i<*anzahl;i++)
1132  {sub = (struct pcdquad *)(((uBYTE *)source)+1+i*sizeof(*sub));
1133  help=ziel+i;
1134 
1135  help->seq = (((unsigned long) sub->highseq) << 24) |(((unsigned long) sub->lowseq) << 16);
1136  help->len = ((unsigned long) sub->len) +1;
1137  help->key = sub->key;
1138 
1139 #ifdef DEBUGhuff
1140  fprintf(stderr," Anz: %d A1: %08x A2: %08x X:%02x %02x %02x %02x Seq: %08x Laenge: %d %d\n",
1141  *anzahl,sbuffer,sub,((uBYTE *)sub)[0],((uBYTE *)sub)[1],((uBYTE *)sub)[2],((uBYTE *)sub)[3],
1142  help->seq,help->len,sizeof(uBYTE));
1143 #endif
1144 
1145  if(help->len > 16) error(E_HUFF);
1146 
1147  help->mask = ~ ( (E << (32-help->len)) -1);
1148 
1149  }
1150 #ifdef DEBUG
1151  for(i=0;i<*anzahl;i++)
1152  {help=ziel+i;
1153  fprintf(stderr,"H: %3d %08lx & %08lx (%2d) = %02x = %5d %8x\n",
1154  i, help->seq,help->mask,help->len,help->key,(signed char)help->key,
1155  help->seq & (~help->mask));
1156  }
1157 #endif
1158 
1159 }
1160 
1161 #undef E
1162 
1163 static struct myhqt myhuff0[256],myhuff1[256],myhuff2[256];
1165 
1166 static void readhqt(w,h,n)
1167  dim w,h;
1168  int n;
1169  {
1170  uBYTE *ptr;
1171 
1172  melde("readhqt\n");
1173  EREADBUF;
1174  ptr = sbuffer;
1175 
1176  readhqtsub((struct pcdhqt *)ptr,myhuff0,&myhufflen0);
1177 
1178  if(n<2) return;
1179  ptr+= 1 + 4* myhufflen0;
1180  readhqtsub((struct pcdhqt *)ptr,myhuff1,&myhufflen1);
1181 
1182  if(n<3) return;
1183  ptr+= 1 + 4* myhufflen1;
1184  readhqtsub((struct pcdhqt *)ptr,myhuff2,&myhufflen2);
1185 
1186 }
1187 
1188 
1189 
1190 
1191 
1192 static void decode(w,h,f,f1,f2,autosync)
1193  dim w,h;
1194  implane *f,*f1,*f2;
1195  int autosync;
1196  {int i,htlen,sum;
1197  unsigned long sreg,maxwidth;
1198  unsigned int inh,n,zeile,segment,ident;
1199  struct myhqt *htptr,*hp;
1200 
1201  uBYTE *nptr;
1202  uBYTE *lptr;
1203 
1204  melde("decode\n");
1205 #define nextbuf { nptr=sbuffer; EREADBUF; }
1206 #define checkbuf { if (nptr >= sbuffer + sizeof(sbuffer)) nextbuf; }
1207 #define shiftout(n){ sreg<<=n; inh-=n; \
1208  while (inh<=24) \
1209  {checkbuf; \
1210  sreg |= ((unsigned long)(*(nptr++)))<<(24-inh);\
1211  inh+=8;\
1212  }\
1213  }
1214 #define issync ((sreg & 0xffffff00) == 0xfffffe00)
1215 #define seeksync { while (!issync) shiftout(1);}
1216 
1217 
1218  if( f && ((! f->im) || ( f->iheight < h ) || (f->iwidth<w ))) error(E_INTERN);
1219  if( f1 && ((!f1->im) || (f1->iheight < h/2) || (f1->iwidth<w/2))) error(E_INTERN);
1220  if( f2 && ((!f2->im) || (f2->iheight < h/2) || (f2->iwidth<w/2))) error(E_INTERN);
1221 
1222  htlen=sreg=maxwidth=0;
1223  htptr=0;
1224  nextbuf;
1225  inh=32;
1226  lptr=0;
1227  shiftout(16);
1228  shiftout(16);
1229 
1230  if(autosync) seeksync;
1231 
1232  n=0;
1233  for(;;)
1234  {
1235  if (issync)
1236  {shiftout(24);
1237  ident=sreg>>16;
1238  shiftout(16);
1239 
1240  zeile=(ident>>1) & 0x1fff;
1241  segment=ident>>14;
1242 
1243 #ifdef DEBUG
1244  fprintf(stderr,"Ident %4x Zeile: %6d Segment %3d Pixels bisher: %5d Position: %8lx\n",
1245  ident,zeile,segment,n,bufpos);
1246 #endif
1247 
1248 
1249  if(lptr && (n!=maxwidth)) error(E_SEQ1);
1250  n=0;
1251 
1252  if(zeile==h) {RPRINT; return; }
1253  if(zeile >h) error(E_SEQ2);
1254 
1255  switch(segment)
1256  {
1257  case 0: if((!f) && autosync) {seeksync; break;}
1258  if(!f) error(E_SEQ7);
1259  lptr=f->im + zeile*f->mwidth;
1260  maxwidth=f->iwidth;
1261  htlen=myhufflen0;
1262  htptr=myhuff0;
1263  break;
1264 
1265  case 2: if((!f1) && autosync) {seeksync; break;}
1266  if(!f1) error(E_SEQ7);
1267  lptr=f1->im + (zeile>>1)*f1->mwidth;
1268  maxwidth=f1->iwidth;
1269  htlen=myhufflen1;
1270  htptr=myhuff1;
1271  break;
1272 
1273  case 3: if((!f2) && autosync) {seeksync; break;}
1274  if(!f2) error(E_SEQ7);
1275  lptr=f2->im + (zeile>>1)*f2->mwidth;
1276  maxwidth=f2->iwidth;
1277  htlen=myhufflen2;
1278  htptr=myhuff2;
1279  break;
1280 
1281  default:error(E_SEQ3);
1282  }
1283  }
1284  else
1285  {
1286 /* if((!lptr) || (n>maxwidth)) error(E_SEQ4);*/
1287  if(!lptr) error(E_SEQ6);
1288  if(n>maxwidth) error(E_SEQ4);
1289  for(i=0,hp=htptr;(i<htlen) && ((sreg & hp->mask)!= hp->seq); i++,hp++);
1290  if(i>=htlen) error(E_SEQ5);
1291 
1292  sum=((int)(*lptr)) + ((sBYTE)hp->key);
1293  NORM(sum);
1294  *(lptr++) = sum;
1295 
1296  n++;
1297  shiftout(hp->len);
1298 
1299  }
1300 
1301  }
1302 
1303 
1304 #undef nextbuf
1305 #undef checkbuf
1306 #undef shiftout
1307 #undef issync
1308 #undef seeksync
1309 
1310  }
1311 
1312 
1313 
1314 
1315 static void clear(l,n)
1316  implane *l;
1317  int n;
1318 { dim x,y;
1319  uBYTE *ptr;
1320 
1321  ptr=l->im;
1322  for (x=0;x<l->mwidth;x++)
1323  for (y=0; y<l->mheight;y++)
1324  *(ptr++)=n;
1325 }
1326 
1327 
1328 
1329 #define slen 3072
1330 
1331 static void sharpit(l)
1332  implane *l;
1333  {int x,y,h,w,mw,akk;
1334  uBYTE f1[slen],f2[slen],*old,*akt,*ptr,*work,*help,*optr;
1335 
1336  if((!l) || (!l->im)) error(E_INTERN);
1337  if(l->iwidth > slen) error(E_INTERN);
1338 
1339  old=f1; akt=f2;
1340  h=l->iheight;
1341  w=l->iwidth;
1342  mw=l->mwidth;
1343 
1344  for(y=1;y<h-1;y++)
1345  {
1346  ptr=l->im+ y*mw;
1347  optr=ptr-mw;
1348  work=akt;
1349 
1350  *(work++)= *(ptr++);
1351  for(x=1;x<w-1;x++)
1352  { akk = 5*((int)ptr[0])- ((int)ptr[1]) - ((int)ptr[-1])
1353  - ((int)ptr[mw]) - ((int)ptr[-mw]);
1354  NORM(akk);
1355  *(work++)=akk;
1356  ptr++;
1357  }
1358 
1359  *(work++)= *(ptr++);
1360 
1361  if(y>1) memcpy(optr,old,w);
1362  help=old;old=akt;akt=help;
1363 
1364  }
1365 
1366 
1367 
1368  akt=optr+mw;
1369  for(x=0;x<w;x++)
1370  *(akt++) = *(old++);
1371  }
1372 
1373 
1374 #undef slen
1375 
1376 
1377 
1378 
1379 
1380 
1381 static int testbegin()
1382  {int i,j;
1383  for(i=j=0;i<32;i++)
1384  if(sbuffer[i]==0xff) j++;
1385 
1386  return (j>30);
1387 
1388  }
1389 
1390 static long Skip4Base()
1391  {long cd_offset,cd_offhelp;
1392 
1393  cd_offset = L_Head + L_Base16 + L_Base4 + L_Base ;
1394  SEEK(cd_offset+3);
1395  EREADBUF;
1396  cd_offhelp=((((long)sbuffer[510])<<8) | sbuffer[511]) + 1;
1397 
1398  cd_offset+=cd_offhelp;
1399 
1400  SEEK(cd_offset);
1401  EREADBUF;
1402  while(!testbegin())
1403  {cd_offset++;
1404  EREADBUF;
1405  }
1406  return cd_offset;
1407  }
static int pr(int(*writeFunc)(void *stream, const char *data, int size), void *stream, const char *data)
Definition: HTMLGen.cc:249
int maxwidth
Definition: afm2pfm.c:100
int source[257]
Definition: afm2tfm.c:928
#define BUF(x)
#define width(a)
Definition: aptex-macros.h:198
#define height(a)
Definition: aptex-macros.h:200
#define blue
Definition: backend_eps.c:37
#define green
Definition: backend_eps.c:36
#define red
Definition: backend_eps.c:35
#define n
Definition: t4ht.c:1290
#define b
Definition: jpegint.h:372
int w
Definition: dviconv.c:26
int h
Definition: dviconv.c:9
#define fopen
Definition: xxstdio.h:21
#define fread
Definition: xxstdio.h:25
#define ftell
Definition: xxstdio.h:31
int strcmp()
Definition: coll.cpp:143
unsigned int work(FILE *)
Definition: dvispc.c:1858
mpz_t * f
Definition: gen-fib.c:34
#define t
Definition: afcover.h:96
#define d(n)
Definition: gpos-common.c:151
#define memcpy(d, s, n)
Definition: gsftopk.c:64
unsigned char uBYTE
Definition: hpcdtoppm.c:61
#define E
Definition: hpcdtoppm.c:1119
#define issync
static void clear()
static void readhqtsub()
#define SEEK(x)
Definition: hpcdtoppm.c:156
unsigned long dim
Definition: hpcdtoppm.c:62
static int myhufflen0
Definition: hpcdtoppm.c:1164
#define nextbuf
static void writepicture()
static uBYTE sbuffer[0x800]
Definition: hpcdtoppm.c:136
static int myhufflen2
Definition: hpcdtoppm.c:1164
int main(int argc, char **argv)
Definition: hpcdtoppm.c:269
static long Skip4Base()
Definition: hpcdtoppm.c:1390
#define NORM(x)
Definition: hpcdtoppm.c:184
TURNS
Definition: hpcdtoppm.c:92
@ T_NONE
Definition: hpcdtoppm.c:92
@ T_LEFT
Definition: hpcdtoppm.c:92
@ T_RIGHT
Definition: hpcdtoppm.c:92
@ T_AUTO
Definition: hpcdtoppm.c:92
static void decode()
static int keep_ycc
Definition: hpcdtoppm.c:137
#define BaseH
Definition: hpcdtoppm.c:65
#define BitShift
Definition: hpcdtoppm.c:844
signed char sBYTE
Definition: hpcdtoppm.c:55
#define shiftout(n)
ERRORS
Definition: hpcdtoppm.c:88
@ E_SEQ2
Definition: hpcdtoppm.c:89
@ E_SEQ7
Definition: hpcdtoppm.c:89
@ E_SEQ6
Definition: hpcdtoppm.c:89
@ E_OVSKIP
Definition: hpcdtoppm.c:89
@ E_TAUTO
Definition: hpcdtoppm.c:90
@ E_TCANT
Definition: hpcdtoppm.c:90
@ E_ARG
Definition: hpcdtoppm.c:88
@ E_IMP
Definition: hpcdtoppm.c:89
@ E_MEM
Definition: hpcdtoppm.c:88
@ E_READ
Definition: hpcdtoppm.c:88
@ E_OPT
Definition: hpcdtoppm.c:88
@ E_SEQ
Definition: hpcdtoppm.c:89
@ E_SEQ5
Definition: hpcdtoppm.c:89
@ E_SEQ3
Definition: hpcdtoppm.c:89
@ E_SEQ1
Definition: hpcdtoppm.c:89
@ E_SEQ4
Definition: hpcdtoppm.c:89
@ E_POS
Definition: hpcdtoppm.c:89
@ E_HUFF
Definition: hpcdtoppm.c:88
@ E_WRITE
Definition: hpcdtoppm.c:88
@ E_NONE
Definition: hpcdtoppm.c:88
@ E_INTERN
Definition: hpcdtoppm.c:88
SIZES
Definition: hpcdtoppm.c:94
@ S_UNSPEC
Definition: hpcdtoppm.c:94
@ S_Base
Definition: hpcdtoppm.c:94
@ S_Base4
Definition: hpcdtoppm.c:94
@ S_Over
Definition: hpcdtoppm.c:94
@ S_Base16
Definition: hpcdtoppm.c:94
@ S_16Base
Definition: hpcdtoppm.c:94
@ S_4Base
Definition: hpcdtoppm.c:94
#define nullplane
Definition: hpcdtoppm.c:110
#define melde(x)
Definition: hpcdtoppm.c:166
#define S_DEFAULT
Definition: hpcdtoppm.c:97
static struct myhqt myhuff0[256]
Definition: hpcdtoppm.c:1163
static void ycctorgb()
#define seeksync
static struct myhqt myhuff2[256]
Definition: hpcdtoppm.c:1163
static char nbuf[100]
Definition: hpcdtoppm.c:135
#define BaseW
Definition: hpcdtoppm.c:64
#define slen
Definition: hpcdtoppm.c:1329
static enum ERRORS readplain()
static void readhqt()
#define L_Base
Definition: hpcdtoppm.c:81
static void planealloc()
static char * ppmname
Definition: hpcdtoppm.c:134
static FILE * fout
Definition: hpcdtoppm.c:133
static void halve()
#define dr(feld, kennung)
#define L_Base16
Definition: hpcdtoppm.c:75
#define EREADBUF
Definition: hpcdtoppm.c:176
#define L_Head
Definition: hpcdtoppm.c:72
static void druckeid()
Definition: hpcdtoppm.c:1080
#define RPRINT
Definition: hpcdtoppm.c:157
#define SECSIZE
Definition: hpcdtoppm.c:67
static char * pcdname
Definition: hpcdtoppm.c:134
#define ASKIP
#define L_Base4
Definition: hpcdtoppm.c:78
static FILE * fin
Definition: hpcdtoppm.c:133
static int myhufflen1
Definition: hpcdtoppm.c:1164
static void error()
Definition: cffdrivr.c:657
static struct myhqt myhuff1[256]
Definition: hpcdtoppm.c:1163
#define SKIPr(n)
Definition: hpcdtoppm.c:179
static int testbegin()
Definition: hpcdtoppm.c:1381
static void sharpit()
static void interpolate()
static int do_sharp
Definition: hpcdtoppm.c:137
#define SeBase16
Definition: hpcdtoppm.c:74
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
void exit()
kerning y
Definition: ttdriver.c:212
#define fclose
Definition: debug.h:100
#define fprintf
Definition: mendex.h:64
#define malloc
Definition: alloca.c:91
#define sprintf
Definition: snprintf.c:44
float x
Definition: cordic.py:15
static void do_info(const OpenType::Font &otf, ErrorHandler *errh, ErrorHandler *result_errh)
Definition: otfinfo.cc:387
#define ARGS(alist)
Definition: pbmplus.h:235
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld init[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head if pixblock_size cache_preload_simple endif process_pixblock_tail pixinterleave dst_w_basereg irp if pixblock_size chunk_size tst beq if DST_W else pixst DST_W else mov ORIG_W endif add lsl if lsl endif if lsl endif lsl endif lsl endif lsl endif subs mov DST_W if regs_shortage str endif bge start_of_loop_label endm macro generate_composite_function
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF sub
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
integer nptr[3999]
Definition: pmxab.c:511
#define pm_close(file)
Definition: png22pnm.c:120
void ppm_init(int *argcP, argv)
Definition: libppm1.c:21
void ppm_writeppmrow(FILE *file, pixel *pixelrow, int cols, pixval maxval, int forceplain)
Definition: libppm2.c:129
void ppm_writeppminit(FILE *file, int cols, int rows, pixval maxval, int forceplain)
Definition: libppm2.c:23
#define PPM_ASSIGN(p, red, grn, blu)
Definition: ppm.h:46
gray pixval
Definition: ppm.h:9
#define ppm_allocrow(cols)
Definition: ppm.h:72
static int size
Definition: ppmlabel.c:24
int g
Definition: ppmqvga.c:68
int r
Definition: ppmqvga.c:68
static pixel * pixrow
Definition: ppmtoilbm.c:128
static uint8_t * optr
Definition: buildvm_lib.c:14
size_t bufpos(caryll_Buffer *buf)
Definition: buffer.c:18
mp_ptr hp
Definition: sec_pi1_div.c:86
ShellFileEnvironment e
Definition: sh6.c:388
dim iwidth
Definition: hpcdtoppm.c:105
dim mwidth
Definition: hpcdtoppm.c:104
dim mheight
Definition: hpcdtoppm.c:104
dim iheight
Definition: hpcdtoppm.c:105
uBYTE * im
Definition: hpcdtoppm.c:106
unsigned long len
Definition: hpcdtoppm.c:114
uBYTE key
Definition: hpcdtoppm.c:114
unsigned long seq
Definition: hpcdtoppm.c:114
unsigned long mask
Definition: hpcdtoppm.c:114
uBYTE entries
Definition: hpcdtoppm.c:113
struct pcdquad entry[256]
Definition: hpcdtoppm.c:113
uBYTE len
Definition: hpcdtoppm.c:112
uBYTE key
Definition: hpcdtoppm.c:112
uBYTE lowseq
Definition: hpcdtoppm.c:112
uBYTE highseq
Definition: hpcdtoppm.c:112
uBYTE high
Definition: hpcdtoppm.c:1116
uBYTE low
Definition: hpcdtoppm.c:1116
char id2[20]
Definition: hpcdtoppm.c:1070
uBYTE ww1[14]
Definition: hpcdtoppm.c:1069
char id3[4 *16+4]
Definition: hpcdtoppm.c:1071
char id1[8]
Definition: hpcdtoppm.c:1068
char id4[20]
Definition: hpcdtoppm.c:1073
uBYTE ww3[2 *16+1]
Definition: hpcdtoppm.c:1074
uBYTE idx[11 *16]
Definition: hpcdtoppm.c:1076
char id5[4 *16]
Definition: hpcdtoppm.c:1075
short ww2
Definition: hpcdtoppm.c:1072
Definition: ppm.h:33
Definition: paths.h:128
Definition: sh.h:1345
Definition: dvips.h:235
#define c2
Definition: t1io.c:53
#define c1
Definition: t1io.c:52
#define FILE
Definition: t1stdio.h:34
#define feof(f)
Definition: t1stdio.h:109
int j
Definition: t4ht.c:1589
return() int(((double) *(font_tbl[cur_fnt].wtbl+(int)(*(font_tbl[cur_fnt].char_wi+(int)(ch - font_tbl[cur_fnt].char_f)% 256)))/(double)(1L<< 20)) *(double) font_tbl[cur_fnt].scale)
char ident[]
Definition: ttf2pk.c:40
@ L
Definition: ubidiimp.h:45
#define argv
Definition: xmain.c:270
#define argc
Definition: xmain.c:269