Helper function for applyMaskPenaltyRule1.
We need this for doing this calculation in both vertical and horizontal orders respectively.
@param ByteMatrix matrix @param boolean isHorizontal @return integer
See Implementation
Helper function for applyMaskPenaltyRule1.
We need this for doing this calculation in both vertical and horizontal orders respectively.
@param ByteMatrix matrix @param boolean isHorizontal @return integer