mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-11-06 05:17:42 +00:00
swscale/ops_memcpy: also use bulk memset/memcpy for negative strides
The operations themselves have already been generalized to support this, so all we need to do is modify the base input/output pointers.
This commit is contained in:
1 parent
2b507718fc
commit
bf743bb9e0
1 file changed
+9
-2
@@ -60,9 +60,16 @@ static void process_memcpy(const SwsOpExec *exec, const void *priv,
|
||||
int lines = y_end - y_start;
|
||||
|
||||
/* Replace the per-line loop with a bulk memset/memcpy when possible. */
|
||||
const size_t abs_stride = FFABS(out_stride);
|
||||
if ((!in || out_stride == in_stride) &&
|
||||
out_stride >= 0 && (size_t) out_stride <= bytes + SWS_MAX_PADDING) {
|
||||
bytes += (size_t) (lines - 1) * out_stride;
|
||||
abs_stride <= bytes + SWS_MAX_PADDING) {
|
||||
if (out_stride < 0) {
|
||||
const ptrdiff_t offset = (lines - 1) * out_stride;
|
||||
out += offset;
|
||||
if (in)
|
||||
in += offset;
|
||||
}
|
||||
bytes += (lines - 1) * abs_stride;
|
||||
lines = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user