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

View File

@@ -46,32 +46,23 @@
#include <config.h> #include <config.h>
#endif #endif
/* werking: /* how it works:
1 - zoek een overgang in een kolom 1 - seek for a transistion in a collumn
2 - kijk wat de relatie met links en rechts is, 2 - check the relationship with left and right,
Is pixel boven overgang links of rechts ervan gelijk aan bovenste kleur, Is pixel above transition to the left or right equal to the top color, seek down
zoek dan naar beneden.
Is pixel onder overgang links of rechts ervan gelijk aan onderste kleur,
zoek dan naar boven.
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 /* there should be a funcion * to indicate if two colors are
* wel of niet gelijk zijn. * equal or not.
* Voor nu maar een define * 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 unsigned int anti_mask = 0xffffffff;
static int anti_a, anti_b, anti_g, anti_r; 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; if (first->next == 0) match = first;
else if (first->next->position >= edge->position) match = first; else if (first->next->position >= edge->position) match = first;
} else if (first->col2 == edge->col1) { } 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) { } else if (first->position == edge->position) {
if (first->col1 == edge->col1 || first->col2 == edge->col2) match = first; if (first->col1 == edge->col1 || first->col2 == edge->col2) match = first;
} else { } else {
if (match) break; /* er is er al een */ if (match) break; /* there is one */
if (first->col1 == edge->col1) { if (first->col1 == edge->col1) {
if (first->prev == 0) match = first; if (first->prev == 0) match = first;
@@ -190,8 +181,8 @@ static void filterdraw(unsigned int * ldest, unsigned int * lsrce, int zero, int
int count; int count;
double weight, add; double weight, add;
/* we filteren de pixels op ldest tussen in en out met pixels van lsrce /* we filter the pixels at ldest between in and out with pixels from lsrce
* Het gewicht loopt ondertussen van 0 naar 1 * 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; add = 0.5 / count;
weight = 0.5 * add; weight = 0.5 * add;
/* dit moet natuurlijk gamma gecorrigeerd */ /* this of course gamma corrected */
for(; count > 0; count --) { for(; count > 0; count --) {
if (anti_a) dst[0] += weight * (src[0] - dst[0]); 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; drawboth = FALSE;
if (left == 0 || right == 0) { if (left == 0 || right == 0) {
/* rand */ /* edge */
any = left; any = left;
if (right) any = right; if (right) any = right;
if (any) { if (any) {
/* spiegelen */ /* mirroring */
pos = 2 * middle->position - any->position; pos = 2 * middle->position - any->position;
if (any->position < middle->position) { if (any->position < middle->position) {
@@ -290,18 +281,18 @@ static void filterimage(struct ImBuf * ibuf, struct ImBuf * cbuf, ListBase * lis
drawboth = TRUE; drawboth = TRUE;
} }
} else if (left->position == middle->position || right->position == middle->position) { } else if (left->position == middle->position || right->position == middle->position) {
/* recht stuk */ /* straight piece */
/* klein hoekje, met een van de twee op afstand 2 (ander is toch op afstand 0) ? */ /* 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; if (abs(left->position - right->position) == 2) drawboth = TRUE;
} else if (left->position < middle->position && right->position > middle->position){ } else if (left->position < middle->position && right->position > middle->position){
/* trap 1 */ /* stair 1 */
drawboth = TRUE; drawboth = TRUE;
} else if (left->position > middle->position && right->position < middle->position){ } else if (left->position > middle->position && right->position < middle->position){
/* trap 2 */ /* stair 2 */
drawboth = TRUE; drawboth = TRUE;
} else { } else {
/* piek */ /* a peek */
drawboth = TRUE; 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) 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++) { for (i = 0; i < size; i++) {
curlist = listarray + i; curlist = listarray + i;
new = (Edge*)MEM_callocN(sizeof(Edge),"Edge"); 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; new->col1 = new->col2 - 1;
BLI_addhead(curlist, new); BLI_addhead(curlist, new);
new = (Edge*)MEM_callocN(sizeof(Edge),"Edge"); new = (Edge*)MEM_callocN(sizeof(Edge),"Edge");
new->position = ibuf->y - 1; 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; new->col2 = new->col1 - 1;
BLI_addtail(curlist, new); BLI_addtail(curlist, new);
} }
@@ -458,12 +449,12 @@ void IMB_clever_double(struct ImBuf * ibuf)
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
curlist = listarray + i; curlist = listarray + i;
new = (Edge*)MEM_callocN(sizeof(Edge),"Edge"); 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; new->col1 = new->col2 - 1;
BLI_addhead(curlist, new); BLI_addhead(curlist, new);
new = (Edge*)MEM_callocN(sizeof(Edge),"Edge"); new = (Edge*)MEM_callocN(sizeof(Edge),"Edge");
new->position = ibuf->x - 1; 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; new->col2 = new->col1 - 1;
BLI_addtail(curlist, new); BLI_addtail(curlist, new);
} }

View File

@@ -52,7 +52,7 @@ unsigned int **imb_copyplanelist(struct ImBuf *ibuf)
unsigned int **listn,**listo; unsigned int **listn,**listo;
nobp=ibuf->depth; 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); if (listn==0) return (0);
listo=ibuf->planes; 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) static void bptolscanl(unsigned int *buf, int size, unsigned int **list, int nobp, int offset)
{ {
/* zet bitplanes om in een buffer met ints /* converts bitplanes to a buffer with ints
door 4 deelbare hoeveelheid bitplanes, by 4 dividiable amount of bitplanes,
breedte bitplanes op ints afgrond */ the width of bitplanes is rounded at ints */
list += nobp; list += nobp;
@@ -183,7 +183,7 @@ void imb_bptolong(struct ImBuf *ibuf)
int nobp,i,x; int nobp,i,x;
unsigned int *rect,offset; unsigned int *rect,offset;
/* eerst alle ints wissen */ /* first clear all ints */
if (ibuf == 0) return; if (ibuf == 0) return;
if (ibuf->planes == 0) return; if (ibuf->planes == 0) return;
@@ -191,7 +191,7 @@ void imb_bptolong(struct ImBuf *ibuf)
nobp=ibuf->depth; nobp=ibuf->depth;
if (nobp != 32){ 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); 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) 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 /* converts a buffer with ints to bitplanes. Take care, buffer
wordt vernietigd !*/ will be destroyed !*/
if (nobp != 32) 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) void imb_longtobp(struct ImBuf *ibuf)
{ {
/* zet een buffer met ints, om in bitplanes. Opgepast, buffer /* converts a buffer with ints to bitplanes. Take care, buffer
wordt vernietigd !*/ will be destroyed !*/
int nobp,i,x; int nobp,i,x;
unsigned int *rect,offset,*buf; 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 * there still is a bug here. If you want to convert an image to a 1 bit colormap you get
* naar een colormap met 1 bit resolutie krijg je een zwart plaatje. Zowieso alles met minder * a black image. All conversion to less than 4 bits is too dark anyway.
* dan 4 bits is te donker.
*/ */
void IMB_freeImBufdata(void) void IMB_freeImBufdata(void)
@@ -118,7 +117,6 @@ void imb_losecmapbits(struct ImBuf *ibuf, unsigned int *coltab)
static void addcmapbits(struct ImBuf *ibuf) static void addcmapbits(struct ImBuf *ibuf)
/* struct ImBuf *ibuf; */
{ {
int i,bits; int i,bits;
int div,mul; int div,mul;
@@ -155,7 +153,7 @@ static short addplanetocube(short *cube, short *plane, int minx, int miny, int s
short done = FALSE; short done = FALSE;
int x, numx, numy, skipc, skipp, temp; int x, numx, numy, skipc, skipp, temp;
/* eerst maar eens clippen */ /* clip first */
numx = numy = sizep; numx = numy = sizep;
@@ -213,7 +211,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
nocol = maxcol - mincol; nocol = maxcol - mincol;
coltab += 4 * mincol; coltab += 4 * mincol;
/* kleuren terugbrengen tot juiste hoeveelheid bits */ /* reduce colors to the right amount of bits */
{ {
unsigned int * lctab, and; 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); 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 (lastcube){
if (mincol == lastmincol && maxcol == lastmaxcol && cbits == lastcbits){ if (mincol == lastmincol && maxcol == lastmaxcol && cbits == lastcbits){
@@ -258,7 +256,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
lastmaxcol = maxcol; lastmaxcol = maxcol;
lastcbits = cbits; lastcbits = cbits;
/* cube initialiseren */ /* cube initialise */
cube = _cube; cube = _cube;
for (i = (1 << (3 * cbits)); i > 0 ; i--){ 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; cube += 2;
} }
/* error look up table aan maken */ /* mak error look up table */
{ {
unsigned int delta; 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; 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); addcg = (addcr << cbits);
addcb = (addcg << cbits); addcb = (addcg << cbits);
/* eerste ronde invullen */ /* fill in first round */
{ {
unsigned int ofs; unsigned int ofs;
@@ -299,7 +297,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
for (i = 0 ; i < nocol ; i++){ for (i = 0 ; i < nocol ; i++){
ofs = (col[3] * addcr) + (col[2] * addcg) + (col[1] * addcb); 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; if (cube[ofs + 1]) cube[ofs] = i + mincol;
cube[ofs + 1] = 0; cube[ofs + 1] = 0;
col += 4; col += 4;
@@ -312,7 +310,7 @@ short *imb_coldeltatab(unsigned char *coltab, short mincol, short maxcol, short
done = FALSE; done = FALSE;
sizep = 2*i +1; sizep = 2*i +1;
/* plane initialiseren */ /* plane initialise */
{ {
unsigned int delta; unsigned int delta;
short *plane; 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) static void convcmap(struct ImBuf* ibuf, short *deltab, short cbits)
/* struct ImBuf* ibuf; */
/* short *deltab,cbits; */
{ {
unsigned int *rect; unsigned int *rect;
short x,y; short x,y;
@@ -449,7 +445,7 @@ short IMB_converttocmap(struct ImBuf *ibuf)
convcmap(ibuf, deltab, cbits); convcmap(ibuf, deltab, cbits);
if (abuf) { if (abuf) {
/* alpha omzetten naar kleur 0 */ /* convert alpha to color 0 */
rect = ibuf->rect; rect = ibuf->rect;
arect = abuf->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) void imb_makecolarray(struct ImBuf *ibuf, unsigned char *mem, short nocols)
/* struct ImBuf *ibuf; */
/* uchar *mem; */
/* short nocols; */
{ {
short i,bits = 0; short i,bits = 0;
uchar *cmap; uchar *cmap;
/* wat is hier de theorie achter */ /* what's the theory behind this? */
nocols = ibuf->maxcol; 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; } #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) void IMB_applycmap(struct ImBuf *ibuf)
/* struct ImBuf *ibuf; */
{ {
unsigned int *rect, *cmap; unsigned int *rect, *cmap;
int x, y, i, col, code; int x, y, i, col, code;
@@ -548,7 +540,7 @@ void IMB_applycmap(struct ImBuf *ibuf)
if (IS_ham(ibuf)){ if (IS_ham(ibuf)){
/* masker genereren maximaal (8 + 2) bits */ /* generate mask of max (8 + 2) bits */
mask = malloc(1024 * 2 * sizeof(int)); mask = malloc(1024 * 2 * sizeof(int));
x = 1 << (ibuf->depth - 2); x = 1 << (ibuf->depth - 2);
@@ -568,7 +560,7 @@ void IMB_applycmap(struct ImBuf *ibuf)
mask[i + x + x + x + 1024] = 0xff000000 | col << 8; mask[i + x + x + x + 1024] = 0xff000000 | col << 8;
} }
/* alleen kleur 0 transparant */ /* only color 0 transparant */
mask[0+1024] =ibuf->cmap[0]; mask[0+1024] =ibuf->cmap[0];
for (y = ibuf->y ; y>0 ; y--){ for (y = ibuf->y ; y>0 ; y--){

View File

@@ -45,7 +45,6 @@
#endif #endif
void imb_checkncols(struct ImBuf *ibuf) void imb_checkncols(struct ImBuf *ibuf)
/* struct ImBuf *ibuf; */
{ {
unsigned int i; unsigned int i;
@@ -78,7 +77,7 @@ void imb_checkncols(struct ImBuf *ibuf)
} }
return; return;
} else { } else {
/* ibuf->maxcol is bepalend voor de diepte */ /* ibuf->maxcol defines the depth */
for (i=1 ; ibuf->maxcol > (1 << i); i++); for (i=1 ; ibuf->maxcol > (1 << i); i++);
ibuf->depth = i; ibuf->depth = i;
return; return;
@@ -96,7 +95,7 @@ void IMB_de_interlace(struct ImBuf *ibuf)
ibuf->flags |= IB_fields; ibuf->flags |= IB_fields;
if (ibuf->rect) { if (ibuf->rect) {
/* kopieen aanmaken */ /* make copies */
tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0); tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0);
tbuf2 = 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, short dmax, unsigned char *rgb,
unsigned short *ham, unsigned short *ham,
short type, short round, short shift) short type, short round, short shift)
/* short x, dmax, type, round, shift; */
/* uchar *dit, *rgb; */
/* unsigned short *ham; */
{ {
short dx = 0; short dx = 0;
short c1, c2; short c1, c2;
@@ -102,27 +99,21 @@ static void convhamscanl(short x, short y,
unsigned char coltab[][4], unsigned char coltab[][4],
short *deltab, short *deltab,
short bits) 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 a, r, g, b, lr, lg, lb, dr, dg, db, col, fout, type, x2;
int round, shift; int round, shift;
uchar *rgb, dit[2]; uchar *rgb, dit[2];
unsigned short *ham, *hambase; unsigned short *ham, *hambase;
/* Opzet: /* Concept:
eerst wordt het gehele plaatje afgelopen, waarbij kleurovergangen gecodeerd first we check the entire image, where color transitions are coded: FGRB XXXX XXXX
worden: FGRB XXXX XXXX F - free color value, can be changed by anyone
F - vrije kleurwaarde, mag door ieder veranderd worden G/R/B - green/red/blue ham transition, only to be changed by this color
G/R/B - groen/rood/blauw ham overgang, alleen door die kleur te veranderen XXXX XXXX - N bits value.
XXXX XXXX - N bits waarde.
0000 XXXX XXXX is palet kleur. 0000 XXXX XXXX is palette color.
daarna wordt eerst de groen dither toegevoegd, dan de rood dither en after that first the green dither is added, then the red dither, and finally blue dither
tenslotte wordt blauwdither toegevoegd
*/ */
if ((hambase = (unsigned short *) malloc((x+4) * sizeof(unsigned short)))==0) return; 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; shift = 8 - bits;
round = 1 << (shift - 1); 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 = 3; x2 >= 0; x2 --) hambase[x + x2] = HAMFREE;
for (x2 = x ;x2 > 0; x2--){ for (x2 = x ;x2 > 0; x2--){
@@ -254,7 +245,6 @@ static void convhamscanl(short x, short y,
short imb_converttoham(struct ImBuf *ibuf) short imb_converttoham(struct ImBuf *ibuf)
/* struct ImBuf* ibuf; */
{ {
unsigned int coltab[256],*rect; unsigned int coltab[256],*rect;
short x,y,* deltab; 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) * 32 brighntesses Y 15 with direct access (black and white are specials)
* 16 kleuren H ue * 16 colors H ue
* 7 intensiteiten S aturation * 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) 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; short r,g,b,lr,lg,lb,dr,dg,db,col,fout,type,step;
int i; 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[]) static short dec_hamx(struct ImBuf * ibuf, unsigned char *body, int cmap[])
/* struct ImBuf * ibuf; */
/* uchar *body; */
/* int cmap[]; */
{ {
int todo,i; int todo,i;
int j,step,col; int j,step,col;
@@ -457,9 +451,6 @@ struct ImBuf *imb_loadanim(int *iffmem, int flags)
static unsigned char *makebody_anim(int bytes, static unsigned char *makebody_anim(int bytes,
unsigned char *buf, unsigned char *buf,
unsigned char *rect) unsigned char *rect)
/* register uchar *buf; */
/* register uchar *rect; */
/* int bytes; */
{ {
register uchar last,this; register uchar last,this;
register int copy; register int copy;
@@ -476,8 +467,8 @@ static unsigned char *makebody_anim(int bytes,
last = this; last = this;
this = *rect++; this = *rect++;
if (last == this){ if (last == this){
if (this == rect[-3]){ /* drie dezelfde? */ if (this == rect[-3]){ /* three the same? */
bytes --; /* bytes goed zetten */ bytes --; /* init bytes */
break; break;
} }
} }
@@ -505,8 +496,8 @@ static unsigned char *makebody_anim(int bytes,
copy = FALSE; copy = FALSE;
} else { } else {
while (*rect++ == this){ /* zoek naar eerste afwijkende byte */ while (*rect++ == this){ /* seek first different byte */
if (--bytes == 0) break; /* of einde regel */ if (--bytes == 0) break; /* or end of line */
} }
rect --; rect --;
copy = rect-rectstart; copy = rect-rectstart;
@@ -533,8 +524,6 @@ static unsigned char *makebody_anim(int bytes,
short imb_enc_anim(struct ImBuf *ibuf, int file) short imb_enc_anim(struct ImBuf *ibuf, int file)
/* struct ImBuf *ibuf; */
/* int file; */
{ {
int step, size, i, skip, steps = 0; int step, size, i, skip, steps = 0;
uchar *buf1, *crect, *_buf1, *_buf2, *bufend; 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 (file < 0 ) return (0);
if (ibuf->rect == 0) return(0); if (ibuf->rect == 0) return(0);
/* dither toevoegen */ /* add dither */
switch(ibuf->ftype){ switch(ibuf->ftype){
case AN_hamx: case AN_hamx:

View File

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

View File

@@ -80,20 +80,6 @@
#define calloc(x,y) MEM_callocN((x)*(y), __FILE__) #define calloc(x,y) MEM_callocN((x)*(y), __FILE__)
#define freelist(x) BLI_freelistN(x) #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 #ifdef SHLIB
void *(*ib_calloc)(); void *(*ib_calloc)();
#define calloc(x,y) ib_calloc((x),(y)) #define calloc(x,y) ib_calloc((x),(y))

View File

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

View File

@@ -65,20 +65,16 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
#endif #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 * 1. jpeg - standard printing, u & v at quarter of resulution
* 2. jvid - standaard video u & v halve resolutie, frame opengeklapt * 2. jvid - standaard video, u & v half resolution, frame not interlaced
type 3 is unsupported as of jul 05 2000 Frank. type 3 is unsupported as of jul 05 2000 Frank.
* 3. jstr - als 2, maar dan met twee losse fields weggeschreven * 3. jstr - as 2, but written in 2 seperate fields
* moet baseline zijn
* moet rgb zijn
* moet samplingfactors goed hebben
* 4. jmax - no scaling in the components
* 4. jmax - geen scaling in de componenten
*/ */
static int jpeg_failed = FALSE; static int jpeg_failed = FALSE;
@@ -253,7 +249,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
struct ImBuf * ibuf = 0; struct ImBuf * ibuf = 0;
uchar * rect; uchar * rect;
/* eigen app1 handler installeren */ /* install own app1 handler */
ibuf_ftype = 0; ibuf_ftype = 0;
jpeg_set_marker_processor(cinfo, 0xe1, handle_app1); jpeg_set_marker_processor(cinfo, 0xe1, handle_app1);
cinfo->dct_method = JDCT_FLOAT; 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); jpeg_set_defaults(cinfo);
/* eigen instellingen */ /* own settings */
cinfo->dct_method = JDCT_FLOAT; cinfo->dct_method = JDCT_FLOAT;
jpeg_set_quality(cinfo, quality, TRUE); jpeg_set_quality(cinfo, quality, TRUE);
@@ -535,7 +531,7 @@ static int save_vidjpeg(char * name, struct ImBuf * ibuf)
init_jpeg(outfile, cinfo, ibuf); init_jpeg(outfile, cinfo, ibuf);
/* scalings factoren goedzetten */ /* adjust scaling factors */
if (cinfo->in_color_space == JCS_RGB) { if (cinfo->in_color_space == JCS_RGB) {
cinfo->comp_info[0].h_samp_factor = 2; cinfo->comp_info[0].h_samp_factor = 2;
cinfo->comp_info[0].v_samp_factor = 1; 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); init_jpeg(outfile, cinfo, ibuf);
/* scalings factoren goedzetten */ /* adjust scaling factors */
if (cinfo->in_color_space == JCS_RGB) { if (cinfo->in_color_space == JCS_RGB) {
cinfo->comp_info[0].h_samp_factor = 1; cinfo->comp_info[0].h_samp_factor = 1;
cinfo->comp_info[0].v_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) == FORM){
if (GET_ID(mem+2) == ILBM){ if (GET_ID(mem+2) == ILBM){
return (imb_loadamiga(mem, flags)); 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)); return (imb_loadamiga(mem+3, flags));
} else if (GET_ID(mem+2) == ANIM){ } else if (GET_ID(mem+2) == ANIM){
return (imb_loadanim(mem, flags)); 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) == FORM){
if (GET_ID(mem+2) == ILBM){ if (GET_ID(mem+2) == ILBM){
return (imb_loadamiga(mem, flags)); 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)); return (imb_loadamiga(mem+3, flags));
} else if (GET_ID(mem+2) == ANIM){ } else if (GET_ID(mem+2) == ANIM){
return (imb_loadanim(mem, flags)); return (imb_loadanim(mem, flags));

View File

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