From e701f9b67010279db02ceb51f7d08078cb34170a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 29 Apr 2012 15:47:02 +0000 Subject: style cleanup: whitespace / commas --- source/blender/imbuf/intern/anim_movie.c | 14 ++-- source/blender/imbuf/intern/bmp.c | 60 +++++++-------- source/blender/imbuf/intern/filter.c | 44 +++++------ source/blender/imbuf/intern/imageprocess.c | 16 ++-- source/blender/imbuf/intern/indexer_dv.c | 4 +- source/blender/imbuf/intern/iris.c | 64 +++++++-------- source/blender/imbuf/intern/jp2.c | 26 +++---- .../blender/imbuf/intern/openexr/openexr_api.cpp | 2 +- source/blender/imbuf/intern/readimage.c | 2 +- source/blender/imbuf/intern/rectop.c | 8 +- source/blender/imbuf/intern/scaling.c | 90 +++++++++++----------- source/blender/imbuf/intern/targa.c | 64 +++++++-------- source/blender/imbuf/intern/thumbs.c | 14 ++-- source/blender/imbuf/intern/util.c | 8 +- 14 files changed, 208 insertions(+), 208 deletions(-) (limited to 'source/blender/imbuf/intern') diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index d0d141a8ef8..cf1a4df1cf9 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -133,8 +133,8 @@ static void free_anim_movie(struct anim *UNUSED(anim)) { ; } static int an_stringdec(const char *string, char* head, char *tail, unsigned short *numlen) { - unsigned short len,nume,nums=0; - short i,found=FALSE; + unsigned short len, nume, nums=0; + short i, found=FALSE; len=strlen(string); nume = len; @@ -156,7 +156,7 @@ static int an_stringdec(const char *string, char* head, char *tail, unsigned sho } } if (found) { - strcpy(tail ,&string[nume+1]); + strcpy(tail, &string[nume+1]); strcpy(head, string); head[nums]= '\0'; *numlen=nume-nums+1; @@ -285,7 +285,7 @@ static int startavi (struct anim *anim) streamcount = anim->streamindex; #endif - anim->avi = MEM_callocN (sizeof(AviMovie),"animavi"); + anim->avi = MEM_callocN (sizeof(AviMovie), "animavi"); if (anim->avi == NULL) { printf("Can't open avi: %s\n", anim->name); @@ -676,7 +676,7 @@ static void ffmpeg_postprocess(struct anim * anim) uint8_t** dst = anim->pFrameRGB->data; int dstStride2[4] = { dstStride[0], 0, 0, 0 }; uint8_t* dst2[4] = { dst[0], 0, 0, 0 }; - int x,y,h,w; + int x, y, h, w; unsigned char* bottom; unsigned char* top; @@ -933,7 +933,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: looking for PTS=%lld " "(pts_timebase=%g, frame_rate=%g, st_time=%lld)\n", - (long long int)pts_to_search,pts_time_base, frame_rate, st_time); + (long long int)pts_to_search, pts_time_base, frame_rate, st_time); if (anim->last_frame && anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search) { @@ -1040,7 +1040,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, anim->next_packet.stream_index = -1; } - /* memset(anim->pFrame,...) ?? */ + /* memset(anim->pFrame, ...) ?? */ if (ret >= 0) { ffmpeg_decode_video_frame_scan(anim, pts_to_search); diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index 06e1d75c5d0..bce3c70fd93 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -192,18 +192,18 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags) } /* Couple of helper functions for writing our data */ -static int putIntLSB(unsigned int ui,FILE *ofile) +static int putIntLSB(unsigned int ui, FILE *ofile) { - putc((ui>>0)&0xFF,ofile); - putc((ui>>8)&0xFF,ofile); - putc((ui>>16)&0xFF,ofile); - return putc((ui>>24)&0xFF,ofile); + putc((ui>>0)&0xFF, ofile); + putc((ui>>8)&0xFF, ofile); + putc((ui>>16)&0xFF, ofile); + return putc((ui>>24)&0xFF, ofile); } -static int putShortLSB(unsigned short us,FILE *ofile) +static int putShortLSB(unsigned short us, FILE *ofile) { - putc((us>>0)&0xFF,ofile); - return putc((us>>8)&0xFF,ofile); + putc((us>>0)&0xFF, ofile); + return putc((us>>8)&0xFF, ofile); } /* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */ @@ -220,37 +220,37 @@ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y; data = (uchar *) ibuf->rect; - ofile = BLI_fopen(name,"wb"); + ofile = BLI_fopen(name, "wb"); if (!ofile) return 0; - putShortLSB(19778,ofile); /* "BM" */ - putIntLSB(0,ofile); /* This can be 0 for BI_RGB bitmaps */ - putShortLSB(0,ofile); /* Res1 */ - putShortLSB(0,ofile); /* Res2 */ - putIntLSB(BMP_FILEHEADER_SIZE + sizeof(infoheader),ofile); - - putIntLSB(sizeof(infoheader),ofile); - putIntLSB(ibuf->x,ofile); - putIntLSB(ibuf->y,ofile); - putShortLSB(1,ofile); - putShortLSB(24,ofile); - putIntLSB(0,ofile); - putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader),ofile); - putIntLSB(0,ofile); - putIntLSB(0,ofile); - putIntLSB(0,ofile); - putIntLSB(0,ofile); + putShortLSB(19778, ofile); /* "BM" */ + putIntLSB(0, ofile); /* This can be 0 for BI_RGB bitmaps */ + putShortLSB(0, ofile); /* Res1 */ + putShortLSB(0, ofile); /* Res2 */ + putIntLSB(BMP_FILEHEADER_SIZE + sizeof(infoheader), ofile); + + putIntLSB(sizeof(infoheader), ofile); + putIntLSB(ibuf->x, ofile); + putIntLSB(ibuf->y, ofile); + putShortLSB(1, ofile); + putShortLSB(24, ofile); + putIntLSB(0, ofile); + putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader), ofile); + putIntLSB(0, ofile); + putIntLSB(0, ofile); + putIntLSB(0, ofile); + putIntLSB(0, ofile); /* Need to write out padded image data in bgr format */ for (y=0;yy;y++) { for (x=0;xx;x++) { ptr=(x + y * ibuf->x) * 4; - if (putc(data[ptr+2],ofile) == EOF) return 0; - if (putc(data[ptr+1],ofile) == EOF) return 0; - if (putc(data[ptr],ofile) == EOF) return 0; + if (putc(data[ptr+2], ofile) == EOF) return 0; + if (putc(data[ptr+1], ofile) == EOF) return 0; + if (putc(data[ptr], ofile) == EOF) return 0; } /* add padding here */ - for (t=0;t1) { c1 = c2 = *point; @@ -72,7 +72,7 @@ static void filtrow(unsigned char *point, int x) static void filtrowf(float *point, int x) { - float c1,c2,c3; + float c1, c2, c3; if (x>1) { c1 = c2 = *point; @@ -92,7 +92,7 @@ static void filtrowf(float *point, int x) static void filtcolum(unsigned char *point, int y, int skip) { - unsigned int c1,c2,c3,error; + unsigned int c1, c2, c3, error; unsigned char *point2; if (y>1) { @@ -115,7 +115,7 @@ static void filtcolum(unsigned char *point, int y, int skip) static void filtcolumf(float *point, int y, int skip) { - float c1,c2,c3, *point2; + float c1, c2, c3, *point2; if (y>1) { c1 = c2 = *point; @@ -148,23 +148,23 @@ void IMB_filtery(struct ImBuf *ibuf) for (;x>0;x--) { if (point) { - if (ibuf->planes > 24) filtcolum(point,y,skip); + if (ibuf->planes > 24) filtcolum(point, y, skip); point++; - filtcolum(point,y,skip); + filtcolum(point, y, skip); point++; - filtcolum(point,y,skip); + filtcolum(point, y, skip); point++; - filtcolum(point,y,skip); + filtcolum(point, y, skip); point++; } if (pointf) { - if (ibuf->planes > 24) filtcolumf(pointf,y,skip); + if (ibuf->planes > 24) filtcolumf(pointf, y, skip); pointf++; - filtcolumf(pointf,y,skip); + filtcolumf(pointf, y, skip); pointf++; - filtcolumf(pointf,y,skip); + filtcolumf(pointf, y, skip); pointf++; - filtcolumf(pointf,y,skip); + filtcolumf(pointf, y, skip); pointf++; } } @@ -186,23 +186,23 @@ void imb_filterx(struct ImBuf *ibuf) for (;y>0;y--) { if (point) { - if (ibuf->planes > 24) filtrow(point,x); + if (ibuf->planes > 24) filtrow(point, x); point++; - filtrow(point,x); + filtrow(point, x); point++; - filtrow(point,x); + filtrow(point, x); point++; - filtrow(point,x); + filtrow(point, x); point+=skip; } if (pointf) { - if (ibuf->planes > 24) filtrowf(pointf,x); + if (ibuf->planes > 24) filtrowf(pointf, x); pointf++; - filtrowf(pointf,x); + filtrowf(pointf, x); pointf++; - filtrowf(pointf,x); + filtrowf(pointf, x); pointf++; - filtrowf(pointf,x); + filtrowf(pointf, x); pointf+=skip; } } @@ -304,7 +304,7 @@ void IMB_mask_filter_extend(char *mask, int width, int height) void IMB_mask_clear(ImBuf *ibuf, char *mask, int val) { - int x,y; + int x, y; if (ibuf->rect_float) { for (x=0; xx; x++) { for (y=0; yy; y++) { @@ -399,7 +399,7 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter) if (!check_pixel_assigned(srcbuf, srcmask, index, depth, is_float)) { float tmp[4]; float wsum=0; - float acc[4]={0,0,0,0}; + float acc[4]={0, 0, 0, 0}; k = 0; if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) || diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index ba165d51e96..2109891a3ce 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -50,7 +50,7 @@ /* This define should be relocated to a global header some where Kent Mein * I stole it from util.h in the plugins api */ -#define MAX2(x,y) ( (x)>(y) ? (x) : (y) ) +#define MAX2(x, y) ( (x)>(y) ? (x) : (y) ) /* Only this one is used liberally here, and in imbuf */ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf) @@ -113,10 +113,10 @@ static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float ** static float P(float k) { float p1, p2, p3, p4; - p1 = MAX2(k+2.0f,0); - p2 = MAX2(k+1.0f,0); - p3 = MAX2(k,0); - p4 = MAX2(k-1.0f,0); + p1 = MAX2(k+2.0f, 0); + p2 = MAX2(k+1.0f, 0); + p3 = MAX2(k, 0); + p4 = MAX2(k-1.0f, 0); return (float)(1.0f/6.0f)*( p1*p1*p1 - 4.0f * p2*p2*p2 + 6.0f * p3*p3*p3 - 4.0f * p4*p4*p4); } @@ -125,15 +125,15 @@ static float P(float k) /* older, slower function, works the same as above */ static float P(float k) { - return (float)(1.0f/6.0f)*( pow( MAX2(k+2.0f,0) , 3.0f ) - 4.0f * pow( MAX2(k+1.0f,0) , 3.0f ) + 6.0f * pow( MAX2(k,0) , 3.0f ) - 4.0f * pow( MAX2(k-1.0f,0) , 3.0f)); + return (float)(1.0f/6.0f)*( pow( MAX2(k+2.0f, 0), 3.0f ) - 4.0f * pow( MAX2(k+1.0f, 0), 3.0f ) + 6.0f * pow( MAX2(k, 0), 3.0f ) - 4.0f * pow( MAX2(k-1.0f, 0), 3.0f)); } #endif void bicubic_interpolation_color(struct ImBuf *in, unsigned char *outI, float *outF, float u, float v) { - int i,j,n,m,x1,y1; + int i, j, n, m, x1, y1; unsigned char *dataI; - float a,b,w,wx,wy[4], outR,outG,outB,outA,*dataF; + float a, b, w, wx, wy[4], outR, outG, outB, outA, *dataF; /* sample area entirely outside image? */ if (ceil(u)<0 || floor(u)>in->x-1 || ceil(v)<0 || floor(v)>in->y-1) diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c index f0c38f6db06..8dc03ae708d 100644 --- a/source/blender/imbuf/intern/indexer_dv.c +++ b/source/blender/imbuf/intern/indexer_dv.c @@ -171,7 +171,7 @@ static void parse_header_block(indexer_dv_context * This, unsigned char* target) static void parse_subcode_blocks( indexer_dv_context * This, unsigned char* target) { - int i,j; + int i, j; for (j = 0; j < 2; j++) { for (i = 3; i < 80; i += 5) { @@ -185,7 +185,7 @@ static void parse_subcode_blocks( static void parse_vaux_blocks( indexer_dv_context * This, unsigned char* target) { - int i,j; + int i, j; for (j = 0; j < 3; j++) { for (i = 3; i < 80; i += 5) { diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index e775d0f7bbd..430361dbb53 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -74,7 +74,7 @@ typedef struct { #define GINTLUM (156) #define BINTLUM (21) -#define ILUM(r,g,b) ((int)(RINTLUM*(r)+GINTLUM*(g)+BINTLUM*(b))>>8) +#define ILUM(r, g, b) ((int)(RINTLUM * (r) + GINTLUM * (g) + BINTLUM * (b)) >> 8) #define OFFSET_R 0 /* this is byte order dependent */ #define OFFSET_G 1 @@ -149,7 +149,7 @@ static void putshort(FILE *outf, unsigned short val) buf[0] = (val>>8); buf[1] = (val>>0); - fwrite(buf,2,1,outf); + fwrite(buf, 2, 1, outf); } static int putlong(FILE *outf, unsigned int val) @@ -160,7 +160,7 @@ static int putlong(FILE *outf, unsigned int val) buf[1] = (val>>16); buf[2] = (val>>8); buf[3] = (val>>0); - return fwrite(buf,4,1,outf); + return fwrite(buf, 4, 1, outf); } static void readheader(FILE *inf, IMAGE *image) @@ -178,18 +178,18 @@ static int writeheader(FILE *outf, IMAGE *image) { IMAGE t= {0}; - fwrite(&t,sizeof(IMAGE),1,outf); - fseek(outf,0,SEEK_SET); - putshort(outf,image->imagic); - putshort(outf,image->type); - putshort(outf,image->dim); - putshort(outf,image->xsize); - putshort(outf,image->ysize); - putshort(outf,image->zsize); - putlong(outf,image->min); - putlong(outf,image->max); - putlong(outf,0); - return fwrite("no name",8,1,outf); + fwrite(&t, sizeof(IMAGE), 1, outf); + fseek(outf, 0, SEEK_SET); + putshort(outf, image->imagic); + putshort(outf, image->type); + putshort(outf, image->dim); + putshort(outf, image->xsize); + putshort(outf, image->ysize); + putshort(outf, image->zsize); + putlong(outf, image->min); + putlong(outf, image->max); + putlong(outf, 0); + return fwrite("no name", 8, 1, outf); } static int writetab(FILE *outf, unsigned int *tab, int len) @@ -197,7 +197,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len) int r = 0; while (len) { - r = putlong(outf,*tab++); + r = putlong(outf, *tab++); len -= 4; } return r; @@ -271,14 +271,14 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) readheader(inf, &image); if (image.imagic != IMAGIC) { - fprintf(stderr,"longimagedata: bad magic number in image file\n"); + fprintf(stderr, "longimagedata: bad magic number in image file\n"); return(NULL); } rle = ISRLE(image.type); bpp = BPP(image.type); if (bpp != 1 && bpp != 2) { - fprintf(stderr,"longimagedata: image must have 1 or 2 byte per pix chan\n"); + fprintf(stderr, "longimagedata: image must have 1 or 2 byte per pix chan\n"); return(NULL); } @@ -299,8 +299,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) lengthtab = (unsigned int *)MEM_mallocN(tablen, "iris endtab"); file_offset = 512; - readtab(inf,starttab,tablen); - readtab(inf,lengthtab,tablen); + readtab(inf, starttab, tablen); + readtab(inf, lengthtab, tablen); /* check data order */ cur = 0; @@ -710,27 +710,27 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons image->zsize = zsize; image->min = 0; image->max = 255; - goodwrite *= writeheader(outf,image); - fseek(outf,512+2*tablen,SEEK_SET); + goodwrite *= writeheader(outf, image); + fseek(outf, 512+2*tablen, SEEK_SET); pos = 512+2*tablen; for (y = 0; y < ysize; y++) { for (z = 0; z < zsize; z++) { if (zsize == 1) { - lumrow((uchar *)lptr,(uchar *)lumbuf,xsize); - len = compressrow((uchar *)lumbuf,rlebuf,CHANOFFSET(z),xsize); + lumrow((uchar *)lptr, (uchar *)lumbuf, xsize); + len = compressrow((uchar *)lumbuf, rlebuf, CHANOFFSET(z), xsize); } else { if (z<4) { - len = compressrow((uchar *)lptr, rlebuf,CHANOFFSET(z),xsize); + len = compressrow((uchar *)lptr, rlebuf, CHANOFFSET(z), xsize); } else if (z<8 && zptr) { - len = compressrow((uchar *)zptr, rlebuf,CHANOFFSET(z-4),xsize); + len = compressrow((uchar *)zptr, rlebuf, CHANOFFSET(z-4), xsize); } } if (len>rlebuflen) { - fprintf(stderr,"output_iris: rlebuf is too small - bad poop\n"); + fprintf(stderr, "output_iris: rlebuf is too small - bad poop\n"); exit(1); } goodwrite *= fwrite(rlebuf, len, 1, outf); @@ -742,9 +742,9 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons if (zptr) zptr += xsize; } - fseek(outf,512,SEEK_SET); - goodwrite *= writetab(outf,starttab,tablen); - goodwrite *= writetab(outf,lengthtab,tablen); + fseek(outf, 512, SEEK_SET); + goodwrite *= writetab(outf, starttab, tablen); + goodwrite *= writetab(outf, lengthtab, tablen); MEM_freeN(image); MEM_freeN(starttab); MEM_freeN(lengthtab); @@ -754,7 +754,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons if (goodwrite) return 1; else { - fprintf(stderr,"output_iris: not enough space for image!!\n"); + fprintf(stderr, "output_iris: not enough space for image!!\n"); return 0; } } @@ -765,7 +765,7 @@ static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n) { lumptr += CHANOFFSET(0); while (n--) { - *lumptr = ILUM(rgbptr[OFFSET_R],rgbptr[OFFSET_G],rgbptr[OFFSET_B]); + *lumptr = ILUM(rgbptr[OFFSET_R], rgbptr[OFFSET_G], rgbptr[OFFSET_B]); lumptr += 4; rgbptr += 4; } diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 6abfbdb4aa1..c71763b245d 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -158,7 +158,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) if ((image->numcomps * image->x1 * image->y1) == 0) { - fprintf(stderr,"\nError: invalid raw image parameters\n"); + fprintf(stderr, "\nError: invalid raw image parameters\n"); return NULL; } @@ -339,7 +339,7 @@ static void cinema_parameters(opj_cparameters_t *parameters) parameters->tp_flag = 'C'; parameters->tp_on = 1; - /*Tile and Image shall be at (0,0)*/ + /*Tile and Image shall be at (0, 0)*/ parameters->cp_tx0 = 0; parameters->cp_ty0 = 0; parameters->image_offset_x0 = 0; @@ -363,7 +363,7 @@ static void cinema_parameters(opj_cparameters_t *parameters) } -static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol) +static void cinema_setup_encoder(opj_cparameters_t *parameters, opj_image_t *image, img_fol_t *img_fol) { int i; float temp_rate; @@ -375,9 +375,9 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag parameters->numresolution = 6; } if (!((image->comps[0].w == 2048) || (image->comps[0].h == 1080))) { - fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 " + fprintf(stdout, "Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 " "(2K profile) compliance requires that at least one of coordinates match 2048 x 1080\n", - image->comps[0].w,image->comps[0].h); + image->comps[0].w, image->comps[0].h); parameters->cp_rsiz = STD_RSIZ; } break; @@ -390,12 +390,12 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag parameters->numresolution = 7; } if (!((image->comps[0].w == 4096) || (image->comps[0].h == 2160))) { - fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4" + fprintf(stdout, "Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4" "(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n", - image->comps[0].w,image->comps[0].h); + image->comps[0].w, image->comps[0].h); parameters->cp_rsiz = STD_RSIZ; } - parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution); + parameters->numpocs = initialise_4K_poc(parameters->POC, parameters->numresolution); break; case OFF: /* do nothing */ @@ -465,13 +465,13 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) int i, numcomps, w, h, prec; - int x,y, y_row; + int x, y, y_row; OPJ_COLOR_SPACE color_space; opj_image_cmptparm_t cmptparm[4]; /* maximum of 4 components */ opj_image_t * image = NULL; img_fol_t img_fol; /* only needed for cinema presets */ - memset(&img_fol,0,sizeof(img_fol_t)); + memset(&img_fol, 0, sizeof(img_fol_t)); if (ibuf->ftype & JP2_CINE) { @@ -552,7 +552,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) float rgb[3]; switch (prec) { - case 8: /* Convert blenders float color channels to 8,12 or 16bit ints */ + case 8: /* Convert blenders float color channels to 8, 12 or 16bit ints */ for (y=h-1; y>=0; y--) { y_row = y*w; for (x=0; xtcp_mct = image->numcomps == 3 ? 1 : 0; if (parameters->cp_cinema) { - cinema_setup_encoder(parameters,image,&img_fol); + cinema_setup_encoder(parameters, image, &img_fol); } if (img_fol.rates) @@ -748,7 +748,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) } fwrite(cio->buffer, 1, codestream_length, f); fclose(f); - fprintf(stderr,"Generated outfile %s\n",name); + fprintf(stderr, "Generated outfile %s\n", name); /* close and free the byte stream */ opj_cio_close(cio); diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 44b7472b910..50bc55da412 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1024,7 +1024,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) addzbuffloatImBuf(ibuf); firstz= ibuf->zbuf_float - (dw.min.x - dw.min.y*width); firstz+= (height-1)*width; - frameBuffer.insert ("Z", Slice (Imf::FLOAT, (char *)firstz , sizeof(float), -width*sizeof(float))); + frameBuffer.insert("Z", Slice (Imf::FLOAT, (char *)firstz, sizeof(float), -width * sizeof(float))); } file->setFrameBuffer (frameBuffer); diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index 61f90f7a97a..e9d549be8b9 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -152,7 +152,7 @@ ImBuf *IMB_testiffname(const char *filepath, int flags) imb_cache_filename(filepath_tx, filepath, flags); - file = BLI_open(filepath_tx,O_BINARY|O_RDONLY,0); + file = BLI_open(filepath_tx, O_BINARY|O_RDONLY, 0); if (file < 0) return NULL; ibuf=IMB_loadifffile(file, flags|IB_test|IB_multilayer, filepath_tx); diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index 6ea84fd6717..9f025803c2e 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -359,13 +359,13 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx, /* copy */ for (;height > 0; height--) { if (do_char) { - memcpy(drect,srect, width * sizeof(int)); + memcpy(drect, srect, width * sizeof(int)); drect += destskip; srect += srcskip; } if (do_float) { - memcpy(drectf,srectf, width * sizeof(float) * 4); + memcpy(drectf, srectf, width * sizeof(float) * 4); drectf += destskip*4; srectf += srcskip*4; } @@ -496,8 +496,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, CLAMP(y1, 0, height); CLAMP(y2, 0, height); - if (x1>x2) SWAP(int,x1,x2); - if (y1>y2) SWAP(int,y1,y2); + if (x1>x2) SWAP(int, x1, x2); + if (y1>y2) SWAP(int, y1, y2); if (x1==x2 || y1==y2) return; a = col[3]; diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index a7b994beef9..7f5430dad8a 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -53,10 +53,10 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1) { struct ImBuf *ibuf2; - uchar *p1,*_p1,*dest; - short a,r,g,b; - int x,y; - float af,rf,gf,bf, *p1f, *_p1f, *destf; + uchar *p1, *_p1, *dest; + short a, r, g, b; + int x, y; + float af, rf, gf, bf, *p1f, *_p1f, *destf; int do_rect, do_float; if (ibuf1==NULL) return (NULL); @@ -119,7 +119,7 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1) struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1) { struct ImBuf *ibuf2; - int *p1,*dest, i, col, do_rect, do_float; + int *p1, *dest, i, col, do_rect, do_float; float *p1f, *destf; if (ibuf1==NULL) return (NULL); @@ -128,7 +128,7 @@ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1) do_rect= (ibuf1->rect != NULL); do_float= (ibuf1->rect_float != NULL); - ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->planes, ibuf1->flags); + ibuf2 = IMB_allocImBuf(2 * ibuf1->x, ibuf1->y, ibuf1->planes, ibuf1->flags); if (ibuf2==NULL) return (NULL); p1 = (int *) ibuf1->rect; @@ -172,11 +172,11 @@ struct ImBuf *IMB_double_x(struct ImBuf *ibuf1) struct ImBuf *IMB_half_y(struct ImBuf *ibuf1) { struct ImBuf *ibuf2; - uchar *p1,*p2,*_p1,*dest; - short a,r,g,b; - int x,y; + uchar *p1, *p2, *_p1, *dest; + short a, r, g, b; + int x, y; int do_rect, do_float; - float af,rf,gf,bf,*p1f,*p2f,*_p1f,*destf; + float af, rf, gf, bf, *p1f, *p2f, *_p1f, *destf; p1= p2= NULL; p1f= p2f= NULL; @@ -187,7 +187,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1) do_rect= (ibuf1->rect != NULL); do_float= (ibuf1->rect_float != NULL); - ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->planes, ibuf1->flags); + ibuf2 = IMB_allocImBuf(ibuf1->x, (ibuf1->y) / 2, ibuf1->planes, ibuf1->flags); if (ibuf2==NULL) return (NULL); _p1 = (uchar *) ibuf1->rect; @@ -246,7 +246,7 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1) struct ImBuf *ibuf2; int *p1, *dest1, *dest2; float *p1f, *dest1f, *dest2f; - int x,y; + int x, y; int do_rect, do_float; if (ibuf1==NULL) return (NULL); @@ -255,7 +255,7 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1) do_rect= (ibuf1->rect != NULL); do_float= (ibuf1->rect_float != NULL); - ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->planes, ibuf1->flags); + ibuf2 = IMB_allocImBuf(ibuf1->x, 2 * ibuf1->y, ibuf1->planes, ibuf1->flags); if (ibuf2==NULL) return (NULL); p1 = (int *) ibuf1->rect; @@ -297,7 +297,7 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1) { uchar *p1, *p2 = NULL, *dest; float *p1f, *destf, *p2f = NULL; - int x,y; + int x, y; const short do_rect= (ibuf1->rect != NULL); const short do_float= (ibuf1->rect_float != NULL) && (ibuf2->rect_float != NULL); @@ -1093,18 +1093,18 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy) static struct ImBuf *scaleupx(struct ImBuf *ibuf, int newx) { - uchar *rect,*_newrect=NULL,*newrect; - float *rectf,*_newrectf=NULL,*newrectf; - float sample,add; - float val_a,nval_a,diff_a; - float val_b,nval_b,diff_b; - float val_g,nval_g,diff_g; - float val_r,nval_r,diff_r; - float val_af,nval_af,diff_af; - float val_bf,nval_bf,diff_bf; - float val_gf,nval_gf,diff_gf; - float val_rf,nval_rf,diff_rf; - int x,y, do_rect = 0, do_float = 0; + uchar *rect, *_newrect=NULL, *newrect; + float *rectf, *_newrectf=NULL, *newrectf; + float sample, add; + float val_a, nval_a, diff_a; + float val_b, nval_b, diff_b; + float val_g, nval_g, diff_g; + float val_r, nval_r, diff_r; + float val_af, nval_af, diff_af; + float val_bf, nval_bf, diff_bf; + float val_gf, nval_gf, diff_gf; + float val_rf, nval_rf, diff_rf; + int x, y, do_rect = 0, do_float = 0; val_a = nval_a = diff_a = val_b = nval_b = diff_b = 0; val_g = nval_g = diff_g = val_r = nval_r = diff_r = 0; @@ -1260,18 +1260,18 @@ static struct ImBuf *scaleupx(struct ImBuf *ibuf, int newx) static struct ImBuf *scaleupy(struct ImBuf *ibuf, int newy) { - uchar *rect,*_newrect=NULL,*newrect; - float *rectf,*_newrectf=NULL,*newrectf; - float sample,add; - float val_a,nval_a,diff_a; - float val_b,nval_b,diff_b; - float val_g,nval_g,diff_g; - float val_r,nval_r,diff_r; - float val_af,nval_af,diff_af; - float val_bf,nval_bf,diff_bf; - float val_gf,nval_gf,diff_gf; - float val_rf,nval_rf,diff_rf; - int x,y, do_rect = 0, do_float = 0, skipx; + uchar *rect, *_newrect=NULL, *newrect; + float *rectf, *_newrectf=NULL, *newrectf; + float sample, add; + float val_a, nval_a, diff_a; + float val_b, nval_b, diff_b; + float val_g, nval_g, diff_g; + float val_r, nval_r, diff_r; + float val_af, nval_af, diff_af; + float val_bf, nval_bf, diff_bf; + float val_gf, nval_gf, diff_gf; + float val_rf, nval_rf, diff_rf; + int x, y, do_rect = 0, do_float = 0, skipx; val_a = nval_a = diff_a = val_b = nval_b = diff_b = 0; val_g = nval_g = diff_g = val_r = nval_r = diff_r = 0; @@ -1484,10 +1484,10 @@ struct ImBuf *IMB_scaleImBuf(struct ImBuf * ibuf, unsigned int newx, unsigned in return ibuf; } - if (newx < ibuf->x) if (newx) scaledownx(ibuf,newx); - if (newy < ibuf->y) if (newy) scaledowny(ibuf,newy); - if (newx > ibuf->x) if (newx) scaleupx(ibuf,newx); - if (newy > ibuf->y) if (newy) scaleupy(ibuf,newy); + if (newx < ibuf->x) if (newx) scaledownx(ibuf, newx); + if (newy < ibuf->y) if (newy) scaledowny(ibuf, newy); + if (newx > ibuf->x) if (newx) scaleupx(ibuf, newx); + if (newy > ibuf->y) if (newy) scaleupy(ibuf, newy); return(ibuf); } @@ -1498,10 +1498,10 @@ struct imbufRGBA { struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy) { - unsigned int *rect,*_newrect,*newrect; + unsigned int *rect, *_newrect, *newrect; struct imbufRGBA *rectf, *_newrectf, *newrectf; - int x,y, do_float=0, do_rect=0; - int ofsx,ofsy,stepx,stepy; + int x, y, do_float=0, do_rect=0; + int ofsx, ofsy, stepx, stepy; rect = NULL; _newrect = NULL; newrect = NULL; rectf = NULL; _newrectf = NULL; newrectf = NULL; diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index 0ed9b99d0ee..1a05dd93229 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -73,7 +73,7 @@ static int tga_out1(unsigned int data, FILE *file) uchar *p; p = (uchar *) & data; - if (putc(p[0],file) == EOF) return(EOF); + if (putc(p[0], file) == EOF) return(EOF); return (~EOF); } @@ -82,8 +82,8 @@ static int tga_out2(unsigned int data, FILE * file) uchar *p; p = (uchar *) & data; - if (putc(p[0],file) == EOF) return(EOF); - if (putc(p[1],file) == EOF) return(EOF); + if (putc(p[0], file) == EOF) return(EOF); + if (putc(p[1], file) == EOF) return(EOF); return (~EOF); } @@ -93,9 +93,9 @@ static int tga_out3(unsigned int data, FILE * file) uchar *p; p = (uchar *) & data; - if (putc(p[2],file) == EOF) return(EOF); - if (putc(p[1],file) == EOF) return(EOF); - if (putc(p[0],file) == EOF) return(EOF); + if (putc(p[2], file) == EOF) return(EOF); + if (putc(p[1], file) == EOF) return(EOF); + if (putc(p[0], file) == EOF) return(EOF); return (~EOF); } @@ -106,16 +106,16 @@ static int tga_out4(unsigned int data, FILE * file) p = (uchar *) & data; /* 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); - if (putc(p[3],file) == EOF) return(EOF); + if (putc(p[2], file) == EOF) return(EOF); + if (putc(p[1], file) == EOF) return(EOF); + if (putc(p[0], file) == EOF) return(EOF); + if (putc(p[3], file) == EOF) return(EOF); return (~EOF); } static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FILE*)) { - register int last,this; + register int last, this; register int copy, bytes; register unsigned int *rect, *rectstart, *temp; int y; @@ -150,9 +150,9 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI last = copy; if (copy>=128) last = 128; copy -= last; - if (fputc(last-1,file) == EOF) return(0); + if (fputc(last-1, file) == EOF) return(0); do { - if (out(*rect++,file) == EOF) return(0); + if (out(*rect++, file) == EOF) return(0); } while (--last != 0); } rectstart = rect; @@ -173,17 +173,17 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI while (copy) { if (copy>128) { - if (fputc(255,file) == EOF) return(0); + if (fputc(255, file) == EOF) return(0); copy -= 128; } else { if (copy == 1) { - if (fputc(0,file) == EOF) return(0); + if (fputc(0, file) == EOF) return(0); } - else if (fputc(127 + copy,file) == EOF) return(0); + else if (fputc(127 + copy, file) == EOF) return(0); copy = 0; } - if (out(last,file) == EOF) return(0); + if (out(last, file) == EOF) return(0); } copy=TRUE; } @@ -276,10 +276,10 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags) if (ibuf->planes==32) { buf[17] |= 0x08; } - fildes = BLI_fopen(name,"wb"); + fildes = BLI_fopen(name, "wb"); if (!fildes) return 0; - if (fwrite(buf, 1, 18,fildes) != 18) { + if (fwrite(buf, 1, 18, fildes) != 18) { fclose(fildes); return (0); } @@ -485,10 +485,10 @@ partial_load: complete_partial_load(ibuf, rect); } -static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, int psize) +static void ldtarga(struct ImBuf * ibuf, unsigned char * mem, size_t mem_size, int psize) { unsigned char *mem_end = mem+mem_size; - int col,size; + int col, size; unsigned int *rect; uchar * cp = (uchar *) &col; @@ -553,10 +553,10 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags) unsigned int *rect, *cmap= NULL /*, mincol= 0*/, maxcol= 0; uchar * cp = (uchar *) &col; - if (checktarga(&tga,mem) == 0) return(NULL); + if (checktarga(&tga, mem) == 0) return(NULL); - if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,tga.pixsize, 0); - else ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,(tga.pixsize + 0x7) & ~0x7, IB_rect); + if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize, tga.ysize, tga.pixsize, 0); + else ibuf = IMB_allocImBuf(tga.xsize, tga.ysize, (tga.pixsize + 0x7) & ~0x7, IB_rect); if (ibuf == NULL) return(NULL); ibuf->ftype = TGA; @@ -621,18 +621,18 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags) case 1: case 2: case 3: - if (tga.pixsize <= 8) ldtarga(ibuf,mem,mem_size,0); - else if (tga.pixsize <= 16) ldtarga(ibuf,mem,mem_size,1); - else if (tga.pixsize <= 24) ldtarga(ibuf,mem,mem_size,2); - else if (tga.pixsize <= 32) ldtarga(ibuf,mem,mem_size,3); + if (tga.pixsize <= 8) ldtarga(ibuf, mem, mem_size, 0); + else if (tga.pixsize <= 16) ldtarga(ibuf, mem, mem_size, 1); + else if (tga.pixsize <= 24) ldtarga(ibuf, mem, mem_size, 2); + else if (tga.pixsize <= 32) ldtarga(ibuf, mem, mem_size, 3); break; case 9: case 10: case 11: - if (tga.pixsize <= 8) decodetarga(ibuf,mem,mem_size,0); - else if (tga.pixsize <= 16) decodetarga(ibuf,mem,mem_size,1); - else if (tga.pixsize <= 24) decodetarga(ibuf,mem,mem_size,2); - else if (tga.pixsize <= 32) decodetarga(ibuf,mem,mem_size,3); + if (tga.pixsize <= 8) decodetarga(ibuf, mem, mem_size, 0); + else if (tga.pixsize <= 16) decodetarga(ibuf, mem, mem_size, 1); + else if (tga.pixsize <= 24) decodetarga(ibuf, mem, mem_size, 2); + else if (tga.pixsize <= 32) decodetarga(ibuf, mem, mem_size, 3); break; } diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 9aeed8002e1..23080aee7ab 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -69,13 +69,13 @@ #define URI_MAX FILE_MAX*3 + 8 -static int get_thumb_dir( char* dir , ThumbSize size) +static int get_thumb_dir(char *dir, ThumbSize size) { #ifdef WIN32 wchar_t dir_16 [MAX_PATH]; /* yes, applications shouldn't store data there, but so does GIMP :)*/ SHGetSpecialFolderPathW(0, dir_16, CSIDL_PROFILE, 0); - conv_utf_16_to_8(dir_16,dir,FILE_MAX); + conv_utf_16_to_8(dir_16, dir, FILE_MAX); #else @@ -132,7 +132,7 @@ static const char hex[17] = "0123456789abcdef"; /* Note: This escape function works on file: URIs, but if you want to * escape something else, please read RFC-2396 */ -static void escape_uri_string (const char *string, char* escaped_string, int len,UnsafeCharacterSet mask) +static void escape_uri_string (const char *string, char* escaped_string, int len, UnsafeCharacterSet mask) { #define ACCEPTABLE(a) ((a)>=32 && (a)<128 && (acceptable[(a)-32] & use_mask)) @@ -302,7 +302,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im return NULL; } if (size == THB_FAIL) { - img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata); + img = IMB_allocImBuf(1, 1, 32, IB_rect | IB_metadata); if (!img) return NULL; } else { @@ -398,7 +398,7 @@ ImBuf* IMB_thumb_read(const char* path, ThumbSize size) char uri[FILE_MAX*3+8]; ImBuf *img = NULL; - if (!uri_from_filename(path,uri)) { + if (!uri_from_filename(path, uri)) { return NULL; } if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) { @@ -414,7 +414,7 @@ void IMB_thumb_delete(const char* path, ThumbSize size) char thumb[FILE_MAX]; char uri[FILE_MAX*3+8]; - if (!uri_from_filename(path ,uri)) { + if (!uri_from_filename(path, uri)) { return; } if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) { @@ -439,7 +439,7 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source) if (stat(path, &st)) { return NULL; } - if (!uri_from_filename(path,uri)) { + if (!uri_from_filename(path, uri)) { return NULL; } if (thumbpath_from_uri(uri, thumb, sizeof(thumb), THB_FAIL)) { diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 9e819e56da5..62cf206dfec 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -154,12 +154,12 @@ static int IMB_ispic_name(const char *name) if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name); - if (stat(name,&st) == -1) + if (stat(name, &st) == -1) return FALSE; if (((st.st_mode) & S_IFMT) != S_IFREG) return FALSE; - if ((fp = BLI_open(name,O_BINARY|O_RDONLY, 0)) < 0) + if ((fp = BLI_open(name, O_BINARY|O_RDONLY, 0)) < 0) return FALSE; if (read(fp, buf, 32) != 32) { @@ -342,14 +342,14 @@ int imb_get_anim_type(const char * name) /* stat test below fails on large files > 4GB */ if (isffmpeg(name)) return (ANIM_FFMPEG); # endif - if (stat(name,&st) == -1) return(0); + if (stat(name, &st) == -1) return(0); if (((st.st_mode) & S_IFMT) != S_IFREG) return(0); if (isavi(name)) return (ANIM_AVI); if (ismovie(name)) return (ANIM_MOVIE); #else - if (stat(name,&st) == -1) return(0); + if (stat(name, &st) == -1) return(0); if (((st.st_mode) & S_IFMT) != S_IFREG) return(0); if (ismovie(name)) return (ANIM_MOVIE); -- cgit v1.2.3