From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 3BAC74D239 for ; Mon, 15 Dec 2025 17:06:46 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'XzMEatB1+S4Xd38jotuLuxo5h9QrFgVrmCj3ShsK3KM=', expected b'9rnNb/ZbVRVj+cQ3KnE3J4UxUEGN6keCT7JqFjDLrmg=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1765795262; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=XzMEatB1+S4Xd38jotuLuxo5h9QrFgVrmCj3ShsK3KM=; b=alASdmLUj45GgqM3Ph+QRSwe5TVI46bTAtpXyqrSz+5LXn/F6Nn+jS3Sd9CYAiqPoshdA GLQCVQLX7/PG2iiCtvMmHPHs2vbseT7sdbjQNYwABDVy4IZP8xQ6/bMkXOHZZ9JKVPx84bg 8g12Ed0Fjl3Wvqu0/eA0WVMpwoDGCq/nrDuf3zTuMpPISmG+dmJeyFQ4fkMhcL8ZfSQ9v88 sZdOe+WMMtATuWV0+xpMdBjigy+i+oCXiZ7ny+f44LEZXLl/v175I5LugdTdz/6HViWcqQM lyYkOmBCrs2j9rTNVysr/Df9FOGTrrGwItuucU5mmaYZu3bt22ePlXyckbRA== Received: from [172.20.0.2] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7C847690860; Mon, 15 Dec 2025 12:41:02 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1765795255; b=qadhL37Znu5/Qz9iRO2PuwEKXMYwbIZi1U83hvgIIKms+SjKj/97ylyMYDfiTMOvQN4a/ JKBLwoKPD8oI0/JEGyHowO3GGxz4BpmHNjRDIhgMrgt9UF2/PnrMxFjFrkNXCPDD0/UmosN 41S0oDKZCEVNLZ+LJnJmVgwluSkUDEq/vkIJPAdXVY9NhaiaG/9/v4trbQdClH6cNGhejxW NKZtdZxCuYmmY5P2RwT4X9Zfrvos1AMgtYzwpW7GLpV/v07AhfbsAzhnqkRb1snOKDBRJLE KJ907yXBndvztJfjSK3sioTbZVT9TvqC7cvvvTfh8GJL5EmKDXDpVcAPXxqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1765795255; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=pj7+MnZGl02RU9mUh1q83EiDZCHH39JBsB0BRl4W4pE=; b=Zwj48CDZdDLRzieH+kPfaTvEAc4UcvxLj4w6XsuJqNh8bvuxc4Hdct3S5LnCzvUWGRT0q aQFy2w4RAE0Z6GR3vOWDnnRfRqt+c7K028Jpiz4XhUdl9fXKwWBhOgw86YKbCkvDP3bTxCR cwE0aDq/7L+JsKlIyQ9jhEtK4qviFWnr6KmEf2hU7rH48j7lRKppVKkReWGYphnHPZ81XqB 2UtyB2H6gTI0KCj02YIJbc+VXgENxjKQaS9Qk47AKY+QnfVyye3I949pGRTgeAMl2URIru3 vEC78aG6omDW+Gg3frNYAwxpV8TfkjSFatX9+6pJ/vumbvr28ElU+X79TbWg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1765795249; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=9rnNb/ZbVRVj+cQ3KnE3J4UxUEGN6keCT7JqFjDLrmg=; b=ayoMsozHtZ/0rIIINuoaTMatKqwbkJZ4c8+rf02UGMCQUnp+L9ZCpG3bhOR+Pq1gdGOED iYyrTyuXXzVb42S46JvhNiKo6EQrXN871f0op837O8Ij2PjXHWDIsJaZLIqt2oUnthEfqEu ZyZTXgbhLbcjYZsC1I/jhb1gAJX78SqSuD0Ll0eeINjI/w7bgwW1wxOG5xFgKntDysV6AFK ZjrvouEhLBiVxfdpm314i8xHveme1mx5oAydAKZyP1W38jO+BVBBl9CunrprbvSEdLsoa97 Dp+iXq7qkApvUIz2t750n3WJCiaJJTtYAMHCkRRRTo4NuxMUK5S2avon/wTQ== Received: from 55ca25703178 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 5B3CB690744 for ; Mon, 15 Dec 2025 12:40:49 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Dec 2025 10:40:48 -0000 Message-ID: <176579524951.60.16069619656949537050@2cb04c0e5124> Message-ID-Hash: L5R53IAE4GKPC24LZT46L5SBDDRPTT6A X-Message-ID-Hash: L5R53IAE4GKPC24LZT46L5SBDDRPTT6A X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avfilter/vf_libplacebo: rotate all input frames, not just reference (PR #21204) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Niklas Haas via ffmpeg-devel Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21204 opened by Niklas Haas (haasn) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21204 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21204.patch In commit 6e0034ab7e46429731fec6d2c390fa536a9157ad, the image crop adjustment was moved after the fitting logic. However, this moved the adjustment inside the `if (src == ref)` branch, thus missing applying the same un-rotation to input frames that are *not* the reference frame. Fix this by pulling the logic back out of the branch again. While we could just move it after the fitting logic, I think it's more clear to the intent of the code to just preserve the (rotated) crop rect as a separate variable `crop_orig`. Fixes: 6e0034ab7e46429731fec6d2c390fa536a9157ad >>From 4ac3b3a6da54ee165a9e6310f34dfb367712a20b Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Mon, 15 Dec 2025 11:29:58 +0100 Subject: [PATCH] avfilter/vf_libplacebo: rotate all input frames, not just reference In commit 6e0034ab7e46429731fec6d2c390fa536a9157ad, the image crop adjustment was moved after the fitting logic. However, this moved the adjustment inside the `if (src == ref)` branch, thus missing applying the same un-rotation to input frames that are *not* the reference frame. Fix this by pulling the logic back out of the branch again. While we could just move it after the fitting logic, I think it's more clear to the intent of the code to just preserve the (rotated) crop rect as a separate variable `crop_orig`. Fixes: 6e0034ab7e46429731fec6d2c390fa536a9157ad --- libavfilter/vf_libplacebo.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index b1788565bf..c8015a9641 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -917,6 +917,15 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in, image->crop.x1 = image->crop.x0 + s->var_values[VAR_CROP_W]; image->crop.y1 = image->crop.y0 + s->var_values[VAR_CROP_H]; + const pl_rect2df crop_orig = image->crop; + pl_rotation rot_total = PL_ROTATION_360 + image->rotation - target->rotation; + if (rot_total % PL_ROTATION_180 == PL_ROTATION_90) { + /* Libplacebo expects the input crop relative to the actual frame + * dimensions, so un-transpose them here */ + FFSWAP(float, image->crop.x0, image->crop.y0); + FFSWAP(float, image->crop.x1, image->crop.y1); + } + if (src == ref) { /* Only update the target crop once, for the 'reference' frame */ target->crop.x0 = av_expr_eval(s->pos_x_pexpr, s->var_values, NULL); @@ -924,16 +933,13 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in, target->crop.x1 = target->crop.x0 + s->var_values[VAR_POS_W]; target->crop.y1 = target->crop.y0 + s->var_values[VAR_POS_H]; - /* Effective visual crop */ double sar_in = q2d_fallback(inlink->sample_aspect_ratio, 1.0); double sar_out = q2d_fallback(outlink->sample_aspect_ratio, 1.0); - - pl_rotation rot_total = PL_ROTATION_360 + image->rotation - target->rotation; if (rot_total % PL_ROTATION_180 == PL_ROTATION_90) sar_in = 1.0 / sar_in; - pl_rect2df fixed = image->crop; + pl_rect2df fixed = crop_orig; pl_rect2df_stretch(&fixed, sar_in / sar_out, 1.0); switch (s->fit_mode) { @@ -956,13 +962,6 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in, case FIT_SCALE_DOWN: pl_rect2df_aspect_fit(&target->crop, &fixed, 0.0); } - - if (rot_total % PL_ROTATION_180 == PL_ROTATION_90) { - /* Libplacebo expects the input crop relative to the actual frame - * dimensions, so un-transpose them here */ - FFSWAP(float, image->crop.x0, image->crop.y0); - FFSWAP(float, image->crop.x1, image->crop.y1); - } } } } -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org