diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2007-03-09 17:58:10 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2007-03-09 17:58:10 +0000 |
commit | 1ca92b339a0c65bfadab923c618863b71955c5be (patch) | |
tree | 1e8317dad092f8802c524326a12a76219cef194e | |
parent | f2ff7fc0202fad727ec2fea4bc628205130dd86d (diff) | |
download | netpbm-mirror-1ca92b339a0c65bfadab923c618863b71955c5be.tar.gz netpbm-mirror-1ca92b339a0c65bfadab923c618863b71955c5be.tar.xz netpbm-mirror-1ca92b339a0c65bfadab923c618863b71955c5be.zip |
Release 10.35.24
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@246 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | Makefile.version | 2 | ||||
-rw-r--r-- | converter/other/pamtoxvmini.c | 29 | ||||
-rw-r--r-- | doc/HISTORY | 7 | ||||
-rw-r--r-- | lib/libpbm3.c | 5 |
4 files changed, 30 insertions, 13 deletions
diff --git a/Makefile.version b/Makefile.version index 5ae33973..f3089b29 100644 --- a/Makefile.version +++ b/Makefile.version @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 35 -NETPBM_POINT_RELEASE = 23 +NETPBM_POINT_RELEASE = 24 diff --git a/converter/other/pamtoxvmini.c b/converter/other/pamtoxvmini.c index 449b3c99..3207b0d5 100644 --- a/converter/other/pamtoxvmini.c +++ b/converter/other/pamtoxvmini.c @@ -75,15 +75,20 @@ makeXvPalette(xvPalette * const xvPaletteP) { static void writeXvHeader(FILE * const ofP, unsigned int const cols, - unsigned int const rows, - unsigned int const maxval) { + unsigned int const rows) { fprintf(ofP, "P7 332\n"); fprintf(ofP, "# Created by Pamtoxvmini\n"); fprintf(ofP, "#END_OF_COMMENTS\n"); - fprintf(ofP, "%u %u %u\n", cols, rows, maxval); + /* I don't know what the maxval number (3rd field) means here, since + the maxvals are fixed at red=7, grn=7, blu=3. We used to have + it put the maxval of the input image there. That generated an + output that Xv choked on when the input maxval was 65535. + */ + + fprintf(ofP, "%u %u 255\n", cols, rows); } @@ -105,7 +110,7 @@ findClosestColor(struct pam * const pamP, colors in the XV palette: */ assert(pamP->depth >= 3); - assert(pamP->maxval = 255); + assert(pamP->maxval == 255); bestPaletteIndex = 0; bestDistanceSoFar = UINT_MAX; @@ -185,30 +190,34 @@ writeXvRaster(struct pam * const pamP, tuple * tuplerow; unsigned int row; unsigned char * xvrow; + struct pam scaledPam; paletteHash = pnm_createtuplehash(); tuplerow = pnm_allocpamrow(pamP); xvrow = (unsigned char*)pm_allocrow(pamP->width, 1); + scaledPam = *pamP; + scaledPam.maxval = 255; + for (row = 0; row < pamP->height; ++row) { unsigned int col; pnm_readpamrow(pamP, tuplerow); - pnm_scaletuplerow(pamP, tuplerow, tuplerow, 255); - pnm_makerowrgb(pamP, tuplerow); + pnm_scaletuplerow(pamP, tuplerow, tuplerow, scaledPam.maxval); + pnm_makerowrgb(&scaledPam, tuplerow); - for (col = 0; col < pamP->width; ++col) { + for (col = 0; col < scaledPam.width; ++col) { unsigned int paletteIndex; - getPaletteIndexThroughCache(pamP, tuplerow[col], xvPaletteP, + getPaletteIndexThroughCache(&scaledPam, tuplerow[col], xvPaletteP, paletteHash, &paletteIndex); assert(paletteIndex < 256); xvrow[col] = paletteIndex; } - fwrite(xvrow, 1, pamP->width, ofP); + fwrite(xvrow, 1, scaledPam.width, ofP); } pm_freerow((char*)xvrow); @@ -240,7 +249,7 @@ main(int argc, pnm_setminallocationdepth(&pam, 3); - writeXvHeader(stdout, pam.width, pam.height, pam.maxval); + writeXvHeader(stdout, pam.width, pam.height); writeXvRaster(&pam, &xvPalette, stdout); diff --git a/doc/HISTORY b/doc/HISTORY index 8a64c17b..3ae17ed1 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,13 @@ Netpbm. CHANGE HISTORY -------------- +07.03.09 BJH Release 10.35.24 + + libnetpbm: fix crash with PBM images < 8 columns on MMX/SSE + machine. + + pamtoxvmini: fix maxval != 255 bugs. + 07.02.21 BJH Release 10.35.23 pamtoxvmini: fix crash. diff --git a/lib/libpbm3.c b/lib/libpbm3.c index 9cdc66ea..cb6edd5b 100644 --- a/lib/libpbm3.c +++ b/lib/libpbm3.c @@ -107,11 +107,12 @@ packBitsWithMmxSse(FILE * const fileP, typedef int v8qi __attribute__ ((mode(V8QI))); typedef int di __attribute__ ((mode(DI))); - int col; di const zero64 = 0; /* to clear with PXOR */ - for (col = 0; col < cols-7; col += 8) { + unsigned int col; + + for (col = 0; col + 7 < cols; col += 8) { v8qi const compare = __builtin_ia32_pcmpeqb(*(v8qi*) (&bitrow[col]), *(v8qi*) &zero64); unsigned char const backwardWhiteMask = (unsigned char) |