Package skyview.geometry.projecter
Class Interleave
- java.lang.Object
-
- skyview.geometry.projecter.Interleave
-
public class Interleave extends java.lang.Object
This class implements bit interleaving for two-d images. The pixel and indices methods are complementary enabling users to transform between a scalar bit-interleaved index and a set of normal array indices.
-
-
Constructor Summary
Constructors Constructor Description Interleave()
Create a default interleaver with that can handle 512x512 images in a single iteration.Interleave(int order)
Create an interleaver with a specified buffer size for the array lookups.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
ImgToRing(long pix, int size)
Given the index in natural image order (y*nx+x), get the nested index.int[]
indices(long pixel)
Separate interleaved pixels bits into the x and y values.static void
main(java.lang.String[] args)
long
pixel(int x, int y)
int
quickImgToRing(int pix)
This method can only be used if the dimension exactly matches the order for the Interleave.int
quickRingToImg(int pix)
This method can only be used if the Interleave order exactly matches the dimesion of the image.long
ringToImg(long pix, int size)
Given an a pixel with an interleaved index.
-
-
-
Constructor Detail
-
Interleave
public Interleave(int order)
Create an interleaver with a specified buffer size for the array lookups. The interleaver will be able to handle large interleaves but will break them up into bit strings of the specified order length.- Parameters:
order
- The number of bits in to be [de]interleaved in an iteration.
-
Interleave
public Interleave()
Create a default interleaver with that can handle 512x512 images in a single iteration.
-
-
Method Detail
-
pixel
public long pixel(int x, int y)
-
indices
public int[] indices(long pixel)
Separate interleaved pixels bits into the x and y values.- Parameters:
pixel
-- Returns:
-
ringToImg
public long ringToImg(long pix, int size)
Given an a pixel with an interleaved index. return the index into the image as if it simply indexed in natural image order (y*nx+x)- Parameters:
pix
-size
-- Returns:
-
quickRingToImg
public int quickRingToImg(int pix)
This method can only be used if the Interleave order exactly matches the dimesion of the image. E.g., if our tiles have 512x512 pixels then the order must be 9.- Parameters:
pix
-- Returns:
-
ImgToRing
public long ImgToRing(long pix, int size)
Given the index in natural image order (y*nx+x), get the nested index.
-
quickImgToRing
public int quickImgToRing(int pix)
This method can only be used if the dimension exactly matches the order for the Interleave.
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-