  * @return 0 if succeeds, otherwise nonzero
  */
 __device__ int
-gpujpeg_huffman_gpu_encoder_encode_block(const int leftover_value, int & out_bits, int & dc, short2* data, uint8_t* & data_compressed, 
+gpujpeg_huffman_gpu_encoder_encode_block(const int value0, const int leftover_value, int & out_bits, int & dc, int * data, uint8_t* & data_compressed, 
     struct gpujpeg_table_huffman_encoder* d_table_dc, struct gpujpeg_table_huffman_encoder* d_table_ac)
 {
     // Encode the DC coefficient difference per section F.1.2.1
-    int temp = data[0].x - dc;
-    dc = data[0].x;
+    int temp = value0 - dc;
+    dc = value0;
     
     __threadfence_block();
     // put leftover bits back
-    *(int*)data = leftover_value;
+    *data = leftover_value;
     
     int cword_size, cword_value;
     gpujpeg_huffman_gpu_encode_value(cword_size, cword_value, 0, temp, d_table_dc);

    for ( int k = 1; k < 64; k++ ) 
    {
        __threadfence_block();
        const int value = data[k].x;
        const int r = data[k].y;
        __threadfence_block();
        // if last coefficient is zero
        if ( r == -1 ) {
            gpujpeg_huffman_gpu_encoder_emit_bits(out_bits, (uint8_t*)data, d_table_ac->size[256], d_table_ac->code[256]);
            break;
        }
        
        gpujpeg_huffman_gpu_encode_value(cword_size, cword_value, r, value, d_table_ac);
        gpujpeg_huffman_gpu_encoder_emit_bits(out_bits, (uint8_t*)data, cword_size, cword_value);
        __threadfence_block();
    }

    return 0;

        gpujpeg_huffman_gpu_encoder_output((uint8_t*)s_out, remaining_bytes, data_compressed);
    }
    return __ballot(result);
}

/**
