YUVFormatpublic class YUVFormat extends VideoFormat Describes YUV image data. |
Fields Summary |
---|
public static final int | YUV_411YUV Planar 4:1:1 type. | public static final int | YUV_420YUV Planar 4:2:0 type. | public static final int | YUV_422YUV Planar 4:2:2 type. | public static final int | YUV_111YUV Planar 1:1:1 type. | public static final int | YUV_YVU9YUV Planar YVU9 type. Contains a Y value for
every pixel and U and V values for every 4x4 block of pixels. | public static final int | YUV_YUYVYUV 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. | public static final int | YUV_SIGNEDWhen added to the yuvType, specifies that the chrominance values
are signed. | protected int | yuvTypeThe YUV format type | protected int | strideYLength of a row of Y values. Would be >= width of the frame. | protected int | strideUVLength of a row of U or V values. | protected int | offsetYWhen 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. | protected int | offsetUWhen 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. | protected int | offsetVWhen 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. | private static String | ENCODING |
Constructors Summary |
---|
public YUVFormat()Constructs a YUVFormat object that represents all YUV formats.
super(ENCODING);
| public YUVFormat(int yuvType)Constructs a YUVFormat object for a specific yuvType .
super(ENCODING);
this.yuvType = yuvType;
| public YUVFormat(Dimension size, int maxDataLength, 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.)
// Call VideoFormat constructor
super(ENCODING, size, maxDataLength, dataType, frameRate);
// Set YUV properties.
this.yuvType = yuvType;
this.strideY = strideY;
this.strideUV = strideUV;
this.offsetY = offsetY;
this.offsetU = offsetU;
this.offsetV = offsetV;
|
Methods Summary |
---|
public java.lang.Object | clone()Creates a clone of this YUVFormat .
YUVFormat f = new YUVFormat(size,
maxDataLength,
dataType,
frameRate,
yuvType,
strideY,
strideUV,
offsetY,
offsetU,
offsetV);
f.copy(this);
return f;
| protected void | copy(javax.media.Format f)Copies the attributes from the specified Format into
this YUVFormat .
super.copy(f);
if (f instanceof YUVFormat) {
YUVFormat other = (YUVFormat) f;
yuvType = other.yuvType;
strideY = other.strideY;
strideUV = other.strideUV;
offsetY = other.offsetY;
offsetU = other.offsetU;
offsetV = other.offsetV;
}
| 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 .
if (format instanceof YUVFormat) {
YUVFormat other = (YUVFormat) format;
return super.equals(format) &&
yuvType == other.yuvType &&
strideY == other.strideY &&
strideUV == other.strideUV &&
offsetY == other.offsetY &&
offsetU == other.offsetU &&
offsetV == other.offsetV;
} else
return false;
| public int | getOffsetU()Gets the U offset--the position in the data where the U values begin.
return offsetU;
| public int | getOffsetV()Gets the V offset--the position in the data where the V values begin.
return offsetV;
| public int | getOffsetY()Gets the Y offset--the position in the data where the Y values begin.
return offsetY;
| public int | getStrideUV()Gets the UV stride--the length of a row of U or V values.
return strideUV;
| public int | getStrideY()Gets the Y stride--the length of a row of Y values.
return strideY;
| public int | getYuvType()Gets the YUV data format.
return yuvType;
| public javax.media.Format | intersects(javax.media.Format format)Finds the attributes shared by two matching Format objects.
If the specified Format does not match this one, the result
is undefined.
Format fmt;
if ((fmt = super.intersects(format)) == null)
return null;
if (!(format instanceof YUVFormat))
return fmt;
YUVFormat other = (YUVFormat)format;
YUVFormat res = (YUVFormat)fmt;
res.yuvType = (yuvType != NOT_SPECIFIED ?
yuvType : other.yuvType);
res.strideY = (strideY != NOT_SPECIFIED ?
strideY : other.strideY);
res.strideUV = (strideUV != NOT_SPECIFIED ?
strideUV : other.strideUV);
res.offsetY = (offsetY != NOT_SPECIFIED ?
offsetY : other.offsetY);
res.offsetU = (offsetU != NOT_SPECIFIED ?
offsetU : other.offsetU);
res.offsetV = (offsetV != NOT_SPECIFIED ?
offsetV : other.offsetV);
return res;
| public boolean | matches(javax.media.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.)
if (!super.matches(format))
return false;
if (!(format instanceof YUVFormat))
return true;
YUVFormat other = (YUVFormat) format;
return
(yuvType == NOT_SPECIFIED || other.yuvType == NOT_SPECIFIED ||
yuvType == other.yuvType) &&
(strideY == NOT_SPECIFIED || other.strideY == NOT_SPECIFIED ||
strideY == other.strideY) &&
(strideUV == NOT_SPECIFIED || other.strideUV == NOT_SPECIFIED ||
strideUV == other.strideUV) &&
(offsetY == NOT_SPECIFIED || other.offsetY == NOT_SPECIFIED ||
offsetY == other.offsetY) &&
(offsetU == NOT_SPECIFIED || other.offsetU == NOT_SPECIFIED ||
offsetU == other.offsetU) &&
(offsetV == NOT_SPECIFIED || other.offsetV == NOT_SPECIFIED ||
offsetV == other.offsetV);
| public javax.media.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.
YUVFormat fmt;
if ((fmt = (YUVFormat)super.relax()) == null)
return null;
fmt.strideY = NOT_SPECIFIED;
fmt.strideUV = NOT_SPECIFIED;
fmt.offsetY = NOT_SPECIFIED;
fmt.offsetU = NOT_SPECIFIED;
fmt.offsetV = NOT_SPECIFIED;
return fmt;
| public java.lang.String | toString()Gets a String representation of the attributes of this
YUVFormat . For example: "YUV Video Format, 352x240, ...".
return "YUV Video Format: Size = " + size +
" MaxDataLength = " + maxDataLength + " DataType = " + dataType +
" yuvType = " + yuvType + " StrideY = " + strideY +
" StrideUV = " + strideUV +
" OffsetY = " + offsetY +
" OffsetU = " + offsetU + " OffsetV = " + offsetV + "\n";
|
|