Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Embedded Acceleration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vipin Thomas
Embedded Acceleration
Commits
a0fa523a
Commit
a0fa523a
authored
3 years ago
by
Vipin Thomas
Browse files
Options
Downloads
Patches
Plain Diff
Update pixel.cpp
parent
480cff9e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pixel.cpp
+23
-25
23 additions, 25 deletions
pixel.cpp
with
23 additions
and
25 deletions
pixel.cpp
+
23
−
25
View file @
a0fa523a
#include
<iostream>
#include
<hls_stream.h>
#include
<ap_axi_sdata.h>
#include
<math.h>
#include
<math.h>
using
namespace
std
;
...
...
@@ -13,29 +13,27 @@ static int decrpyt=0;
static
long
long
asciiNum
=
0
;
static
int
asciiVal
=
0
;
long
long
convert
(
int
n
);
long
long
convert
(
int
n
);
long
long
toAscii
(
chr
number
);
int
convertBinInt
(
long
long
n
);
char
stegnoDcrypt
(
int
data
);
void
stegno
(
char
c
);
void
stegnoDcrypt
(
int
data
);
int
stegno
(
int
c
,
int
data
,
int
position1
,
int
position2
);
void
pixel
(
ap_int
<
32
>
position1
,
ap_int
<
32
>
position2
,
ap_int
<
32
>
w
,
ap_int
<
32
>
h
,
ap_int
<
32
>
stream_count
,
ap_int
<
32
>
character
,
ap_int
<
32
>
selector
,
ap_int
<
32
>
selector
,
hls
::
stream
<
pkt_t
>
&
din
,
hls
::
stream
<
pkt_t
>
&
dout
)
{
#pragma HLS INTERFACE ap_ctrl_none port=return
#pragma HLS INTERFACE s_axilite port=position1
#pragma HLS INTERFACE s_axilite port=position2
#pragma HLS INTERFACE s_axilite port=w
#pragma HLS INTERFACE s_axilite port=h
#pragma HLS INTERFACE s_axilite port=stream_count
#pragma HLS INTERFACE s_axilite port=character
#pragma HLS INTERFACE s_axilite port=selector
//switch for encrypt and decrypt
#pragma HLS INTERFACE s_axilite port=selector
#pragma HLS INTERFACE axis port=din
#pragma HLS INTERFACE axis port=dout
...
...
@@ -44,7 +42,7 @@ void pixel(
switch
(
selector
)
{
case
0
:
stegno
(
character
);
pkt
.
data
=
stegno
(
character
,
pkt
.
data
,
position1
,
position2
);
break
;
case
1
:
...
...
@@ -57,10 +55,10 @@ void pixel(
count_streams
++
;
if
(
count_streams
==
w
*
h
*
3
){
if
(
count_streams
==
stream_count
){
count_streams
=
0
;
asciiVal
=
convertBinInt
(
asciiNum
);
pkt
.
data
=
asciiVal
pkt
.
data
=
asciiVal
;
dout
.
write
(
pkt
);
}
...
...
@@ -71,27 +69,27 @@ void pixel(
dout
.
write
(
pkt
);
}
void
stegno
(
char
c
){
// to check
charIn
=
toAscii
(
c
);
if
(
count_streams
>
3
*
(
position1
-
1
)
&&
count_streams
<
3
*
(
position2
)){
int
stegno
(
int
c
,
int
data
,
int
position1
,
int
position2
){
charIn
=
toAscii
((
char
)
c
);
if
((
count_streams
>
3
*
(
position1
-
1
))
&&
(
count_streams
<
3
*
(
position2
))){
addNum
=
charIn
%
10
;
charIn
=
(
int
)
charIn
/
10
;
pkt
.
data
=
convertBinInt
((
convert
(
pkt
.
data
)
/
10
)
*
10
+
addNum
);
}
return
convertBinInt
((
convert
(
data
)
/
10
)
*
10
+
addNum
);
}
long
long
stegnoDcrypt
(
int
data
){
void
stegnoDcrypt
(
int
data
){
decrpyt
=
convert
(
data
)
%
10
;
asciiNum
=
asciiNum
*
10
+
decrpyt
;
}
long
long
convert
(
int
n
)
{
long
long
bin
=
0
;
...
...
@@ -119,5 +117,5 @@ int convertBinInt(long long n) {
long
long
toAscii
(
char
c
)
{
int
n
=
(
int
)
c
;
long
long
bin
=
convert
(
n
);
return
bin
;
return
bin
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment