Package net.sourceforge.jiu.color.conversion

# Class PCDYCbCrConversion

java.lang.Object
net.sourceforge.jiu.color.conversion.PCDYCbCrConversion

All Implemented Interfaces:
  `YCbCrIndex`, `RGBIndex`

public class PCDYCbCrConversion extends Object implements RGBIndex, YCbCrIndex
Convert from YCbCr color space (as used in Kodak PCD files) to RGB. Only works for 24 bits per pixel (8 bits per channel) image data.

Author:
  Marco Schmidt

## Field Summary

Fields
Modifier and Type
Field
Description
`private static final float`
`c11`
`private static final float`
`c12`
`private static final float`
`c13`
`private static final float`
`c21`
`private static final float`
`c22`
`private static final float`
`c23`
`private static final float`
`c31`
`private static final float`
`c32`
`private static final float`
`c33`

### Fields inherited from interface net.sourceforge.jiu.data.RGBIndex

`INDEX_BLUE, INDEX_GREEN, INDEX_RED`

### Fields inherited from interface net.sourceforge.jiu.color.YCbCrIndex

`INDEX_CB, INDEX_CR, INDEX_Y`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`private`
`PCDYCbCrConversion()`

## Method Summary

Modifier and Type
Method
Description
`private static void`
`checkArray(byte[] data, int offset, int num)`
`static void`
`convertYccToRgb(byte[] y, byte[] cb, byte[] cr, int yccOffset, byte[] r, byte[] g, byte[] b, int rgbOffset, int num)`
Converts pixels from YCbCr to RGB color space.
`private static byte`
`floatToByte(float f)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### c11

private static final float c11

See Also:
  - Constant Field Values

### c12

private static final float c12

See Also:
  - Constant Field Values

### c13

private static final float c13

See Also:
  - Constant Field Values

### c21

private static final float c21

See Also:
  - Constant Field Values

### c22

private static final float c22

See Also:
  - Constant Field Values

### c23

private static final float c23

See Also:
  - Constant Field Values

### c31

private static final float c31

See Also:
  - Constant Field Values

### c32

private static final float c32

See Also:
  - Constant Field Values

### c33

private static final float c33

See Also:
  - Constant Field Values

## Constructor Details

### PCDYCbCrConversion

private PCDYCbCrConversion()

## Method Details

### floatToByte

private static byte floatToByte(float f)

### checkArray

private static void checkArray(byte[] data, int offset, int num) throws IllegalArgumentException

Throws:
  `IllegalArgumentException`

### convertYccToRgb

public static void convertYccToRgb(byte[] y, byte[] cb, byte[] cr, int yccOffset, byte[] r, byte[] g, byte[] b, int rgbOffset, int num) throws IllegalArgumentException
Converts pixels from YCbCr to RGB color space. Input pixels are given as three byte arrays for luminance and the two chroma components. Same for output pixels, three other arrays for red, green and blue. Offset values can be specified separately for the YCbCr and the RGB arrays.

Parameters:
  `y` - the array of gray source samples
  `cb` - the array of chroma blue source samples
  `cr` - the array of chroma red source samples
  `yccOffset` - offset value into the arrays y, cb and cr; color conversion will be started at the yccOffset'th value of each array
  `r` - the array of red destination samples
  `g` - the array of green destination samples
  `b` - the array of blue destination samples
  `rgbOffset` - offset value into the arrays r, g and b; destination samples will be written to the three arrays starting at the rgbOffset'th value of each array
  `num` - the number of pixels to be converted
Throws:
  `IllegalArgumentException` - if one of the int values is negative or one of the arrays is null or too small