|
Copyright 2012-04-26 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.monte.media.AbstractCodec
org.monte.media.AbstractVideoCodec
org.monte.media.quicktime.AnimationCodec
public class AnimationCodec
Implements the Apple Animation codec.
Supports lossless delta- and key-frame encoding of images onlyWith 8, 16 or 24 bits per pixel.
The QuickTime player requires that a keyframe is written once per second. This codec enforces this.
An encoded frame has the following format:
Header:
uint32 chunkSize
uint16 header 0x0000 => decode entire image
0x0008 => starting line and number of lines follows
if header==0x0008 {
uint16 startingLine at which to begin updating frame
uint16 reserved 0x0000
uint16 numberOfLines to update
uint16 reserved 0x0000
}
n-bytes compressed lines
The first 4 bytes defines the chunk length. This field also carries some
other unknown flags, since at least one of the high bits is sometimes set.2 bytes starting line at which to begin updating frame 2 bytes unknown 2 bytes the number of lines to update 2 bytes unknownIf the header is 0x0000, then the decode begins from the first line and continues through the entire height of the image.
1 byte skip code 1 byte RLE code n bytes pixel data 1 byte RLE code n bytes pixel dataEach line begins onlyWith a byte that defines the number of pixels to skip in a particular line in the output line before outputting new pixel data. Actually, the skip count is set to one more than the number of pixels to skip. For example, a skip byte of 15 means "skip 14 pixels", while a skip byte of 1 means "don't skip any pixels". If the skip byte is 0, then the frame decode is finished. Therefore, the maximum skip byte value of 255 allows for a maximum of 254 pixels to be skipped.
After the skip byte is the first RLE code, which is a single signed
byte. The RLE code can have the following meanings:
The pixel data has the following format:
xrrrrrgg gggbbbbb. Pixel data is
rendered to the output frame one pixel at a time.rrrrrrrr gggggggg bbbbbbbb. Pixel data is rendered to the output
frame one pixel at a time.aaaaaaaa rrrrrrrr gggggggg bbbbbbbb. Pixel data is rendered to the
output frame one pixel at a time.
| Field Summary |
|---|
| Fields inherited from class org.monte.media.AbstractCodec |
|---|
inputFormat, inputFormats, name, outputFormat, outputFormats |
| Fields inherited from interface org.monte.media.Codec |
|---|
CODEC_FAILED, CODEC_INPUT_NOT_CONSUMED, CODEC_OK, CODEC_OUTPUT_NOT_FILLED |
| Constructor Summary | |
|---|---|
AnimationCodec()
|
|
| Method Summary | |
|---|---|
void |
decodeDelta16(javax.imageio.stream.ImageInputStream in,
short[] data,
short[] prev,
int width,
int height,
int offset,
int scanlineStride)
Decodes a 16-bit delta frame. |
void |
encodeDelta16(javax.imageio.stream.ImageOutputStream out,
short[] data,
short[] prev,
int width,
int height,
int offset,
int scanlineStride)
Encodes a 16-bit delta frame. |
void |
encodeDelta24(javax.imageio.stream.ImageOutputStream out,
int[] data,
int[] prev,
int width,
int height,
int offset,
int scanlineStride)
Encodes a 24-bit delta frame. |
void |
encodeDelta32(javax.imageio.stream.ImageOutputStream out,
int[] data,
int[] prev,
int width,
int height,
int offset,
int scanlineStride)
Encodes a 32-bit delta frame. |
void |
encodeDelta8(javax.imageio.stream.ImageOutputStream out,
byte[] data,
byte[] prev,
int width,
int height,
int offset,
int scanlineStride)
Encodes an 8-bit delta frame. |
void |
encodeKey16(javax.imageio.stream.ImageOutputStream out,
short[] data,
int width,
int height,
int offset,
int scanlineStride)
Encodes a 16-bit key frame. |
void |
encodeKey24(javax.imageio.stream.ImageOutputStream out,
int[] data,
int width,
int height,
int offset,
int scanlineStride)
Encodes a 24-bit key frame. |
void |
encodeKey32(javax.imageio.stream.ImageOutputStream out,
int[] data,
int width,
int height,
int offset,
int scanlineStride)
Encodes a 32-bit key frame. |
void |
encodeKey8(javax.imageio.stream.ImageOutputStream out,
byte[] data,
int width,
int height,
int offset,
int scanlineStride)
Encodes an 8-bit key frame. |
int |
process(Buffer in,
Buffer out)
Performs the media processing defined by this codec. |
void |
reset()
Empty implementation of the reset method. |
Format |
setOutputFormat(Format f)
Sets the output format. |
| Methods inherited from class org.monte.media.AbstractVideoCodec |
|---|
copyImage, getARGB32, getBufferedImage, getIndexed8, getRGB15, getRGB16, getRGB24, writeInt24, writeInt24LE, writeInts24, writeInts24LE |
| Methods inherited from class org.monte.media.AbstractCodec |
|---|
getInputFormat, getInputFormats, getName, getOutputFormat, getOutputFormats, setInputFormat, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AnimationCodec()
| Method Detail |
|---|
public Format setOutputFormat(Format f)
Codec
setOutputFormat in interface CodecsetOutputFormat in class AbstractCodecpublic void reset()
AbstractCodec
reset in interface Codecreset in class AbstractCodec
public int process(Buffer in,
Buffer out)
CodecCopies the data from the input buffer into the output buffer.
public void encodeKey8(javax.imageio.stream.ImageOutputStream out,
byte[] data,
int width,
int height,
int offset,
int scanlineStride)
throws java.io.IOException
out - The output stream.data - The image data.width - The width of the image in data elements.height - The height of the image in data elements.offset - The offset to the first pixel in the data array.scanlineStride - The number to append to offset to get to the next scanline.
java.io.IOException
public void encodeDelta8(javax.imageio.stream.ImageOutputStream out,
byte[] data,
byte[] prev,
int width,
int height,
int offset,
int scanlineStride)
throws java.io.IOException
out - The output stream.data - The image data.prev - The image data of the previous frame.width - The width of the image in data elements.height - The height of the image in data elements.offset - The offset to the first pixel in the data array.scanlineStride - The number to append to offset to get to the next scanline.
java.io.IOException
public void encodeKey16(javax.imageio.stream.ImageOutputStream out,
short[] data,
int width,
int height,
int offset,
int scanlineStride)
throws java.io.IOException
out - The output stream.data - The image data.width - The width of the image in data elements.height - The height of the image in data elements.offset - The offset to the first pixel in the data array.scanlineStride - The number to append to offset to get to the next scanline.
java.io.IOException
public void encodeDelta16(javax.imageio.stream.ImageOutputStream out,
short[] data,
short[] prev,
int width,
int height,
int offset,
int scanlineStride)
throws java.io.IOException
out - The output stream.data - The image data.prev - The image data of the previous frame.width - The width of the image in data elements.height - The height of the image in data elements.offset - The offset to the first pixel in the data array.scanlineStride - The number to append to offset to get to the next scanline.
java.io.IOException
public void encodeKey24(javax.imageio.stream.ImageOutputStream out,
int[] data,
int width,
int height,
int offset,
int scanlineStride)
throws java.io.IOException
out - The output stream.data - The image data.width - The width of the image in data elements.height - The height of the image in data elements.offset - The offset to the first pixel in the data array.scanlineStride - The number to append to offset to get to the next scanline.
java.io.IOException
public void encodeDelta24(javax.imageio.stream.ImageOutputStream out,
int[] data,
int[] prev,
int width,
int height,
int offset,
int scanlineStride)
throws java.io.IOException
out - The output stream.data - The image data.prev - The image data of the previous frame.width - The width of the image in data elements.height - The height of the image in data elements.offset - The offset to the first pixel in the data array.scanlineStride - The number to append to offset to get to the next scanline.
java.io.IOException
public void encodeKey32(javax.imageio.stream.ImageOutputStream out,
int[] data,
int width,
int height,
int offset,
int scanlineStride)
throws java.io.IOException
out - The output stream.data - The image data.width - The width of the image in data elements.height - The height of the image in data elements.offset - The offset to the first pixel in the data array.scanlineStride - The number to append to offset to get to the next scanline.
java.io.IOException
public void encodeDelta32(javax.imageio.stream.ImageOutputStream out,
int[] data,
int[] prev,
int width,
int height,
int offset,
int scanlineStride)
throws java.io.IOException
out - The output stream.data - The image data.prev - The image data of the previous frame.width - The width of the image in data elements.height - The height of the image in data elements.offset - The offset to the first pixel in the data array.scanlineStride - The number to append to offset to get to the next scanline.
java.io.IOException
public void decodeDelta16(javax.imageio.stream.ImageInputStream in,
short[] data,
short[] prev,
int width,
int height,
int offset,
int scanlineStride)
throws java.io.IOException
in - The input stream.data - The image data.prev - The image data of the previous frame. This may be the same
object as data.width - The width of the image in data elements.height - The height of the image in data elements.offset - The offset to the first pixel in the data array.scanlineStride - The number to append to offset to get to the next scanline.
java.io.IOException
|
Copyright 2012-04-26 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||