From f53c1c5ce50d3255f5511a3fbd5a994f1076f8ee Mon Sep 17 00:00:00 2001 From: Vipin Thomas <vipin.thomas@stud.th-deg.de> Date: Sat, 12 Jun 2021 16:49:30 +0000 Subject: [PATCH] Update pixel.cpp --- pixel.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pixel.cpp b/pixel.cpp index 500cfe7..5c35ac0 100644 --- a/pixel.cpp +++ b/pixel.cpp @@ -8,7 +8,6 @@ using namespace std; typedef ap_axis<32,0,0,0> pkt_t; static int count_streams = 0; static long long charIn=0; -static int addNum=0; //static int decrpyt=0; //static long long asciiNum=0; //static int asciiVal=0; @@ -17,7 +16,7 @@ long long convert(int n); long long toAscii(chr number); int convertBinInt(long long n); void stegnoDcrypt(int data); -int stegno(int c,int data,int position1,int position2); +int stegno(int c,int data); void pixel( ap_int<32> position1, @@ -41,7 +40,12 @@ void pixel( if (count_streams == 0){ charIn=toAscii((char)character); } - pkt.data=stegno(charIn,pkt.data,position1,position2); + + if((count_streams >= 3 * (position1 - 1)) && (count_streams < 3 * (position2))){ + + pkt.data=stegno(charIn,pkt.data); + + } // switch(selector) // { // case 0: @@ -61,7 +65,6 @@ void pixel( if (count_streams == stream_count){ count_streams = 0; charIn=0; - addNum=0; // asciiVal= convertBinInt(asciiNum); // pkt.data=asciiVal; // dout.write(pkt); @@ -74,15 +77,11 @@ void pixel( dout.write(pkt); } -int stegno(int c,int data,int position1,int position2){ +int stegno(int c,int data){ - - if((count_streams >= 3 * (position1 - 1)) && (count_streams < 3 * (position2))){ - addNum=charIn%10; + int addNum=charIn%10; charIn=(int)charIn/10; - } - return convertBinInt((convert(data)/10)*10+addNum); } -- GitLab