This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit a41bc1dea3ac60dab029d208e13b05efcc922e34 Author: Niklas Haas <[email protected]> AuthorDate: Tue Mar 17 01:22:07 2026 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Sat Mar 28 18:50:13 2026 +0100 swscale/ops_optimizer: merge duplicate SWS_OP_SCALE (As long as the constant doesn't overflow) Signed-off-by: Niklas Haas <[email protected]> --- libswscale/ops_optimizer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libswscale/ops_optimizer.c b/libswscale/ops_optimizer.c index 5e114cd512..ce3f820e40 100644 --- a/libswscale/ops_optimizer.c +++ b/libswscale/ops_optimizer.c @@ -628,6 +628,17 @@ retry: goto retry; } + /* Merge consecutive scaling operations (that don't overflow) */ + if (next->op == SWS_OP_SCALE) { + int64_t p = op->c.q.num * (int64_t) next->c.q.num; + int64_t q = op->c.q.den * (int64_t) next->c.q.den; + if (FFABS(p) <= INT_MAX && FFABS(q) <= INT_MAX) { + av_reduce(&op->c.q.num, &op->c.q.den, p, q, INT_MAX); + ff_sws_op_list_remove_at(ops, n + 1, 1); + goto retry; + } + } + /* Scaling by exact power of two */ if (factor2 && ff_sws_pixel_type_is_int(op->type)) { op->op = factor2 > 0 ? SWS_OP_LSHIFT : SWS_OP_RSHIFT; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
