pub fn qtree_onebit(a: &[i32], n: usize, nx: usize, ny: usize, b: &mut [u8], bit: usize) {
    let mut s10: usize;
    let mut s00: usize;

    /*
     * use selected bit to get amount to shift
     */
    let b0: i32 = 1 << bit;
    let b1: i32 = b0 << 1;
    let b2: i32 = b0 << 2;
    let b3: i32 = b0 << 3;
    let mut k: usize = 0;
    let mut ii = 0; /* k is index of b[i/2,j/2]	*/

    if nx == 0 {
        return;
    } // Stops underflow and early return

    for i in (0..(nx - 1)).step_by(2) {
        //for (i = 0; i<nx-1; i += 2) {
        s00 = n * i; /* s00 is index of a[i,j]	*/
        s10 = s00 + n; /* s10 is index of a[i+1,j]	*/
        let mut ji = 0;

        if ny == 0 {
            continue;
        } // Stops underflow

        for _j in (0..(ny - 1)).step_by(2) {
            //for (j = 0; j<ny-1; j += 2) {

            b[k] = (((a[s10 + 1] & b0)
                | ((a[s10] << 1) & b1)
                | ((a[s00 + 1] << 2) & b2)
                | ((a[s00] << 3) & b3))
                >> bit) as u8;

            k += 1;
            s00 += 2;
            s10 += 2;
            ji += 2;
        }
        if ji < ny {
            /*
             * row size is odd, do last element in row
             * s00+1,s10+1 are off edge
             */
            b[k] = ((((a[s10] << 1) & b1) | ((a[s00] << 3) & b3)) >> bit) as u8;
            k += 1;
        }
        ii += 2;
    }
    if ii < nx {
        /*
         * column size is odd, do last row
         * s10,s10+1 are off edge
         */
        s00 = n * ii;
        let mut ji = 0;
        if ny == 0 {
            return;
        } // Early return, prevent underflow on next line (ny - 1)
        for _j in (0..(ny - 1)).step_by(2) {
            //for (j = 0; j<ny-1; j += 2) {
            b[k] = ((((a[s00 + 1] << 2) & b2) | ((a[s00] << 3) & b3)) >> bit) as u8;
            k += 1;
            s00 += 2;
            ji += 2;
        }
        if ji < ny {
            /*
             * both row and column size are odd, do corner element
             * s00+1, s10, s10+1 are off edge
             */
            b[k] = (((a[s00] << 3) & b3) >> bit) as u8;
            k += 1;
        }
    }
}
/*
 * Do first quadtree reduction step on bit BIT of array A.
 * Results put into B.
 *
 * a = (9) &[37536, 37088, 224, 36864, 0, 222, 77022, 222, 0]
 * n = 1
 * nx = 5
 * ny = 0
 * b = [0,0,1,8]
 * bit = 16
 */
Do first quadtree reduction step on bit BIT of array A.
Results put into B.


