javax.media.format
Class YUVFormat

java.lang.Object
  |
  +--javax.media.Format
        |
        +--javax.media.format.VideoFormat
              |
              +--javax.media.format.YUVFormat

public class YUVFormat
extends VideoFormat

Describes YUV image data.

Since:
JMF 2.0
See Also:
Serialized Form

Field Summary
protected  int offsetU
          When the YUV data is in planar format, specifies the offset into the data for the U plane.
protected  int offsetV
          When the YUV data is in planar format, specifies the offset into the data for the V plane.
protected  int offsetY
          When the YUV data is in planar format, specifies the offset into the data for the Y plane.
protected  int strideUV
          Length of a row of U or V values.
protected  int strideY
          Length of a row of Y values.
static int YUV_111
          YUV Planar 1:1:1 type.
static int YUV_411
          YUV Planar 4:1:1 type.
static int YUV_420
          YUV Planar 4:2:0 type.
static int YUV_422
          YUV Planar 4:2:2 type.
static int YUV_SIGNED
          When added to the yuvType, specifies that the chrominance values are signed.
static int YUV_YUYV
          YUV 4:2:2 interleaved format.
static int YUV_YVU9
          YUV Planar YVU9 type.
protected  int yuvType
          The YUV format type
 
Fields inherited from class javax.media.format.VideoFormat
CINEPAK, frameRate, H261, H261_RTP, H263, H263_1998_RTP, H263_RTP, INDEO32, INDEO41, INDEO50, IRGB, JPEG, JPEG_RTP, maxDataLength, MJPEGA, MJPEGB, MJPG, MPEG, MPEG_RTP, RGB, RLE, RPZA, size, SMC, YUV
 
Fields inherited from class javax.media.Format
byteArray, clz, dataType, encoding, FALSE, formatArray, intArray, NOT_SPECIFIED, shortArray, TRUE
 
Constructor Summary
YUVFormat()
          Constructs a YUVFormat object that represents all YUV formats.
YUVFormat(java.awt.Dimension size, int maxDataLength, java.lang.Class dataType, float frameRate, int yuvType, int strideY, int strideUV, int offsetY, int offsetU, int offsetV)
          Constructs a YUVFormat with the specified properties.
YUVFormat(int yuvType)
          Constructs a YUVFormat object for a specific yuvType.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of this YUVFormat.
protected  void copy(Format f)
          Copies the attributes from the specified Format into this YUVFormat.
 boolean equals(java.lang.Object format)
          Compares the specified Format with this YUVFormat.
 int getOffsetU()
          Gets the U offset--the position in the data where the U values begin.
 int getOffsetV()
          Gets the V offset--the position in the data where the V values begin.
 int getOffsetY()
          Gets the Y offset--the position in the data where the Y values begin.
 int getStrideUV()
          Gets the UV stride--the length of a row of U or V values.
 int getStrideY()
          Gets the Y stride--the length of a row of Y values.
 int getYuvType()
          Gets the YUV data format.
 Format intersects(Format format)
          Finds the attributes shared by two matching Format objects.
 boolean matches(Format format)
          Checks whether or not the specified Format matches this YUVFormat.
 Format relax()
          Generate a format that's less restrictive than this format but contains the basic attributes that will make this resulting format useful for format matching.
 java.lang.String toString()
          Gets a String representation of the attributes of this YUVFormat.
 
Methods inherited from class javax.media.format.VideoFormat
getFrameRate, getMaxDataLength, getSize
 
Methods inherited from class javax.media.Format
getDataType, getEncoding, isSameEncoding, isSameEncoding
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

YUV_411

public static final int YUV_411
YUV Planar 4:1:1 type.

YUV_420

public static final int YUV_420
YUV Planar 4:2:0 type.

YUV_422

public static final int YUV_422
YUV Planar 4:2:2 type.

YUV_111

public static final int YUV_111
YUV Planar 1:1:1 type.

YUV_YVU9

public static final int YUV_YVU9
YUV Planar YVU9 type. Contains a Y value for every pixel and U and V values for every 4x4 block of pixels.

YUV_YUYV

public static final int YUV_YUYV
YUV 4:2:2 interleaved format. The components are ordered as specified by the offsetY, offsetU and offsetV attributes. For example, if the ordering is Y, V, Y and U, the offsets would be offsetY=0;offsetU=3;offsetV=1. The position of the second Y is implied. Y pixel stride is assumed to be 2 and the U and V pixel strides are assumed to be 4.

YUV_SIGNED

public static final int YUV_SIGNED
When added to the yuvType, specifies that the chrominance values are signed.

yuvType

protected int yuvType
The YUV format type

strideY

protected int strideY
Length of a row of Y values. Would be >= width of the frame.

strideUV

protected int strideUV
Length of a row of U or V values.

offsetY

