/** Create a Rational identity matrix of the specified size. */ private Rational [] identityMatrix (int dim) { Rational[] val = new Rational [dim * dim]; // Set them all to zero, then overwrite the diagonal values // to one. int i; for (i = 0; i < dim * dim; i++) { val[i] = new Rational (0, 1); } for (i = 0; i < dim; i++) { val[dim * i + i] = new Rational (1, 1); } return val; }
/** Reads an SRATIONAL value and returns it as a Rational. */ protected Rational readSignedRational(long count, long value) throws IOException { _raf.seek(value); long numer = ModuleBase.readSignedInt(_raf, _bigEndian); long denom = ModuleBase.readSignedInt(_raf, _bigEndian); return new Rational(numer, denom); }
/** Reads a RATIONAL value and returns it as a Rational. */ protected Rational readRational(long count, long value) throws IOException { _raf.seek(value); long numer = ModuleBase.readUnsignedInt(_raf, _bigEndian); long denom = ModuleBase.readUnsignedInt(_raf, _bigEndian); return new Rational(numer, denom); }
public static Rational readSignedRational (DataInputStream stream, boolean endian, ModuleBase counted) throws IOException { long n = readSignedInt (stream, endian, counted); long d = readSignedInt (stream, endian, counted); return new Rational (n, d); }
public static Rational readUnsignedRational (RandomAccessFile file, boolean endian) throws IOException { long n = readUnsignedInt (file, endian); long d = readUnsignedInt (file, endian); return new Rational (n, d); }
public static Rational readSignedRational (RandomAccessFile file, boolean endian) throws IOException { long n = readSignedInt (file, endian); long d = readSignedInt (file, endian); return new Rational (n, d); }
/** Reads an array of RATIONAL values and returns it as an * array of Rational. */ protected Rational [] readRationalArray(long count, long value) throws IOException { _raf.seek(value); byte [] buffer = new byte [(int) calcValueSize(RATIONAL, count)]; _raf.read(buffer); DataInputStream stream = new DataInputStream(new ByteArrayInputStream(buffer)); Rational [] rarray = new Rational [(int) count]; for (int i=0; i<count; i++) { long numer = ModuleBase.readUnsignedInt (stream, _bigEndian, null); long denom = ModuleBase.readUnsignedInt (stream, _bigEndian, null); rarray[i] = new Rational(numer, denom); } return rarray; }
/** Reads an array of SRATIONAL values and returns it as an * array of Rational. */ protected Rational [] readSignedRationalArray(long count, long value) throws IOException { _raf.seek(value); byte [] buffer = new byte [(int) calcValueSize(SRATIONAL, count)]; _raf.read(buffer); DataInputStream stream = new DataInputStream(new ByteArrayInputStream(buffer)); Rational [] rarray = new Rational [(int) count]; for (int i=0; i<count; i++) { long numer = ModuleBase.readSignedInt (stream, _bigEndian, null); long denom = ModuleBase.readSignedInt (stream, _bigEndian, null); rarray[i] = new Rational(numer, denom); } return rarray; }
public static Rational readUnsignedRational (DataInputStream stream, boolean endian, ModuleBase counted) throws IOException { long n = readUnsignedInt (stream, endian, counted); long d = readUnsignedInt (stream, endian, counted); return new Rational (n, d); }
protected static Rational average(Rational r1, Rational r2) { long d1 = r1.getDenominator(); long d2 = r2.getDenominator(); Rational f1 = new Rational(r1.getNumerator()*d2, r1.getDenominator()*d2); Rational f2 = new Rational(r2.getNumerator()*d1, r2.getDenominator()*d1); return new Rational((f1.getNumerator() + f2.getNumerator())/2, f1.getDenominator()); }
_baselineExposure = new Rational (0, 1); _baselineNoise = new Rational (1, 1); _baselineSharpness = new Rational (1, 1); _linearResponseLimit = new Rational (1, 1); Rational zero = new Rational (0, 1); if (_blackLevel == null) { _blackLevel = new Rational [_blackLevelRepeatDim[0] * Rational one = new Rational (1, 1); if (_defaultScale == null) { _defaultScale = new Rational[] { one, one }; _defaultCropSize[0] = new Rational (_niso.getImageWidth(), 1); _defaultCropSize[1] = new Rational (_niso.getImageLength(), 1); _antiAliasStrength = new Rational (1, 1);
blueY = readUnsignedInt(); _nisoMetadata.setWhitePointXValue(new Rational(whitePtX, 100000)); _nisoMetadata.setWhitePointYValue(new Rational(whitePtY, 100000)); _nisoMetadata.setPrimaryChromaticitiesRedX(new Rational(redX, 100000)); _nisoMetadata.setPrimaryChromaticitiesRedY(new Rational(redY, 100000)); _nisoMetadata.setPrimaryChromaticitiesGreenX(new Rational(greenX, 100000)); _nisoMetadata.setPrimaryChromaticitiesGreenY(new Rational(greenY, 100000)); _nisoMetadata.setPrimaryChromaticitiesBlueX(new Rational(blueX, 100000)); _nisoMetadata.setPrimaryChromaticitiesBlueY(new Rational(blueY, 100000));
Rational ratGamma = new Rational (100000, gamma); Property gammaProp = new Property ("Gamma", PropertyType.RATIONAL,
if (_niso.getYCbCrCoefficients() == null) { _niso.setYCbCrCoefficients (new Rational [] {new Rational (299, 1000), new Rational (587, 1000), new Rational (114, 1000)}); _blackLevel = new Rational[(int) count]; for (int i = 0; i < count; i++) { _blackLevel[i] = new Rational (ibl[i], 1); _defaultCropOrigin = new Rational[(int) count]; for (int i = 0; i < count; i++) { _defaultCropOrigin[i] = new Rational (lco[i], 1); _defaultCropSize = new Rational[(int) count]; for (int i = 0; i < count; i++) { _defaultCropSize[i] = new Rational (lcs[i], 1); _asShotNeutral = new Rational [(int) count]; for (int i = 0; i < count; i++) { _asShotNeutral[i] = new Rational (asn[i], 1);