/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#ifndef _NMM_YUVtoYUVCONVERTERNODE_HPP_
#define _NMM_YUVtoYUVCONVERTERNODE_HPP_

#include "nmm/multimedia/GenericConverterNode.hpp"

#define CLIPPED(x) ((x)>255?255:((x)<0?0:(x)))

namespace NMM {
 /** \class YUVtoYUVConverterNode
   * \ingroup VideoConverter
   * This Node converts an incoming YUV image to a BGR0 image
   * (blue, green, red and ignored channel, in this order).
   */
class YUVtoYUVConverterNode : public GenericConverterNode {

public:

  YUVtoYUVConverterNode(const char* name = "YUVtoYUVConverterNode", 	
			const StreamQueue::Mode queue_mode = StreamQueue::DEFAULT_MODE, 
			const int size = StreamQueue::DEFAULT_SIZE);
    
  virtual ~YUVtoYUVConverterNode() {};



  static Buffer* UYVY2YUYV  (Buffer* in_buffer, const GenericConverterNode* node);
  static Buffer* YUV422_planar2UYVY422(Buffer* in, const GenericConverterNode* node);
  static Buffer* UYVY422toYUV422_planar(Buffer *in, const GenericConverterNode* node);
  static Buffer* UYVY411_packetToYUV411_planar(Buffer *in, const GenericConverterNode* node);
  static Buffer* UYVY422_packetToYUV422_packet(Buffer *in, const GenericConverterNode* node);
  static Buffer* YUV422_packetToUYVY422_packet(Buffer *in, const GenericConverterNode* node);


protected:
  virtual Result doInit();
  virtual Result doInitOutput();
  virtual Result doDeinitOutput();

};

}

#endif //_NMM_YUV2BGR0NODE_HPP_
