Skip to content

Commit 89b00c1

Browse files
author
Jed Smith
committed
bugfix threshold min
1 parent 4486be7 commit 89b00c1

File tree

3 files changed

+43
-38
lines changed

3 files changed

+43
-38
lines changed

GamutCompress.dctl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ __DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p
9393
}
9494

9595
// thr is the percentage of the core gamut to protect: the complement of threshold.
96-
float3 thr;
97-
thr = make_float3(_fmaxf(0.00001, 1.0f-threshold_r), _fmaxf(0.00001, 1.0f-threshold_g), _fmaxf(0.00001, 1.0f-threshold_b));
96+
float3 thr = make_float3(
97+
1.0f-_fmaxf(0.00001, threshold_r),
98+
1.0f-_fmaxf(0.00001, threshold_g),
99+
1.0f-_fmaxf(0.00001, threshold_b));
98100

99101
// lim is the distance beyond the gamut boundary that will be compressed to the gamut boundary.
100102
// lim = 0.2 will compress from a distance of 1.2 from achromatic to 1.0 (the gamut boundary).

GamutCompress.fuse

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -172,39 +172,39 @@ end
172172

173173

174174
function Process(req)
175-
local src = InImage:GetValue(req)
176-
local dst = Image{ IMG_Like = src, IMG_DeferAlloc = true }
177-
178-
if not req:IsPreCalc() then
179-
local node = DVIPComputeNode(req, "SolidKernel", SolidKernel, "SolidParams", SolidParams)
180-
local params = node:GetParamBlock(SolidParams)
181-
182-
params.hexagonal = InHexagonal:GetValue(req).Value
183-
params.threshold_r = InThresholdR:GetValue(req).Value
184-
params.threshold_g = InThresholdG:GetValue(req).Value
185-
params.threshold_b = InThresholdB:GetValue(req).Value
186-
params.power = InPower:GetValue(req).Value
187-
params.shd_rolloff = InShdRolloff:GetValue(req).Value
188-
params.cyan = InCyan:GetValue(req).Value
189-
params.magenta = InMagenta:GetValue(req).Value
190-
params.yellow = InYellow:GetValue(req).Value
191-
params.invert = InInvert:GetValue(req).Value
192-
params.srcCompOrder = src:IsMask() and 1 or 15
193-
194-
node:SetParamBlock(params)
195-
196-
node:AddInput("src", src)
197-
node:AddOutput("dst", dst)
198-
199-
local ok = node:RunSession(req)
200-
201-
if not ok then
202-
dst = nil
203-
end
204-
205-
end
175+
local src = InImage:GetValue(req)
176+
local dst = Image{ IMG_Like = src, IMG_DeferAlloc = true }
177+
178+
if not req:IsPreCalc() then
179+
local node = DVIPComputeNode(req, "SolidKernel", SolidKernel, "SolidParams", SolidParams)
180+
local params = node:GetParamBlock(SolidParams)
181+
182+
params.hexagonal = InHexagonal:GetValue(req).Value
183+
params.threshold_r = InThresholdR:GetValue(req).Value
184+
params.threshold_g = InThresholdG:GetValue(req).Value
185+
params.threshold_b = InThresholdB:GetValue(req).Value
186+
params.power = InPower:GetValue(req).Value
187+
params.shd_rolloff = InShdRolloff:GetValue(req).Value
188+
params.cyan = InCyan:GetValue(req).Value
189+
params.magenta = InMagenta:GetValue(req).Value
190+
params.yellow = InYellow:GetValue(req).Value
191+
params.invert = InInvert:GetValue(req).Value
192+
params.srcCompOrder = src:IsMask() and 1 or 15
193+
194+
node:SetParamBlock(params)
195+
196+
node:AddInput("src", src)
197+
node:AddOutput("dst", dst)
206198

207-
OutImage:Set(req, dst)
199+
local ok = node:RunSession(req)
200+
201+
if not ok then
202+
dst = nil
203+
end
204+
205+
end
206+
207+
OutImage:Set(req, dst)
208208
end
209209

210210

@@ -255,9 +255,9 @@ SolidKernel = [[
255255

256256
// thr is the percentage of the core gamut to protect: the complement of threshold.
257257
float3 thr = make_float3(
258-
_fmaxf(0.0001f, 1.0f-params->threshold_r),
259-
_fmaxf(0.0001f, 1.0f-params->threshold_g),
260-
_fmaxf(0.0001f, 1.0f-params->threshold_b));
258+
1.0f-_fmaxf(0.0001f, params->threshold_r),
259+
1.0f-_fmaxf(0.0001f, params->threshold_g),
260+
1.0f-_fmaxf(0.0001f, params->threshold_b));
261261

262262
// lim is the max distance from the gamut boundary that will be compressed
263263
// 0 is a no-op, 1 will compress colors from a distance of 2.0 from achromatic to the gamut boundary

GamutCompress.glsl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ void main() {
9393
}
9494

9595
// thr is the percentage of the core gamut to protect: the complement of threshold.
96-
vec3 thr = vec3(max(0.00001, 1.0-threshold.x), max(0.00001, 1.0-threshold.y), max(0.00001, 1.0-threshold.z));
96+
vec3 thr = vec3(
97+
1.0-max(0.00001, threshold.x),
98+
1.0-max(0.00001, threshold.y),
99+
1.0-max(0.00001, threshold.z));
97100

98101
// lim is the distance beyond the gamut boundary that will be compressed to the gamut boundary.
99102
// lim = 0.2 will compress from a distance of 1.2 from achromatic to 1.0 (the gamut boundary).

0 commit comments

Comments
 (0)