History

swscale/graph: make noop loop more robust

The current loop only works if the input and output have the same number of planes. However, with the new scaling logic, we can also optimize into a noop the case where the input has extra unneeded planes. For the memcpy fallback to work in these cases we have to instead check if the *output* pointer is set, rather than the input pointer.

Niklas Haas committed 1 year ago

Commit bc9696b1 parent 51e91241 file · +3 −1Browse files

Unified · Split

libswscale/graph.c+3−1
@@ -115,8 +115,10 @@ static void run_copy(const SwsImg *out_base, const SwsImg *in_base, · 114 unmodified lines
115115 SwsImg in = shift_img(in_base, y);
116116 SwsImg out = shift_img(out_base, y);
117117
118− for (int i = 0; i < FF_ARRAY_ELEMS(in.data) && in.data[i]; i++) {
118+ for (int i = 0; i < FF_ARRAY_ELEMS(out.data) && out.data[i]; i++) {
119119 const int lines = h >> vshift(in.fmt, i);
120+ av_assert1(in.data[i]);
121+
120122 if (in.linesize[i] == out.linesize[i]) {
121123 memcpy(out.data[i], in.data[i], lines * out.linesize[i]);
122124 } else {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t