         position_x = position_x / samp_factor_h;
         position_y = position_y / samp_factor_v;
 
-        int data_position = position_y * comp.data_width + position_x;
+        unsigned int data_position = position_y * comp.data_width + position_x;
         comp.d_data[data_position] = value;
     }
 };

struct gpujpeg_preprocessor_raw_to_comp_store<1, 1>
{
    static __device__ void
    perform(uint8_t value, int position_x, int position_y, struct gpujpeg_preprocessor_data_component & comp)
    {
        int data_position = position_y * comp.data_width + position_x;
        comp.d_data[data_position] = value;

{
    const unsigned int image_position_x = threadIdx.x + blockIdx.x * blockDim.x;
    const unsigned int image_position_y = blockIdx.y;
    const unsigned int x = threadIdx.x;
    const unsigned int pix_offset = image_position_y * image_width + blockIdx.x * blockDim.x;
        
    // Load to shared
