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 File Reference
#include <string.h>
#include "ppm.h"
Include dependency graph for hpcdtoppm.c:

Go to the source code of this file.

Classes

struct  _implane
 
struct  pcdquad
 
struct  pcdhqt
 
struct  myhqt
 
struct  ph1
 
struct  pcdword
 

Macros

#define xOWN_WRITE
 
#define xDEBUG
 
#define xMELDUNG
 
#define BaseW   ((dim)768)
 
#define BaseH   ((dim)512)
 
#define SECSIZE   0x800
 
#define SeHead   2
 
#define L_Head   (1+SeHead)
 
#define SeBase16   18
 
#define L_Base16   (1+SeBase16)
 
#define SeBase4   72
 
#define L_Base4   (1+SeBase4)
 
#define SeBase   288
 
#define L_Base   (1+SeBase)
 
#define S_DEFAULT   S_Base16
 
#define nullplane   ((implane *) 0)
 
#define SEEK(x)   { if (fseek(fin,((x) * SECSIZE),0)) error(E_READ);}
 
#define RPRINT
 
#define READBUF   fread(sbuffer,sizeof(sbuffer),1,fin)
 
#define melde(x)
 
#define EREADBUF   {if(READBUF < 1) error(E_READ);}
 
#define SKIP(n)   { if (fseek(fin,(n),1)) error(E_READ);}
 
#define SKIPr(n)   { if (fseek(fin,(n),1)) return(E_READ);}
 
#define xTRIF(x, u, o, a, b, c)   ((x)<(u)? (a) : ( (x)>(o)?(c):(b) ))
 
#define xNORM(x)   x=TRIF(x,0,255,0,x,255)
 
#define NORM(x)   { if(x<0) x=0; else if (x>255) x=255;}
 
#define ASKIP   { argc--; argv ++;}
 
#define BitShift   12
 
#define dr(feld, kennung)
 
#define db(feld)
 
#define E   ((unsigned long) 1)
 
#define nextbuf   { nptr=sbuffer; EREADBUF; }
 
#define checkbuf   { if (nptr >= sbuffer + sizeof(sbuffer)) nextbuf; }
 
#define shiftout(n)
 
#define issync   ((sreg & 0xffffff00) == 0xfffffe00)
 
#define seeksync   { while (!issync) shiftout(1);}
 
#define slen   3072
 

Typedefs

typedef signed char sBYTE
 
typedef unsigned char uBYTE
 
typedef unsigned long dim
 
typedef struct _implane implane
 

Enumerations

enum  ERRORS {
  E_NONE , E_READ , E_WRITE , E_INTERN ,
  E_ARG , E_OPT , E_MEM , E_HUFF ,
  E_SEQ , E_SEQ1 , E_SEQ2 , E_SEQ3 ,
  E_SEQ4 , E_SEQ5 , E_SEQ6 , E_SEQ7 ,
  E_POS , E_IMP , E_OVSKIP , E_TAUTO ,
  E_TCANT
}
 
enum  TURNS { T_NONE , T_RIGHT , T_LEFT , T_AUTO }
 
enum  SIZES {
  S_UNSPEC , S_Base16 , S_Base4 , S_Base ,
  S_4Base , S_16Base , S_Over
}
 

Functions

static void error ()
 
static void planealloc ()
 
static enum ERRORS readplain ()
 
static void interpolate ()
 
static void halve ()
 
static void ycctorgb ()
 
static void writepicture ()
 
static void druckeid ()
 
static void clear ()
 
static long Skip4Base ()
 
static void readhqt ()
 
static void decode ()
 
static void sharpit ()
 
static void readhqtsub ()
 
static int testbegin ()
 
static void error (enum ERRORS e)
 
static void planealloc (implane *p, dim width, dim height)
 
int main (int argc, char **argv)
 
static enum ERRORS readplain (dim w, dim h, implane *l, implane *c1, implane *c2)
 
static void interpolate (implane *p)
 
static void halve (implane *p)
 
static void ycctorgb (dim w, dim h, implane *l, implane *c1, implane *c2)
 
static void writepicture (dim w, dim h, implane *r, implane *g, implane *b, enum TURNS t)
 
static void readhqtsub (struct pcdhqt *source, struct myhqt *ziel, int *anzahl)
 
static void readhqt (dim w, dim h, int n)
 
static void decode (dim w, dim h, implane *f, implane *f1, implane *f2, int autosync)
 
static void clear (implane *l, int n)
 
static void sharpit (implane *l)
 

