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.
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user