Bug 307313 - Digikam uses wrong darkness/saturation values
Summary: Digikam uses wrong darkness/saturation values
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-DImg-RAW (show other bugs)
Version: 3.0.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-24 08:39 UTC by S. Burmeister
Modified: 2019-12-23 17:17 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.0.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description S. Burmeister 2012-09-24 08:39:08 UTC
According to bug 279255 there are two ways to use the values darkness and saturation. Either ones uses them as is, e.g. darkness 15 and saturation 4095, this is what dcraw reports.

Alternatively (comment 2 bug 279255) darkness can be set to 0 if it is subtracted from the saturation value, i.e. 4095 becomes 4080. In former versions digikam did so.

Currently it sets the darkness from 15 to 0 but forgets to subtract it from the saturation value.

Reproducible: Always

Steps to Reproduce:
Issue dcraw -w -v on a RAW picture and check the values for darkness and saturation.

Run digikam, open a RAW file in the editor and use the demosaicing tool. 
Actual Results:  
Check digikam's debug output and notice that it uses a darkness of 0 but does not subtract the darkness value reported by dcraw from the saturation.
Comment 1 Alex Tutubalin 2012-09-24 09:41:53 UTC
Previous bug (279255) was reported about 1 year ago with LibRaw 0.13.7

This bug is reported for digiKam 3.0.0 which comes with LibRaw 0.14.7. What version of LibRaw do you *really* use?
Comment 2 S. Burmeister 2012-09-24 10:01:13 UTC
I do not understand the confusion about the two reports. If the libraw version did not change its behaviour would not have changed, would it? And the previous report does also state that it changed and what version I encountered the new behaviour with.

If one builds current git of the digikam collection, i.e. including libkdcraw it results in:
LibRaw: 0.14.6
Comment 3 Alex Tutubalin 2012-09-24 10:21:35 UTC
Yes, internals in LibRaw 0.14 are very different from LibRaw 0.13.
For example, black subtraction *surely* adjusts maximum (saturation) value.
Comment 4 S. Burmeister 2012-09-24 10:35:06 UTC
I can only state what the debug output shows and that's (for the same picture):

Digikam:

Scaling with darkness 0, saturation 4095, and
multipliers 1,916350 1,000000 1,714829 1,000000

dcraw -w -v:

Skaliere mit Dunkelheit 15, Sättigung 4095, und
Multiplikatoren 1.916350 1.000000 1.714829 1.000000

Dunkelheit = darkness
Sättigung = saturation.

So either the debug output is wrong or the darkness is not subtracted from the saturation.

From the old report you can see that at that time, i.e. with libraw 0.13 digikam's debug output showed: darkness 0 and saturation 4080 if dcraw showed darkness 15 and saturation 4095.
Comment 5 Alex Tutubalin 2012-09-24 10:58:10 UTC
I'm just wondering, why LibRaw code used from dcraw_emu produces correct results (same with dcraw -w), while the same code used from digiKam makes different results.

There is no way to do so, unless you set black level to 0 somewhere in digiKam settings.
Comment 6 S. Burmeister 2012-09-24 11:29:48 UTC
digikam(29476)/KDCRAW KDcrawIface::KDcraw::loadFromLibraw:
-- RAW DECODING SETTINGS --------------------------------
-- autoBrightness:          false
-- sixteenBitsImage:        true
-- brightness:              1
-- RAWQuality:              0
-- inputColorSpace:         0
-- outputColorSpace:        1
-- RGBInterpolate4Colors:   false
-- DontStretchPixels:       false
-- unclipColors:            0
-- whiteBalance:            1
-- customWhiteBalance:      6500
-- customWhiteBalanceGreen: 1
-- halfSizeColorImage:      false
-- enableBlackPoint:        true
-- blackPoint:              0
-- enableWhitePoint:        false
-- whitePoint:              0
-- NoiseReductionType:      2
-- NoiseReductionThreshold: 300
-- enableCACorrection:      false
-- caMultiplier:            0, 0
-- medianFilterPasses:      0
-- inputProfile:            ""
-- outputProfile:           ""
-- deadPixelMap:            ""
-- whiteBalanceArea:        QRect(0,0 0x0)
-- dcbIterations:           -1
-- dcbEnhanceFl:            false
-- eeciRefine:              false
-- esMedPasses:             0
-- NRChrominaceThreshold:   100
-- expoCorrection:          false
-- expoCorrectionShift:     1
-- expoCorrectionHighlight: 0
---------------------------------------------------------

Is the black point the black level? If so digikam does set it to 0 as it seems.