Variables

static FILEfin =0
 
static FILEfout =0
 
static char * pcdname =0
 
static char * ppmname =0
 
static char nbuf [100]
 
static uBYTE sbuffer [0x800]
 
static int do_sharp
 
static int keep_ycc
 
static struct myhqt myhuff0 [256]
 
static struct myhqt myhuff1 [256]
 
static struct myhqt myhuff2 [256]
 
static int myhufflen0 =0
 
static int myhufflen1 =0
 
static int myhufflen2 =0
 

Macro Definition Documentation

◆ ASKIP

#define ASKIP   { argc--; argv ++;}

◆ BaseH

#define BaseH   ((dim)512)

Definition at line 65 of file hpcdtoppm.c.

◆ BaseW

#define BaseW   ((dim)768)

Definition at line 64 of file hpcdtoppm.c.

◆ BitShift

#define BitShift   12

Definition at line 844 of file hpcdtoppm.c.

◆ checkbuf

#define checkbuf   { if (nptr >= sbuffer + sizeof(sbuffer)) nextbuf; }

◆ db

#define db (   feld)
Value:
fprintf(stderr,"--%d\n",sizeof(feld)); for(i=0;i<sizeof(feld);i+=2) \
fprintf(stderr,"%4d %6d\n",i,(signed int)((((unsigned int)feld[i])<<8)|feld[i+1]));\
fprintf(stderr,"\n");
small capitals from c petite p scientific i
Definition: afcover.h:80
#define fprintf
Definition: mendex.h:64
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)

◆ dr

#define dr (   feld,
  kennung 
)
Value:
strncpy(ss,feld,sizeof(feld));\
ss[sizeof(feld)]=0;\
fprintf(stderr,"%s: %s \n",kennung,ss);
char * strncpy()

◆ E

#define E   ((unsigned long) 1)

Definition at line 1119 of file hpcdtoppm.c.

◆ EREADBUF

#define EREADBUF   {if(READBUF < 1) error(E_READ);}

Definition at line 176 of file hpcdtoppm.c.

◆ issync

#define issync   ((sreg & 0xffffff00) == 0xfffffe00)

◆ L_Base

#define L_Base   (1+SeBase)

Definition at line 81 of file hpcdtoppm.c.

◆ L_Base16

#define L_Base16   (1+SeBase16)

Definition at line 75 of file hpcdtoppm.c.

◆ L_Base4

#define L_Base4   (1+SeBase4)

Definition at line 78 of file hpcdtoppm.c.

◆ L_Head

#define L_Head   (1+SeHead)

Definition at line 72 of file hpcdtoppm.c.

◆ melde

#define melde (   x)

Definition at line 166 of file hpcdtoppm.c.

◆ nextbuf

#define nextbuf   { nptr=sbuffer; EREADBUF; }

◆ NORM

#define NORM (   x)    { if(x<0) x=0; else if (x>255) x=255;}

Definition at line 184 of file hpcdtoppm.c.

◆ nullplane

#define nullplane   ((implane *) 0)

Definition at line 110 of file hpcdtoppm.c.

◆ READBUF

#define READBUF   fread(sbuffer,sizeof(sbuffer),1,fin)

Definition at line 158 of file hpcdtoppm.c.

◆ RPRINT

#define RPRINT

Definition at line 157 of file hpcdtoppm.c.

◆ S_DEFAULT

#define S_DEFAULT   S_Base16

Definition at line 97 of file hpcdtoppm.c.

◆ SeBase

#define SeBase   288

Definition at line 80 of file hpcdtoppm.c.

◆ SeBase16

#define SeBase16   18

Definition at line 74 of file hpcdtoppm.c.

◆ SeBase4

#define SeBase4   72

Definition at line 77 of file hpcdtoppm.c.

◆ SECSIZE

#define SECSIZE   0x800

Definition at line 67 of file hpcdtoppm.c.

◆ SEEK

#define SEEK (   x)    { if (fseek(fin,((x) * SECSIZE),0)) error(E_READ);}

Definition at line 156 of file hpcdtoppm.c.

◆ seeksync

#define seeksync   { while (!issync) shiftout(1);}

◆ SeHead

#define SeHead   2

Definition at line 71 of file hpcdtoppm.c.

◆ shiftout

#define shiftout (   n)
Value:
{ sreg<<=n; inh-=n; \
while (inh<=24) \
sreg |= ((unsigned long)(*(nptr++)))<<(24-inh);\
inh+=8;\
}\
}
#define n
Definition: t4ht.c:1290
#define checkbuf
integer nptr[3999]
Definition: pmxab.c:511

