|
|
|
@ -12,37 +12,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation |
|
|
|
{ |
|
|
|
private readonly YCbCrConverter converter; |
|
|
|
|
|
|
|
private static readonly Rational[] DefaultLuma = |
|
|
|
{ |
|
|
|
new Rational(299, 1000), |
|
|
|
new Rational(587, 1000), |
|
|
|
new Rational(114, 1000) |
|
|
|
}; |
|
|
|
|
|
|
|
private static readonly Rational[] DefaultReferenceBlackWhite = |
|
|
|
{ |
|
|
|
new Rational(0, 1), new Rational(255, 1), |
|
|
|
new Rational(128, 1), new Rational(255, 1), |
|
|
|
new Rational(128, 1), new Rational(255, 1) |
|
|
|
}; |
|
|
|
|
|
|
|
public YCbCrTiffColor(Rational[] referenceBlackAndWhite, Rational[] coefficients) |
|
|
|
{ |
|
|
|
referenceBlackAndWhite ??= DefaultReferenceBlackWhite; |
|
|
|
coefficients ??= DefaultLuma; |
|
|
|
|
|
|
|
if (referenceBlackAndWhite.Length != 6) |
|
|
|
{ |
|
|
|
TiffThrowHelper.ThrowImageFormatException("reference black and white array should have 6 entry's"); |
|
|
|
} |
|
|
|
|
|
|
|
if (coefficients.Length != 3) |
|
|
|
{ |
|
|
|
TiffThrowHelper.ThrowImageFormatException("luma coefficients array should have 6 entry's"); |
|
|
|
} |
|
|
|
|
|
|
|
this.converter = new YCbCrConverter(referenceBlackAndWhite, coefficients); |
|
|
|
} |
|
|
|
public YCbCrTiffColor(Rational[] referenceBlackAndWhite, Rational[] coefficients) => this.converter = new YCbCrConverter(referenceBlackAndWhite, coefficients); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public override void Decode(ReadOnlySpan<byte> data, Buffer2D<TPixel> pixels, int left, int top, int width, int height) |
|
|
|
|