|
Copyright 2011-01-06 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.randelshofer.media.anim.ANIMFrame
ch.randelshofer.media.anim.ANIMKeyFrame
public class ANIMKeyFrame
| Field Summary | |
|---|---|
protected static int |
VDAT_ID
|
| Fields inherited from class ch.randelshofer.media.anim.ANIMFrame |
|---|
BadBitsOP_ByteVertical, BadBitsOP_GeneralDelta, BIT_LongData, BIT_LongInfoOffsets, BIT_OneInfoListForAllPlanes, BIT_RLC, BIT_Vertical, BIT_XOR, colorModel, data |
| Constructor Summary | |
|---|---|
ANIMKeyFrame()
|
|
| Method Summary | |
|---|---|
void |
decode(BitmapImage bitmap,
ANIMMovieTrack track)
|
void |
setCompression(int compression)
For possible values see ANIMMovieTrack. |
void |
setData(byte[] data)
|
static int |
unpackByteRun1(byte[] in,
byte[] out)
ByteRun1 run decoder. |
void |
unpackVertical(byte[] in,
BitmapImage bm)
Vertical run decoder. |
| Methods inherited from class ch.randelshofer.media.anim.ANIMFrame |
|---|
addAudioCommand, cleanUpAudioCommands, getAudioCommands, getBits, getBottomBound, getColorModel, getInterleave, getLeftBound, getOperation, getRelTime, getRightBound, getTopBound, isBidirectional, setAbsTime, setBits, setColorModel, setHeight, setInterleave, setMask, setOperation, setRelTime, setWidth, setX, setY |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int VDAT_ID
| Constructor Detail |
|---|
public ANIMKeyFrame()
| Method Detail |
|---|
public void setData(byte[] data)
setData in class ANIMFramepublic void setCompression(int compression)
ANIMMovieTrack.
public void decode(BitmapImage bitmap,
ANIMMovieTrack track)
decode in class ANIMFrame
public static int unpackByteRun1(byte[] in,
byte[] out)
The run encoding scheme by byteRun1 is best described by pseudo code for the decoder Unpacker (called UnPackBits in the Macintosh toolbox.
UnPacker:
LOOP until produced the desired number of bytes
Read the next source byte into n
SELECT n FROM
[0..127] => copy the next n+1 bytes literally
[-1..-127] => replicate the next byte -n+1 times
-128 => no operation
ENDCASE;
ENDLOOP;
public void unpackVertical(byte[] in,
BitmapImage bm)
Each plane is stored in a separate VDAT chunk.
A VDAT chunk consists of an id, a length, and a body.
struct {
uint16 id; // The 4 ASCII characters "VDAT"
uint16 length,
byte[length] body
}
The body consists of a command list and a data list.
struct {
uint16 cnt; // Command count + 2
uint8[cnt - 2] cmd; // The commands
uint16[] data; // Data words
}
Pseudo code for the unpacker:
UnPacker:
Read cnt;
LOOP cnt - 2 TIMES
Read the next command byte into cmd
SELECT cmd FROM
0 =>
Read the next data word into n
Copy the next n data words literally
1 =>
Read the next data word into n
Replicate the next data word n times
[2..127] =>
Replicate the next data word cmd times
[-1..-128] =>
Copy the next -cmd data words literally
ENDCASE;
IF end of data reached THEN EXIT END;
ENDLOOP;
|
Copyright 2011-01-06 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||