#include "Rotate.h"

#include <fstream>

void main()
{
	int in;

	cout << "(1)Encoder  (2)Decoder :";
	cin >> in;
	if (in == 1)
	{
		Image I("in.raw", 255);

		I.Decompose();
		I.VSS22();

		//change and rotate
		I.ChangeArea(0,7,1,8);
		I.ChangeArea(0,6,1,8);
		I.ChangeArea(0,5,1,8);
		I.ChangeArea(0,4,1,8);
		I.ChangeArea(0,3,1,8);
		I.ChangeArea(0,2,1,8);
		I.ChangeArea(0,1,1,8);
		I.ChangeArea(0,0,1,8);

		I.RotateRight(0,0);
		I.RotateRight(0,1);
		I.RotateRight(0,2);
		I.RotateRight(0,3);
		I.RotateRight(0,4);
		I.RotateRight(0,5);
		I.RotateRight(0,6);
		I.RotateRight(0,7);

		I.Combine();
		I.SaveResult("k1.raw", "k2.raw");
	}
	else
	{
		Image O("k1.raw", "k2.raw", 510);

		O.IDecompose();
		
		//inverse-change and inverse-rotate

		O.IVSS22();
		O.ICombine();

		O.SaveImage("k.raw");
	}
}
