aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/tiff/files
diff options
context:
space:
mode:
authordinoex <dinoex@FreeBSD.org>2004-11-16 12:14:25 +0800
committerdinoex <dinoex@FreeBSD.org>2004-11-16 12:14:25 +0800
commit0a24433fd9d9090aeb6aeb6318afc2555cb78199 (patch)
treeafb25abfa6e54c18c1ab7ab103589edb546e2d51 /graphics/tiff/files
parentf8d87decab007a9fea6728bdd5d4f0658ffa9d62 (diff)
downloadfreebsd-ports-gnome-0a24433fd9d9090aeb6aeb6318afc2555cb78199.tar.gz
freebsd-ports-gnome-0a24433fd9d9090aeb6aeb6318afc2555cb78199.tar.zst
freebsd-ports-gnome-0a24433fd9d9090aeb6aeb6318afc2555cb78199.zip
- bugfix in YCbCr support
some tables were initialized with wrong value missing check for division by zero Submitted by: Hans Petter Selasky
Diffstat (limited to 'graphics/tiff/files')
-rw-r--r--graphics/tiff/files/patch-tif_color.c43
-rw-r--r--graphics/tiff/files/patch-tiff2ps.c (renamed from graphics/tiff/files/patch-float)0
2 files changed, 43 insertions, 0 deletions
diff --git a/graphics/tiff/files/patch-tif_color.c b/graphics/tiff/files/patch-tif_color.c
new file mode 100644
index 000000000000..9288d85ff565
--- /dev/null
+++ b/graphics/tiff/files/patch-tif_color.c
@@ -0,0 +1,43 @@
+*** libtiff/tif_color.c.ref Fri Nov 5 18:01:44 2004
+--- libtiff/tif_color.c Fri Nov 5 18:26:46 2004
+***************
+*** 170,176 ****
+ #define SHIFT 16
+ #define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5))
+ #define ONE_HALF ((int32)(1<<(SHIFT-1)))
+! #define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)((RW)-(RB)))
+ #define CLAMP(f,min,max) ((f)<(min)?(min):(f)>(max)?(max):(f))
+
+ void
+--- 170,176 ----
+ #define SHIFT 16
+ #define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5))
+ #define ONE_HALF ((int32)(1<<(SHIFT-1)))
+! #define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)) ? ((RW)-(RB)) : 1))
+ #define CLAMP(f,min,max) ((f)<(min)?(min):(f)>(max)?(max):(f))
+
+ void
+***************
+*** 243,252 ****
+ * constructing tables indexed by the raw pixel data.
+ */
+ for (i = 0, x = -128; i < 256; i++, x++) {
+! int32 Cr = (int32)Code2V(x, refBlackWhite[4] - 128.0F,
+! refBlackWhite[5] - 128.0F, 127);
+! int32 Cb = (int32)Code2V(x, refBlackWhite[2] - 128.0F,
+! refBlackWhite[3] - 128.0F, 127);
+
+ ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT);
+ ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT);
+--- 243,252 ----
+ * constructing tables indexed by the raw pixel data.
+ */
+ for (i = 0, x = -128; i < 256; i++, x++) {
+! int32 Cr = ((int32)Code2V(x, refBlackWhite[4] - 128.0F,
+! refBlackWhite[5] - 128.0F, 255)) - 128;
+! int32 Cb = ((int32)Code2V(x, refBlackWhite[2] - 128.0F,
+! refBlackWhite[3] - 128.0F, 255)) - 128;
+
+ ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT);
+ ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT);
+
diff --git a/graphics/tiff/files/patch-float b/graphics/tiff/files/patch-tiff2ps.c
index 5178a026aa35..5178a026aa35 100644
--- a/graphics/tiff/files/patch-float
+++ b/graphics/tiff/files/patch-tiff2ps.c