Do first quadtree reduction step on bit BIT of array A . Results put into B .
pub fn qtree_onebit(a: &[i32], n: usize, nx: usize, ny: usize, b: &mut [u8], bit: usize) {
    let mut s10: usize;
    let mut s00: usize;
    /*
     * use selected bit to get amount to shift
     */
    let b0: i32 = 1 << bit;
    let b1: i32 = b0 << 1;
    let b2: i32 = b0 << 2;
    let b3: i32 = b0 << 3;
    let mut k: usize = 0;
    let mut ii = 0; /* k is index of b[i/2,j/2]	*/
    if nx == 0 {
        return;
    } // Stops underflow and early return
    for i in (0..(nx - 1)).step_by(2) {
        //for (i = 0; i<nx-1; i += 2) {
        s00 = n * i; /* s00 is index of a[i,j]	*/
        s10 = s00 + n; /* s10 is index of a[i+1,j]	*/
        let mut ji = 0;
        if ny == 0 {
            continue;
        } // Stops underflow
        for _j in (0..(ny - 1)).step_by(2) {
            //for (j = 0; j<ny-1; j += 2) {
            b[k] = (((a[s10 + 1] & b0)
                | ((a[s10] << 1) & b1)
                | ((a[s00 + 1] << 2) & b2)
                | ((a[s00] << 3) & b3))
                >> bit) as u8;
            k += 1;
            s00 += 2;
            s10 += 2;
            ji += 2;
        }
        if ji < ny {
            /*
             * row size is odd, do last element in row
             * s00+1,s10+1 are off edge
             */
            b[k] = ((((a[s10] << 1) & b1) | ((a[s00] << 3) & b3)) >> bit) as u8;
            k += 1;
        }
        ii += 2;
    }
    if ii < nx {
        /*
         * column size is odd, do last row
         * s10,s10+1 are off edge
         */
        s00 = n * ii;
        let mut ji = 0;
        if ny == 0 {
            return;
        } // Early return, prevent underflow on next line (ny - 1)
        for _j in (0..(ny - 1)).step_by(2) {
            //for (j = 0; j<ny-1; j += 2) {
            b[k] = ((((a[s00 + 1] << 2) & b2) | ((a[s00] << 3) & b3)) >> bit) as u8;
            k += 1;
            s00 += 2;
            ji += 2;
        }
        if ji < ny {
            /*
             * both row and column size are odd, do corner element
             * s00+1, s10, s10+1 are off edge
             */
            b[k] = (((a[s00] << 3) & b3) >> bit) as u8;
            k += 1;
        }
    }
}
pub fn qtree_onebit ( a : & [ i32 ] , n : usize , nx : usize , ny : usize , b : & mut [ u8 ] , bit : usize ) { let mut s10 : usize ; let mut s00 : usize ; /*
     * use selected bit to get amount to shift
     */ let b0 : i32 = 1 << bit ; let b1 : i32 = b0 << 1 ; let b2 : i32 = b0 << 2 ; let b3 : i32 = b0 << 3 ; let mut k : usize = 0 ; let mut ii = 0 ; /* k is index of b[i/2,j/2]	*/ if nx == 0 { return ; } // Stops underflow and early return for i in ( 0 .. ( nx - 1 ) ) . step_by ( 2 ) { //for (i = 0; i<nx-1; i += 2) { s00 = n * i ; /* s00 is index of a[i,j]	*/ s10 = s00 + n ; /* s10 is index of a[i+1,j]	*/ let mut ji = 0 ; if ny == 0 { continue ; } // Stops underflow for _j in ( 0 .. ( ny - 1 ) ) . step_by ( 2 ) { //for (j = 0; j<ny-1; j += 2) { b [ k ] = ( ( ( a [ s10 + 1 ] & b0 ) | ( ( a [ s10 ] << 1 ) & b1 ) | ( ( a [ s00 + 1 ] << 2 ) & b2 ) | ( ( a [ s00 ] << 3 ) & b3 ) ) >> bit ) as u8 ; k += 1 ; s00 += 2 ; s10 += 2 ; ji += 2 ; } if ji < ny { /*
             * row size is odd, do last element in row
             * s00+1,s10+1 are off edge
             */ b [ k ] = ( ( ( ( a [ s10 ] << 1 ) & b1 ) | ( ( a [ s00 ] << 3 ) & b3 ) ) >> bit ) as u8 ; k += 1 ; } ii += 2 ; } if ii < nx { /*
         * column size is odd, do last row
         * s10,s10+1 are off edge
         */ s00 = n * ii ; let mut ji = 0 ; if ny == 0 { return ; } // Early return, prevent underflow on next line (ny - 1) for _j in ( 0 .. ( ny - 1 ) ) . step_by ( 2 ) { //for (j = 0; j<ny-1; j += 2) { b [ k ] = ( ( ( ( a [ s00 + 1 ] << 2 ) & b2 ) | ( ( a [ s00 ] << 3 ) & b3 ) ) >> bit ) as u8 ; k += 1 ; s00 += 2 ; ji += 2 ; } if ji < ny { /*
             * both row and column size are odd, do corner element
             * s00+1, s10, s10+1 are off edge
             */ b [ k ] = ( ( ( a [ s00 ] << 3 ) & b3 ) >> bit ) as u8 ; k += 1 ; } } }
Do first quadtree reduction step on bit BIT of array A.
Do first quadtree reduction step on bit BIT of array A .
a
&[i32]
n
usize
nx
usize
ny
usize
b
&mut [u8]
bit
usize
a
&[i32]
n
usize
nx
usize
ny
usize
b
&mut [u8]
bit
usize