// Filename : y2r.h
//
// This file was initially generated by SpaceStudio but is meant to be modified
// by the user.
#ifndef Y2R_H
#define Y2R_H

#include "spacecomp.h"
#include "abstract_module.h"
#include "application_definitions.h"

// Do NOT move macros, functions and includes beginning with "spacecomp".

class y2r: public abstract_module {
	SPACECOMP_START(y2r, INDEX, y2r);

public:
	y2r(SPACECOMP_CTOR_PARAMS(y2r, INDEX));

	void thread(SPACECOMP_THREAD_PARAMS(y2r, INDEX, thread));

private:

	unsigned long m_outputAddress;
	unsigned long m_vga_address;

	// internal methods
	void write_420_format();

	void determineOutputAddress();
	unsigned int yuv2rgb(signed short, signed short, signed short);

	unsigned char m_nb_blocks;
	unsigned char m_imageNo;

	unsigned char m_horizontal_mcu;
	unsigned char m_vertical_mcu;
	#define m_increment1 8
	//int32_t m_increment1;
	unsigned short m_increment2;

	int32_t m_width;
	int32_t m_height;

	int16_t Y[2];
	int16_t CB[8];
	int16_t CR[8];

	SPACECOMP_END(y2r, INDEX, y2r);
};

#endif
