pub fn qtree_reduce(a: &mut [u8], n: usize, nx: usize, ny: usize) {
    //int i, j, k;
    let mut s10;
    let mut s00;
    let mut k = 0;
    let mut ii = 0; /* k is index of b[i/2,j/2]	*/

    if nx == 0 {
        return;
    } // Early return and prevents underflows
    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]	*/

        if ny == 0 {
            ii += 2;
            continue;
        } // Early continue and prevents underflows
        for _j in (0..(ny - 1)).step_by(2) {
            //for (j = 0; j<ny-1; j += 2) {
            a[k] = u8::from(a[s10 + 1] != 0)
                | (u8::from(a[s10] != 0) << 1)
                | (u8::from(a[s00 + 1] != 0) << 2)
                | (u8::from(a[s00] != 0) << 3);
            k += 1;
            s00 += 2;
            s10 += 2;
        }

        if ny % 2 != 0 {
            /*
             * row size is odd, do last element in row
             * s00+1,s10+1 are off edge
             */
            a[k] = (u8::from(a[s10] != 0) << 1) | (u8::from(a[s00] != 0) << 3);
            k += 1;
        }
        ii += 2;
    }
    if nx % 2 != 0 {
        /*
         * column size is odd, do last row
         * s10,s10+1 are off edge
         */
        s00 = n * ii;
        if ny == 0 {
            return;
        } // Early return and prevents underflows
        for _j in (0..(ny - 1)).step_by(2) {
            //for (j = 0; j<ny-1; j += 2) {
            a[k] = (u8::from(a[s00 + 1] != 0) << 2) | (u8::from(a[s00] != 0) << 3);
            k += 1;
            s00 += 2;
        }
        if ny % 2 != 0 {
            /*
             * both row and column size are odd, do corner element
             * s00+1, s10, s10+1 are off edge
             */
            a[k] = u8::from(a[s00] != 0) << 3;
            k += 1;
        }
    }
}
/*
 * do one quadtree reduction step on array a
 * results put into b (which may be the same as a)
 */
do one quadtree reduction step on array a
results put into b (which may be the same as a)
do one quadtree reduction step on array a results put into b ( which may be the same as a )
pub fn qtree_reduce(a: &mut [u8], n: usize, nx: usize, ny: usize) {
    //int i, j, k;
    let mut s10;
    let mut s00;
    let mut k = 0;
    let mut ii = 0; /* k is index of b[i/2,j/2]	*/
    if nx == 0 {
        return;
    } // Early return and prevents underflows
    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]	*/
        if ny == 0 {
            ii += 2;
            continue;
        } // Early continue and prevents underflows
        for _j in (0..(ny - 1)).step_by(2) {
            //for (j = 0; j<ny-1; j += 2) {
            a[k] = u8::from(a[s10 + 1] != 0)
                | (u8::from(a[s10] != 0) << 1)
                | (u8::from(a[s00 + 1] != 0) << 2)
                | (u8::from(a[s00] != 0) << 3);
            k += 1;
            s00 += 2;
            s10 += 2;
        }
        if ny % 2 != 0 {
            /*
             * row size is odd, do last element in row
             * s00+1,s10+1 are off edge
             */
            a[k] = (u8::from(a[s10] != 0) << 1) | (u8::from(a[s00] != 0) << 3);
            k += 1;
        }
        ii += 2;
    }
    if nx % 2 != 0 {
        /*
         * column size is odd, do last row
         * s10,s10+1 are off edge
         */
        s00 = n * ii;
        if ny == 0 {
            return;
        } // Early return and prevents underflows
        for _j in (0..(ny - 1)).step_by(2) {
            //for (j = 0; j<ny-1; j += 2) {
            a[k] = (u8::from(a[s00 + 1] != 0) << 2) | (u8::from(a[s00] != 0) << 3);
            k += 1;
            s00 += 2;
        }
        if ny % 2 != 0 {
            /*
             * both row and column size are odd, do corner element
             * s00+1, s10, s10+1 are off edge
             */
            a[k] = u8::from(a[s00] != 0) << 3;
            k += 1;
        }
    }
}
pub fn qtree_reduce ( a : & mut [ u8 ] , n : usize , nx : usize , ny : usize ) { //int i, j, k; let mut s10 ; let mut s00 ; let mut k = 0 ; let mut ii = 0 ; /* k is index of b[i/2,j/2]	*/ if nx == 0 { return ; } // Early return and prevents underflows 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]	*/ if ny == 0 { ii += 2 ; continue ; } // Early continue and prevents underflows for _j in ( 0 .. ( ny - 1 ) ) . step_by ( 2 ) { //for (j = 0; j<ny-1; j += 2) { a [ k ] = u8 :: from ( a [ s10 + 1 ] != 0 ) | ( u8 :: from ( a [ s10 ] != 0 ) << 1 ) | ( u8 :: from ( a [ s00 + 1 ] != 0 ) << 2 ) | ( u8 :: from ( a [ s00 ] != 0 ) << 3 ) ; k += 1 ; s00 += 2 ; s10 += 2 ; } if ny % 2 != 0 { /*
             * row size is odd, do last element in row
             * s00+1,s10+1 are off edge
             */ a [ k ] = ( u8 :: from ( a [ s10 ] != 0 ) << 1 ) | ( u8 :: from ( a [ s00 ] != 0 ) << 3 ) ; k += 1 ; } ii += 2 ; } if nx % 2 != 0 { /*
         * column size is odd, do last row
         * s10,s10+1 are off edge
         */ s00 = n * ii ; if ny == 0 { return ; } // Early return and prevents underflows for _j in ( 0 .. ( ny - 1 ) ) . step_by ( 2 ) { //for (j = 0; j<ny-1; j += 2) { a [ k ] = ( u8 :: from ( a [ s00 + 1 ] != 0 ) << 2 ) | ( u8 :: from ( a [ s00 ] != 0 ) << 3 ) ; k += 1 ; s00 += 2 ; } if ny % 2 != 0 { /*
             * both row and column size are odd, do corner element
             * s00+1, s10, s10+1 are off edge
             */ a [ k ] = u8 :: from ( a [ s00 ] != 0 ) << 3 ; k += 1 ; } } }
do one quadtree reduction step on array a
 results put into b (which may be the same as a)
do one quadtree reduction step on array a results put into b ( which may be the same as a )
a
&mut [u8]
n
usize
nx
usize
ny
usize
a
&mut [u8]
n
usize
nx
usize
ny
usize