translated comments for imbuf c files

This commit is contained in:
2003-04-27 09:59:36 +00:00
parent 9508bb0d41
commit af45ac2703
13 changed files with 111 additions and 195 deletions

View File

@@ -218,8 +218,8 @@ static uchar *makebody(uchar **planes, short bytes, short depth, uchar *buf)
last = this;
this = *bitpl++;
if (last == this){
if (this == bitpl[-3]){ /* drie dezelfde? */
todo -= 1; /* todo goed zetten */
if (this == bitpl[-3]){ /* three identical ones? */
todo -= 1; /* set todo */
break;
}
}
@@ -248,8 +248,8 @@ static uchar *makebody(uchar **planes, short bytes, short depth, uchar *buf)
copy = FALSE;
}
else{
while (*bitpl++ == this){ /* zoek naar eerste afwijkende byte */
if (--todo == 0) break; /* of einde regel */
while (*bitpl++ == this){ /* search for first different bye */
if (--todo == 0) break; /* or end of line */
}
bitpl -= 1;
copy = bitpl-bitplstart;
@@ -486,7 +486,7 @@ struct ImBuf *imb_loadamiga(int *iffmem,int flags)
return(0);
}
/* vergeet stencil */
/* forget stencil */
ibuf->depth = bmhd.nPlanes;
if (flags & IB_rect){
@@ -507,7 +507,7 @@ struct ImBuf *imb_loadamiga(int *iffmem,int flags)
*rect++ = col;
}
ibuf->depth = 24;
} else if (ibuf->depth <= 8) { /* geen colormap en geen 24 bits: zwartwit */
} else if (ibuf->depth <= 8) { /* no colormap and no 24 bits: b&w */
uchar *rect;
int size, shift;

View File

@@ -46,32 +46,23 @@
#include <config.h>
#endif
/* werking:
/* how it works:
1 - zoek een overgang in een kolom
2 - kijk wat de relatie met links en rechts is,
Is pixel boven overgang links of rechts ervan gelijk aan bovenste kleur,
zoek dan naar beneden.
Is pixel onder overgang links of rechts ervan gelijk aan onderste kleur,
zoek dan naar boven.
1 - seek for a transistion in a collumn
2 - check the relationship with left and right,
Is pixel above transition to the left or right equal to the top color, seek down
Is pixel below transition to the left or right equal to the bottom color, seek up
*/
/* er moet een functie * komen die aan kan geven of twee kleuren nu
* wel of niet gelijk zijn.
* Voor nu maar een define
/* there should be a funcion * to indicate if two colors are
* equal or not.
* For now we use a define
*/
/*
zipfork "cc -g anti.c util.o -lgl_s -limbuf -limage -lm -o anti > /dev/console"
zipfork "anti /data/rt > /dev/console"
zipfork "anti /pics/martin/03.01.ChambFinal/0001 > /dev/console"
*/
static unsigned int anti_mask = 0xffffffff;
static int anti_a, anti_b, anti_g, anti_r;
@@ -162,12 +153,12 @@ static Edge * findmatch(Edge * first, Edge * edge)
if (first->next == 0) match = first;
else if (first->next->position >= edge->position) match = first;
} else if (first->col2 == edge->col1) {
match = 0; /* bij zigzagjes kan deze al 'ns foutief gezet zijn */
match = 0; /* at 'sig saw' situations this one can be wrongly set */
}
} else if (first->position == edge->position) {
if (first->col1 == edge->col1 || first->col2 == edge->col2) match = first;
} else {
if (match) break; /* er is er al een */
if (match) break; /* there is one */
if (first->col1 == edge->col1) {
if (first->prev == 0) match = first;
@@ -190,8 +181,8 @@ static void filterdraw(unsigned int * ldest, unsigned int * lsrce, int zero, int
int count;
double weight, add;
/* we filteren de pixels op ldest tussen in en out met pixels van lsrce
* Het gewicht loopt ondertussen van 0 naar 1
/* we filter the pixels at ldest between in and out with pixels from lsrce
* weight values go from 0 to 1
*/
@@ -218,7 +209,7 @@ static void filterdraw(unsigned int * ldest, unsigned int * lsrce, int zero, int
add = 0.5 / count;
weight = 0.5 * add;
/* dit moet natuurlijk gamma gecorrigeerd */
/* this of course gamma corrected */
for(; count > 0; count --) {
if (anti_a) dst[0] += weight * (src[0] - dst[0]);
@@ -260,11 +251,11 @@ static void filterimage(struct ImBuf * ibuf, struct ImBuf * cbuf, ListBase * lis
drawboth = FALSE;
if (left == 0 || right == 0) {
/* rand */
/* edge */
any = left;
if (right) any = right;
if (any) {
/* spiegelen */
/* mirroring */
pos = 2 * middle->position - any->position;
if (any->position < middle->position) {
@@ -290,18 +281,18 @@ static void filterimage(struct ImBuf * ibuf, struct ImBuf * cbuf, ListBase * lis
drawboth = TRUE;
}
} else if (left->position == middle->position || right->position == middle->position) {
/* recht stuk */
/* klein hoekje, met een van de twee op afstand 2 (ander is toch op afstand 0) ? */
/* straight piece */
/* small corner, with one of the two at distance 2 (the other is at dist 0) ? */
if (abs(left->position - right->position) == 2) drawboth = TRUE;
} else if (left->position < middle->position && right->position > middle->position){
/* trap 1 */
/* stair 1 */
drawboth = TRUE;
} else if (left->position > middle->position && right->position < middle->position){
/* trap 2 */
/* stair 2 */
drawboth = TRUE;
} else {
/* piek */
/* a peek */
drawboth = TRUE;
}
@@ -345,7 +336,7 @@ void IMB_antialias(struct ImBuf * ibuf)
}
/* intelligente scaling */
/* intelligent scaling */
static void _intel_scale(struct ImBuf * ibuf, ListBase * listarray, int dir)
{
@@ -440,12 +431,12 @@ void IMB_clever_double(struct ImBuf * ibuf)
for (i = 0; i < size; i++) {
curlist = listarray + i;
new = (Edge*)MEM_callocN(sizeof(Edge),"Edge");
new->col2 = ibuf->rect[i]; /* bovenste pixel */
new->col2 = ibuf->rect[i]; /* upper pixel */
new->col1 = new->col2 - 1;
BLI_addhead(curlist, new);
new = (Edge*)MEM_callocN(sizeof(Edge),"Edge");
new->position = ibuf->y - 1;
new->col1 = ibuf->rect[i + ((ibuf->y -1) * ibuf->x)]; /* onderste pixel */
new->col1 = ibuf->rect[i + ((ibuf->y -1) * ibuf->x)]; /* bottom pixel */
new->col2 = new->col1 - 1;
BLI_addtail(curlist, new);
}
@@ -458,12 +449,12 @@ void IMB_clever_double(struct ImBuf * ibuf)
for (i = 0; i < size; i++) {
curlist = listarray + i;
new = (Edge*)MEM_callocN(sizeof(Edge),"Edge");
new->col2 = ibuf->rect[i * ibuf->x]; /* linkse pixel */
new->col2 = ibuf->rect[i * ibuf->x]; /* left pixel */
new->col1 = new->col2 - 1;
BLI_addhead(curlist, new);
new = (Edge*)MEM_callocN(sizeof(Edge),"Edge");
new->position = ibuf->x - 1;
new->col1 = ibuf->rect[((i + 1) * ibuf->x) - 1]; /* rechtse pixel */
new->col1 = ibuf->rect[((i + 1) * ibuf->x) - 1]; /* right pixel */
new->col2 = new->col1 - 1;
BLI_addtail(curlist, new);
}

View File

@@ -52,7 +52,7 @@ unsigned int **imb_copyplanelist(struct ImBuf *ibuf)
unsigned int **listn,**listo;
nobp=ibuf->depth;
listn= malloc(nobp*sizeof(int *)); /* kopie van bitmap maken */
listn= malloc(nobp*sizeof(int *)); /* make copy of bitmap */
if (listn==0) return (0);
listo=ibuf->planes;
@@ -66,9 +66,9 @@ unsigned int **imb_copyplanelist(struct ImBuf *ibuf)
static void bptolscanl(unsigned int *buf, int size, unsigned int **list, int nobp, int offset)
{
/* zet bitplanes om in een buffer met ints
door 4 deelbare hoeveelheid bitplanes,
breedte bitplanes op ints afgrond */
/* converts bitplanes to a buffer with ints
by 4 dividiable amount of bitplanes,
the width of bitplanes is rounded at ints */
list += nobp;
@@ -183,7 +183,7 @@ void imb_bptolong(struct ImBuf *ibuf)
int nobp,i,x;
unsigned int *rect,offset;
/* eerst alle ints wissen */
/* first clear all ints */
if (ibuf == 0) return;
if (ibuf->planes == 0) return;
@@ -191,7 +191,7 @@ void imb_bptolong(struct ImBuf *ibuf)
nobp=ibuf->depth;
if (nobp != 32){
if (nobp == 24) IMB_rectoptot(ibuf, 0, IMB_rectfill, 0xff000000); /* alpha zetten */
if (nobp == 24) IMB_rectoptot(ibuf, 0, IMB_rectfill, 0xff000000); /* set alpha */
else IMB_rectoptot(ibuf, 0, IMB_rectfill, 0);
}
@@ -209,8 +209,8 @@ void imb_bptolong(struct ImBuf *ibuf)
static void ltobpscanl(unsigned int *rect, int x, unsigned int **list, int nobp, int offset)
{
/* zet een buffer met ints, om in bitplanes. Opgepast, buffer
wordt vernietigd !*/
/* converts a buffer with ints to bitplanes. Take care, buffer
will be destroyed !*/
if (nobp != 32)
{
@@ -338,8 +338,8 @@ static void ltobpscanl(unsigned int *rect, int x, unsigned int **list, int nobp,
void imb_longtobp(struct ImBuf *ibuf)
{
/* zet een buffer met ints, om in bitplanes. Opgepast, buffer
wordt vernietigd !*/
/* converts a buffer with ints to bitplanes. Take care, buffer
will be destroyed !*/
int nobp,i,x;
unsigned int *rect,offset,*buf;

View File

@@ -55,9 +55,8 @@ short alpha_col0 = FALSE;
/*
* er zit nog ergens een bug/inconsequentie in het programma. Als je een plaatje om wilt zetten
* naar een colormap met 1 bit resolutie krijg je een zwart plaatje. Zowieso alles met minder
* dan 4 bits is te donker.
* there still is a bug here. If you want to convert an image to a 1 bit colormap you get
* a black image. All conversion to less than 4 bits is too dark anyway.
*/
void IMB_freeImBufdata(void)
@@ -118,7 +117,6 @@ void imb_losecmapbits(struct ImBuf *ibuf, unsigned int *coltab)
static void addcmapbits(struct ImBuf *ibuf)
/* struct ImBuf *ibuf; */
{
int i,bits;
int div,mul;
@@ -155,7 +153,7 @@ static short addplanetocube(short *cube, short *plane, int minx, int miny, int s
short done = FALSE;
int x, numx, numy, skipc, skipp, temp;
/* eerst maar eens clippen */
/* clip first */
numx = numy = sizep;
@@ -213,7 +211,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
nocol = maxcol - mincol;
coltab += 4 * mincol;
/* kleuren terugbrengen tot juiste hoeveelheid bits */
/* reduce colors to the right amount of bits */
{
unsigned int * lctab, and;
@@ -224,7 +222,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
for (i=nocol-1 ; i >= 0 ; i--) lctab[i] = (lctab[i] & and) >> (8 - cbits);
}
/* zijn deze gegevens hetzelfde als de vorige ? */
/* is this data the same as previous ? */
if (lastcube){
if (mincol == lastmincol && maxcol == lastmaxcol && cbits == lastcbits){
@@ -258,7 +256,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
lastmaxcol = maxcol;
lastcbits = cbits;
/* cube initialiseren */
/* cube initialise */
cube = _cube;
for (i = (1 << (3 * cbits)); i > 0 ; i--){
@@ -267,7 +265,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
cube += 2;
}
/* error look up table aan maken */
/* mak error look up table */
{
unsigned int delta;
@@ -281,7 +279,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
}
}
/* colorplane initialiseren */
/* colorplane initialise */
for (i = 6 * nocol - 1; i >= 0; i--) _colp[i] = 1;
@@ -289,7 +287,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
addcg = (addcr << cbits);
addcb = (addcg << cbits);
/* eerste ronde invullen */
/* fill in first round */
{
unsigned int ofs;
@@ -299,7 +297,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
for (i = 0 ; i < nocol ; i++){
ofs = (col[3] * addcr) + (col[2] * addcg) + (col[1] * addcb);
/* is deze kleur al ingevuld -> dan overslaan */
/* color been filled in -> then skip */
if (cube[ofs + 1]) cube[ofs] = i + mincol;
cube[ofs + 1] = 0;
col += 4;
@@ -312,7 +310,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
done = FALSE;
sizep = 2*i +1;
/* plane initialiseren */
/* plane initialise */
{
unsigned int delta;
short *plane;
@@ -381,8 +379,6 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
static void convcmap(struct ImBuf* ibuf, short *deltab, short cbits)
/* struct ImBuf* ibuf; */
/* short *deltab,cbits; */
{
unsigned int *rect;
short x,y;
@@ -449,7 +445,7 @@ short IMB_converttocmap(struct ImBuf *ibuf)
convcmap(ibuf, deltab, cbits);
if (abuf) {
/* alpha omzetten naar kleur 0 */
/* convert alpha to color 0 */
rect = ibuf->rect;
arect = abuf->rect;
@@ -471,14 +467,11 @@ short IMB_converttocmap(struct ImBuf *ibuf)
void imb_makecolarray(struct ImBuf *ibuf, unsigned char *mem, short nocols)
/* struct ImBuf *ibuf; */
/* uchar *mem; */
/* short nocols; */
{
short i,bits = 0;
uchar *cmap;
/* wat is hier de theorie achter */
/* what's the theory behind this? */
nocols = ibuf->maxcol;
@@ -534,7 +527,6 @@ void imb_makecolarray(struct ImBuf *ibuf, unsigned char *mem, short nocols)
#define SWITCH_INT(a) {char s_i, *p_i; p_i= (char *)&(a); s_i= p_i[0]; p_i[0]= p_i[3]; p_i[3]= s_i; s_i= p_i[1]; p_i[1]= p_i[2]; p_i[2]= s_i; }
void IMB_applycmap(struct ImBuf *ibuf)
/* struct ImBuf *ibuf; */
{
unsigned int *rect, *cmap;
int x, y, i, col, code;
@@ -548,7 +540,7 @@ void IMB_applycmap(struct ImBuf *ibuf)
if (IS_ham(ibuf)){
/* masker genereren maximaal (8 + 2) bits */
/* generate mask of max (8 + 2) bits */
mask = malloc(1024 * 2 * sizeof(int));
x = 1 << (ibuf->depth - 2);
@@ -568,7 +560,7 @@ void IMB_applycmap(struct ImBuf *ibuf)
mask[i + x + x + x + 1024] = 0xff000000 | col << 8;
}
/* alleen kleur 0 transparant */
/* only color 0 transparant */
mask[0+1024] =ibuf->cmap[0];
for (y = ibuf->y ; y>0 ; y--){

View File

@@ -45,7 +45,6 @@
#endif
void imb_checkncols(struct ImBuf *ibuf)
/* struct ImBuf *ibuf; */
{
unsigned int i;
@@ -78,7 +77,7 @@ void imb_checkncols(struct ImBuf *ibuf)
}
return;
} else {
/* ibuf->maxcol is bepalend voor de diepte */
/* ibuf->maxcol defines the depth */
for (i=1 ; ibuf->maxcol > (1 << i); i++);
ibuf->depth = i;
return;
@@ -96,7 +95,7 @@ void IMB_de_interlace(struct ImBuf *ibuf)
ibuf->flags |= IB_fields;
if (ibuf->rect) {
/* kopieen aanmaken */
/* make copies */
tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);

View File

@@ -58,9 +58,6 @@ static void addhamdither(short x, unsigned char *dit,
short dmax, unsigned char *rgb,
unsigned short *ham,
short type, short round, short shift)
/* short x, dmax, type, round, shift; */
/* uchar *dit, *rgb; */
/* unsigned short *ham; */
{
short dx = 0;
short c1, c2;
@@ -102,27 +99,21 @@ static void convhamscanl(short x, short y,
unsigned char coltab[][4],
short *deltab,
short bits)
/* short x, y, bits; */
/* uchar *rgbbase; */
/* uchar coltab[][4]; */
/* short *deltab; */
{
int a, r, g, b, lr, lg, lb, dr, dg, db, col, fout, type, x2;
int round, shift;
uchar *rgb, dit[2];
unsigned short *ham, *hambase;
/* Opzet:
eerst wordt het gehele plaatje afgelopen, waarbij kleurovergangen gecodeerd
worden: FGRB XXXX XXXX
F - vrije kleurwaarde, mag door ieder veranderd worden
G/R/B - groen/rood/blauw ham overgang, alleen door die kleur te veranderen
XXXX XXXX - N bits waarde.
/* Concept:
first we check the entire image, where color transitions are coded: FGRB XXXX XXXX
F - free color value, can be changed by anyone
G/R/B - green/red/blue ham transition, only to be changed by this color
XXXX XXXX - N bits value.
0000 XXXX XXXX is palet kleur.
0000 XXXX XXXX is palette color.
daarna wordt eerst de groen dither toegevoegd, dan de rood dither en
tenslotte wordt blauwdither toegevoegd
after that first the green dither is added, then the red dither, and finally blue dither
*/
if ((hambase = (unsigned short *) malloc((x+4) * sizeof(unsigned short)))==0) return;
@@ -138,7 +129,7 @@ static void convhamscanl(short x, short y,
shift = 8 - bits;
round = 1 << (shift - 1);
/* om te voorkomen dat er 'ruis' ontstaat aan het einde van de regel */
/* to prevent 'noise' at the end of the line */
for (x2 = 3; x2 >= 0; x2 --) hambase[x + x2] = HAMFREE;
for (x2 = x ;x2 > 0; x2--){
@@ -254,7 +245,6 @@ static void convhamscanl(short x, short y,
short imb_converttoham(struct ImBuf *ibuf)
/* struct ImBuf* ibuf; */
{
unsigned int coltab[256],*rect;
short x,y,* deltab;

View File

@@ -200,21 +200,18 @@ float adat_distort = 1.0;
/*
*
* Nieuwe versie:
* New version:
*
* 32 helderheden Y 15 direct te bereiken (zwart & wit zijn specials)
* 16 kleuren H ue
* 7 intensiteiten S aturation
* 32 brighntesses Y 15 with direct access (black and white are specials)
* 16 colors H ue
* 7 intensities S aturation
*
* Totaal 3584 'verschillende' kleuren. Eerste 512 kleuren vrij.
* Total 3584 'different' colors. First 512 colors free.
*
*
*/
void imb_convhamx(struct ImBuf *ibuf, unsigned char coltab[][4], short *deltab)
/* struct ImBuf *ibuf; */
/* uchar coltab[][4]; */
/* short *deltab; */
{
short r,g,b,lr,lg,lb,dr,dg,db,col,fout,type,step;
int i;
@@ -294,9 +291,6 @@ void imb_convhamx(struct ImBuf *ibuf, unsigned char coltab[][4], short *deltab)
}
static short dec_hamx(struct ImBuf * ibuf, unsigned char *body, int cmap[])
/* struct ImBuf * ibuf; */
/* uchar *body; */
/* int cmap[]; */
{
int todo,i;
int j,step,col;
@@ -457,9 +451,6 @@ struct ImBuf *imb_loadanim(int *iffmem, int flags)
static unsigned char *makebody_anim(int bytes,
unsigned char *buf,
unsigned char *rect)
/* register uchar *buf; */
/* register uchar *rect; */
/* int bytes; */
{
register uchar last,this;
register int copy;
@@ -476,8 +467,8 @@ static unsigned char *makebody_anim(int bytes,
last = this;
this = *rect++;
if (last == this){
if (this == rect[-3]){ /* drie dezelfde? */
bytes --; /* bytes goed zetten */
if (this == rect[-3]){ /* three the same? */
bytes --; /* init bytes */
break;
}
}
@@ -505,8 +496,8 @@ static unsigned char *makebody_anim(int bytes,
copy = FALSE;
} else {
while (*rect++ == this){ /* zoek naar eerste afwijkende byte */
if (--bytes == 0) break; /* of einde regel */
while (*rect++ == this){ /* seek first different byte */
if (--bytes == 0) break; /* or end of line */
}
rect --;
copy = rect-rectstart;
@@ -533,8 +524,6 @@ static unsigned char *makebody_anim(int bytes,
short imb_enc_anim(struct ImBuf *ibuf, int file)
/* struct ImBuf *ibuf; */
/* int file; */
{
int step, size, i, skip, steps = 0;
uchar *buf1, *crect, *_buf1, *_buf2, *bufend;
@@ -544,7 +533,7 @@ short imb_enc_anim(struct ImBuf *ibuf, int file)
if (file < 0 ) return (0);
if (ibuf->rect == 0) return(0);
/* dither toevoegen */
/* add dither */
switch(ibuf->ftype){
case AN_hamx:

View File

@@ -62,8 +62,8 @@ unsigned short imb_start_iff(struct ImBuf *ibuf, int file)
*point++=BMHD;
*point++=sizeof(struct BitMapHeader);
bmhd=(struct BitMapHeader *)point; /* bmhd wijst naar plek waar bmhd moet komen */
point=(unsigned int *)((char *)point+sizeof(struct BitMapHeader)); /* pointer alvast verder zetten */
bmhd=(struct BitMapHeader *)point; /* bmhd points to location where bmhd will be */
point=(unsigned int *)((char *)point+sizeof(struct BitMapHeader)); /* advance pointer already */
bmhd->w=ibuf->x;
bmhd->h=ibuf->y;
@@ -93,7 +93,7 @@ unsigned short imb_start_iff(struct ImBuf *ibuf, int file)
*point++ = BIG_LONG(sizeof(struct Adat));
adat = (struct Adat *)point;
point = (unsigned int *)((char *)point+sizeof(struct Adat)); /* pointer alvast verder zetten */
point = (unsigned int *)((char *)point+sizeof(struct Adat)); /* advance pointer already */
adat->w = BIG_SHORT(ibuf->x);
adat->h = BIG_SHORT(ibuf->y);
@@ -180,11 +180,11 @@ unsigned short imb_update_iff(int file, int code)
if (file<=0) return (FALSE);
filelen = BLI_filesize(file)-8; /* filelengte berekenen */
filelen = BLI_filesize(file)-8; /* calc filelength */
lseek(file,0L,2); /* seek end */
if (filelen & 1){ /* lengte even maken */
if (filelen & 1){ /* make length 'even' */
switch(code){
case BODY:
nop = IFFNOP;
@@ -203,7 +203,7 @@ unsigned short imb_update_iff(int file, int code)
filelen-=4;
lseek(file,4L,1);
while (filelen>0){ /* zoek BODY op */
while (filelen>0){ /* seek BODY */
read(file, buf, 8);
filelen -= 8;
if (buf[0] == code) break;

View File

@@ -80,20 +80,6 @@
#define calloc(x,y) MEM_callocN((x)*(y), __FILE__)
#define freelist(x) BLI_freelistN(x)
/*
bindkey -r f1,'cc -O -c imbuf.c\n'
bindkeyo -r f1,'make paint \n'
bindkeyo -r f2,'paint /usr/4Dgifts/iristools/images/max5.rgb \n'
bindkey -r f1,'cc paint.c imbuf.c -lgl_s -lm -lfm_s -g -o paint\n'
bindkey -r f2,'/usr/people/bin/compres /usr/people/pics/0600\n'
compileren met:
lc -Lm -f8 -dAMIGA imbuf
*/
#ifdef SHLIB
void *(*ib_calloc)();
#define calloc(x,y) ib_calloc((x),(y))

View File

@@ -128,7 +128,6 @@ static uchar * file_data;
static int file_offset;
static unsigned short getshort(FILE *inf)
/* FILE *inf; */
{
unsigned char * buf;
@@ -139,7 +138,6 @@ static unsigned short getshort(FILE *inf)
}
static unsigned int getlong(FILE *inf)
/* FILE *inf; */
{
unsigned char * buf;
@@ -150,8 +148,6 @@ static unsigned int getlong(FILE *inf)
}
static void putshort(FILE *outf, unsigned short val)
/* FILE *outf; */
/* unsigned short val; */
{
unsigned char buf[2];
@@ -161,8 +157,6 @@ static void putshort(FILE *outf, unsigned short val)
}
static int putlong(FILE *outf, unsigned int val)
/* FILE *outf; */
/* unsigned int val; */
{
unsigned char buf[4];
@@ -174,8 +168,6 @@ static int putlong(FILE *outf, unsigned int val)
}
static void readheader(FILE *inf, IMAGE *image)
/* FILE *inf; */
/* IMAGE *image; */
{
memset(image, 0, sizeof(IMAGE));
image->imagic = getshort(inf);
@@ -187,8 +179,6 @@ static void readheader(FILE *inf, IMAGE *image)
}
static int writeheader(FILE *outf, IMAGE *image)
/* FILE *outf; */
/* IMAGE *image; */
{
IMAGE t;
@@ -208,9 +198,6 @@ static int writeheader(FILE *outf, IMAGE *image)
}
static int writetab(FILE *outf, unsigned int *tab, int len)
/* FILE *outf; */
/* unsigned int *tab; */
/* int len; */
{
int r = 0;
@@ -222,9 +209,6 @@ static int writetab(FILE *outf, unsigned int *tab, int len)
}
static void readtab(FILE *inf, unsigned int *tab, int len)
/* FILE *inf; */
/* unsigned int *tab; */
/* int len; */
{
while(len) {
*tab++ = getlong(inf);
@@ -399,7 +383,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
rect += 4;
}
} else if (image.zsize == 3){
/* alpha toevoegen */
/* add alpha */
rect = (uchar *) ibuf->rect;
for (x = ibuf->x * ibuf->y; x > 0; x--) {
rect[0] = 255;
@@ -423,8 +407,6 @@ struct ImBuf *imb_loadiris(unsigned char *mem, int flags)
/* static utility functions for longimagedata */
static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n)
/* unsigned char *lptr, *cptr; */
/* int z, n; */
{
lptr += z;
while(n--) {
@@ -481,8 +463,6 @@ static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n
*/
static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
/* unsigned char *optr, *iptr; */
/* int z; */
{
unsigned char pixel, count;
@@ -635,8 +615,6 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, int
/* static utility functions for output_iris */
static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n)
/* unsigned char *rgbptr, *lumptr; */
/* int n; */
{
lumptr += CHANOFFSET(0);
while(n--) {
@@ -647,8 +625,6 @@ static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n)
}
static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cnt)
/* unsigned char *lbuf, *rlebuf; */
/* int z, cnt; */
{
unsigned char *iptr, *ibufend, *sptr, *optr;
short todo, cc;

View File

@@ -65,20 +65,16 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
#endif
/*
* Er zijn in principe vier verschillende jpeg formaten.
* In principle there are 4 jpeg formats.
*
* 1. jpeg - standaard drukwerk, u & v op kwart van resolutie
* 2. jvid - standaard video u & v halve resolutie, frame opengeklapt
* 1. jpeg - standard printing, u & v at quarter of resulution
* 2. jvid - standaard video, u & v half resolution, frame not interlaced
type 3 is unsupported as of jul 05 2000 Frank.
* 3. jstr - als 2, maar dan met twee losse fields weggeschreven
* moet baseline zijn
* moet rgb zijn
* moet samplingfactors goed hebben
* 3. jstr - as 2, but written in 2 seperate fields
* 4. jmax - geen scaling in de componenten
* 4. jmax - no scaling in the components
*/
static int jpeg_failed = FALSE;
@@ -253,7 +249,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
struct ImBuf * ibuf = 0;
uchar * rect;
/* eigen app1 handler installeren */
/* install own app1 handler */
ibuf_ftype = 0;
jpeg_set_marker_processor(cinfo, 0xe1, handle_app1);
cinfo->dct_method = JDCT_FLOAT;
@@ -488,7 +484,7 @@ static int init_jpeg(FILE * outfile, struct jpeg_compress_struct * cinfo, struct
}
jpeg_set_defaults(cinfo);
/* eigen instellingen */
/* own settings */
cinfo->dct_method = JDCT_FLOAT;
jpeg_set_quality(cinfo, quality, TRUE);
@@ -535,7 +531,7 @@ static int save_vidjpeg(char * name, struct ImBuf * ibuf)
init_jpeg(outfile, cinfo, ibuf);
/* scalings factoren goedzetten */
/* adjust scaling factors */
if (cinfo->in_color_space == JCS_RGB) {
cinfo->comp_info[0].h_samp_factor = 2;
cinfo->comp_info[0].v_samp_factor = 1;
@@ -601,7 +597,7 @@ static int save_maxjpeg(char * name, struct ImBuf * ibuf)
init_jpeg(outfile, cinfo, ibuf);
/* scalings factoren goedzetten */
/* adjust scaling factors */
if (cinfo->in_color_space == JCS_RGB) {
cinfo->comp_info[0].h_samp_factor = 1;
cinfo->comp_info[0].v_samp_factor = 1;

View File

@@ -104,7 +104,7 @@ ImBuf *IMB_ibImageFromMemory(int *mem, int size, int flags) {
if (GET_ID(mem) == FORM){
if (GET_ID(mem+2) == ILBM){
return (imb_loadamiga(mem, flags));
} else if (GET_ID(mem+5) == ILBM){ /* animaties */
} else if (GET_ID(mem+5) == ILBM){ /* animations */
return (imb_loadamiga(mem+3, flags));
} else if (GET_ID(mem+2) == ANIM){
return (imb_loadanim(mem, flags));
@@ -154,7 +154,7 @@ struct ImBuf *IMB_loadiffmem(int *mem, int flags) {
if (GET_ID(mem) == FORM){
if (GET_ID(mem+2) == ILBM){
return (imb_loadamiga(mem, flags));
} else if (GET_ID(mem+5) == ILBM){ /* animaties */
} else if (GET_ID(mem+5) == ILBM){ /* animations */
return (imb_loadamiga(mem+3, flags));
} else if (GET_ID(mem+2) == ANIM){
return (imb_loadanim(mem, flags));

View File

@@ -111,7 +111,7 @@ static int tga_out4(unsigned int data, FILE * file)
uchar *p;
p = (uchar *) & data;
/* volgorde = bgra */
/* order = bgra */
if (putc(p[2],file) == EOF) return(EOF);
if (putc(p[1],file) == EOF) return(EOF);
if (putc(p[0],file) == EOF) return(EOF);
@@ -138,8 +138,8 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
last = this;
this = *rect++;
if (last == this){
if (this == rect[-3]){ /* drie dezelfde? */
bytes --; /* bytes goed zetten */
if (this == rect[-3]){ /* three the same? */
bytes --; /* set bytes */
break;
}
}
@@ -167,8 +167,8 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
copy = FALSE;
} else {
while (*rect++ == this){ /* zoek naar eerste afwijkende byte */
if (--bytes == 0) break; /* of einde regel */
while (*rect++ == this){ /* seek for first different byte */
if (--bytes == 0) break; /* oor end of line */
}
rect --;
copy = rect-rectstart;
@@ -254,7 +254,7 @@ short imb_savetarga(struct ImBuf * ibuf, int file, int flags)
memset(buf,0,sizeof(buf));
/* buf[0] = 0; lengte string */
/* buf[0] = 0; length string */
buf[16] = (ibuf->depth + 0x7 ) & ~0x7;
if (ibuf->cmap) {
@@ -372,9 +372,6 @@ int imb_is_a_targa(void *buf) {
}
static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, int psize)
/* struct ImBuf *ibuf; */
/* uchar *mem; */
/* int psize; */
{
int count, col, size;
unsigned int *rect;
@@ -386,7 +383,7 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, int psize)
size = ibuf->x * ibuf->y;
rect = ibuf->rect;
/* alpha zetten */
/* set alpha */
cp[0] = 0xff;
cp[1] = cp[2] = 0;
@@ -398,7 +395,7 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, int psize)
if (psize & 2){
if (psize & 1){
/* volgorde = bgra */
/* order = bgra */
cp[0] = mem[3];
cp[1] = mem[0];
cp[2] = mem[1];
@@ -435,7 +432,7 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, int psize)
while (count > 0){
if (psize & 2){
if (psize & 1){
/* volgorde = bgra */
/* order = bgra */
cp[0] = mem[3];
cp[1] = mem[0];
cp[2] = mem[1];
@@ -478,14 +475,14 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, int psize)
size = ibuf->x * ibuf->y;
rect = ibuf->rect;
/* alpha zetten */
/* set alpha */
cp[0] = 0xff;
cp[1] = cp[2] = 0;
while(size > 0){
if (psize & 2){
if (psize & 1){
/* volgorde = bgra */
/* order = bgra */
cp[0] = mem[3];
cp[1] = mem[0];
cp[2] = mem[1];
@@ -493,7 +490,7 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, int psize)
/*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
mem += 4;
} else{
/* zet alpha bij 24 bits kleuren */
/* set alpha for 24 bits colors */
cp[1] = mem[0];
cp[2] = mem[1];
cp[3] = mem[2];
@@ -571,14 +568,14 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, int flags)
for (col = ibuf->maxcol - 1; col > 0; col >>= 1) size++;
ibuf->depth = size;
if (tga.mapbits != 32) { /* alpha bits zetten */
if (tga.mapbits != 32) { /* set alpha bits */
ibuf->cmap[0] &= BIG_LONG(0x00ffffff);
}
}
if (flags & IB_test) return (ibuf);
if (tga.imgtyp != 1 && tga.imgtyp != 9) IMB_freecmapImBuf(ibuf); /* kan soms gebeuren (beuh) */
if (tga.imgtyp != 1 && tga.imgtyp != 9) IMB_freecmapImBuf(ibuf); /* happens sometimes (beuh) */
switch(tga.imgtyp){
case 1: