Skip to content
Merged
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
17 changes: 9 additions & 8 deletions data/kernels/demosaic_vng.cl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2016-2025 darktable developers.
Copyright (C) 2016-2026 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -19,6 +19,8 @@
#include "common.h"

kernel void
#define AVGWINDOW 1

vng_border_interpolate(read_only image2d_t in,
write_only image2d_t out,
const int width,
Expand All @@ -33,21 +35,20 @@ vng_border_interpolate(read_only image2d_t in,
if(x >= width || y >= height) return;

const int colors = (filters == 9) ? 3 : 4;
const int avgwindow = 1;

if(x >= border && x < width-border && y >= border && y < height-border) return;

float o[4] = { 0.0f };
float sum[4] = { 0.0f };
int count[4] = { 0 };

for(int j = y-avgwindow; j <= y+avgwindow; j++)
for(int i = x-avgwindow; i <= x+avgwindow; i++)
for(int j = y-AVGWINDOW; j <= y+AVGWINDOW; j++)
for(int i = x-AVGWINDOW; i <= x+AVGWINDOW; i++)
{
if(j >= 0 && i >= 0 && j < height && i < width)
{
const int f = fcol(j, i, filters, xtrans);
sum[f] += fmax(0.0f, read_imagef(in, sampleri, (int2)(i, j)).x);
sum[f] += fmax(0.0f, read_imagef(in, samplerA, (int2)(i, j)).x);
count[f]++;
}
}
Expand Down Expand Up @@ -118,7 +119,7 @@ vng_lin_interpolate(read_only image2d_t in, write_only image2d_t out, const int
float o[4] = { 0.0f };

global const int *ip = lookup[y % size][x % size];
int num_pixels = ip[0];
const int num_pixels = ip[0];
ip++;

// for each adjoining pixel not of this pixel's color, sum up its weighted values
Expand Down Expand Up @@ -239,7 +240,7 @@ vng_interpolate(read_only image2d_t in, write_only image2d_t out, const int widt
return;
}

float thold = gmin + (gmax * 0.5f);
const float thold = gmin + (gmax * 0.5f);
float sum[4] = { 0.0f };
const int color = fcol(y, x, filters, xtrans);
int num = 0;
Expand Down Expand Up @@ -298,7 +299,7 @@ vng_green_equilibrate(read_only image2d_t in, write_only image2d_t out, const in

if(x >= width || y >= height) return;

float4 pixel = read_imagef(in, sampleri, (int2)(x , y));
float4 pixel = read_imagef(in, samplerA, (int2)(x , y));

pixel.y = (pixel.y + pixel.w) / 2.0f;
pixel.w = 0.0f;
Expand Down
12 changes: 8 additions & 4 deletions src/common/opencl.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2010-2025 darktable developers.
Copyright (C) 2010-2026 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -3152,12 +3152,16 @@ void *dt_opencl_copy_host_to_device_constant(const int devid,
cl_mem dev = (darktable.opencl->dlocl->symbols->dt_clCreateBuffer)
(darktable.opencl->dev[devid].context, mode, size, host, &err);

if(err != CL_SUCCESS || oversize)
if(err != CL_SUCCESS)
dt_print(DT_DEBUG_OPENCL,
"[opencl copy_host_to_device_constant]"
" could not allocate %sbuffer on device '%s' id=%d: %s",
oversize ? "oversize " : "",
" could not allocate buffer on device '%s' id=%d: %s",
darktable.opencl->dev[devid].fullname, devid, cl_errstr(err));
if(oversize)
dt_print(DT_DEBUG_OPENCL | DT_DEBUG_VERBOSE,
"[opencl copy_host_to_device_constant]"
" fallback to non-const buffer on device '%s' id=%d",
darktable.opencl->dev[devid].fullname, devid);

dt_opencl_memory_statistics(devid, dev, OPENCL_MEMORY_ADD);

Expand Down
4 changes: 2 additions & 2 deletions src/iop/demosaicing/capture.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2025 darktable developers.
Copyright (C) 2026 darktable developers.

darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -731,7 +731,7 @@ static void _capture_radius(dt_iop_module_t *self,

dt_print_pipe(DT_DEBUG_PIPE, filters != 9u ? "bayer autoradius" : "xtrans autoradius",
pipe, self, DT_DEVICE_NONE, NULL, NULL,
"%sradius=%.2f from %s image data is %s reliable",
"%sradius=%.2f from %s image data is %sreliable",
same_radius ? "unchanged" : "", radius,
enough ? "enough" : "small",
reliable ? "" : "not ");
Expand Down
Loading
Loading