◆ SKIP

#define SKIP (   n)    { if (fseek(fin,(n),1)) error(E_READ);}

Definition at line 178 of file hpcdtoppm.c.

◆ SKIPr

#define SKIPr (   n)    { if (fseek(fin,(n),1)) return(E_READ);}

Definition at line 179 of file hpcdtoppm.c.

◆ slen

#define slen   3072

Definition at line 1329 of file hpcdtoppm.c.

◆ xDEBUG

#define xDEBUG

Definition at line 18 of file hpcdtoppm.c.

◆ xMELDUNG

#define xMELDUNG

Definition at line 22 of file hpcdtoppm.c.

◆ xNORM

#define xNORM (   x)    x=TRIF(x,0,255,0,x,255)

Definition at line 183 of file hpcdtoppm.c.

◆ xOWN_WRITE

#define xOWN_WRITE

Definition at line 14 of file hpcdtoppm.c.

◆ xTRIF

#define xTRIF (   x,
  u,
  o,
  a,
  b,
  c 
)    ((x)<(u)? (a) : ( (x)>(o)?(c):(b) ))

Definition at line 182 of file hpcdtoppm.c.

Typedef Documentation

◆ dim

typedef unsigned long dim

Definition at line 62 of file hpcdtoppm.c.

◆ implane

typedef struct _implane implane

Definition at line 62 of file hpcdtoppm.c.

◆ sBYTE

typedef signed char sBYTE

Definition at line 55 of file hpcdtoppm.c.

◆ uBYTE

typedef unsigned char uBYTE

Definition at line 61 of file hpcdtoppm.c.

Enumeration Type Documentation

◆ ERRORS

enum ERRORS
Enumerator
E_NONE 
E_READ 
E_WRITE 
E_INTERN 
E_ARG 
E_OPT 
E_MEM 
E_HUFF 
E_SEQ 
E_SEQ1 
E_SEQ2 
E_SEQ3 
E_SEQ4 
E_SEQ5 
E_SEQ6 
E_SEQ7 
E_POS 
E_IMP 
E_OVSKIP 
E_TAUTO 
E_TCANT 

Definition at line 88 of file hpcdtoppm.c.

◆ SIZES

enum SIZES
Enumerator
S_UNSPEC 
S_Base16 
S_Base4 
S_Base 
S_4Base 
S_16Base 
S_Over 

Definition at line 94 of file hpcdtoppm.c.

◆ TURNS

enum TURNS
Enumerator
T_NONE 
T_RIGHT 
T_LEFT 
T_AUTO 

Definition at line 92 of file hpcdtoppm.c.

Function Documentation

◆ clear() [1/2]

◆ clear() [2/2]

static void clear ( implane l,
int  n 
)
static

Definition at line 1315 of file hpcdtoppm.c.

References cutout::l, n, ptr, cordic::x, and y.

◆ decode() [1/2]

◆ decode() [2/2]

◆ druckeid()

static void druckeid ( )
static

Definition at line 1080 of file hpcdtoppm.c.

References d, dr, and sbuffer.

Referenced by main().

◆ error() [1/2]

static void error ( )
static

Definition at line 657 of file cffdrivr.c.

Referenced by decode(), halve(), interpolate(), main(), planealloc(), sharpit(), writepicture(), and ycctorgb().

◆ error() [2/2]

static void error ( enum ERRORS  e)
static

◆ halve() [1/2]

static void halve ( )
static

Referenced by Bezier::hit_recurse(), and main().

◆ halve() [2/2]

static void halve ( implane p)
static

Definition at line 809 of file hpcdtoppm.c.

References E_INTERN, error(), h, melde, nptr, optr, p, w, cordic::x, and y.

◆ interpolate() [1/2]

◆ interpolate() [2/2]

static void interpolate ( implane p)
static

Definition at line 744 of file hpcdtoppm.c.

References E_INTERN, error(), h, int(), melde, nptr, optr, p, w, cordic::x, and y.

◆ main()

◆ planealloc() [1/2]

static void planealloc ( )
static

Referenced by main().

◆ planealloc() [2/2]

static void planealloc ( implane p,
dim  width,
dim  height 
)
static

Definition at line 252 of file hpcdtoppm.c.

References E_MEM, error(), height, malloc, p, and width.

◆ readhqt() [1/2]

static void readhqt ( )
static

