 	}
 
 	/* do translation */
-	float fetch_x = x + xtrans - transform_info[2];
+	float fetch_x = x + xtrans + transform_info[2];
 	float fetch_y = y + ytrans + transform_info[3];
 
 	/* do rotation */

 *	transform should be in form: (single pointer to array in row major form)
 *		cos(theta)	-sin(theta)	t_x
 *		sin(theta)	cos(theta)	t_y
 *		0						0						1
 */
__host__ void apply_transform(float *input, float *output, float *transform, 
		const int width, const int height, int xtrans, int ytrans,

__host__ void find_dest(float *transform, int width, int height, int *xtrans,
		int*ytrans, int *dwidth, int*dheight)
{
	int x1 = -width/2 * transform[0] - height/2 * transform[1] + transform[2];
	int y1 = -width/2 * transform[3] - height/2 * transform[4] + transform[5];
	int x2 = -width/2 * transform[0] + height/2 * transform[1] + transform[2];
	int y2 = -width/2 * transform[3] + height/2 * transform[4] + transform[5];
	int x3 = width/2 * transform[0] - height/2 * transform[1] + transform[2];
	int y3 = width/2 * transform[3] - height/2 * transform[4] + transform[5];
	int x4 = width/2 * transform[0] + height/2 * transform[1] + transform[2];
	int y4 = width/2 * transform[3] + height/2 * transform[4] + transform[5];

	int xmin = min(min(min(x1, x2), x3), x4);
	int ymin = min(min(min(y1, y2), y3), y4);
	int xmax = max(max(max(x1, x2), x3), x4);
	int ymax = max(max(max(y1, y2), y3), y4);


	*xtrans =  - transform[2];
	*ytrans =  - transform[5];
	*dwidth = xmax - xmin;
	*dheight = ymax - ymin;
}

__host__ int main(int argc, char **argv){
