about summary refs log tree commit diff
path: root/lib/ppm.h
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-03-05 01:09:39 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-03-05 01:09:39 +0000
commitffcb1453bce751e315fb422f667e2e61a1137d40 (patch)
tree9f36f4f4571a5f0676e222632831d6a9c12f40eb /lib/ppm.h
parentc13514b9e889dad5a35adc71a29840c206b0a286 (diff)
downloadnetpbm-mirror-ffcb1453bce751e315fb422f667e2e61a1137d40.tar.gz
netpbm-mirror-ffcb1453bce751e315fb422f667e2e61a1137d40.tar.xz
netpbm-mirror-ffcb1453bce751e315fb422f667e2e61a1137d40.zip
clarify applicable standard, add more precision
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3164 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/ppm.h')
-rw-r--r--lib/ppm.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/ppm.h b/lib/ppm.h
index 5b94af9e..6f1f21b5 100644
--- a/lib/ppm.h
+++ b/lib/ppm.h
@@ -211,9 +211,7 @@ PPM_DISTANCE(pixel const p1,
    combination of intensities, whereas luma is a linear combination of
    gamma-adjusted intensities, as you would find in a Netpbm image.
 
-   These are from ITU-R BT.601.5.  That means they probably aren't technically
-   right for use with PPM images, because the PPM spec says ITU-R BT.709.
-   The two are similar, though.
+   These are from ITU-R BT.601.5.
 */
 #define PPM_LUMINR (0.2989)
 #define PPM_LUMING (0.5866)
@@ -222,12 +220,12 @@ PPM_DISTANCE(pixel const p1,
 #define PPM_LUMIN(p) ( PPM_LUMINR * PPM_GETR(p) \
                        + PPM_LUMING * PPM_GETG(p) \
                        + PPM_LUMINB * PPM_GETB(p) )
-#define PPM_CHROM_B(p) ( -0.16874 * PPM_GETR(p) \
-                         - 0.33126 * PPM_GETG(p) \
+#define PPM_CHROM_B(p) ( -0.168736 * PPM_GETR(p) \
+                         - 0.331264 * PPM_GETG(p) \
                          + 0.5 * PPM_GETB(p) )
 #define PPM_CHROM_R(p) ( 0.5 * PPM_GETR(p) \
-                         - 0.41869 * PPM_GETG(p) \
-                         - 0.08131 * PPM_GETB(p) )
+                         - 0.418688 * PPM_GETG(p) \
+                         - 0.081312 * PPM_GETB(p) )
 
 pixel
 ppm_color_from_ycbcr(unsigned int const y,