11/*
22 This file is part of darktable,
3- Copyright (C) 2016-2025 darktable developers.
3+ Copyright (C) 2016-2026 darktable developers.
44
55 darktable is free software: you can redistribute it and/or modify
66 it under the terms of the GNU General Public License as published by
1919#include "common.h"
2020
2121kernel void
22+ #define AVGWINDOW 1
23+
2224vng_border_interpolate (read_only image2d_t in ,
2325 write_only image2d_t out ,
2426 const int width ,
@@ -33,21 +35,20 @@ vng_border_interpolate(read_only image2d_t in,
3335 if (x >= width || y >= height ) return ;
3436
3537 const int colors = (filters == 9 ) ? 3 : 4 ;
36- const int avgwindow = 1 ;
3738
3839 if (x >= border && x < width - border && y >= border && y < height - border ) return ;
3940
4041 float o [4 ] = { 0.0f };
4142 float sum [4 ] = { 0.0f };
4243 int count [4 ] = { 0 };
4344
44- for (int j = y - avgwindow ; j <= y + avgwindow ; j ++ )
45- for (int i = x - avgwindow ; i <= x + avgwindow ; i ++ )
45+ for (int j = y - AVGWINDOW ; j <= y + AVGWINDOW ; j ++ )
46+ for (int i = x - AVGWINDOW ; i <= x + AVGWINDOW ; i ++ )
4647 {
4748 if (j >= 0 && i >= 0 && j < height && i < width )
4849 {
4950 const int f = fcol (j , i , filters , xtrans );
50- sum [f ] += fmax (0.0f , read_imagef (in , sampleri , (int2 )(i , j )).x );
51+ sum [f ] += fmax (0.0f , read_imagef (in , samplerA , (int2 )(i , j )).x );
5152 count [f ]++ ;
5253 }
5354 }
@@ -118,7 +119,7 @@ vng_lin_interpolate(read_only image2d_t in, write_only image2d_t out, const int
118119 float o [4 ] = { 0.0f };
119120
120121 global const int * ip = lookup [y % size ][x % size ];
121- int num_pixels = ip [0 ];
122+ const int num_pixels = ip [0 ];
122123 ip ++ ;
123124
124125 // for each adjoining pixel not of this pixel's color, sum up its weighted values
@@ -239,7 +240,7 @@ vng_interpolate(read_only image2d_t in, write_only image2d_t out, const int widt
239240 return ;
240241 }
241242
242- float thold = gmin + (gmax * 0.5f );
243+ const float thold = gmin + (gmax * 0.5f );
243244 float sum [4 ] = { 0.0f };
244245 const int color = fcol (y , x , filters , xtrans );
245246 int num = 0 ;
@@ -298,7 +299,7 @@ vng_green_equilibrate(read_only image2d_t in, write_only image2d_t out, const in
298299
299300 if (x >= width || y >= height ) return ;
300301
301- float4 pixel = read_imagef (in , sampleri , (int2 )(x , y ));
302+ float4 pixel = read_imagef (in , samplerA , (int2 )(x , y ));
302303
303304 pixel .y = (pixel .y + pixel .w ) / 2.0f ;
304305 pixel .w = 0.0f ;
0 commit comments