Skip to content

Commit 06f53c8

Browse files
Check for available lab profile
While falling back to lab jzczhz blending we should check if - a profile is provided - a file profile is available - the corresponding input profile could be created. If not, we can't do anything here and just leave out blending.
1 parent e4a126e commit 06f53c8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/develop/blends/blendif_rgb_jzczhz.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,21 @@ static void _blendif_combine_channels(const float *const restrict pixels,
240240
if(dt_is_valid_colormatrix(profile->matrix_out_transposed[0][0]))
241241
_blendif_jzczhz(pixels, mask, stride, parameters + DEVELOP_BLENDIF_PARAMETER_ITEMS * DEVELOP_BLENDIF_Jz_in,
242242
invert_mask, profile);
243-
else
243+
else if(profile)
244244
{
245-
cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
245+
const gboolean test = (profile->type != DT_COLORSPACE_FILE)
246+
|| (profile->type == DT_COLORSPACE_FILE && dt_util_test_image_file(profile->filename));
247+
248+
cmsHPROFILE *input = test ? dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile : NULL;
246249
cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
247-
cmsHTRANSFORM *xform = cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0);
250+
cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
248251

249-
_blendif_jzczhz_lab(pixels, mask, stride, parameters + DEVELOP_BLENDIF_PARAMETER_ITEMS * DEVELOP_BLENDIF_Jz_in,
252+
if(xform)
253+
{
254+
_blendif_jzczhz_lab(pixels, mask, stride, parameters + DEVELOP_BLENDIF_PARAMETER_ITEMS * DEVELOP_BLENDIF_Jz_in,
250255
invert_mask, xform);
251-
cmsDeleteTransform(xform);
256+
cmsDeleteTransform(xform);
257+
}
252258
}
253259
}
254260
}

0 commit comments

Comments
 (0)