From 791bf247f376eaa964cfb7ba2996baabaeeec136 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Thu, 8 Oct 2026 02:23:57 +0200 Subject: [PATCH] swscale/ops: stop nuking output pad metadata on unused output pads This cleanly separates the forwards and backwards passes - output pad metadata is set if it *would* be valid, and whether or not it's needed is tracked explicitly in `dep_out` instead of by resetting these components. Signed-off-by: Niklas Haas --- libswscale/ops.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libswscale/ops.c b/libswscale/ops.c index a06fcc2f25..766c7e6475 100644 --- a/libswscale/ops.c +++ b/libswscale/ops.c @@ -615,6 +615,9 @@ void ff_sws_op_list_update_comps(SwsOpList *ops) memcpy(prev, op->outputs, sizeof(prev)); } + #undef FORWARD + #undef RESET + /* Backwards pass, solves for output component dependencies */ SwsCompMask need_out[4] = {0}; @@ -622,11 +625,8 @@ void ff_sws_op_list_update_comps(SwsOpList *ops) SwsOp *op = &ops->ops[n]; SwsCompMask need_in[4] = {0}; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) op->outputs[i].dep_out = need_out[i]; - if (!need_out[i]) - RESET(i); - } switch (op->op) { case SWS_OP_READ: @@ -684,9 +684,6 @@ void ff_sws_op_list_update_comps(SwsOpList *ops) memcpy(need_out, need_in, sizeof(need_in)); } - - #undef FORWARD - #undef RESET } static void op_uninit(SwsOp *op)