提交 ffb3ca45 编写于 作者: A Anthony Catel 提交者: jp9000

libobs: Use one copy for RGBA output when possible

A minor optimization: in copy_rgbx_frame (used when libobs is set to
output RGBA frames instead of YUV frames), if the line sizes for the
source and destination match, just use a single memcpy call for all of
the data instead of multiple memcpy calls.
上级 b22bc812
......@@ -473,10 +473,15 @@ static inline void copy_rgbx_frame(
uint8_t *in_ptr = input->data[0];
uint8_t *out_ptr = output->data[0];
for (size_t y = 0; y < info->height; y++) {
memcpy(out_ptr, in_ptr, info->width * 4);
in_ptr += input->linesize[0];
out_ptr += output->linesize[0];
/* if the line sizes match, do a single copy */
if (input->linesize[0] == output->linesize[0]) {
memcpy(out_ptr, in_ptr, input->linesize[0] * info->height);
} else {
for (size_t y = 0; y < info->height; y++) {
memcpy(out_ptr, in_ptr, info->width * 4);
in_ptr += input->linesize[0];
out_ptr += output->linesize[0];
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册