1 /* 2 This file is part of darktable, 3 Copyright (C) 2012-2020 darktable developers. 4 5 darktable is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 darktable is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with darktable. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #pragma once 20 21 #include <stddef.h> // for size_t 22 23 typedef struct dt_bilateral_t 24 { 25 size_t size_x, size_y, size_z; 26 int width, height; 27 int numslices, sliceheight, slicerows; //height--in input image, rows--in grid 28 float sigma_s, sigma_r; 29 float *buf __attribute__((aligned(64))); 30 } __attribute__((packed)) dt_bilateral_t; 31 32 size_t dt_bilateral_memory_use(const int width, // width of input image 33 const int height, // height of input image 34 const float sigma_s, // spatial sigma (blur pixel coords) 35 const float sigma_r); // range sigma (blur luma values) 36 37 size_t dt_bilateral_memory_use2(const int width, // width of input image 38 const int height, // height of input image 39 const float sigma_s, // spatial sigma (blur pixel coords) 40 const float sigma_r); // range sigma (blur luma values) 41 42 size_t dt_bilateral_singlebuffer_size(const int width, // width of input image 43 const int height, // height of input image 44 const float sigma_s, // spatial sigma (blur pixel coords) 45 const float sigma_r); // range sigma (blur luma values) 46 47 size_t dt_bilateral_singlebuffer_size2(const int width, // width of input image 48 const int height, // height of input image 49 const float sigma_s, // spatial sigma (blur pixel coords) 50 const float sigma_r); // range sigma (blur luma values) 51 52 void dt_bilateral_grid_size(dt_bilateral_t *b, const int width, const int height, const float L_range, 53 float sigma_s, const float sigma_r); 54 55 dt_bilateral_t *dt_bilateral_init(const int width, // width of input image 56 const int height, // height of input image 57 const float sigma_s, // spatial sigma (blur pixel coords) 58 const float sigma_r); // range sigma (blur luma values) 59 60 void dt_bilateral_splat(const dt_bilateral_t *b, const float *const in); 61 62 void dt_bilateral_blur(const dt_bilateral_t *b); 63 64 void dt_bilateral_slice(const dt_bilateral_t *const b, const float *const in, float *out, const float detail); 65 66 void dt_bilateral_slice_to_output(const dt_bilateral_t *const b, const float *const in, float *out, 67 const float detail); 68 69 void dt_bilateral_free(dt_bilateral_t *b); 70 71 // modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh 72 // vim: shiftwidth=2 expandtab tabstop=2 cindent 73 // kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified; 74