Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-vr-interactive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
blender
blender-vr-interactive
Commits
cf868c21
Commit
cf868c21
authored
4 years ago
by
Martin Pulec
Browse files
Options
Downloads
Patches
Plain Diff
UltraGrid plugin: opt to use memmove instead of memcpy
parent
370f22af
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/ultragrid/ultragrid.cpp
+15
-9
15 additions, 9 deletions
client/ultragrid/ultragrid.cpp
with
15 additions
and
9 deletions
client/ultragrid/ultragrid.cpp
+
15
−
9
View file @
cf868c21
...
@@ -344,6 +344,12 @@ void cesnet_set_render_buffer_rgba(unsigned char *rgba, int width, int height)
...
@@ -344,6 +344,12 @@ void cesnet_set_render_buffer_rgba(unsigned char *rgba, int width, int height)
bool
copy_data
(
struct
cesnet_shm
*
cesnet_shm
,
bool
copy_data
(
struct
cesnet_shm
*
cesnet_shm
,
unsigned
char
*
y
,
unsigned
char
*
u
,
unsigned
char
*
v
,
int
width
,
int
height
)
unsigned
char
*
y
,
unsigned
char
*
u
,
unsigned
char
*
v
,
int
width
,
int
height
)
{
{
void
*
(
*
copy_fn
)(
void
*
dest
,
const
void
*
src
,
size_t
n
)
=
memcpy
;
if
(
getenv
(
"MEMMOVE_INSTEAD_MEMCPY"
))
{
copy_fn
=
memmove
;
}
# if !defined WITH_CLIENT_CUDA
# if !defined WITH_CLIENT_CUDA
if
(
cesnet_shm
->
use_gpu
)
{
if
(
cesnet_shm
->
use_gpu
)
{
fprintf
(
stderr
,
"CUDA support not compiled in! Use 'uv -t shm' to use standard SHM.
\n
"
);
fprintf
(
stderr
,
"CUDA support not compiled in! Use 'uv -t shm' to use standard SHM.
\n
"
);
...
@@ -386,26 +392,26 @@ bool copy_data(struct cesnet_shm *cesnet_shm,
...
@@ -386,26 +392,26 @@ bool copy_data(struct cesnet_shm *cesnet_shm,
}
else
{
}
else
{
// Y
// Y
for
(
int
i
=
0
;
i
<
height
;
++
i
)
{
for
(
int
i
=
0
;
i
<
height
;
++
i
)
{
memcpy
(
out1_y
,
y
,
width
);
copy_fn
(
out1_y
,
y
,
width
);
out1_y
+=
width
;
out1_y
+=
width
;
y
+=
width
;
y
+=
width
;
memcpy
(
out2_y
,
y
,
width
);
copy_fn
(
out2_y
,
y
,
width
);
out2_y
+=
width
;
out2_y
+=
width
;
y
+=
width
;
y
+=
width
;
}
}
// U V
// U V
for
(
int
i
=
0
;
i
<
height
/
2
;
++
i
)
{
for
(
int
i
=
0
;
i
<
height
/
2
;
++
i
)
{
memcpy
(
out1_u
,
u
,
width
/
2
);
copy_fn
(
out1_u
,
u
,
width
/
2
);
out1_u
+=
width
/
2
;
out1_u
+=
width
/
2
;
u
+=
width
/
2
;
u
+=
width
/
2
;
memcpy
(
out2_u
,
u
,
width
/
2
);
copy_fn
(
out2_u
,
u
,
width
/
2
);
out2_u
+=
width
/
2
;
out2_u
+=
width
/
2
;
u
+=
width
/
2
;
u
+=
width
/
2
;
memcpy
(
out1_v
,
v
,
width
/
2
);
copy_fn
(
out1_v
,
v
,
width
/
2
);
out1_v
+=
width
/
2
;
out1_v
+=
width
/
2
;
v
+=
width
/
2
;
v
+=
width
/
2
;
memcpy
(
out2_v
,
v
,
width
/
2
);
copy_fn
(
out2_v
,
v
,
width
/
2
);
out2_v
+=
width
/
2
;
out2_v
+=
width
/
2
;
v
+=
width
/
2
;
v
+=
width
/
2
;
}
}
...
@@ -426,12 +432,12 @@ bool copy_data(struct cesnet_shm *cesnet_shm,
...
@@ -426,12 +432,12 @@ bool copy_data(struct cesnet_shm *cesnet_shm,
# endif
# endif
}
else
{
}
else
{
int
len
=
width
*
height
;
int
len
=
width
*
height
;
memcpy
(
tmp
,
y
,
len
);
copy_fn
(
tmp
,
y
,
len
);
tmp
+=
len
;
tmp
+=
len
;
len
=
width
*
height
/
4
;
len
=
width
*
height
/
4
;
memcpy
(
tmp
,
u
,
len
);
copy_fn
(
tmp
,
u
,
len
);
tmp
+=
len
;
tmp
+=
len
;
memcpy
(
tmp
,
v
,
len
);
copy_fn
(
tmp
,
v
,
len
);
}
}
}
}
return
true
;
return
true
;
...
...
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