 #include "gpu3.cuh"
 #include "../common/gpu_only_utils.cuh"
 #include "../common/utils.hpp"
+
+#define PAD_TOP 2
+#define PAD_LEFT 2
+#define PAD_BOTTOM 1
+#define PAD_RIGHT 1
 
 void and_reduction(uint8_t* d_data, int width, int height, dim3 grid_dim, dim3 block_dim) {
     int shared_mem_size = block_dim.x * block_dim.y * sizeof(uint8_t);

}

// Performs 1 iteration of the thinning algorithm.
__global__ void skeletonize_pass(uint8_t* d_src, uint8_t* d_dst, int width, int height) {
    int row = blockIdx.y * blockDim.y + threadIdx.y;
    int col = blockIdx.x * blockDim.x + threadIdx.x;

    if ((row < height) & (col < width)) {
        uint8_t NZ = black_neighbors_around(d_src, row, col, width, height);
        uint8_t TR_P1 = wb_transitions_around(d_src, row, col, width, height);
        uint8_t TR_P2 = wb_transitions_around(d_src, row - 1, col, width, height);
        uint8_t TR_P4 = wb_transitions_around(d_src, row, col - 1, width, height);
        uint8_t P2 = P2_f(d_src, row, col, width, height);
        uint8_t P4 = P4_f(d_src, row, col, width, height);
        uint8_t P6 = P6_f(d_src, row, col, width, height);
        uint8_t P8 = P8_f(d_src, row, col, width, height);

        uint8_t thinning_cond_1 = ((2 <= NZ) & (NZ <= 6));
        uint8_t thinning_cond_2 = (TR_P1 == 1);

        uint8_t thinning_cond_4 = (((P2 & P4 & P6) == 0) | (TR_P4 != 1));
        uint8_t thinning_cond_ok = thinning_cond_1 & thinning_cond_2 & thinning_cond_3 & thinning_cond_4;

        d_dst[g_row * g_width + g_col] = BINARY_WHITE + ((1 - thinning_cond_ok) * d_src[g_row * g_width + g_col]);
    }
}

