Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media.anim
Class ANIMKeyFrame

    java.lang.Object
      org.monte.media.anim.ANIMFrame
          org.monte.media.anim.ANIMKeyFrame

    public class ANIMKeyFrame

extends ANIMFrame

Version:
  2010-06-27 Support for "vertical" compression added.
  1.0 1999-10-19
Author:
  Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland

Field Summary
`protected static int` | `VDAT_ID`

Fields inherited from class org.monte.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 org.monte.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

### VDAT_ID

    protected static final int VDAT_ID

Constructor Detail

### ANIMKeyFrame

    public ANIMKeyFrame()

Method Detail

### setData

    public void setData(byte[] data)

  Overrides:
    `setData` in class `ANIMFrame`

### setCompression

    public void setCompression(int compression)

  For possible values see `ANIMMovieTrack`.

### decode

    public void decode(BitmapImage bitmap,
                       ANIMMovieTrack track)

  Specified by:
    `decode` in class `ANIMFrame`

### unpackByteRun1

    public static int unpackByteRun1(byte[] in,
                                     byte[] out)

  ByteRun1 run decoder.

  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;

### unpackVertical

    public void unpackVertical(byte[] in,
                               BitmapImage bm)

  Vertical run decoder.

  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;

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD