summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTavis Ormandy <taviso@gentoo.org>2005-01-04 14:10:18 +0000
committerTavis Ormandy <taviso@gentoo.org>2005-01-04 14:10:18 +0000
commit52a8cc829ccd36c7229f727235fb3d51b820ebe8 (patch)
treef650aa5687b54fa92ffc3d7bdaf0e073aeab3ddb /media-gfx/xv/files
parentunmask for x86 (diff)
downloadhistorical-52a8cc829ccd36c7229f727235fb3d51b820ebe8.tar.gz
historical-52a8cc829ccd36c7229f727235fb3d51b820ebe8.tar.bz2
historical-52a8cc829ccd36c7229f727235fb3d51b820ebe8.zip
add patches
Diffstat (limited to 'media-gfx/xv/files')
-rw-r--r--media-gfx/xv/files/digest-xv-3.10a-r92
-rw-r--r--media-gfx/xv/files/xv-optimize-jpeg.diff18
-rw-r--r--media-gfx/xv/files/xv-postscript-double-free.diff30
-rw-r--r--media-gfx/xv/files/xv-smoothing-algorithm.diff172
4 files changed, 222 insertions, 0 deletions
diff --git a/media-gfx/xv/files/digest-xv-3.10a-r9 b/media-gfx/xv/files/digest-xv-3.10a-r9
new file mode 100644
index 000000000000..2bb5f3fa79b8
--- /dev/null
+++ b/media-gfx/xv/files/digest-xv-3.10a-r9
@@ -0,0 +1,2 @@
+MD5 2d4fbeec1561304362781cc8e2f7f72d xv-3.10a.tar.gz 2259124
+MD5 f8b8a8f7d76e5108b4abe3e7a5901f3e xv-3.10a-gentoo.tar.gz 52394
diff --git a/media-gfx/xv/files/xv-optimize-jpeg.diff b/media-gfx/xv/files/xv-optimize-jpeg.diff
new file mode 100644
index 000000000000..bcd1879f6fba
--- /dev/null
+++ b/media-gfx/xv/files/xv-optimize-jpeg.diff
@@ -0,0 +1,18 @@
+--- xvjpeg.c.orig 2005-01-04 13:49:48.074362760 +0000
++++ xvjpeg.c 2005-01-04 13:51:04.286776712 +0000
+@@ -761,6 +761,7 @@
+ jpeg_set_defaults(&cinfo);
+ jpeg_set_quality(&cinfo, (int)qDial.val, TRUE);
+ cinfo.smoothing_factor = (int)smDial.val;
++ cinfo.optimize_coding = TRUE;
+
+
+ jpeg_start_compress(&cinfo, TRUE);
+--- jpeg/jconfig.cfg.orig 1994-12-22 22:35:00.000000000 +0000
++++ jpeg/jconfig.cfg 2005-01-04 13:51:04.285776864 +0000
+@@ -42,3 +42,5 @@
+ #undef PROGRESS_REPORT
+
+ #endif /* JPEG_CJPEG_DJPEG */
++
++#define JDCT_DEFAULT JDCT_FLOAT
diff --git a/media-gfx/xv/files/xv-postscript-double-free.diff b/media-gfx/xv/files/xv-postscript-double-free.diff
new file mode 100644
index 000000000000..740dafcb65e7
--- /dev/null
+++ b/media-gfx/xv/files/xv-postscript-double-free.diff
@@ -0,0 +1,30 @@
+--- xv-3.10a/xvps.c Thu Dec 22 14:12:17 1994
++++ xv-3.10a/xvps.c Sun Nov 30 22:55:21 1997
+@@ -891,7 +891,7 @@
+ int i, j, q, err, rpix, gpix, bpix, nc, ptype;
+ int iw, ih, ox, oy, slen, lwidth, bits, colorps, w, h, pfree;
+ double iwf, ihf;
+- byte *inpix, *rmap, *gmap, *bmap;
++ byte *save_inpix, *inpix, *rmap, *gmap, *bmap;
+
+ slen = bits = colorps = 0;
+
+@@ -901,7 +901,8 @@
+
+ WaitCursor();
+
+- inpix = GenSavePic(&ptype, &w, &h, &pfree, &nc, &rmap, &gmap, &bmap);
++ save_inpix = inpix =
++ GenSavePic(&ptype, &w, &h, &pfree, &nc, &rmap, &gmap, &bmap);
+
+
+ /* printed image will have size iw,ih (in picas) */
+@@ -1123,7 +1124,7 @@
+ fprintf(fp,"origstate restore\n\n");
+ fprintf(fp,"%%%%Trailer\n");
+
+- if (pfree) free(inpix);
++ if (pfree) free(save_inpix);
+
+ if (CloseOutFile(fp, filename, (err==EOF)) == 0) {
+ DirBox(0);
diff --git a/media-gfx/xv/files/xv-smoothing-algorithm.diff b/media-gfx/xv/files/xv-smoothing-algorithm.diff
new file mode 100644
index 000000000000..e5516966a5eb
--- /dev/null
+++ b/media-gfx/xv/files/xv-smoothing-algorithm.diff
@@ -0,0 +1,172 @@
+diff -urN old/xv-3.10a/xvsmooth.c xv-3.10a/xvsmooth.c
+--- old/xv-3.10a/xvsmooth.c Thu Dec 22 17:34:42 1994
++++ xv-3.10a/xvsmooth.c Sun Aug 17 14:07:58 1997
+@@ -65,10 +65,13 @@
+ returns a dwide*dhigh 24bit image, or NULL on failure (malloc) */
+ /* rmap,gmap,bmap should be 'desired' colors */
+
++ /* DANGER: This code assumes that a right-shift on signed integers is
++ performed arithmetically, i.e. the sign bit is copied to the right. */
++
+ byte *pic24, *pp;
+- int *cxtab, *pxtab;
+- int y1Off, cyOff;
+- int ex, ey, cx, cy, px, py, apx, apy, x1, y1;
++ int *pxtab;
++ int ex, ey, px, py, x0, x1, y0, y1;
++ int y0off, y1off;
+ int cA, cB, cC, cD;
+ int pA, pB, pC, pD;
+ int retval, bperpix;
+@@ -98,69 +101,61 @@
+ else {
+ /* dwide >= swide && dhigh >= shigh */
+
+- /* cx,cy = original pixel in pic824. px,py = relative position
+- of pixel ex,ey inside of cx,cy as percentages +-50%, +-50%.
+- 0,0 = middle of pixel */
+-
+- /* we can save a lot of time by precomputing cxtab[] and pxtab[], both
+- dwide arrays of ints that contain values for the equations:
+- cx = (ex * swide) / dwide;
+- px = ((ex * swide * 100) / dwide) - (cx * 100) - 50; */
+-
+- cxtab = (int *) malloc(dwide * sizeof(int));
+- if (!cxtab) { free(pic24); return NULL; }
++ /* px, py = location on original image, in units of 1/256 pixel
++ We can save time by precomputing all values of px. */
+
+ pxtab = (int *) malloc(dwide * sizeof(int));
+- if (!pxtab) { free(pic24); free(cxtab); return NULL; }
+-
+- for (ex=0; ex<dwide; ex++) {
+- cxtab[ex] = (ex * swide) / dwide;
+- pxtab[ex] = (((ex * swide)* 100) / dwide)
+- - (cxtab[ex] * 100) - 50;
+- }
++ if (!pxtab) { free(pic24); return NULL; }
+
+- for (ey=0; ey<dhigh; ey++) {
++ for (ex=0; ex < dwide; ex++)
++ pxtab[ex] = ((ex << 8) + 128) * swide / dwide - 128;
++
++ for (ey=0; ey < dhigh; ey++) {
+ byte *pptr, rA, gA, bA, rB, gB, bB, rC, gC, bC, rD, gD, bD;
+
+ ProgressMeter(0, (dhigh)-1, ey, "Smooth");
+
+- cy = (ey * shigh) / dhigh;
+- py = (((ey * shigh) * 100) / dhigh) - (cy * 100) - 50;
+- if (py<0) { y1 = cy-1; if (y1<0) y1=0; }
+- else { y1 = cy+1; if (y1>shigh-1) y1=shigh-1; }
++ py = ((ey << 8) + 128) * shigh / dhigh - 128;
++ y0 = py >> 8; /* Put integer part in y0 */
++ y1 = y0 + 1;
++ py &= 255; /* Keep fractional part in py */
++
++ if (y0 < 0) y0 = y1 = 0;
++ if (y1 >= shigh) y0 = y1 = shigh-1;
+
+- cyOff = cy * swide * bperpix; /* current line */
+- y1Off = y1 * swide * bperpix; /* up or down one line, depending */
++ y0off = y0 * swide * bperpix; /* current line */
++ y1off = y1 * swide * bperpix; /* one line down */
+
+ if ((ey&15) == 0) WaitCursor();
+
+- for (ex=0; ex<dwide; ex++) {
+- rA = rB = rC = rD = gA = gB = gC = gD = bA = bB = bC = bD = 0;
++ for (ex=0; ex < dwide; ex++) {
+
+- cx = cxtab[ex];
+ px = pxtab[ex];
++ x0 = px >> 8; /* Put integer part in x0 */
++ x1 = x0 + 1;
++ px &= 255; /* Keep fractional part in px */
+
+- if (px<0) { x1 = cx-1; if (x1<0) x1=0; }
+- else { x1 = cx+1; if (x1>swide-1) x1=swide-1; }
++ if (x0 < 0) x0 = x1 = 0;
++ if (x1 >= swide) x0 = x1 = swide-1;
+
+ if (is24) {
+- pptr = pic824 + y1Off + x1*bperpix; /* corner pixel */
++ pptr = pic824 + y0off + x0*bperpix; /* upper left pixel */
+ rA = *pptr++; gA = *pptr++; bA = *pptr++;
+
+- pptr = pic824 + y1Off + cx*bperpix; /* up/down center pixel */
++ pptr = pic824 + y0off + x1*bperpix; /* upper right pixel */
+ rB = *pptr++; gB = *pptr++; bB = *pptr++;
+
+- pptr = pic824 + cyOff + x1*bperpix; /* left/right center pixel */
++ pptr = pic824 + y1off + x0*bperpix; /* lower left pixel */
+ rC = *pptr++; gC = *pptr++; bC = *pptr++;
+
+- pptr = pic824 + cyOff + cx*bperpix; /* center pixel */
++ pptr = pic824 + y1off + x1*bperpix; /* lower right pixel */
+ rD = *pptr++; gD = *pptr++; bD = *pptr++;
+ }
+ else { /* 8-bit picture */
+- cA = pic824[y1Off + x1]; /* corner pixel */
+- cB = pic824[y1Off + cx]; /* up/down center pixel */
+- cC = pic824[cyOff + x1]; /* left/right center pixel */
+- cD = pic824[cyOff + cx]; /* center pixel */
++ cA = pic824[y0off + x0]; /* upper left pixel */
++ cB = pic824[y0off + x1]; /* upper right pixel */
++ cC = pic824[y1off + x0]; /* lower left pixel */
++ cD = pic824[y1off + x1]; /* lower right pixel */
+ }
+
+ /* quick check */
+@@ -170,38 +165,30 @@
+ }
+
+ else {
+- /* compute weighting factors */
+- apx = abs(px); apy = abs(py);
+- pA = (apx * apy) / 100;
+- pB = (apy * (100 - apx)) / 100;
+- pC = (apx * (100 - apy)) / 100;
+- pD = 100 - (pA + pB + pC);
++ pA = (256-px)*(256-py); /* compute weighting factors */
++ pB = px * (256-py); /* total weight is exactly 2^16 */
++ pC = (256-px) * py;
++ pD = px * py;
+
+ if (is24) {
+- *pp++ = ((int) (pA * rA))/100 + ((int) (pB * rB))/100 +
+- ((int) (pC * rC))/100 + ((int) (pD * rD))/100;
+-
+- *pp++ = ((int) (pA * gA))/100 + ((int) (pB * gB))/100 +
+- ((int) (pC * gC))/100 + ((int) (pD * gD))/100;
+-
+- *pp++ = ((int) (pA * bA))/100 + ((int) (pB * bB))/100 +
+- ((int) (pC * bC))/100 + ((int) (pD * bD))/100;
++ *pp++ = (pA * rA + pB * rB + pC * rC + pD * rD) + 32768 >> 16;
++ *pp++ = (pA * gA + pB * gB + pC * gC + pD * gD) + 32768 >> 16;
++ *pp++ = (pA * bA + pB * bB + pC * bC + pD * bD) + 32768 >> 16;
+ }
+ else { /* 8-bit pic */
+- *pp++ = ((int) (pA * rmap[cA]))/100 + ((int)(pB * rmap[cB]))/100 +
+- ((int) (pC * rmap[cC]))/100 + ((int)(pD * rmap[cD]))/100;
++ *pp++ = (pA * rmap[cA] + pB * rmap[cB] + pC * rmap[cC] +
++ pD * rmap[cD]) + 32768 >> 16;
+
+- *pp++ = ((int) (pA * gmap[cA]))/100 + ((int)(pB * gmap[cB]))/100 +
+- ((int) (pC * gmap[cC]))/100 + ((int)(pD * gmap[cD]))/100;
++ *pp++ = (pA * gmap[cA] + pB * gmap[cB] + pC * gmap[cC] +
++ pD * gmap[cD]) + 32768 >> 16;
+
+- *pp++ = ((int)(pA * bmap[cA]))/100 + ((int)(pB * bmap[cB]))/100 +
+- ((int)(pC * bmap[cC]))/100 + ((int)(pD * bmap[cD]))/100;
++ *pp++ = (pA * bmap[cA] + pB * bmap[cB] + pC * bmap[cC] +
++ pD * bmap[cD]) + 32768 >> 16;
+ }
+ }
+ }
+ }
+
+- free(cxtab);
+ free(pxtab);
+ retval = 0; /* okay */
+ }