         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;
     }
 };

    __syncthreads();

    // Load
    int offset = x * 2;
    float r1;
    float r2 = (float)(s_data[offset + 1]);
    float r3;

struct gpujpeg_preprocessor_raw_to_comp_store
{
    static __device__ void
    perform(uint8_t value, unsigned int position_x, unsigned int position_y, struct gpujpeg_preprocessor_data_component & comp)
    {
        uint8_t samp_factor_h = s_samp_factor_h;
        if ( samp_factor_h == GPUJPEG_DYNAMIC ) {
