10 #ifndef CLASS_TURNERMIXER
11 #define CLASS_TURNERMIXER
33 int make(vector<DataType *> *list,
int width,
int height, vector<int> parameters,
int nParameters,
bool show_data){
41 if(nParameters != 3)
return 1;
42 int byteOffset = parameters[0];
43 int packetOffset = parameters[1];
44 int payload = parameters[2];
45 if((byteOffset < 0) || (packetOffset < 0))
return 5;
47 file.open(
"files/turner.txt",ofstream::out| ofstream::trunc);
49 file << height*width <<
"\n";
50 int i = 0, j = 0, k = 0, m = 0;
51 for(
int h = 0; h < height; h=h+1)
53 for(
int w = 0; w < width; w=w+1)
62 int ip = ((j+(m*byteOffset))/height)%height;
63 int jp = (j+(m*byteOffset))%width;
64 int iPos = ((h*width)+w);
65 int fPos = ((ip*width)+jp);
67 list->at(fPos)=list->at(iPos);
69 file << iPos <<
"-" << fPos <<
"\n";
75 cout <<
"Turner And Peterson Applied to Image\n";
83 int unmake(vector<DataType *> *list,
bool show_data){
90 string line, delimiter=
"-";
92 string path =
"files/turner.txt";
93 file.open(path.c_str());
96 int width = atoi(line.c_str());
97 for(
int x=0;x<width;x++){
99 array.push_back(line);
101 for(
int x=0;x<width;x++){
102 string s = array.back();
106 pos = s.find(delimiter);
107 token = s.substr(0, pos);
108 iPos = atoi(token.c_str());
109 s.erase(0, pos + delimiter.length());
110 pos = s.find(delimiter);
111 token = s.substr(0, pos);
112 fPos = atoi(token.c_str());
113 s.erase(0, pos + delimiter.length());
115 list->at(fPos)=list->at(iPos);
119 cout <<
"Turner And Petterson undo to Image\n";
Clase abstracta que representa la estructura que debe tener todo procesamiento de imagen...
Clase que representa un tipo de dato que será paquetizado.
Clase que implementa el Método de entrelazamiento de Turner.
int make(vector< DataType * > *list, int width, int height, vector< int > parameters, int nParameters, bool show_data)
int unmake(vector< DataType * > *list, bool show_data)