/* UC Santa Barbara ArchLab www.cs.ucsb.edu/~arch Wavelet-Based Phase Classification Source Code www.cs.ucsb.edu/~arch/wavelet Copyright (c) 2006 The Regents of the University of California. All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for educational, research and non-profit purposes, without fee, and without a written agreement is hereby granted, provided that the above copyright notice, this paragraph and the following three paragraphs appear in all copies. Permission to incorporate this software into commercial products may be obtained by contacting the University of California. For information about obtaining such a license contact: Tim Sherwood This software program and documentation are copyrighted by The Regents of the University of California. The software program and documentation are supplied "as is", without any accompanying services from The Regents. The Regents does not warrant that the operation of the program will be uninterrupted or error-free. The end-user understands that the program was developed for research purposes and is advised not to rely exclusively on the program for any reason. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. Ted Huffmire, (www.cs.ucsb.edu/~huffmire, huffmire at cs dot ucsb dot edu) Tim Sherwood (www.cs.ucsb.edu/~sherwood, sherwood at cs dot ucsb dot edu) 14 June 2006 File: pixel.java Publication: Ted Huffmire and Tim Sherwood. Wavelet-Based Phase Classification. Proceedings of the Fifteenth International Conference on Parallel Architectures and Compilation Techniques (PACT'06), Seattle, Washington, September 16-20, 2006. */ public class pixel { private float m_y; private float m_i; private float m_q; public pixel() { m_y = 0.0f; m_i = 0.0f; m_q = 0.0f; } public void copy(pixel a) { m_y = a.getY(); m_i = a.getI(); m_q = a.getQ(); } public void setYIQ(float y, float i, float q) { m_y = y; m_i = i; m_q = q; } public void setRGB(float r, float g, float b) { m_y = .299f * r + .587f * g + .114f * b; m_i = .596f * r - .275f * g - .321f * b; m_q = .212f * r - .523f * g + .311f * b; m_i += 0.596f; m_i /= 1.192f; m_q += 0.523f; m_q /= 1.046f; } public float getY() { return m_y; } public float getI() { return m_i; } public float getQ() { return m_q; } public float getR() { float y = m_y, i = m_i, q = m_q; i *= 1.192f; i -= 0.596f; q *= 1.046f; q -= 0.523f; return y + .9556880604f * i + .6198580945f * q; } public float getG() { float y = m_y, i = m_i, q = m_q; i *= 1.192f; i -= 0.596f; q *= 1.046f; q -= 0.523f; return y - .2715817969f * i - .6468738161f * q; } public float getB() { float y = m_y, i = m_i, q = m_q; i *= 1.192f; i -= 0.596f; q *= 1.046f; q -= 0.523f; return y - 1.1081773270f * i + 1.7050645600f * q; } public void setY(float y) { m_y = y; } public void setI(float i) { m_i = i; } public void setQ(float q) { m_q = q; } }