This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit cb2b7fde781cc377ed4b85c963426644249b28f4 Author: Niklas Haas <[email protected]> AuthorDate: Thu Oct 8 13:57:39 2026 +0200 Commit: Niklas Haas <[email protected]> CommitDate: Tue Oct 20 21:33:01 2026 +0000 swscale/ops: add helper functions to determine op input/output types Only works for homogeneous ops, which is the current assumption anyways. Likely will be deleted again once the ops are fully migrated to a per-lane type accounting, though that will require some changes to the vulkan backend which I'm not willing to do right now. Signed-off-by: Niklas Haas <[email protected]> --- libswscale/ops.c | 20 ++++++++++++++++++++ libswscale/ops.h | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/libswscale/ops.c b/libswscale/ops.c index caf933bd58..85fd0b074e 100644 --- a/libswscale/ops.c +++ b/libswscale/ops.c @@ -168,6 +168,26 @@ const SwsOp *ff_sws_op_next(const SwsOp *op) return idx < ops->num_ops - 1 ? &ops->ops[idx + 1] : NULL; } +SwsPixelType ff_sws_op_output_type(const SwsOp *op) +{ + SwsPixelType type = SWS_PIXEL_NONE; + for (int i = 0; op && i < 4; i++) { + if (!SWS_OP_NEEDED(op, i) || !op->outputs[i].type) + continue; + else if (!type) + type = op->outputs[i].type; + else if (op->outputs[i].type != type) + return SWS_PIXEL_NONE; + } + + return type; +} + +SwsPixelType ff_sws_op_input_type(const SwsOp *op) +{ + return ff_sws_op_output_type(ff_sws_op_prev(op)); +} + /* biased towards `a` */ static AVRational64 av_min_q64(AVRational64 a, AVRational64 b) { diff --git a/libswscale/ops.h b/libswscale/ops.h index bfb5085ae5..8dcabb2ead 100644 --- a/libswscale/ops.h +++ b/libswscale/ops.h @@ -291,6 +291,13 @@ SwsCompMask ff_sws_comp_mask_needed(const SwsOp *op); */ int ff_sws_rw_op_planes(const SwsOp *op); +/** + * Return the input/output type of an operation, if all inputs/outputs are + * the same type, or SWS_PIXEL_NONE if no type can be established. + */ +SwsPixelType ff_sws_op_input_type(const SwsOp *op); +SwsPixelType ff_sws_op_output_type(const SwsOp *op); + /** * Describe an operation in human-readable form. */ -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
