/* Copyright (C) 2012 fmaj7b5.info This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef FM7b5_BINARIZE_CUH #define FM7b5_BINARIZE_CUH #include "binarize.h" #include "MDView.cuh" namespace FM7b5 { template __global__ void binarize(const MDView out, const MDView in, const size_t width, const size_t height, const uint_fast8_t thres) { const size_t w(blockDim.x * blockIdx.x + threadIdx.x); const size_t h(blockDim.y * blockIdx.y + threadIdx.y); if (w >= width || h >= height) { return; } out[h][w] = (in[h][w] < thres) ? 0 : 255; } } #endif /* FM7b5_BINARIZE_CUH */