Referenced by main().

◆ readhqt() [2/2]

static void readhqt ( dim  w,
dim  h,
int  n 
)
static

Definition at line 1166 of file hpcdtoppm.c.

References EREADBUF, melde, myhuff0, myhuff1, myhuff2, myhufflen0, myhufflen1, myhufflen2, n, ptr, readhqtsub(), and sbuffer.

◆ readhqtsub() [1/2]

static void readhqtsub ( )
static

Referenced by readhqt().

◆ readhqtsub() [2/2]

static void readhqtsub ( struct pcdhqt source,
struct myhqt ziel,
int anzahl 
)
static

Definition at line 1122 of file hpcdtoppm.c.

◆ readplain() [1/2]

static enum ERRORS readplain ( )
static

Referenced by main().

◆ readplain() [2/2]

static enum ERRORS readplain ( dim  w,
dim  h,
implane l,
implane c1,
implane c2 
)
static

Definition at line 269 of file hpcdtoppm.c.

◆ sharpit() [1/2]

static void sharpit ( )
static

Referenced by ycctorgb().

◆ sharpit() [2/2]

static void sharpit ( implane l)
static

Definition at line 1331 of file hpcdtoppm.c.

References E_INTERN, error(), h, fc-lang::help, int(), cutout::l, memcpy, NORM, optr, ptr, slen, w, work(), cordic::x, and y.

◆ Skip4Base()

static long Skip4Base ( )
static

Definition at line 1390 of file hpcdtoppm.c.

References EREADBUF, L_Base, L_Base16, L_Base4, L_Head, sbuffer, SEEK, and testbegin().

Referenced by main().

◆ testbegin()

static int testbegin ( )
static

Definition at line 1381 of file hpcdtoppm.c.

References i, j, and sbuffer.

Referenced by Skip4Base().

◆ writepicture() [1/2]

static void writepicture ( )
static

Referenced by main().

◆ writepicture() [2/2]

static void writepicture ( dim  w,
dim  h,
implane r,
implane g,
implane b,
enum TURNS  t 
)
static

◆ ycctorgb() [1/2]

static void ycctorgb ( )
static

Referenced by main().

◆ ycctorgb() [2/2]

static void ycctorgb ( dim  w,
dim  h,
implane l,
implane c1,
implane c2 
)
static

Definition at line 846 of file hpcdtoppm.c.

References BitShift, blue, c1, c2, do_sharp, E_INTERN, error(), green, h, i, init, keep_ycc, cutout::l, L, melde, NORM, red, sharpit(), w, cordic::x, and y.

Variable Documentation

◆ do_sharp

int do_sharp
static

Definition at line 137 of file hpcdtoppm.c.

Referenced by main(), and ycctorgb().

◆ fin

◆ fout

FILE * fout =0
static

Definition at line 133 of file hpcdtoppm.c.

Referenced by error(), main(), and writepicture().

◆ keep_ycc

int keep_ycc
static

Definition at line 137 of file hpcdtoppm.c.

Referenced by main(), and ycctorgb().

◆ myhuff0

struct myhqt myhuff0[256]
static

Definition at line 1122 of file hpcdtoppm.c.

Referenced by decode(), and readhqt().

◆ myhuff1

struct myhqt myhuff1[256]
static

Definition at line 1163 of file hpcdtoppm.c.

Referenced by decode(), and readhqt().

◆ myhuff2

struct myhqt myhuff2[256]
static

Definition at line 1163 of file hpcdtoppm.c.

Referenced by decode(), and readhqt().

◆ myhufflen0

int myhufflen0 =0
static

Definition at line 1164 of file hpcdtoppm.c.

Referenced by decode(), and readhqt().

◆ myhufflen1

int myhufflen1 =0
static

Definition at line 1164 of file hpcdtoppm.c.

Referenced by decode(), and readhqt().

◆ myhufflen2

int myhufflen2 =0
static

Definition at line 1164 of file hpcdtoppm.c.

Referenced by decode(), and readhqt().

◆ nbuf

◆ pcdname

char* pcdname =0
static

Definition at line 134 of file hpcdtoppm.c.

Referenced by main().

◆ ppmname

char * ppmname =0
static

Definition at line 134 of file hpcdtoppm.c.

Referenced by error(), main(), and writepicture().

◆ sbuffer

uBYTE sbuffer[0x800]
static

Definition at line 136 of file hpcdtoppm.c.

Referenced by druckeid(), main(), readhqt(), Skip4Base(), and testbegin().