Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
blender
blender-vr-interactive
Commits
cf868c21
Commit
cf868c21
authored
Aug 28, 2020
by
Martin Pulec
Browse files
UltraGrid plugin: opt to use memmove instead of memcpy
parent
370f22af
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/ultragrid/ultragrid.cpp
View file @
cf868c21
...
...
@@ -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
,
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
(
cesnet_shm
->
use_gpu
)
{
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,
}
else
{
// Y
for
(
int
i
=
0
;
i
<
height
;
++
i
)
{
memcpy
(
out1_y
,
y
,
width
);
copy_fn
(
out1_y
,
y
,
width
);
out1_y
+=
width
;
y
+=
width
;
memcpy
(
out2_y
,
y
,
width
);
copy_fn
(
out2_y
,
y
,
width
);
out2_y
+=
width
;
y
+=
width
;
}
// U V
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
;
u
+=
width
/
2
;
memcpy
(
out2_u
,
u
,
width
/
2
);
copy_fn
(
out2_u
,
u
,
width
/
2
);
out2_u
+=
width
/
2
;
u
+=
width
/
2
;
memcpy
(
out1_v
,
v
,
width
/
2
);
copy_fn
(
out1_v
,
v
,
width
/
2
);
out1_v
+=
width
/
2
;
v
+=
width
/
2
;
memcpy
(
out2_v
,
v
,
width
/
2
);
copy_fn
(
out2_v
,
v
,
width
/
2
);
out2_v
+=
width
/
2
;
v
+=
width
/
2
;
}
...
...
@@ -426,12 +432,12 @@ bool copy_data(struct cesnet_shm *cesnet_shm,
# endif
}
else
{
int
len
=
width
*
height
;
memcpy
(
tmp
,
y
,
len
);
copy_fn
(
tmp
,
y
,
len
);
tmp
+=
len
;
len
=
width
*
height
/
4
;
memcpy
(
tmp
,
u
,
len
);
copy_fn
(
tmp
,
u
,
len
);
tmp
+=
len
;
memcpy
(
tmp
,
v
,
len
);
copy_fn
(
tmp
,
v
,
len
);
}
}
return
true
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment