public static int[] bilinear(int[] pixs, int iw, int ih, int ow, int oh, float p) {

		int[] opix = new int[ow * oh];
		for (int i = 0; i < oh-1; i++) {
			float dy = i/p;
			int iy = (int)dy;
			if(iy>ih-2)iy = ih-2;
			float d_y = dy-iy;
			
			for (int j = 0; j < ow-1; j++) {
				int g;
				float dx = j/p;
				int ix = (int)dx;
				if(ix>iw-2)ix = iw-2;
				float d_x = dx -ix;
				
				g = (int)(
						(1-d_x)	*(1-d_y)	*pixs[iy*iw+ix]+
						(d_x)	*(1-d_y)	*pixs[iy*iw+ix+1]+
						(1-d_x)	*(d_y)		*pixs[(iy+1)*iw+ix]+
						(d_x)	*(d_y)		*pixs[(iy+1)*iw+ix+1]
						);
				opix[i*ow+j] = g;
			}
		}
		return opix;
	}