swscale: support sliced input with cascaded scaling contexts
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 4 Jun 2026 18:50:45 +0000 (20:50 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 Jun 2026 02:59:14 +0000 (04:59 +0200)
commit1c479fdf64b91dab45a9e7da47d8c964a2c6b488
tree4b2c046304d019d4fdfab01d6b77778e6fa487f5
parentd981b2ba537cbbd70c012a9a6d008a45aa5cf9b0
swscale: support sliced input with cascaded scaling contexts

Previously scale_cascaded() assumed the whole source frame arrived in a
single sws_scale() call, and the dispatcher only routed full-frame calls
to it. A partial input slice fell through to ff_swscale() on the parent
dispatcher context, whose scaler state (c->desc) is never initialized in
cascade mode, causing a NULL dereference / crash.

Top-down sliced output is bit-exact with full-frame scaling; bottom-up
matches swscale's pre-existing (non-cascade) slice behaviour for
subsampled intermediate formats.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 10f2abc41fdb8624a95676a10764904ee58e4ccb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libswscale/swscale.c