[Digikam-devel] [Bug 148382] overexposure indication already when fully "saturated"
Gilles Caulier
caulier.gilles at gmail.com
Fri Oct 15 14:42:28 BST 2010
https://bugs.kde.org/show_bug.cgi?id=148382
Gilles Caulier <caulier.gilles at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |caulier.gilles at gmail.com
--- Comment #19 from Gilles Caulier <caulier gilles gmail com> 2010-10-15 15:42:24 ---
SVN commit 1186207 by cgilles:
fix endianess with over/under exposure indicator.
set over exposure limit to more than 1% of max histogram segment.
set under exposure limit to less than 1% of min histogram segment.
BUGS: 253702
M +52 -9 dimg.cpp
--- trunk/extragear/graphics/digikam/libs/dimg/dimg.cpp #1186206:1186207
@@ -1559,8 +1559,10 @@
// alpha channel is auto-detected during QImage->QPixmap conversion
uchar *bits = img.bits();
+
// Using DImgScale before to compute Mask clamp to 65534 | 254. Why ?
- int max = sixteenBit() ? 65534 : 254;
+ int max = sixteenBit() ? 64880 : 252; // max histogram segment -1%
+ int min = sixteenBit() ? 655 : 3; // min histogram segment +1%
// --------------------------------------------------------
@@ -1580,6 +1582,7 @@
uint dim = m_priv->width * m_priv->height;
uchar* dptr = bits;
+ int s_blue, s_green, s_red;
if (sixteenBit())
{
@@ -1587,26 +1590,46 @@
for (uint i = 0; i < dim; ++i)
{
- int s_blue = *sptr++;
- int s_green = *sptr++;
- int s_red = *sptr++;
+ s_blue = *sptr++;
+ s_green = *sptr++;
+ s_red = *sptr++;
sptr++;
- if ((under) && (s_red == 0) && (s_green == 0) && (s_blue == 0))
+ if ((under) && (s_red <= min) && (s_green <= min) && (s_blue <=
min))
{
+ if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
+ {
+ dptr[0] = 0xFF;
+ dptr[1] = u_red;
+ dptr[2] = u_green;
+ dptr[3] = u_blue;
+ }
+ else
+ {
dptr[0] = u_blue;
dptr[1] = u_green;
dptr[2] = u_red;
dptr[3] = 0xFF;
}
+ }
if ((over) && (s_red >= max) && (s_green >= max) && (s_blue >=
max))
{
+ if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
+ {
+ dptr[0] = 0xFF;
+ dptr[1] = o_red;
+ dptr[2] = o_green;
+ dptr[3] = o_blue;
+ }
+ else
+ {
dptr[0] = o_blue;
dptr[1] = o_green;
dptr[2] = o_red;
dptr[3] = 0xFF;
}
+ }
dptr += 4;
}
@@ -1617,26 +1640,46 @@
for (uint i = 0; i < dim; ++i)
{
- int s_blue = *sptr++;
- int s_green = *sptr++;
- int s_red = *sptr++;
+ s_blue = *sptr++;
+ s_green = *sptr++;
+ s_red = *sptr++;
sptr++;
- if ((under) && (s_red == 0) && (s_green == 0) && (s_blue == 0))
+ if ((under) && (s_red <= min) && (s_green <= min) && (s_blue <=
min))
{
+ if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
+ {
+ dptr[0] = 0xFF;
+ dptr[1] = u_red;
+ dptr[2] = u_green;
+ dptr[3] = u_blue;
+ }
+ else
+ {
dptr[0] = u_blue;
dptr[1] = u_green;
dptr[2] = u_red;
dptr[3] = 0xFF;
}
+ }
if ((over) && (s_red >= max) && (s_green >= max) && (s_blue >=
max))
{
+ if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
+ {
+ dptr[0] = 0xFF;
+ dptr[1] = o_red;
+ dptr[2] = o_green;
+ dptr[3] = o_blue;
+ }
+ else
+ {
dptr[0] = o_blue;
dptr[1] = o_green;
dptr[2] = o_red;
dptr[3] = 0xFF;
}
+ }
dptr += 4;
}
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Digikam-devel
mailing list