Klasse OctreeQuantization.Node

java.lang.Object
libsidplay.components.mos656x.OctreeQuantization.Node
Umschließende Klasse:
OctreeQuantization

private class OctreeQuantization.Node extends Object
  • Felddetails

    • leaf

      private boolean leaf
    • reference

      protected int reference
    • red

      protected int red
    • green

      protected int green
    • blue

      protected int blue
    • parent

      protected final OctreeQuantization.Node parent
    • children

      private final OctreeQuantization.Node[] children
  • Konstruktordetails

  • Methodendetails

    • pickChild

      private int pickChild(int packed, int depth)
      Select the appropriate child node based on the requested depth
      Parameter:
      packed - the packed color to pick child for
      depth - 0-based depth
      Gibt zurück:
      child index
    • add

      protected void add(int packed, int weight, int depth)
      Add a weighed pixel into a tree.
      Parameter:
      packed - the packed data to add.
      weight - the weight of this pixel
      depth - current depth
    • find

      protected OctreeQuantization.Node find(int packed, int depth)
      Find the nearest node in a tree to color
      Parameter:
      packed - the color to look for
      depth - current depth
      Gibt zurück:
      nearest node
    • reduce

      protected void reduce()
      Reduce a node and mark it as a leaf.

      Invariant: because this only collapses child nodes into itself, the reference count of parent remains unchanged.

      Because we are calling reduction always for the least referenced parent, every parent candidate for reduction can only have leaf nodes under it.

    • toPacked

      protected int toPacked()
      Construct the original kind of packed color value from the node.
      Gibt zurück:
      packed color.
    • distance

      protected int distance(OctreeQuantization.Node a)
      Calculate distance in 3d geometric terms between two colors. YUV palette is used: it should be a perceptively linear coding system.
      Parameter:
      a - color to compare to.
      Gibt zurück:
      distance squared.