Class LogLuvConversion
- java.lang.Object
-
- net.sourceforge.jiu.color.conversion.LogLuvConversion
-
public class LogLuvConversion extends Object
Convert from LogLuv color representation to RGB color space and from LogL to grayscale.This implementation is based on the file
tif_luv.cwhich is part of the TIFF library libtiff. The original implementation was written by Greg W. Larson.Learn more about the color type and its encoding on Greg's page LogLuv Encoding for TIFF Images.
- Since:
- 0.10.0
- Author:
- Marco Schmidt
-
-
Field Summary
Fields Modifier and Type Field Description private static doubleM_LN2private static short[]NCUMprivate static doubleU_NEUprivate static double[]USTARTprivate static intUV_NDIVSprivate static intUV_NVSprivate static floatUV_SQSIZprivate static floatUV_VSTARTprivate static doubleUVSCALEprivate static doubleV_NEU
-
Constructor Summary
Constructors Modifier Constructor Description privateLogLuvConversion()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static byteconvertDoubleToByte(double d)static doubleconvertLogL10toY(int p10)Converts an unsigned 10 bit value (the argument must lie in the interval 0 to 1023) to adoubleluminance (brightness) value between0.0and1.0.static voidconvertLogL16toGray8(byte[] logl, byte[] gray, int num)Converts a number of 16 bit LogL samples to 8 bit grayscale samples.static doubleconvertLogL16toY(int p16)Converts a signed 16 bit value (the argument must lie in the interval -32768 to 32767) to adoubleluminance (brightness) value between0.0and1.0.static voidconvertLogLuv24InterleavedtoRGB24Planar(byte[] logluv, byte[] red, byte[] green, byte[] blue, int num)Converts a number of 24 bit LogLuv pixels to 24 bit RGB pixels.static voidconvertLogLuv32InterleavedtoRGB24Planar(byte[] logluv, byte[] red, byte[] green, byte[] blue, int num)Converts a number of 32 bit LogLuv pixels to 24 bit RGB pixels.
-
-
-
Field Detail
-
M_LN2
private static final double M_LN2
- See Also:
- Constant Field Values
-
UVSCALE
private static final double UVSCALE
- See Also:
- Constant Field Values
-
UV_SQSIZ
private static final float UV_SQSIZ
- See Also:
- Constant Field Values
-
UV_NDIVS
private static final int UV_NDIVS
- See Also:
- Constant Field Values
-
UV_VSTART
private static final float UV_VSTART
- See Also:
- Constant Field Values
-
UV_NVS
private static final int UV_NVS
- See Also:
- Constant Field Values
-
U_NEU
private static final double U_NEU
- See Also:
- Constant Field Values
-
V_NEU
private static final double V_NEU
- See Also:
- Constant Field Values
-
USTART
private static final double[] USTART
-
NCUM
private static final short[] NCUM
-
-
Method Detail
-
convertLogL10toY
public static double convertLogL10toY(int p10)
Converts an unsigned 10 bit value (the argument must lie in the interval 0 to 1023) to adoubleluminance (brightness) value between0.0and1.0. This conversion is needed by both LogLuv to XYZ and LogL to grayscale.- Parameters:
p10- input LogL value- Returns:
- double value with luminance, between 0 and 1
-
convertLogL16toY
public static double convertLogL16toY(int p16)
Converts a signed 16 bit value (the argument must lie in the interval -32768 to 32767) to adoubleluminance (brightness) value between0.0and1.0. This conversion is needed by both LogLuv to XYZ and LogL to grayscale.- Parameters:
p16- input LogL value- Returns:
- double value with luminance, between 0 and 1
-
convertDoubleToByte
private static byte convertDoubleToByte(double d)
-
convertLogLuv24InterleavedtoRGB24Planar
public static void convertLogLuv24InterleavedtoRGB24Planar(byte[] logluv, byte[] red, byte[] green, byte[] blue, int num)Converts a number of 24 bit LogLuv pixels to 24 bit RGB pixels. Each LogLuv pixel is stored as three consecutive bytes in thelogluvbyte array. The first byte and the top two bits of the second are the LogL value, the remaining 14 bits are an index that encodes u and v.- Parameters:
logluv- byte array with LogLuv data, must be at least num * 3 bytes largered- the byte samples for the red channel will be written to this arraygreen- the byte samples for the green channel will be written to this arrayblue- the byte samples for the blue channel will be written to this arraynum- number of pixels to be converted
-
convertLogLuv32InterleavedtoRGB24Planar
public static void convertLogLuv32InterleavedtoRGB24Planar(byte[] logluv, byte[] red, byte[] green, byte[] blue, int num)Converts a number of 32 bit LogLuv pixels to 24 bit RGB pixels. Each LogLuv pixel is stored as four consecutive bytes in thelogluvbyte array. The first two bytes represent the LogL value (most significant bytefirst), followed by the u value and then the v value.- Parameters:
logluv- byte array with LogLuv data, must be at least num * 4 bytes largered- the byte samples for the red channel will be written to this arraygreen- the byte samples for the green channel will be written to this arrayblue- the byte samples for the blue channel will be written to this arraynum- number of pixels to be converted
-
convertLogL16toGray8
public static void convertLogL16toGray8(byte[] logl, byte[] gray, int num)Converts a number of 16 bit LogL samples to 8 bit grayscale samples.- Parameters:
logl- byte array with LogL samples, each 16 bit sample is stored as two consecutive bytes in order most-significant-byte least-significant-byte (network byte order); the array must be at least num * 2 entries largegray- the byte array to which the converted samples will be writtennum- the number of samples to be converted
-
-