[poppler] Question about code

Koji Otani sho at bbr.jp
Tue Jun 22 22:35:44 PDT 2010


From: Albert Astals Cid <aacid at kde.org>
Subject: Question about code
Date: Tue, 22 Jun 2010 21:19:04 +0100
Message-ID: <201006222119.05126.aacid at kde.org>

aacid> Hi Koji, in 
aacid> http://cgit.freedesktop.org/poppler/poppler/commit/?id=140b8ed97416f9c2ec02eb749ca45ca50bd651a8 
aacid> you added
aacid> 
aacid> +  X *= whiteX;
aacid> +  Y *= whiteY;
aacid> +  Z *= whiteZ;
aacid> +  // convert XYZ to RGB, including gamut mapping and gamma correction
aacid> +  r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z;
aacid> +  g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z;
aacid> +  b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z;
aacid> +  rgb->r = dblToCol(pow(clip01(r * kr), 0.5));
aacid> +  rgb->g = dblToCol(pow(clip01(g * kg), 0.5));
aacid> +  rgb->b = dblToCol(pow(clip01(b * kb), 0.5));
aacid> +  rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
aacid> 
aacid> to GfxCalGrayColorSpace::getRGB
aacid> 
aacid> I was having a look and it seems the
aacid> +  rgb->r = dblToCol(pow(clip01(r * kr), 0.5));
aacid> +  rgb->g = dblToCol(pow(clip01(g * kg), 0.5));
aacid> +  rgb->b = dblToCol(pow(clip01(b * kb), 0.5));
aacid> calls are not really needed since we overwrite the values with 
aacid> +  rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
aacid> at the end, right?
aacid> 
aacid> Can i safely remove those lines or there is something i'm missing?
aacid> 
aacid> Thanks,
aacid>   Albert
aacid> 

I think that we should do gamut mapping and gamma correction etc.

Please remove the line:
rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
not other lines.

----
Koji Otani


More information about the poppler mailing list