AFAIK there is no GUI element to set the black level to 0 hence it must be something digikam does internally.
Comment 7 caulier.gilles 2012-09-24 11:53:15 UTC
Black Point, from libkdcraw Raw Decoding Settings :

https://projects.kde.org/projects/kde/kdegraphics/libs/libkdcraw/repository/revisions/master/entry/libkdcraw/rawdecodingsettings.h#L269

... Can be enabled through the GUI using right checkbox. If it's not turned on, it still on default value internally, so 0.

But Black Point value is only passed to libraw decoder only if this option is turned on. Look this code :

https://projects.kde.org/projects/kde/kdegraphics/libs/libkdcraw/repository/revisions/master/entry/libkdcraw/kdcraw_p.cpp#L221

... just to before print all Raw Decoding Settings values on trace. 

SO : 

- If you turned on this settings and let's it to zero, the behavior is normal.
- if you turned off this settings, well, nothing is passed to libraw. So it's libraw default value which is used instead ! Also in this case trace will report value (disabled) but set in GUI. zero by default.

Note : 

In case of digiKam Image Editor, black and white levels options are hideen and DISABLED by default, due to the availability of post processing adjustments.
In case of RAW Converter kipi-plugins; black and white levels options are there. There is no post processing adjustments.

To resume, IE raw import tool do not use black and white levels options. both are disabled in background. Default values from libraw are used here instead.