protected int offsetY
When the YUV data is in planar format, specifies the offset into the data for the Y plane. This value is ignored in the interleaved formats.

offsetU

protected int offsetU
When the YUV data is in planar format, specifies the offset into the data for the U plane. This value is ignored in the interleaved formats.

offsetV

protected int offsetV
When the YUV data is in planar format, specifies the offset into the data for the V plane. This value is ignored in the interleaved formats.
Constructor Detail

YUVFormat

public YUVFormat()
Constructs a YUVFormat object that represents all YUV formats.

YUVFormat

public YUVFormat(int yuvType)
Constructs a YUVFormat object for a specific yuvType.
Parameters:
yuvType - The YUV type for this YUVFormat: YUV_411, YUV_420, YUV_422, YUV_111, YUV_YVU9, or YUV_YUYV.

YUVFormat

public YUVFormat(java.awt.Dimension size,
                 int maxDataLength,
                 java.lang.Class dataType,
                 float frameRate,
                 int yuvType,
                 int strideY,
                 int strideUV,
                 int offsetY,
                 int offsetU,
                 int offsetV)
Constructs a YUVFormat with the specified properties. Use this constructor for planar YUV formats. (YUV_411, YUV_420, YUV_422, YUV_111, or YUV_YVU9.)
Parameters:
size - A Dimension that specifies the frame size.
maxDataLength - The maximum size of the data array.
dataType - The type of the data.
yuvType - The YUV ordering type.
strideY - The number of data elements between the first Y component in a row and the first Y component in the next row.
strideUV - The number of data elements between the first U component in a row and the first U component in the next row. The same value is expected for the V component.
offsetY - The offset into the data array where the Y plane begins.
offsetU - The offset into the data array where the U plane begins.
offsetV - The offset into the data array where the V plane begins.
Method Detail

getYuvType

public int getYuvType()
Gets the YUV data format.
Returns:
The YUV type: YUV_411, YUV_420, YUV_422, YUV_111, YUV_YVU9, or YUV_YUYV.

getStrideY

public int getStrideY()
Gets the Y stride--the length of a row of Y values.
Returns:
An integer representing the Y stride.

getStrideUV

public int getStrideUV()
Gets the UV stride--the length of a row of U or V values.
Returns:
An integer representing the UV stride.

getOffsetY

public int getOffsetY()
Gets the Y offset--the position in the data where the Y values begin.
Returns:
An integer representing the Y offset.

getOffsetU

public int getOffsetU()
Gets the U offset--the position in the data where the U values begin.
Returns:
An integer representing the U offset.

getOffsetV

public int getOffsetV()
Gets the V offset--the position in the data where the V values begin.
Returns:
An integer representing the V offset.

clone

public java.lang.Object clone()
Creates a clone of this YUVFormat.
Overrides:
clone in class VideoFormat
Returns:
A clone of this YUVFormat.

copy

protected void copy(Format f)
Copies the attributes from the specified Format into this YUVFormat.
Overrides:
copy in class VideoFormat
Parameters:
f - The Format to copy the attributes from.

equals

public boolean equals(java.lang.Object format)
Compares the specified Format with this YUVFormat. Returns true only if the specified Format is a YUVFormat object and all of its attributes are identical to the attributes in this YUVFormat.
Overrides:
equals in class VideoFormat
Parameters:
format - The Format to compare.
Returns:
true if the specified Format is the same as this one.

matches

public boolean matches(Format format)
Checks whether or not the specified Format matches this YUVFormat. Matches only compares the attributes that are defined in the specified Format, unspecified attributes are ignored.

The two Format objects do not have to be of the same class to match. For example, if "A" are "B" are being compared, a match is possible if "A" is derived from "B" or "B" is derived from "A". (The compared attributes must still match, or matches fails.)

Overrides:
matches in class VideoFormat
Parameters:
format - The Format to compare with this one.
Returns:
true if the specified Format matches this one, false if it does not.

intersects

public Format intersects(Format format)
Finds the attributes shared by two matching Format objects. If the specified Format does not match this one, the result is undefined.
Overrides:
intersects in class VideoFormat
Parameters:
The - matching Format to intersect with this YUVFormat.
Returns:
A Format object with its attributes set to those attributes common to both Format objects.
See Also:
matches(javax.media.Format)

relax

public Format relax()
Generate a format that's less restrictive than this format but contains the basic attributes that will make this resulting format useful for format matching.
Overrides:
relax in class VideoFormat
Returns:
A Format that's less restrictive than the this format.

toString

public java.lang.String toString()
Gets a String representation of the attributes of this YUVFormat. For example: "YUV Video Format, 352x240, ...".
Overrides:
toString in class VideoFormat
Returns:
A String that describes the format attributes.


Submit a bug or feature
Copyright 1994-2004 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved. See the Specification License for more details.
Sun, Sun Microsystems, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.