diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-04-28 18:06:23 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2018-04-28 18:06:23 +0000 |
commit | 198e60227883a3508316c58f526340d18b1175b2 (patch) | |
tree | 2fa78e5fc124114dbad2f98e1759c8ea548f6587 | |
parent | b2394781ed1d0cd27e7d0a7c90d6a73db158c7ab (diff) | |
download | netpbm-mirror-198e60227883a3508316c58f526340d18b1175b2.tar.gz netpbm-mirror-198e60227883a3508316c58f526340d18b1175b2.tar.xz netpbm-mirror-198e60227883a3508316c58f526340d18b1175b2.zip |
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3234 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | editor/pamflip/flip.h | 2 | ||||
-rw-r--r-- | editor/pamflip/pamflip.c | 98 | ||||
-rw-r--r-- | editor/pamflip/pamflip_sse.c | 44 | ||||
-rw-r--r-- | editor/pamflip/pamflip_sse.h | 2 |
4 files changed, 73 insertions, 73 deletions
diff --git a/editor/pamflip/flip.h b/editor/pamflip/flip.h index 612a7f84..ace93044 100644 --- a/editor/pamflip/flip.h +++ b/editor/pamflip/flip.h @@ -1,7 +1,7 @@ #ifndef FLIP_H_INCLUDED #define FLIP_H_INCLUDED -struct xformCore { +struct XformCore { /* a b c d */ diff --git a/editor/pamflip/pamflip.c b/editor/pamflip/pamflip.c index 9a5f8d61..a9d3a72a 100644 --- a/editor/pamflip/pamflip.c +++ b/editor/pamflip/pamflip.c @@ -77,12 +77,12 @@ #include "flip.h" #include "pamflip_sse.h" -enum xformType {LEFTRIGHT, TOPBOTTOM, TRANSPOSE}; +enum XformType {LEFTRIGHT, TOPBOTTOM, TRANSPOSE}; static void parseXformOpt(const char * const xformOpt, unsigned int * const xformCountP, - enum xformType * const xformList) { + enum XformType * const xformList) { /*---------------------------------------------------------------------------- Translate the -xform option string into an array of transform types. @@ -125,13 +125,13 @@ parseXformOpt(const char * const xformOpt, /* See transformPoint() for an explanation of the transform matrix types. The - difference between xformCore and xformMatrix is that 'xformCore' is + difference between XformCore and XformMatrix is that 'XformCore' is particular to the source image dimensions and can be used to do the - transformation, while 'xformCore' is independent of the source image and + transformation, while 'XformCore' is independent of the source image and just tells what kind of transformation. */ -struct xformMatrix { +struct XformMatrix { /* a b 0 c d 0 e f 1 @@ -147,7 +147,7 @@ struct xformMatrix { static void -leftright(struct xformCore * const xformP) { +leftright(struct XformCore * const xformP) { xformP->a = - xformP->a; xformP->c = - xformP->c; } @@ -155,7 +155,7 @@ leftright(struct xformCore * const xformP) { static void -topbottom(struct xformCore * const xformP) { +topbottom(struct XformCore * const xformP) { xformP->b = - xformP->b; xformP->d = - xformP->d; } @@ -174,7 +174,7 @@ swap(int * const xP, int * const yP) { static void -transpose(struct xformCore * const xformP) { +transpose(struct XformCore * const xformP) { swap(&xformP->a, &xformP->b); swap(&xformP->c, &xformP->d); } @@ -183,17 +183,17 @@ transpose(struct xformCore * const xformP) { static void computeXformCore(unsigned int const xformCount, - enum xformType const xformType[], - struct xformCore * const xformP) { + enum XformType const XformType[], + struct XformCore * const xformP) { - struct xformCore const nullTransform = {1, 0, 0, 1}; + struct XformCore const nullTransform = {1, 0, 0, 1}; unsigned int i; *xformP = nullTransform; /* initial value */ for (i = 0; i < xformCount; ++i) { - switch (xformType[i]) { + switch (XformType[i]) { case LEFTRIGHT: leftright(xformP); break; @@ -210,7 +210,7 @@ computeXformCore(unsigned int const xformCount, static void -xformDimensions(struct xformCore const xform, +xformDimensions(struct XformCore const xform, unsigned int const inCols, unsigned int const inRows, unsigned int * const outColsP, @@ -229,18 +229,18 @@ xformDimensions(struct xformCore const xform, static void -computeXformMatrix(struct xformMatrix * const xformP, +computeXformMatrix(struct XformMatrix * const xformP, unsigned int const sourceCols, unsigned int const sourceRows, - struct xformCore const xformCore) { + struct XformCore const XformCore) { - int colMax = xformCore.a * (sourceCols-1) + xformCore.c * (sourceRows-1); - int rowMax = xformCore.b * (sourceCols-1) + xformCore.d * (sourceRows-1); + int colMax = XformCore.a * (sourceCols-1) + XformCore.c * (sourceRows-1); + int rowMax = XformCore.b * (sourceCols-1) + XformCore.d * (sourceRows-1); - xformP->a = xformCore.a; - xformP->b = xformCore.b; - xformP->c = xformCore.c; - xformP->d = xformCore.d; + xformP->a = XformCore.a; + xformP->b = XformCore.b; + xformP->c = XformCore.c; + xformP->d = XformCore.d; xformP->e = colMax < 0 ? -colMax : 0; xformP->f = rowMax < 0 ? -rowMax : 0; } @@ -252,7 +252,7 @@ struct cmdlineInfo { in a form easy for the program to use. */ const char * inputFilespec; /* Filespec of input file */ - struct xformCore xform; + struct XformCore xform; /* Handy mathematical representation of all of transform options */ size_t availableMemory; unsigned int pageSize; @@ -300,8 +300,8 @@ parseCommandLine(int argc, char ** const argv, unsigned int memsizeOpt; const char * xformOpt; unsigned int xformCount; - /* Number of transforms in the 'xformType' array */ - enum xformType xformList[10]; + /* Number of transforms in the 'XformType' array */ + enum XformType xformList[10]; /* Array of transforms to be applied, in order */ MALLOCARRAY(option_def, 100); @@ -602,7 +602,7 @@ transformRowsBottomTopNonPbm(struct pam * const inpamP, static void __inline__ transformPoint(int const col, int const row, - struct xformMatrix const xform, + struct XformMatrix const xform, unsigned int * const newcolP, unsigned int * const newrowP ) { /*---------------------------------------------------------------------------- @@ -653,7 +653,7 @@ writeRaster(struct pam * const pamP, static void transformPbmGen(struct pam * const inpamP, struct pam * const outpamP, - struct xformCore const xformCore) { + struct XformCore const XformCore) { /*---------------------------------------------------------------------------- This is the same as transformGen, except that it uses less memory, since the PBM buffer format uses one bit per pixel instead @@ -665,10 +665,10 @@ transformPbmGen(struct pam * const inpamP, -----------------------------------------------------------------------------*/ bit * bitrow; bit ** newbits; - struct xformMatrix xform; + struct XformMatrix xform; unsigned int row; - computeXformMatrix(&xform, inpamP->width, inpamP->height, xformCore); + computeXformMatrix(&xform, inpamP->width, inpamP->height, XformCore); bitrow = pbm_allocrow_packed(inpamP->width); newbits = pbm_allocarray_packed( outpamP->width, outpamP->height ); @@ -720,7 +720,7 @@ transformPbmGen(struct pam * const inpamP, static void transformNonPbmWhole(struct pam * const inpamP, struct pam * const outpamP, - struct xformCore const xformCore, + struct XformCore const XformCore, bool const verbose) { /*---------------------------------------------------------------------------- Do the transform using "pam" library functions, as opposed to "pbm" @@ -738,10 +738,10 @@ transformNonPbmWhole(struct pam * const inpamP, -----------------------------------------------------------------------------*/ tuple * tuplerow; tuple ** newtuples; - struct xformMatrix xform; + struct XformMatrix xform; unsigned int row; - computeXformMatrix(&xform, inpamP->width, inpamP->height, xformCore); + computeXformMatrix(&xform, inpamP->width, inpamP->height, XformCore); tuplerow = pnm_allocpamrow(inpamP); newtuples = pnm_allocpamarray(outpamP); @@ -798,7 +798,7 @@ initOutCell(struct pam * const outCellPamP, unsigned int const inCellWidth, unsigned int const inCellHeight, struct pam * const inpamP, - struct xformCore const xformCore) { + struct XformCore const XformCore) { /*---------------------------------------------------------------------------- Set up an output cell. Create and open a temporary file to hold its raster. Figure out the dimensions of the cell. Return a PAM structure @@ -812,7 +812,7 @@ initOutCell(struct pam * const outCellPamP, outCellPamP->file = pm_tmpfile(); - xformDimensions(xformCore, inCellWidth, inCellHeight, + xformDimensions(XformCore, inCellWidth, inCellHeight, &outCellFileCt, &outCellRankCt); outCellPamP->width = outCellFileCt; @@ -824,8 +824,8 @@ initOutCell(struct pam * const outCellPamP, static outputMap * createOutputMap(struct pam * const inpamP, unsigned int const maxRows, - struct xformMatrix const cellXform, - struct xformCore const xformCore) { + struct XformMatrix const cellXform, + struct XformCore const XformCore) { /*---------------------------------------------------------------------------- Create and return the output map. That's a map of all the output cells (from which the output image can be assembled, once those cells are filled @@ -853,7 +853,7 @@ createOutputMap(struct pam * const inpamP, MALLOCVAR_NOFAIL(mapP); - xformDimensions(xformCore, inCellFileCt, inCellRankCt, + xformDimensions(XformCore, inCellFileCt, inCellRankCt, &mapP->fileCt, &mapP->rankCt); MALLOCARRAY(mapP->pam, mapP->rankCt); @@ -882,7 +882,7 @@ createOutputMap(struct pam * const inpamP, initOutCell(&mapP->pam[outCellRank][outCellFile], inpamP->width, inCellRowCt, - inpamP, xformCore); + inpamP, XformCore); } return mapP; } @@ -935,14 +935,14 @@ closeCellFiles(outputMap * const outputMapP) { static void transformCell(struct pam * const inpamP, struct pam * const outpamP, - struct xformCore const xformCore) { + struct XformCore const XformCore) { - struct xformMatrix xform; + struct XformMatrix xform; tuple * inTupleRow; tuple ** outTuples; unsigned int inRow; - computeXformMatrix(&xform, inpamP->width, inpamP->height, xformCore); + computeXformMatrix(&xform, inpamP->width, inpamP->height, XformCore); inTupleRow = pnm_allocpamrow(inpamP); @@ -1020,7 +1020,7 @@ stitchCellsToOutput(outputMap * const outputMapP, static void transformNonPbmChunk(struct pam * const inpamP, struct pam * const outpamP, - struct xformCore const xformCore, + struct XformCore const XformCore, unsigned int const maxRows, bool const verbose) { /*---------------------------------------------------------------------------- @@ -1032,11 +1032,11 @@ transformNonPbmChunk(struct pam * const inpamP, header). We call the strip of 'maxRows' rows that we read a source cell. We - transform that cell according to 'xformCore' to create a + transform that cell according to 'XformCore' to create a target cell. We store all the target cells in temporary files. We consider the target cells to be arranged in a column matrix the same as the source cells within the source image; we transform that - matrix according to 'xformCore'. The resulting cell matrix is the + matrix according to 'XformCore'. The resulting cell matrix is the target image. -----------------------------------------------------------------------------*/ /* The cells of the source image ("inCell") are in a 1-column matrix. @@ -1046,7 +1046,7 @@ transformNonPbmChunk(struct pam * const inpamP, unsigned int const inCellFileCt = 1; unsigned int const inCellRankCt = (inpamP->height + maxRows - 1) / maxRows; - struct xformMatrix cellXform; + struct XformMatrix cellXform; unsigned int inCellRank; outputMap * outputMapP; @@ -1054,9 +1054,9 @@ transformNonPbmChunk(struct pam * const inpamP, pm_message("Transforming in %u chunks, using temp files", inCellRankCt); - computeXformMatrix(&cellXform, inCellFileCt, inCellRankCt, xformCore); + computeXformMatrix(&cellXform, inCellFileCt, inCellRankCt, XformCore); - outputMapP = createOutputMap(inpamP, maxRows, cellXform, xformCore); + outputMapP = createOutputMap(inpamP, maxRows, cellXform, XformCore); for (inCellRank = 0; inCellRank < inCellRankCt; ++inCellRank) { unsigned int const inCellFile = 0; @@ -1077,7 +1077,7 @@ transformNonPbmChunk(struct pam * const inpamP, inCellPam = *inpamP; inCellPam.height = inCellRows; - transformCell(&inCellPam, outCellPamP, xformCore); + transformCell(&inCellPam, outCellPamP, XformCore); } rewindCellFiles(outputMapP); @@ -1122,7 +1122,7 @@ maxRowsThatFit(struct pam * const pamP, static void transformPbm(struct pam * const inpamP, struct pam * const outpamP, - struct xformCore const xform, + struct XformCore const xform, bool const verbose) { if (xform.b == 0 && xform.c == 0) { @@ -1155,7 +1155,7 @@ transformPbm(struct pam * const inpamP, static void transformNonPbm(struct pam * const inpamP, struct pam * const outpamP, - struct xformCore const xform, + struct XformCore const xform, unsigned int const availableMemory, bool const verbose) { diff --git a/editor/pamflip/pamflip_sse.c b/editor/pamflip/pamflip_sse.c index e0929f65..467e12b9 100644 --- a/editor/pamflip/pamflip_sse.c +++ b/editor/pamflip/pamflip_sse.c @@ -37,7 +37,7 @@ /*---------------------------------------------------------------------------- This is a specialized routine for row-for-column PBM transformations. - (-cw, -ccw, -xy). It requires GCC (>= v. 4.2.0) and SSE2. + (-cw, -ccw, -xy). It requires GCC (>= v. 4.2.0) and SSE2. In each cycle, we read sixteen rows from the input. We process this band left to right in blocks 8 pixels wide. We use the SSE2 instruction @@ -70,7 +70,7 @@ It is possible to write a non-SSE version by providing a generic version of transpose16Bitrows() or one tuned for a specific architecture. Use 8x8 blocks to avoid endian issues. - + Further enhancement should be possible by employing wider bands, larger blocks as wider SIMD registers become available. Clearing the white parts after instead of before transposition is also a @@ -149,7 +149,7 @@ transpose16Bitrows(unsigned int const cols, register v16qi vReg = { block[0][col8], block[1][col8], - block[2][col8], block[3][col8], + block[2][col8], block[3][col8], block[4][col8], block[5][col8], block[6][col8], block[7][col8], block[8][col8], block[9][col8], @@ -163,14 +163,14 @@ transpose16Bitrows(unsigned int const cols, if (_mm_movemask_epi8(compare) != 0xffff) { /* There is some black content in this block; write to outplane */ - + unsigned int outrow; unsigned int i; outrow = col; /* initial value */ for (i = 0; i < 7; ++i) { - /* GCC (>=4.2) automatically unrolls this loop */ + /* GCC (>=4.2) automatically unrolls this loop */ outplane[outrow++][outcol16] = _mm_movemask_epi8((__m128i)vReg); vReg = (v16qi)_mm_slli_epi32((__m128i)vReg, 1); @@ -197,7 +197,7 @@ analyzeBlock(const struct pam * const inpamP, "twists" brought about by Intel byte ordering which occur when: (1) 16 bytes are loaded to a SSE register (2) 16 bits are written to memory. - + If 'rows' is not a multiple of 8, a partial input band appears at one edge. Set *topOfFullBlockP accordingly. blockPartial[] is an adjusted "block" for this partial band, brought up to a size of 8 rows. The extra pointers point @@ -227,7 +227,7 @@ analyzeBlock(const struct pam * const inpamP, : block[i]; } *topOfFullBlockP = inpamP->height % 16; - + if (inpamP->height >= 16) { *outcol16P = inpamP->height/16 - 1; } else @@ -243,7 +243,7 @@ doPartialBlockTop(const struct pam * const inpamP, const bit * const blockPartial[16], unsigned int const topOfFullBlock, uint16_t ** const outplane) { - + if (topOfFullBlock > 0) { unsigned int colChar, row; unsigned int pad = 16 - topOfFullBlock; @@ -267,7 +267,7 @@ doPartialBlockTop(const struct pam * const inpamP, outplane, inpamP->height /16); /* Transpose partial rows on top of input. Place on right edge of output. - */ + */ } } @@ -303,7 +303,7 @@ doFullBlocks(const struct pam * const inpamP, ++modrow; if (modrow == 16) { /* 16 row buffer is full. Transpose. */ - modrow = 0; + modrow = 0; transpose16Bitrows(inpamP->width, inpamP->height, block, outplane, outcol16); @@ -320,7 +320,7 @@ doPartialBlockBottom(const struct pam * const inpamP, int const xdir, const bit * const blockPartial[16], uint16_t ** const outplane) { - + if (xdir > 0 && inpamP->height % 16 > 0) { unsigned int colChar; @@ -331,7 +331,7 @@ doPartialBlockBottom(const struct pam * const inpamP, outplane, inpamP->height/16); /* Transpose partial rows on bottom of input. Place on right edge of output. - */ + */ } } @@ -341,7 +341,7 @@ static void writeOut(const struct pam * const outpamP, uint16_t ** const outplane, int const ydir) { - + unsigned int row; for (row = 0; row < outpamP->height; ++row) { @@ -357,23 +357,23 @@ writeOut(const struct pam * const outpamP, static void clearOutplane(const struct pam * const outpamP, - uint16_t ** const outplane) { - + uint16_t ** const outplane) { + unsigned int row; - + for (row = 0; row < outpamP->height; ++row) { unsigned int col16; /* column divided by 16 */ for (col16 = 0; col16 < (outpamP->width + 15)/16; ++col16) outplane[row][col16] = 0x0000; } -} +} void pamflip_transformRowsToColumnsPbmSse(const struct pam * const inpamP, const struct pam * const outpamP, - struct xformCore const xformCore) { + struct XformCore const xformCore) { /*---------------------------------------------------------------------------- This is a specialized routine for row-for-column PBM transformations. (-cw, -ccw, -xy). @@ -397,11 +397,11 @@ pamflip_transformRowsToColumnsPbmSse(const struct pam * const inpamP, pm_error("Could not allocate %u x %u array of 16 bit units", blocksPerRow, outpamP->height + 7); - /* We write to the output array in 16 bit units. Add margin. */ + /* We write to the output array in 16 bit units. Add margin. */ clearOutplane(outpamP, outplane); - analyzeBlock(inpamP, inrow, xdir, block, blockPartial, + analyzeBlock(inpamP, inrow, xdir, block, blockPartial, &topOfFullBlock, &outcol16); doPartialBlockTop(inpamP, inrow, blockPartial, topOfFullBlock, outplane); @@ -421,9 +421,9 @@ pamflip_transformRowsToColumnsPbmSse(const struct pam * const inpamP, void pamflip_transformRowsToColumnsPbmSse(const struct pam * const inpamP, const struct pam * const outpamP, - struct xformCore const xformCore) { + struct xformCore const xformCore) { /* Nobody is supposed to call this */ assert(false); } -#endif +#endif diff --git a/editor/pamflip/pamflip_sse.h b/editor/pamflip/pamflip_sse.h index 59e7c026..cd1267b7 100644 --- a/editor/pamflip/pamflip_sse.h +++ b/editor/pamflip/pamflip_sse.h @@ -7,6 +7,6 @@ struct pam; void pamflip_transformRowsToColumnsPbmSse(const struct pam * const inpamP, const struct pam * const outpamP, - struct xformCore const xformCore); + struct XformCore const xformCore); #endif |