Gilles Caulier
Comment 8 S. Burmeister 2012-09-24 12:22:17 UTC
(In reply to comment #7)
> In case of digiKam Image Editor, black and white levels options are hideen
> and DISABLED by default, due to the availability of post processing
> adjustments.

I use the image editor, i.e. the tool that is displayed in the right hand pane. If I understood correctly this means that I cannot set a dark point and libraw uses its default, i.e. 0. Although that 0 was not set by digikam.

So libraw should use 15 or subtract, should it not?

> In case of RAW Converter kipi-plugins; black and white levels options are
> there. There is no post processing adjustments.

I found those, that's not what I use.
Comment 9 S. Burmeister 2012-09-24 12:27:28 UTC
-- enableBlackPoint:        true
-- blackPoint:              0

I guess this should be false + 0 since I did not enable any dark point in the image editor.
Comment 10 Alex Tutubalin 2012-09-24 12:32:50 UTC
BTW, from LibRaw's point of view  blackPoint set to zero mean *zero*
To disable user specified black-point, one should set it to negative value.

BTW, if you set black point to 0, your shadows will be completely destroyed due to high non-linearity.
Comment 11 caulier.gilles 2012-09-24 13:29:12 UTC
> I guess this should be false + 0 since I did not enable any dark point in the image editor.

Right. I take a look...

Gilles Caulier
Comment 12 caulier.gilles 2012-09-24 13:37:46 UTC
Not reproducible here. I use git/master code (3.0.0)

Sound like this settings have been altered in your digiKam config file (~/.kde4/share/config/digikamrc)

In mine, i can see this section :

[ImageViewer Settings]
AutoBrightness=true
AutoZoom=false
BackgroundColor=0,0,0
Black Point=0
Brightness Multiplier=1
Custom White Balance=6500
Custom White Balance Green=1
Dcb Enhance Filter=false
Dcb Iterations=-1
Decoding Quality=3
Dont Stretch Pixels=false
Eeci Refine=false
EnableCACorrection=false
Es Median Filter Passes=0
Expo Correction=false
Expo Correction Highlight=0
Expo Correction Shift=1
ExpoIndicatorMode=true
FixColorsHighlights=false
Four Color RGB=false
FullScreen=false
FullScreen Hide ToolBar=false
FullScreenHideThumbBar=true
Height 1080=1081
JPEG2000Compression=75
JPEG2000LossLess=true
JPEGCompression=100
JPEGSubSampling=1
LastSavedImageExtension=jpeg
Median Filter Passes=0
Noise Reduction Chrominance Threshold=0
Noise Reduction Threshold=0
Noise Reduction Type=0
Output Color Space=1
OverExposureColor=0,0,0
OverExposureIndicator=false
OverExposurePercentsEntry=1
PGFCompression=3
PGFLossLess=true
PNGCompression=9
PreviewMode=128
Show Thumbbar=false
SixteenBitsImage=true
SlideShowDelay=8
SlideShowLoop=false
SlideShowPrintApertureFocal=false
SlideShowPrintCapIfNoTitle=false
SlideShowPrintComment=false
SlideShowPrintDate=false
SlideShowPrintExpoSensitivity=false
SlideShowPrintLabels=false
SlideShowPrintMakeModel=false
SlideShowPrintName=true
SlideShowPrintTitle=false
SlideShowStartCurrent=true
SplitterState=AAAA/wAAAAAAAAACAAAGDwAAARUBAAAAAwAAAAAB
State=AAAA/wAAAAD9AAAAAAAAB4AAAAOpAAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAWAG0AYQBpAG4AVABvAG8AbABCAGEAcgEAAAAA/////wAAAAAAAAAA
TIFFCompression=true
ToolBarsMovable=Disabled
Unclip Color=0
UnderExposureColor=255,255,255
UnderExposureIndicator=false
UnderExposurePercentsEntry=1
Use Black Point=false
Use White Point=false
UseRawImportTool=true
UseThemeBackgroundColor=true
White Balance=1
White Point=0
Width 1920=1921
caBlueMultiplier=0
caRedMultiplier=0
corrections Expanded=false
demosaicing Expanded=true
whitebalance Expanded=true

...where you can see "Use Black Point=false" and "Use White Point=false" settings. Close digiKam, edit this file in a text editor, turn off these options and start again digiKam to check if it still reproducible.

Gilles Caulier
Comment 13 S. Burmeister 2012-09-24 19:51:58 UTC
I did not have to edit the file it was false already. But you looked in the wrong config. It's not ImageViewer Settings but RAW Import Settings. The question however is, why is it set to true if I cannot set it in the editor's RAW tool and how was it set to true if also the kipi RAW plugin shows it as disabled.

I did not edit it in the config file.

[RAW Import Settings]
Amaze CA Refine=false
AutoBrightness=false
Black Point=0
Brightness=0
Brightness Multiplier=1
Contrast=9
Custom White Balance=6500
Custom White Balance Green=1
Dcb Enhance Filter=false
Dcb Iterations=-1
Decoding Quality=0
Decoding Settings Tab=2
Dont Stretch Pixels=false
Eeci Refine=false
EnableCACorrection=false
Es Median Filter Passes=0
Expo Correction=false
Expo Correction Highlight=0
Expo Correction Shift=1
FineExposure=0
FixColorsHighlights=false
Four Color RGB=false
Gamma=1
Histogram Channel=5
Histogram Scale=1
Input Color Profile=
Input Color Space=0
Median Filter Passes=0
NR Threshold=100
Noise Reduction Chrominance Threshold=100
Noise Reduction Threshold=300
Noise Reduction Type=2
Output Color Profile=
Output Color Space=1
RawCurveChannel0Point0=0,0
RawCurveChannel0Point1=3327,4780
RawCurveChannel0Point10=-1,-1
RawCurveChannel0Point11=-1,-1
RawCurveChannel0Point12=49151,57344
RawCurveChannel0Point13=-1,-1
RawCurveChannel0Point14=-1,-1
RawCurveChannel0Point15=-1,-1
RawCurveChannel0Point16=65535,65535
RawCurveChannel0Point17=-1,-1
RawCurveChannel0Point2=-1,-1
RawCurveChannel0Point3=11462,18091
RawCurveChannel0Point4=-1,-1
RawCurveChannel0Point5=18439,27989
RawCurveChannel0Point6=26413,37888
RawCurveChannel0Point7=-1,-1
RawCurveChannel0Point8=33023,44373
RawCurveChannel0Point9=-1,-1
RawCurveChannel0Type=0
RawCurveChannel1Point0=0,0
RawCurveChannel1Point1=-1,-1
RawCurveChannel1Point10=-1,-1
RawCurveChannel1Point11=-1,-1
RawCurveChannel1Point12=-1,-1
RawCurveChannel1Point13=-1,-1
RawCurveChannel1Point14=-1,-1
RawCurveChannel1Point15=-1,-1
RawCurveChannel1Point16=65535,65535
RawCurveChannel1Point17=-1,-1
RawCurveChannel1Point2=-1,-1
RawCurveChannel1Point3=-1,-1
RawCurveChannel1Point4=-1,-1
RawCurveChannel1Point5=-1,-1
RawCurveChannel1Point6=-1,-1
RawCurveChannel1Point7=-1,-1
RawCurveChannel1Point8=-1,-1
RawCurveChannel1Point9=-1,-1
RawCurveChannel1Type=0
RawCurveChannel2Point0=0,0
RawCurveChannel2Point1=-1,-1
RawCurveChannel2Point10=-1,-1
RawCurveChannel2Point11=-1,-1
RawCurveChannel2Point12=-1,-1
RawCurveChannel2Point13=-1,-1
RawCurveChannel2Point14=-1,-1
RawCurveChannel2Point15=-1,-1
RawCurveChannel2Point16=65535,65535
RawCurveChannel2Point17=-1,-1
RawCurveChannel2Point2=-1,-1
RawCurveChannel2Point3=-1,-1
RawCurveChannel2Point4=-1,-1
RawCurveChannel2Point5=-1,-1
RawCurveChannel2Point6=-1,-1
RawCurveChannel2Point7=-1,-1
RawCurveChannel2Point8=-1,-1
RawCurveChannel2Point9=-1,-1
RawCurveChannel2Type=0
RawCurveChannel3Point0=0,0
RawCurveChannel3Point1=-1,-1
RawCurveChannel3Point10=-1,-1
RawCurveChannel3Point11=-1,-1
RawCurveChannel3Point12=-1,-1
RawCurveChannel3Point13=-1,-1
RawCurveChannel3Point14=-1,-1
RawCurveChannel3Point15=-1,-1
RawCurveChannel3Point16=65535,65535
RawCurveChannel3Point17=-1,-1
RawCurveChannel3Point2=-1,-1
RawCurveChannel3Point3=-1,-1
RawCurveChannel3Point4=-1,-1
RawCurveChannel3Point5=-1,-1
RawCurveChannel3Point6=-1,-1
RawCurveChannel3Point7=-1,-1
RawCurveChannel3Point8=-1,-1
RawCurveChannel3Point9=-1,-1
RawCurveChannel3Type=0
RawCurveChannel4Point0=0,0
RawCurveChannel4Point1=-1,-1
RawCurveChannel4Point10=-1,-1
RawCurveChannel4Point11=-1,-1
RawCurveChannel4Point12=-1,-1
RawCurveChannel4Point13=-1,-1
RawCurveChannel4Point14=-1,-1
RawCurveChannel4Point15=-1,-1
RawCurveChannel4Point16=65535,65535
RawCurveChannel4Point17=-1,-1
RawCurveChannel4Point2=-1,-1
RawCurveChannel4Point3=-1,-1
RawCurveChannel4Point4=-1,-1
RawCurveChannel4Point5=-1,-1
RawCurveChannel4Point6=-1,-1
RawCurveChannel4Point7=-1,-1
RawCurveChannel4Point8=-1,-1
RawCurveChannel4Point9=-1,-1
RawCurveChannel4Type=0
Saturation=1.2
Settings Page=0
SixteenBitsImage=true
Unclip Color=0
Use Black Point=true
Use Noise Reduction=true
Use White Point=false
White Balance=1
White Point=0
caBlueMultiplier=0
caRedMultiplier=0
colormanagement Expanded=true
corrections Expanded=true
demosaicing Expanded=true
exposure Expanded=true
luminositycurve Expanded=true
whitebalance Expanded=true
Comment 14 caulier.gilles 2012-09-24 20:34:45 UTC
Right. i have this :


[RAW Import Settings]
AutoBrightness=true
Black Point=0
Brightness=0
Brightness Multiplier=1
Contrast=0
Custom White Balance=6500
Custom White Balance Green=1
Dcb Enhance Filter=false
Dcb Iterations=-1
Decoding Quality=10
Dont Stretch Pixels=false
Eeci Refine=false
EnableCACorrection=false
Es Median Filter Passes=0
Expo Correction=false
Expo Correction Highlight=0
Expo Correction Shift=1
FineExposure=0
FixColorsHighlights=false
Four Color RGB=false
Gamma=1
Histogram Channel=5
Histogram Scale=1
Median Filter Passes=0
Noise Reduction Chrominance Threshold=0
Noise Reduction Threshold=0
Noise Reduction Type=0
Output Color Space=1
RawCurveChannel0Point0=0,0
RawCurveChannel0Point1=-1,-1
RawCurveChannel0Point10=-1,-1
RawCurveChannel0Point11=-1,-1
RawCurveChannel0Point12=-1,-1
RawCurveChannel0Point13=-1,-1
RawCurveChannel0Point14=-1,-1
RawCurveChannel0Point15=-1,-1
RawCurveChannel0Point16=65535,65535
RawCurveChannel0Point17=-1,-1
RawCurveChannel0Point2=-1,-1
RawCurveChannel0Point3=-1,-1
RawCurveChannel0Point4=-1,-1
RawCurveChannel0Point5=-1,-1
RawCurveChannel0Point6=-1,-1
RawCurveChannel0Point7=-1,-1
RawCurveChannel0Point8=-1,-1
RawCurveChannel0Point9=-1,-1
RawCurveChannel0Type=0
RawCurveChannel1Point0=0,0
RawCurveChannel1Point1=-1,-1
RawCurveChannel1Point10=-1,-1
RawCurveChannel1Point11=-1,-1
RawCurveChannel1Point12=-1,-1
RawCurveChannel1Point13=-1,-1
RawCurveChannel1Point14=-1,-1
RawCurveChannel1Point15=-1,-1
RawCurveChannel1Point16=65535,65535
RawCurveChannel1Point17=-1,-1
RawCurveChannel1Point2=-1,-1
RawCurveChannel1Point3=-1,-1
RawCurveChannel1Point4=-1,-1
RawCurveChannel1Point5=-1,-1
RawCurveChannel1Point6=-1,-1
RawCurveChannel1Point7=-1,-1
RawCurveChannel1Point8=-1,-1
RawCurveChannel1Point9=-1,-1
RawCurveChannel1Type=0
RawCurveChannel2Point0=0,0
RawCurveChannel2Point1=-1,-1
RawCurveChannel2Point10=-1,-1
RawCurveChannel2Point11=-1,-1
RawCurveChannel2Point12=-1,-1
RawCurveChannel2Point13=-1,-1
RawCurveChannel2Point14=-1,-1
RawCurveChannel2Point15=-1,-1
RawCurveChannel2Point16=65535,65535
RawCurveChannel2Point17=-1,-1
RawCurveChannel2Point2=-1,-1
RawCurveChannel2Point3=-1,-1
RawCurveChannel2Point4=-1,-1
RawCurveChannel2Point5=-1,-1
RawCurveChannel2Point6=-1,-1
RawCurveChannel2Point7=-1,-1
RawCurveChannel2Point8=-1,-1
RawCurveChannel2Point9=-1,-1
RawCurveChannel2Type=0
RawCurveChannel3Point0=0,0
RawCurveChannel3Point1=-1,-1
RawCurveChannel3Point10=-1,-1
RawCurveChannel3Point11=-1,-1
RawCurveChannel3Point12=-1,-1
RawCurveChannel3Point13=-1,-1
RawCurveChannel3Point14=-1,-1
RawCurveChannel3Point15=-1,-1
RawCurveChannel3Point16=65535,65535
RawCurveChannel3Point17=-1,-1
RawCurveChannel3Point2=-1,-1
RawCurveChannel3Point3=-1,-1
RawCurveChannel3Point4=-1,-1
RawCurveChannel3Point5=-1,-1
RawCurveChannel3Point6=-1,-1
RawCurveChannel3Point7=-1,-1
RawCurveChannel3Point8=-1,-1
RawCurveChannel3Point9=-1,-1
RawCurveChannel3Type=0
RawCurveChannel4Point0=0,0
RawCurveChannel4Point1=-1,-1
RawCurveChannel4Point10=-1,-1
RawCurveChannel4Point11=-1,-1
RawCurveChannel4Point12=-1,-1
RawCurveChannel4Point13=-1,-1
RawCurveChannel4Point14=-1,-1
RawCurveChannel4Point15=-1,-1
RawCurveChannel4Point16=65535,65535
RawCurveChannel4Point17=-1,-1
RawCurveChannel4Point2=-1,-1
RawCurveChannel4Point3=-1,-1
RawCurveChannel4Point4=-1,-1
RawCurveChannel4Point5=-1,-1
RawCurveChannel4Point6=-1,-1
RawCurveChannel4Point7=-1,-1
RawCurveChannel4Point8=-1,-1
RawCurveChannel4Point9=-1,-1
RawCurveChannel4Type=0
Saturation=1.1
Settings Page=0
SixteenBitsImage=true
Unclip Color=2
Use Black Point=false
Use White Point=false
White Balance=1
White Point=0
caBlueMultiplier=0
caRedMultiplier=0
colormanagement Expanded=false
corrections Expanded=true
demosaicing Expanded=true
exposure Expanded=true
luminositycurve Expanded=true
whitebalance Expanded=true

As you can see Black/White settings still off here.

More details : ImageViewer section is for Raw decoding settings panel. RawImport section, well for Raw Import tool.

In all case, turn off these settings to off in RawImport section, and look if it work bettter and if this settings don't go back.

I suspect a side effect between version. I'm sure : in source code, this settings is disabled in Raw Import tool with current implementation.

Gilles Caulier
Comment 15 caulier.gilles 2012-10-29 11:07:33 UTC
Sven,

Do you see my last message ?

Gilles Caulier
Comment 16 S. Burmeister 2012-10-29 17:12:25 UTC
Yes, I changed the setting manually and it did not change on its own again yet.
Comment 17 caulier.gilles 2019-12-23 17:17:33 UTC
Not reproducible with digiKam 7.0.0-beta1.