protected void doAverageLine(byte[] curLine,byte[] prevLine){
  int sub=(int)Math.ceil((getBitsPerComponent() * getColors()) / 8.0);
  for (int i=0; i < curLine.length; i++) {
    int raw=0;
    int prior=0;
    int prevIdx=i - sub;
    if (prevIdx >= 0) {
      raw=curLine[prevIdx] & 0xff;
    }
    if (prevLine != null) {
      prior=prevLine[i] & 0xff;
    }
    curLine[i]+=(byte)Math.floor((raw + prior) / 2);
  }
}

protected void doAverageLine ( byte [ ] curLine , byte [ ] prevLine ) { int sub = ( int ) Math . ceil ( ( getBitsPerComponent ( ) * getColors ( ) ) / 8.0 ) ; for ( int i = 0 ; i < curLine . length ; i ++ ) { int raw = 0 ; int prior = 0 ; int prevIdx = i - sub ; if ( prevIdx >= 0 ) { raw = curLine [ prevIdx ] & 0xff ; } if ( prevLine != null ) { prior = prevLine [ i ] & 0xff ; } curLine [ i ] += ( byte ) Math . floor ( ( raw + prior ) / 2 ) ; } }
return the value of the average algorithm on the line ( compare bytes to the average of the previous byte of the same color and the same byte on the previous line )
