This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 75ba2bf4570c394b678dda3557c9d318b9706e66 Author: Niklas Haas <[email protected]> AuthorDate: Tue Dec 16 00:36:55 2025 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Sat Dec 20 13:52:45 2025 +0000 swscale/ops: correctly truncate on ff_sws_apply_op_q(SWS_OP_RSHIFT) Instead of using a "precise" division, simulate the actual truncation. Note that the division by `den` is unneeded in principle because the denominator *should* always be 1 for an integer, but this way we don't explode if the user should happen to pass `4/2` or something. Fixes a lot of unnecessary clamps w.r.t. xv36, e.g.: xv36be -> yuv444p12be: [u16 XXXX -> ++++] SWS_OP_READ : 4 elem(s) packed >> 0 [u16 ...X -> ++++] SWS_OP_SWAP_BYTES [u16 ...X -> ++++] SWS_OP_SWIZZLE : 1023 [u16 ...X -> ++++] SWS_OP_RSHIFT : >> 4 - [u16 ...X -> ++++] SWS_OP_CONVERT : u16 -> f32 - [f32 ...X -> ++++] SWS_OP_MIN : x <= {4095 4095 4095 _} - [f32 ...X -> ++++] SWS_OP_CONVERT : f32 -> u16 [u16 ...X -> ++++] SWS_OP_SWAP_BYTES [u16 ...X -> ++++] SWS_OP_WRITE : 3 elem(s) planar >> 0 (X = unused, + = exact, 0 = zero) --- libswscale/ops.c | 3 +-- tests/ref/fate/sws-ops-list | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libswscale/ops.c b/libswscale/ops.c index 9bbbfc50ca..f84416feed 100644 --- a/libswscale/ops.c +++ b/libswscale/ops.c @@ -158,9 +158,8 @@ void ff_sws_apply_op_q(const SwsOp *op, AVRational x[4]) } case SWS_OP_RSHIFT: { av_assert1(ff_sws_pixel_type_is_int(op->type)); - AVRational mult = Q(1 << op->c.u); for (int i = 0; i < 4; i++) - x[i] = x[i].den ? av_div_q(x[i], mult) : x[i]; + x[i] = x[i].den ? Q((x[i].num / x[i].den) >> op->c.u) : x[i]; return; } case SWS_OP_SWIZZLE: { diff --git a/tests/ref/fate/sws-ops-list b/tests/ref/fate/sws-ops-list index dbcad4052b..b49f944794 100644 --- a/tests/ref/fate/sws-ops-list +++ b/tests/ref/fate/sws-ops-list @@ -1 +1 @@ -708f10e4de79450729ab2120e4e44ec9 +e910ff7ceaeb64bfdbac3f652b67403f _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
