swscale/ops_dispatch: avoid calling comp->func with w=0

The x86 kernel e.g. assumes that at least one block is processed; so avoid
calling this with an empty width. This is currently only possible if e.g.
operating on an unpadded, very small image whose total linesize is less than
a single block.

Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
Niklas Haas
2026-04-14 16:25:03 +02:00
committed by Niklas Haas
parent 35174913ac
commit dba7b81b38

View File

@@ -340,15 +340,17 @@ static void op_pass_run(const SwsFrame *out, const SwsFrame *in, const int y,
/* Non-aligned case (slow path); process num_blocks - 1 main blocks and
* a separate tail (via memcpy into an appropriately padded buffer) */
for (int i = 0; i < 4; i++) {
/* We process one fewer block, so the in_bump needs to be increased
* to reflect that the plane pointers are left on the last block,
* not the end of the processed line, after each loop iteration */
exec.in_bump[i] += exec.block_size_in;
exec.out_bump[i] += exec.block_size_out;
}
if (num_blocks > 1) {
for (int i = 0; i < 4; i++) {
/* We process one fewer block, so the in_bump needs to be increased
* to reflect that the plane pointers are left on the last block,
* not the end of the processed line, after each loop iteration */
exec.in_bump[i] += exec.block_size_in;
exec.out_bump[i] += exec.block_size_out;
}
comp->func(&exec, comp->priv, 0, y, num_blocks - 1, y + h);
comp->func(&exec, comp->priv, 0, y, num_blocks - 1, y + h);
}
DECLARE_ALIGNED_32(SwsOpExec, tail) = p->exec_tail;
tail.slice_y = y;