Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negadoctor : Introduce slide film mode #425

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions data/kernels/negadoctor.cl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
kernel void
negadoctor (read_only image2d_t in, write_only image2d_t out, int width, int height,
const float4 Dmin, const float4 wb_high, const float4 offset,
const float exposure, const float black, const float gamma, const float soft_clip, const float soft_clip_comp)
const float exposure, const float black, const float gamma, const float soft_clip, const float soft_clip_comp, const int slide_film)
{
const unsigned int x = get_global_id(0);
const unsigned int y = get_global_id(1);
Expand All @@ -38,9 +38,11 @@ negadoctor (read_only image2d_t in, write_only image2d_t out, int width, int hei
// Correct density in log space
o = wb_high * o + offset;

// Print density on paper : ((1 - 10^corrected_de + black) * exposure)^gamma rewritten for FMA
o = -((float4)exposure * native_exp10(o) + (float4)black);
o = native_powr(fmax(o, (float4)0.0f), gamma); // note : this is always > 0
// Print density on paper (negative film) : ((1 - 10^corrected_de + black) * exposure)^gamma rewritten for FMA
o = native_exp10(o);
o = (slide_film) ? ((float4)exposure * o + (float4)black)
: -((float4)exposure * o + (float4)black);
o = native_powr(fmax(o, (float4)0.0f), gamma); // note : this is always > 0

// Compress highlights and clip negatives. from https://lists.gnu.org/archive/html/openexr-devel/2005-03/msg00009.html
o = (o > (float4)soft_clip) ? soft_clip + ((float4)1.0f - native_exp(-(o - (float4)soft_clip) / (float4)soft_clip_comp)) * (float4)soft_clip_comp
Expand Down
Loading