예제 #1
0
        public void ComputeEndPoints(SingleColourLookup[][] lookups)
        {
            // check each index combination (endpoint or intermediate)
            m_error = int.MaxValue;
            for (int index = 0; index < 2; ++index)
            {
                // check the error for this codebook index
                SourceBlock[] sources = new SourceBlock[3];
                int           error   = 0;
                for (int channel = 0; channel < 3; ++channel)
                {
                    // grab the lookup table and index for this channel
                    SingleColourLookup[] lookup = lookups[channel];
                    int target = m_colour[channel];

                    // store a pointer to the source for this channel
                    sources[channel] = lookup[target].sources[index];

                    // accumulate the error
                    int diff = sources[channel].error;
                    error += diff * diff;
                }

                // keep it if the error is lower
                if (error < m_error)
                {
                    m_start = new Vector3(
                        (float)sources[0].start / 31.0f,
                        (float)sources[1].start / 63.0f,
                        (float)sources[2].start / 31.0f
                        );
                    m_end = new Vector3(
                        (float)sources[0].end / 31.0f,
                        (float)sources[1].end / 63.0f,
                        (float)sources[2].end / 31.0f
                        );
                    m_index = (byte)(2 * index);
                    m_error = error;
                }
            }
        }
 public SingleColourLookup(SourceBlock a, SourceBlock b)
 {
     sources = new SourceBlock[] { a, b };
 }
예제 #3
0
 public SingleColourLookup(SourceBlock one, SourceBlock two)
 {
     this.Sources    = new SourceBlock[2];
     this.Sources[0] = one;
     this.Sources[1] = two;
 }