1 31 package org.pdfbox.pdmodel.graphics.predictor; 32 33 46 public class Average extends PredictorAlgorithm 47 { 48 53 public void encodeLine(byte[] src, byte[] dest, int srcDy, int srcOffset, 54 int destDy, int destOffset) 55 { 56 int bpl = getWidth() * getBpp(); 57 for (int x = 0; x < bpl; x++) 58 { 59 dest[x + destOffset] = (byte) (src[x + srcOffset] - ((leftPixel( 60 src, srcOffset, srcDy, x) + abovePixel(src, srcOffset, 61 srcDy, x)) >>> 2)); 62 } 63 } 64 65 68 public void decodeLine(byte[] src, byte[] dest, int srcDy, int srcOffset, 69 int destDy, int destOffset) 70 { 71 int bpl = getWidth() * getBpp(); 72 for (int x = 0; x < bpl; x++) 73 { 74 dest[x + destOffset] = (byte) (src[x + srcOffset] + ((leftPixel( 75 dest, destOffset, destDy, x) + abovePixel(dest, 76 destOffset, destDy, x)) >>> 2)); 77 } 78 } 79 } 80 | Popular Tags |