pub fn cdef_analyze_superblock(in_frame: &mut Frame,
                               bc_global: &mut BlockContext,
                               sbo: &SuperBlockOffset,
                               sbo_global: &SuperBlockOffset,
                               bit_depth: usize) -> CdefDirections {
    let coeff_shift = bit_depth as i32 - 8;
    let mut dir: CdefDirections = CdefDirections {dir: [[0; 8]; 8], var: [[0; 8]; 8]};
    // Each direction block is 8x8 in y, and direction computation only looks at y
    for by in 0..8 {
        for bx in 0..8 {
            // The bc and global SBO are only to determine frame
            // boundaries and skips in the event we're passing in a
            // single-SB copy 'frame' that represents some superblock
            // in the main frame.
            let global_block_offset = sbo_global.block_offset(bx<<1, by<<1);
            if global_block_offset.x < bc_global.cols && global_block_offset.y < bc_global.rows {
                let skip = bc_global.at(&global_block_offset).skip
                         & bc_global.at(&sbo_global.block_offset(2*bx+1, 2*by)).skip
                         & bc_global.at(&sbo_global.block_offset(2*bx, 2*by+1)).skip
                         & bc_global.at(&sbo_global.block_offset(2*bx+1, 2*by+1)).skip;

                if !skip {
                    let mut var: i32 = 0;
                    let mut in_plane = &mut in_frame.planes[0];
                    let in_po = sbo.plane_offset(&in_plane.cfg);
                    let in_stride = in_plane.cfg.stride;
                    let in_slice = &in_plane.mut_slice(&in_po);
                    dir.dir[bx][by] = cdef_find_dir(in_slice.offset(8*bx+2,8*by+2),
                                                    in_stride, &mut var, coeff_shift) as u8;
                    dir.var[bx][by] = var;
                }
            }
        }
    }
    dir
}
// For convenience of use alongside cdef_filter_superblock, we assume
// in_frame is padded.  Blocks are not scanned outside the block
// boundaries (padding is untouched here).
For convenience of use alongside cdef_filter_superblock, we assume
in_frame is padded.  Blocks are not scanned outside the block
boundaries (padding is untouched here).
For convenience of use alongside cdef_filter_superblock we assume in_frame is padded . Blocks are not scanned outside the block boundaries ( padding is untouched here ) .
pub fn cdef_analyze_superblock(in_frame: &mut Frame,
                               bc_global: &mut BlockContext,
                               sbo: &SuperBlockOffset,
                               sbo_global: &SuperBlockOffset,
                               bit_depth: usize) -> CdefDirections {
    let coeff_shift = bit_depth as i32 - 8;
    let mut dir: CdefDirections = CdefDirections {dir: [[0; 8]; 8], var: [[0; 8]; 8]};
    // Each direction block is 8x8 in y, and direction computation only looks at y
    for by in 0..8 {
        for bx in 0..8 {
            // The bc and global SBO are only to determine frame
            // boundaries and skips in the event we're passing in a
            // single-SB copy 'frame' that represents some superblock
            // in the main frame.
            let global_block_offset = sbo_global.block_offset(bx<<1, by<<1);
            if global_block_offset.x < bc_global.cols && global_block_offset.y < bc_global.rows {
                let skip = bc_global.at(&global_block_offset).skip
                         & bc_global.at(&sbo_global.block_offset(2*bx+1, 2*by)).skip
                         & bc_global.at(&sbo_global.block_offset(2*bx, 2*by+1)).skip
                         & bc_global.at(&sbo_global.block_offset(2*bx+1, 2*by+1)).skip;
                if !skip {
                    let mut var: i32 = 0;
                    let mut in_plane = &mut in_frame.planes[0];
                    let in_po = sbo.plane_offset(&in_plane.cfg);
                    let in_stride = in_plane.cfg.stride;
                    let in_slice = &in_plane.mut_slice(&in_po);
                    dir.dir[bx][by] = cdef_find_dir(in_slice.offset(8*bx+2,8*by+2),
                                                    in_stride, &mut var, coeff_shift) as u8;
                    dir.var[bx][by] = var;
                }
            }
        }
    }
    dir
}
pub fn cdef_analyze_superblock ( in_frame : & mut Frame , bc_global : & mut BlockContext , sbo : & SuperBlockOffset , sbo_global : & SuperBlockOffset , bit_depth : usize ) -> CdefDirections { let coeff_shift = bit_depth as i32 - 8 ; let mut dir : CdefDirections = CdefDirections { dir : [ [ 0 ; 8 ] ; 8 ] , var : [ [ 0 ; 8 ] ; 8 ] } ; // Each direction block is 8x8 in y, and direction computation only looks at y for by in 0 .. 8 { for bx in 0 .. 8 { // The bc and global SBO are only to determine frame // boundaries and skips in the event we're passing in a // single-SB copy 'frame' that represents some superblock // in the main frame. let global_block_offset = sbo_global . block_offset ( bx << 1 , by << 1 ) ; if global_block_offset . x < bc_global . cols && global_block_offset . y < bc_global . rows { let skip = bc_global . at ( & global_block_offset ) . skip & bc_global . at ( & sbo_global . block_offset ( 2 * bx + 1 , 2 * by ) ) . skip & bc_global . at ( & sbo_global . block_offset ( 2 * bx , 2 * by + 1 ) ) . skip & bc_global . at ( & sbo_global . block_offset ( 2 * bx + 1 , 2 * by + 1 ) ) . skip ; if ! skip { let mut var : i32 = 0 ; let mut in_plane = & mut in_frame . planes [ 0 ] ; let in_po = sbo . plane_offset ( & in_plane . cfg ) ; let in_stride = in_plane . cfg . stride ; let in_slice = & in_plane . mut_slice ( & in_po ) ; dir . dir [ bx ] [ by ] = cdef_find_dir ( in_slice . offset ( 8 * bx + 2 , 8 * by + 2 ) , in_stride , & mut var , coeff_shift ) as u8 ; dir . var [ bx ] [ by ] = var ; } } } } dir }
For convenience of use alongside cdef_filter_superblock, we assume
in_frame is padded.
For convenience of use alongside cdef_filter_superblock we assume in_frame is padded .
in_frame
&mut Frame
bc_global
&mut BlockContext
sbo
&SuperBlockOffset
sbo_global
&SuperBlockOffset
bit_depth
usize