FilmNegative: non-raw file support and better accuracy (#5798)

* Added support for non-raw files to the film negative tool. The tool is now under the "Color" tab. Moved the entire filmneg code downstream, right after input profile conversion.
Usage changes a bit: White Balance must be set to the _backlight_ color temperature. Added two more sliders to color-balance the picture after negative inversion. Legacy inversion method kept for compatibility with processing profiles saved by RT v5.7 or 5.8 (only if Film Negative was enabled). Should be removed in a future version.
There is still an issue with DCP profiles that need the look table to be active to work properly. Using a simple matrix input profile (or just camera standard) is recommended for now.

* The user can now choose to perform inversion before or after input colorspace conversion.
Seamless backwards compatibility with previous processing profiles; upgrading from a previous version now gives an (almost) identical output as before.
Generalised the concept of film base values: the processing profile now contains a pair of RGB triplets, "reference input" and "reference output", which makes it much more straightforward to compute the output multipliers.

* Added support for `RGB` data type to putToKeyFile, removed the now unused `RGB::toVector()` method. Some cleanup.

* Spot balance picker now stays active indefinitely. Can be disabled by right-clicking, too.

* Removed film negative from `filterRawRefresh` condition, since the new version does not require raw rendering anymore.

* The Output Level slider is now exponential, so it should feel more familiar to use (similar to the exposure compensation slider).

* Removed old `RedBase`, `GreenBase`, `BlueBase` keys from the PP3 file after params upgrade. Keys are only kept if the file only undergoes batch edit (hence no params upgrade was done).

* Made the balance sliders exponential and centered at zero. Now they should be a bit smoother and possibly more user-friendly.

* Changed adjusters' step to more useful values, they were too fine-grained and hard to adjust using the +/- spinbutton.
Increased max ratio value from 3 to 5, as i found an old negative needing a very high blue channel exponent.

* Added an initial processing profile for film negative inversion, to be provided as a bundled profile.

* Removed Output Level and balance sliders when in batch mode: since the effect of these sliders is dependent on the reference input values, those values needed to be copied as well. And, touching any of the sliders needed to flag all three as dirty. All this felt more confusing than useful.
It should be sufficient (and clearer) to copy/paste the params, and then fine-tune the balance on individual pictures when needed.

* Set bayer demosaic method to RCD in the bundled "Film Negative" processing profile. RCD seems to play a bit better with Capture Sharpening in the presence of film grain, compared to Amaze.
This will favor new users starting with all-defaults settings, hence having Capture Sharpening enabled by default.

* Removed incorrect "contrast" term from the "Reference exponent" label. This parameter adjusts the image _gamma_, not its contrast.
This commit is contained in:
rom9
2020-11-21 13:29:47 +01:00
committed by GitHub
parent 7861f5bcd4
commit e635030650
26 changed files with 1327 additions and 936 deletions

View File

@@ -99,7 +99,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit
bayerrawexposure = Gtk::manage(new BayerRAWExposure());
xtransrawexposure = Gtk::manage(new XTransRAWExposure());
fattal = Gtk::manage(new FattalToneMapping());
filmNegative = Gtk::manage (new FilmNegative ());
filmNegative = Gtk::manage (new FilmNegative());
pdSharpening = Gtk::manage (new PdSharpening());
// So Demosaic, Line noise filter, Green Equilibration, Ca-Correction (garder le nom de section identique!) and Black-Level will be moved in a "Bayer sensor" tool,
// and a separate Demosaic and Black Level tool will be created in an "X-Trans sensor" tool
@@ -123,6 +123,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit
addfavoritePanel (detailsPanel, sharpenMicro);
addfavoritePanel (colorPanel, hsvequalizer);
addfavoritePanel (colorPanel, filmSimulation);
addfavoritePanel (colorPanel, filmNegative);
addfavoritePanel (colorPanel, softlight);
addfavoritePanel (colorPanel, rgbcurves);
addfavoritePanel (colorPanel, colortoning);
@@ -165,7 +166,6 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit
addfavoritePanel (rawPanel, preprocess);
addfavoritePanel (rawPanel, darkframe);
addfavoritePanel (rawPanel, flatfield);
addfavoritePanel (rawPanel, filmNegative);
addfavoritePanel (rawPanel, pdSharpening);
int favoriteCount = 0;
@@ -286,7 +286,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit
distortion->setLensGeomListener(this);
crop->setCropPanelListener(this);
icm->setICMPanelListener(this);
filmNegative->setFilmNegProvider (this);
filmNegative->setFilmNegProvider(this);
toolBar = new ToolBar();
toolBar->setToolBarListener(this);
@@ -367,7 +367,6 @@ void ToolPanelCoordinator::imageTypeChanged(bool isRaw, bool isBayer, bool isXtr
preprocessWB->FoldableToolPanel::show();
preprocess->FoldableToolPanel::show();
flatfield->FoldableToolPanel::show();
filmNegative->FoldableToolPanel::show();
pdSharpening->FoldableToolPanel::show();
retinex->FoldableToolPanel::setGrayedOut(false);
return false;
@@ -388,7 +387,6 @@ void ToolPanelCoordinator::imageTypeChanged(bool isRaw, bool isBayer, bool isXtr
preprocessWB->FoldableToolPanel::show();
preprocess->FoldableToolPanel::show();
flatfield->FoldableToolPanel::show();
filmNegative->FoldableToolPanel::show();
pdSharpening->FoldableToolPanel::show();
retinex->FoldableToolPanel::setGrayedOut(false);
return false;
@@ -409,7 +407,6 @@ void ToolPanelCoordinator::imageTypeChanged(bool isRaw, bool isBayer, bool isXtr
preprocessWB->FoldableToolPanel::hide();
preprocess->FoldableToolPanel::hide();
flatfield->FoldableToolPanel::show();
filmNegative->FoldableToolPanel::hide();
pdSharpening->FoldableToolPanel::show();
retinex->FoldableToolPanel::setGrayedOut(false);
return false;
@@ -430,7 +427,6 @@ void ToolPanelCoordinator::imageTypeChanged(bool isRaw, bool isBayer, bool isXtr
preprocessWB->FoldableToolPanel::hide();
preprocess->FoldableToolPanel::hide();
flatfield->FoldableToolPanel::hide();
filmNegative->FoldableToolPanel::hide();
pdSharpening->FoldableToolPanel::hide();
retinex->FoldableToolPanel::setGrayedOut(false);
return false;
@@ -452,7 +448,6 @@ void ToolPanelCoordinator::imageTypeChanged(bool isRaw, bool isBayer, bool isXtr
preprocessWB->FoldableToolPanel::hide();
preprocess->FoldableToolPanel::hide();
flatfield->FoldableToolPanel::hide();
filmNegative->FoldableToolPanel::hide();
pdSharpening->FoldableToolPanel::hide();
retinex->FoldableToolPanel::setGrayedOut(true);
return false;
@@ -613,7 +608,7 @@ void ToolPanelCoordinator::profileChange(
lParams[1] = *mergedParams;
pe.initFrom(lParams);
filterRawRefresh = pe.raw.isUnchanged() && pe.lensProf.isUnchanged() && pe.retinex.isUnchanged() && pe.filmNegative.isUnchanged() && pe.pdsharpening.isUnchanged();
filterRawRefresh = pe.raw.isUnchanged() && pe.lensProf.isUnchanged() && pe.retinex.isUnchanged() && pe.pdsharpening.isUnchanged();
}
*params = *mergedParams;
@@ -732,7 +727,7 @@ void ToolPanelCoordinator::initImage(rtengine::StagedImageProcessor* ipc_, bool
ipc->setSizeListener(resize);
ipc->setLocallabListener(locallab);
ipc->setImageTypeListener(this);
ipc->setFilmNegListener (filmNegative);
ipc->setFilmNegListener(filmNegative);
flatfield->setShortcutPath(Glib::path_get_dirname(ipc->getInitialImage()->getFileName()));
icm->setRawMeta(raw, (const rtengine::FramesData*)pMetaData);
@@ -1280,12 +1275,7 @@ void ToolPanelCoordinator::setEditProvider(EditDataProvider *provider)
}
}
bool ToolPanelCoordinator::getFilmNegativeExponents(rtengine::Coord spotA, rtengine::Coord spotB, std::array<float, 3>& newExps)
bool ToolPanelCoordinator::getFilmNegativeSpot(rtengine::Coord spot, int spotSize, RGB &refInput, RGB &refOutput)
{
return ipc && ipc->getFilmNegativeExponents(spotA.x, spotA.y, spotB.x, spotB.y, newExps);
}
bool ToolPanelCoordinator::getRawSpotValues(rtengine::Coord spot, int spotSize, std::array<float, 3>& rawValues)
{
return ipc && ipc->getRawSpotValues(spot.x, spot.y, spotSize, rawValues);
return ipc && ipc->getFilmNegativeSpot(spot.x, spot.y, spotSize, refInput, refOutput);
}